diff --git a/src/assets/css/variable.scss b/src/assets/css/variable.scss index b12e8a3..7ed8c39 100644 --- a/src/assets/css/variable.scss +++ b/src/assets/css/variable.scss @@ -10,6 +10,7 @@ $cellTextColor: #39414D; $cellCommentColor: #66A0A4; $cellStringColor: #1021D5; $cellKeywordColor: #CF2F72; +$pattern-grey-100: #A5B2C5; $pattern-blue-100: #CEE6FD; $pattern-blue-200: #e6f1fb; $pattern-blue-300: #3991e1; diff --git a/src/components/CreateConnection/Form.vue b/src/components/CreateConnection/Form.vue index 3ef3a8d..ab1a877 100644 --- a/src/components/CreateConnection/Form.vue +++ b/src/components/CreateConnection/Form.vue @@ -2,7 +2,9 @@
- + + + @@ -70,6 +72,9 @@ import { encryptData } from '@/util' @Component({ computed: { + ...mapState({ + userInfo: state => state.user.userInfo + }), ...mapState('CreateConnectionModal', { form: state => state.form, type: state => state.type, diff --git a/src/components/CreateConnection/index.vue b/src/components/CreateConnection/index.vue index 2d9986d..c99434c 100644 --- a/src/components/CreateConnection/index.vue +++ b/src/components/CreateConnection/index.vue @@ -31,6 +31,9 @@ import Form from './Form.vue' @Component({ computed: { + ...mapState({ + userInfo: state => state.user.userInfo + }), ...mapState('CreateConnectionModal', { isShow: state => state.isShow, form: state => state.form, @@ -83,7 +86,7 @@ export default class CreateConnectionModal extends Vue { await this.$refs.ruleForm.checkForm() this.isSubmiting = true const params = { - name: this.form.name, + name: this.userInfo.username + '_' + this.form.name, content: { ...this.form } } if (params.content.password) { diff --git a/src/components/Header/EngineInfo.vue b/src/components/Header/EngineInfo.vue new file mode 100644 index 0000000..7758d09 --- /dev/null +++ b/src/components/Header/EngineInfo.vue @@ -0,0 +1,192 @@ + + + + + \ No newline at end of file diff --git a/src/components/Header/index.vue b/src/components/Header/index.vue index 0ad6667..23f994f 100644 --- a/src/components/Header/index.vue +++ b/src/components/Header/index.vue @@ -6,6 +6,7 @@
+ @@ -18,17 +19,20 @@ import { Component } from 'vue-property-decorator' import HeaderMenu from './HeaderMenu' import UserInfo from './UserInfo' import GlobalHelp from './GlobalHelp' -import ChangeLang from './ChangeLang.vue' +import ChangeLang from './ChangeLang' +import EngineInfo from './EngineInfo' import { mapState } from 'vuex' @Component({ components: { HeaderMenu, UserInfo, GlobalHelp, - ChangeLang + ChangeLang, + EngineInfo }, computed: { ...mapState({ + userInfo: state => state.user.userInfo, isTrial: state => state.global.is_trial }), isLoginPage () { diff --git a/src/config/index.js b/src/config/index.js index d6cfeeb..7b7b4bb 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -110,3 +110,8 @@ export const ACTION_OF_STATE = { [INSTANCE_STATE['9']]: [0, 0, 5, 0], [INSTANCE_STATE['10']]: [0, 0, 5, 0] } + +export const ENGINE_STATUS = { + 0: 'unavailable', + 2: 'available' +} \ No newline at end of file diff --git a/src/locale/en.json b/src/locale/en.json index a38596b..854cc57 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -48,7 +48,21 @@ "schedules": "Schedules", "settings": "Settings", "give_feedback": "Give Feedback", - "Byzer_docs": "Byzer Notebook Docs" + "Byzer_docs": "Byzer Notebook Docs", + "engine_status": "Engine State: ", + "heart_beat": "Heartbeat Detection: ", + "usage": "Resource Rate: ", + "state": { + "available": "Running", + "unavailable": "Disabled" + }, + "percentage": { + "available": "Normal", + "unavailable": "Disabled", + "crowded": "Crowded" + }, + "step": "Auto-refresh engine state every 10 seconds", + "refresh_success": "Engine state refreshed successfully" }, "home": { "quick_start": "Quick Start", diff --git a/src/locale/zh.json b/src/locale/zh.json index bbac384..06aee49 100644 --- a/src/locale/zh.json +++ b/src/locale/zh.json @@ -47,7 +47,21 @@ "schedules": "调度", "settings": "设置", "give_feedback": "反馈", - "Byzer_docs": "Byzer Notebook 手册" + "Byzer_docs": "Byzer Notebook 手册", + "engine_status": "引擎状态:", + "heart_beat": "心跳检测:", + "usage": "资源占比:", + "state": { + "available": "运行中", + "unavailable": "不可用" + }, + "percentage": { + "available": "正常", + "unavailable": "不可用", + "crowded": "拥挤" + }, + "step": "每 10 秒自动刷新引擎状态", + "refresh_success": "引擎状态刷新成功" }, "home": { "quick_start": "快速开始", diff --git a/src/page/Settings/index.vue b/src/page/Settings/index.vue index 71657d3..48584c4 100644 --- a/src/page/Settings/index.vue +++ b/src/page/Settings/index.vue @@ -15,12 +15,28 @@
-
+

{{$t('settings.defaultEngineDesc')}}

- - + + + +
+ + {{ engine.name }} +
+
@@ -31,7 +47,13 @@
{{$t('settings.externalDatasource')}}
- {{$t('add')}} + {{$t('add')}} + {{$t('refresh')}}
\ No newline at end of file diff --git a/src/service/module/settings.js b/src/service/module/settings.js index cc92aa1..c57af2d 100644 --- a/src/service/module/settings.js +++ b/src/service/module/settings.js @@ -10,10 +10,11 @@ export default { resetTimout: () => axios.post('/api/settings/configuration/reset'), checkConnection: payload => axios.post('/api/settings/connection/test', payload), createConnect: payload => axios.post('/api/settings/connection', payload), - getConnectionList: () => axios.get('/api/settings/connection'), + getConnectionList: payload => axios.get(`/api/settings/connection${payload}`), getExistingTableList: connectionId => axios.get(`/api/settings/connection/${connectionId}/table`), updateConnection: (connectionId, data) => axios.put(`/api/settings/connection/${connectionId}`, data), deleteConnection: connectionId => axios.delete(`/api/settings/connection/${connectionId}`), getAlgorithmList: () => axios.get('/api/settings/node/def?node_type=train'), - getParamsByAlgorithmId: id => axios.get(`/api/settings/node/def/${id}`) + getParamsByAlgorithmId: id => axios.get(`/api/settings/node/def/${id}`), + getEngineInfo: payload => axios.get(`/api/engine/status${payload}`) } \ No newline at end of file diff --git a/src/store/module/settings.js b/src/store/module/settings.js index b9a290c..96651ba 100644 --- a/src/store/module/settings.js +++ b/src/store/module/settings.js @@ -2,9 +2,14 @@ import * as types from '../type' import { settings } from '../../service' export default { state: { - isRunningAll: false + isRunningAll: false, + engineInfo: {} + }, + mutations: { + [types.SET_ENGINE_INFO]: (state, payload) => { + state.engineInfo = payload + } }, - mutations: {}, actions: { [types.GET_CONFIGS]: () => { return settings.getDefaultConfig() @@ -24,8 +29,8 @@ export default { [types.CREATE_CONNECTION]: (_, payload) => { return settings.createConnect(payload) }, - [types.GET_CONNECTION_LIST]: () => { - return settings.getConnectionList() + [types.GET_CONNECTION_LIST]: (_, payload = '') => { + return settings.getConnectionList(payload) }, [types.GET_CONNECTION_TABLE]: (_, connectionId) => { return settings.getExistingTableList(connectionId) @@ -41,6 +46,16 @@ export default { }, [types.GET_PARAM_BY_ID]: (_, id) => { return settings.getParamsByAlgorithmId(id) + }, + [types.GET_ENGINE_INFO]: async ({ commit }, payload = '') => { + let res = {} + try { + res = await settings.getEngineInfo(payload) + commit(types.SET_ENGINE_INFO, res.data) + } catch (err) { + console.log(err) + } + return res } } } \ No newline at end of file diff --git a/src/store/type.js b/src/store/type.js index 59ec055..0812a15 100644 --- a/src/store/type.js +++ b/src/store/type.js @@ -139,3 +139,5 @@ export const DELETE_CONNECTION = 'DELETE_CONNECTION' export const GET_ALGORITHM_LIST = 'GET_ALGORITHM_LIST' export const GET_PARAM_BY_ID = 'GET_PARAM_BY_ID' +export const SET_ENGINE_INFO = 'SET_ENGINE_INFO' +export const GET_ENGINE_INFO = 'GET_ENGINE_INFO'