Browse Source

chore: feature flag

Casper Dai 3 years ago
parent
commit
43e63b5baa
6 changed files with 3 additions and 20 deletions
  1. 0 2
      .env
  2. 0 2
      .env.staging
  3. 0 2
      feature.js
  4. 0 9
      src/constant.js
  5. 1 1
      src/router/index.js
  6. 2 4
      src/views/device/detail/index.vue

+ 0 - 2
.env

@@ -4,8 +4,6 @@ ENV = 'currency'
 __PLACEHOLDER__ = 'disabled'
 # 传感器
 __SENSOR__ = 'disabled'
-# 摄像头
-__CAMERA__ = 'disabled'
 # 设备仪表盘
 __DEVICE_DASHBARD__ = 'disabled'
 

+ 0 - 2
.env.staging

@@ -2,8 +2,6 @@ NODE_ENV = 'production'
 
 ENV = 'staging'
 
-__CAMERA__ = 'enabled'
-
 # keycloak
 VUE_APP_KEYCLOAK_OPTIONS_URL = 'https://isoc.artaplay.com:8443/auth'
 # 71服务器

+ 0 - 2
feature.js

@@ -25,8 +25,6 @@ module.exports = {
     ...isEnable('__PLACEHOLDER__'),
     // 传感器
     ...isEnable('__SENSOR__'),
-    // 摄像头
-    ...isEnable('__CAMERA__'),
     // 设备仪表盘
     ...isEnable('__DEVICE_DASHBARD__')
   }

+ 0 - 9
src/constant.js

@@ -105,15 +105,6 @@ export const RoleAccess = {
   ]
 }
 
-Object.values(RoleAccess).forEach(roles => {
-  if (__SENSOR__) {
-    roles.push(Access.VIEW_SENSORS)
-  }
-  if (__CAMERA__) {
-    roles.push(Access.VIEW_CAMERAS)
-  }
-})
-
 export const AlarmStrategy = {
   note: '短信',
   email: '邮件',

+ 1 - 1
src/router/index.js

@@ -205,6 +205,7 @@ export const asyncRoutes = [
     ]
   },
   {
+    dev: !__STAGING__,
     path: '/em',
     component: Layout,
     meta: { title: '设备录入', icon: 'em' },
@@ -219,7 +220,6 @@ export const asyncRoutes = [
       {
         path: 'camera',
         name: 'camera',
-        access: Access.VIEW_CAMERAS,
         component: () => import('@/views/external/camera/index'),
         meta: { title: '摄像头' }
       }

+ 2 - 4
src/views/device/detail/index.vue

@@ -91,6 +91,7 @@ export default {
   },
   data () {
     return {
+      useDashboard: __DEVICE_DASHBARD__,
       loading: true,
       device: null,
       isActivated: false,
@@ -101,7 +102,7 @@ export default {
         { key: 'DeviceRuntime', label: '运行状态' },
         { key: 'DeviceAlarm', label: '设备告警' },
         this.accessSet.has(Access.MANAGE_DEVICE) ? { key: 'DeviceInvoke', label: '设备操控' } : null,
-        this.accessSet.has(Access.VIEW_SENSORS) ? { key: 'Sensors', label: '传感器' } : null,
+        __SENSOR__ ? { key: 'Sensors', label: '传感器' } : null,
         __STAGING__ ? { key: 'Transmitter', label: '发送控制设备' } : null,
         __STAGING__ ? { key: 'ReceivingCard', label: '接收卡' } : null,
         __STAGING__ ? { key: 'LinkState', label: '全链路监测状态' } : null,
@@ -113,9 +114,6 @@ export default {
     deviceId () {
       return this.$route.params.id
     },
-    useDashboard () {
-      return __DEVICE_DASHBARD__
-    },
     statusType () {
       return this.isActivated
         ? this.isOnline