瀏覽代碼

Merge branch '67-deactivate-label-menu-item-if-there-is-no-label-feature' into 'master'

Resolve "deactivate label menu item if there is no label feature"

Closes #67

See merge request troebs/pycs!62
Eric Tröbs 4 年之前
父節點
當前提交
db1e4c98ac
共有 1 個文件被更改,包括 14 次插入7 次删除
  1. 14 7
      webui/src/components/window/side-navigation-bar.vue

+ 14 - 7
webui/src/components/window/side-navigation-bar.vue

@@ -29,7 +29,7 @@
       </div>
 
       <div class="item"
-           :class="{active: window.content === 'labels', inactive: !currentProject}"
+           :class="{active: window.content === 'labels', inactive: !currentProject || !labelsEnabled}"
            @click="ifProjectIsOpened(show, 'labels')">
         <img src="@/assets/icons/tag.svg">
         <span>Labels</span>
@@ -70,29 +70,36 @@ export default {
   name: "side-navigation-bar",
   props: ['window', 'socket', 'status', 'currentProject'],
   computed: {
-    collapsed: function() {
+    collapsed: function () {
       if (!this.status)
         return false;
 
       return this.status.settings.frontend.collapse;
     },
-    mediaAvailable: function() {
+    mediaAvailable: function () {
       return this.currentProject && 'data' in this.currentProject && Object.keys(this.currentProject.data).length > 0;
+    },
+    labelsEnabled: function () {
+      return this.currentProject
+          && (
+              this.currentProject.model.supports.includes('labeled-images')
+              || this.currentProject.model.supports.includes('labeled-bounding-boxes')
+          );
     }
   },
   methods: {
-    closeSelf: function() {
+    closeSelf: function () {
       this.$emit('close', null);
     },
-    ifProjectIsOpened: function(fun, ...args) {
+    ifProjectIsOpened: function (fun, ...args) {
       if (this.currentProject)
         fun.bind(fun)(...args);
     },
-    show: function(value) {
+    show: function (value) {
       this.window.content = value;
       this.closeSelf();
     },
-    collapse: function() {
+    collapse: function () {
       this.socket.post('/settings', {
         frontend: {
           collapse: !this.collapsed