diff --git a/frontend/src/api/datamanager.js b/frontend/src/api/datamanager.js index 40f6fc458..107c5b6ed 100644 --- a/frontend/src/api/datamanager.js +++ b/frontend/src/api/datamanager.js @@ -20,6 +20,12 @@ export const getGroupDetail = (groupId) => { }) } +export const getGroupChildren = (groupId) => { + return axios({ + url: '/api/group/' + groupId + '?childrenOnly=true' + }) +} + export const createGroup = (name, parentId) => { return axios({ url: '/api/group', diff --git a/frontend/src/components/DocumentTree.vue b/frontend/src/components/DocumentTree.vue index f2f15ae10..bfdefa32d 100644 --- a/frontend/src/components/DocumentTree.vue +++ b/frontend/src/components/DocumentTree.vue @@ -43,13 +43,30 @@ export default { searchRefreshDataListTimer: null, realSearchStr: '', searchByIdResult: '', - selectLimit: 200 + selectLimit: 500, + originAsync: false } }, + created() { + this.originAsync = this.isLoadTreeAsync + }, computed: { isSelectableStatus () { return this.$store.state.dataManager.isSelectableStatus }, + isLoadTreeAsync: { + get () { + return this.$store.state.dataManager.isLoadTreeAsync + }, + set (val) { + this.$store.dispatch('commitAndupdateConfigByKey', { + 'command': 'setIsTreeLoadAsync', + 'isShowMessage': false, + val + }) + this.$store.dispatch('loadDataMap') + } + }, groupListOpenNode: { get () { return this.$store.state.dataManager.groupListOpenNode @@ -72,6 +89,10 @@ export default { clearTimeout(this.searchRefreshDataListTimer) this.searchRefreshDataListTimer = setTimeout(() => { if (newValue !== oldValue) { + // When originAsync is true, and searchStr is not empty, close isLoadTreeAsync + if (this.originAsync == true) { + this.isLoadTreeAsync = newValue === '' + } this.realSearchStr = this.searchStr clearTimeout(this.searchRefreshDataListTimer) } diff --git a/frontend/src/components/DocumentTreeDialogDelete.vue b/frontend/src/components/DocumentTreeDialogDelete.vue index 79fbbe554..a6b1b0b2e 100644 --- a/frontend/src/components/DocumentTreeDialogDelete.vue +++ b/frontend/src/components/DocumentTreeDialogDelete.vue @@ -74,7 +74,6 @@

Delete Leaf only

- diff --git a/frontend/src/components/DocumentTreeNode.vue b/frontend/src/components/DocumentTreeNode.vue index b938decea..e02cf2b9d 100644 --- a/frontend/src/components/DocumentTreeNode.vue +++ b/frontend/src/components/DocumentTreeNode.vue @@ -11,17 +11,19 @@ - - {{isNodeOpen ? 'mdi-chevron-down' : 'mdi-chevron-right'}} + + {{ isLoading ? 'mdi-autorenew': 'mdi-chevron-down' }} - mdi-alpha-j-box-outline - mdi-file + mdi-alpha-j-box-outline + mdi-file-cog-outline + mdi-file + +
- - {{data.name}} + {{data.name}} mdi-home @@ -54,115 +56,18 @@ mdi-delete - - - - - - - - Cut - - - - Copy - - - - Paste - - - - Duplicate - - - - - - Add - - - - - - - -
- Import -
-
-
-
- - - - Export - - + mdi-dots-horizontal + -
-
@@ -171,15 +76,14 @@ + + + + diff --git a/frontend/src/store/datamanager.js b/frontend/src/store/datamanager.js index fcdc769f9..99ea4309b 100644 --- a/frontend/src/store/datamanager.js +++ b/frontend/src/store/datamanager.js @@ -20,6 +20,8 @@ export default { isShownCreateDialog: false, isShownDuplicateDialog: false, isShownDeleteDialog: false, + isShownNodeMenu: false, + shownNodeMenuPosition: null, importSnapshotParentNode: {}, snapshotName: '', labels: [], @@ -31,9 +33,10 @@ export default { deleteNode: [], dataListSelectedLabel: [], isLabelDisplay: true, - isCloseReloadWhenEnter: false, + isDisplayConfiguration: false, + isLoadTreeAsync: false, isReloadTreeWhenUpdate: false, - undisplayedKey: ['children', 'type', 'parent_id', 'abs_parent_path', 'parent'], + undisplayedKey: ['children', 'type', 'parent_id', 'abs_parent_path', 'parent', 'link'], undeletableKey: ['id', 'rule', 'name', 'label', 'category', 'super_by'], uneditableKey: ['id', 'rule', 'super_by'], stickyTopKey: ['id', 'rule', 'super_id', 'name', 'label', 'super_by'], @@ -133,6 +136,12 @@ export default { setIsShownDeleteDialog (state, isShownDeleteDialog) { state.isShownDeleteDialog = isShownDeleteDialog }, + setIsShownNodeMenu (state, isShownNodeMenu) { + state.isShownNodeMenu = isShownNodeMenu + }, + setShownNodeMenuPosition (state, shownNodeMenuPosition) { + state.shownNodeMenuPosition = shownNodeMenuPosition + }, setDeleteDialogSource (state, deleteDialogSource) { state.deleteDialogSource = deleteDialogSource }, @@ -145,8 +154,11 @@ export default { setIsLabelDisplay (state, isLabelDisplay) { state.isLabelDisplay = isLabelDisplay }, - setIsCloseReloadWhenEnter (state, isCloseReloadWhenEnter) { - state.isCloseReloadWhenEnter = isCloseReloadWhenEnter + setIsDisplayConfiguration (state, isDisplayConfiguration) { + state.isDisplayConfiguration = isDisplayConfiguration + }, + setIsTreeLoadAsync (state, isLoadTreeAsync) { + state.isLoadTreeAsync = isLoadTreeAsync }, setUndisplayedKey (state, undisplayedKey) { state.undisplayedKey = undisplayedKey @@ -184,17 +196,44 @@ export default { return new Promise((resolve, reject) => { setTimeout(() => { commit('setIsLoading', true) - api.getGroupMap({labels: state.dataListSelectedLabel}) - .then(response => { - commit('addGroupListOpenNode', response.data.data.id) - commit('setGroupList', [response.data.data]) - commit('concatTreeUndeletableId', response.data.data.id) - commit('setIsLoading', false) - }) - .catch(error => { - commit('setIsLoading', false) - bus.$emit('msg.error', 'Load data failed: ' + error.data.message) - }) + commit('setGroupListOpenNode', []) + if (state.isLoadTreeAsync) { + api.getGroupMap({labels: state.dataListSelectedLabel}) + .then(response => { + commit('setGroupList', [response.data.data]) + commit('concatTreeUndeletableId', response.data.data.id) + + api.getGroupChildren(response.data.data.id) + .then(r => { + state.groupList[0].children = [] + state.groupList[0].children.push(...r.data.data) + commit('addGroupListOpenNode', response.data.data.id) + commit('setIsLoading', false) + }) + .catch(error => { + bus.$emit('msg.error', 'Load group ' + state.groupList[0].name + ' children error: ' + error) + commit('setIsLoading', false) + }) + + commit('setIsLoading', false) + }) + .catch(error => { + commit('setIsLoading', false) + bus.$emit('msg.error', 'Load data failed: ' + error.data.message) + }) + } else { + api.getGroupMap({labels: state.dataListSelectedLabel}) + .then(response => { + commit('addGroupListOpenNode', response.data.data.id) + commit('setGroupList', [response.data.data]) + commit('concatTreeUndeletableId', response.data.data.id) + commit('setIsLoading', false) + }) + .catch(error => { + commit('setIsLoading', false) + bus.$emit('msg.error', 'Load data failed: ' + error.data.message) + }) + } resolve() }, 1) }) diff --git a/frontend/src/store/inspector.js b/frontend/src/store/inspector.js index b514dd630..e8a08a33e 100644 --- a/frontend/src/store/inspector.js +++ b/frontend/src/store/inspector.js @@ -162,9 +162,10 @@ export default { }) bus.$emit('msg.success', 'Clear Inspector success!') }, - saveSelectedFlow ({ state }) { + saveSelectedFlow ({ state, dispatch }) { api.saveSelectedFlow(state.selectedIds) .then(response => { + dispatch('loadDataMap') bus.$emit('msg.success', state.selectedIds.length + ' flow saved!') }) .catch(error => { diff --git a/frontend/src/store/settings.js b/frontend/src/store/settings.js index e2b42f3e4..8417e38e2 100644 --- a/frontend/src/store/settings.js +++ b/frontend/src/store/settings.js @@ -4,7 +4,8 @@ import { bus } from '@/eventbus' var configCommitMap = [ {'name': 'mock.mode', 'commit': 'setDiffMode'}, {'name': 'mock.data.showLabel', 'commit': 'setIsLabelDisplay'}, - {'name': 'mock.data.tree.closeReload', 'commit': 'setIsCloseReloadWhenEnter'}, + {'name': 'mock.data.tree.asynchronous', 'commit': 'setIsTreeLoadAsync'}, + {'name': 'mock.data.shownConfig', 'commit': 'setIsDisplayConfiguration'}, {'name': 'mock.request.keep_origin_data', 'commit': 'setIsRequestKeepOriginData'}, {'name': 'mock.data.tree.undeletableId', 'commit': 'concatTreeUndeletableId'}, {'name': 'mock.data.detail.stickyTopKey', 'commit': 'concatStickyTopKey'}, @@ -56,10 +57,10 @@ export default { for (const config of configPreLoad) { if (response.data.hasOwnProperty(config.name) && response.data[config.name]) { commit('addPreLoadFuncSet', config.commit, { root: true }) - commit('setInitialized', true) dispatch(config.commit, { root: true }) } } + commit('setInitialized', true) } }) .catch(error => { @@ -76,7 +77,7 @@ export default { bus.$emit('msg.error', `Update config failed ${error.data.message}`) }) }, - commitAndupdateConfigByKey({ dispatch, commit }, { command, val }) { + commitAndupdateConfigByKey({ dispatch, commit }, { command, isShowMessage, val }) { let updateConfig = {} for (const config of configCommitMap) { if (config.commit == command) { @@ -88,7 +89,9 @@ export default { api.updateConfigByKey(updateConfig) .then(_ => { dispatch('loadConfig') - bus.$emit('msg.success', `Update config success!`) + if (isShowMessage) { + bus.$emit('msg.success', `Update config success!`) + } }) .catch(error => { bus.$emit('msg.error', `Update config failed ${error.data.message}`) diff --git a/frontend/src/views/Main.vue b/frontend/src/views/Main.vue index e4e12ebe4..a10f329d4 100644 --- a/frontend/src/views/Main.vue +++ b/frontend/src/views/Main.vue @@ -78,6 +78,7 @@ export default { beforeDestroy() { document.removeEventListener('keydown', this._keydownListener) this.$io.removeListener('statusBarUpdate', this.loadAllStatusList) + this.$io.removeListener('datamanagerUpdate', this.loadDataMap) this.$io.removeListener('msgSuccess', this.successMessage) this.$io.removeListener('msgInfo', this.infoMessage) this.$io.removeListener('msgError', this.errorMessage) @@ -94,6 +95,7 @@ export default { this.$bus.$on('msg.error', this.errorMessage) this.$bus.$on('msg.destroy', this.destroyMessage) this.$io.on('statusBarUpdate', this.loadAllStatusList) + this.$io.on('datamanagerUpdate', this.loadDataMap) this.$io.on('msgSuccess', this.successMessage) this.$io.on('msgInfo', this.infoMessage) this.$io.on('msgError', this.errorMessage) @@ -159,6 +161,9 @@ export default { loadAllStatusList() { this.$store.dispatch('loadAllStatusList') }, + loadDataMap() { + this.$store.dispatch('loadDataMap') + }, successMessage(msg) { this.$Message.success({ content: msg, diff --git a/frontend/src/views/datamanager/DataDetail.vue b/frontend/src/views/datamanager/DataDetail.vue index af73db5fb..6807b1a32 100644 --- a/frontend/src/views/datamanager/DataDetail.vue +++ b/frontend/src/views/datamanager/DataDetail.vue @@ -22,12 +22,14 @@ + + diff --git a/frontend/src/views/datamanager/DataList.vue b/frontend/src/views/datamanager/DataList.vue index 72fd62c85..22133d2c5 100644 --- a/frontend/src/views/datamanager/DataList.vue +++ b/frontend/src/views/datamanager/DataList.vue @@ -78,6 +78,17 @@ + + + + + + + Load asyn + Load data asynchronous + + + @@ -91,25 +102,26 @@ - + - Reload - Reload when entering DataManager + Labels + Display labels in each tree node - + - Labels - Display labels in each tree nodes + Configuration + Display configuration file in each group + @@ -134,6 +146,7 @@ + @@ -143,6 +156,7 @@