Skip to content

Commit

Permalink
#98 clear logMessageList & resultList after toggling menu (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcheng15 authored Feb 28, 2022
1 parent ebc0689 commit 42b02e4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/components/Header/HeaderMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
</el-menu>
</template>
<script>
import { mapState } from 'vuex'
import { mapMutations, mapState } from 'vuex'
import { actionsTypes } from '../../store'
export default {
data () {
return {}
Expand All @@ -48,7 +49,11 @@ export default {
}
},
methods: {
...mapMutations ({
resetList: actionsTypes.RESET_LIST
}),
handleSelect (key) {
this.resetList()
this.$router.push({name: key})
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/page/Workspace/Notebook/LogMessage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { mapState, mapMutations, mapActions } from 'vuex'
}
})
export default class ExcuteDetail extends Vue {
export default class LogMessage extends Vue {
logList = []
timer = null
Expand All @@ -51,15 +51,19 @@ export default class ExcuteDetail extends Vue {
@Watch('currentNotebook', { immediate: true, deep: true })
onCurrentNotebookChange (newVal) {
if (newVal && newVal.active === 'true' && !this.logMessageList.includes(this.cellId)) {
this.addLogMessage(this.cellId)
this.getLogs()
this.initLog()
}
}
beforeDestroy () {
window.clearTimeout(this.timer)
}
initLog () {
this.addLogMessage(this.cellId)
this.getLogs()
}
pollingData () {
window.clearTimeout(this.timer)
if (this._isDestroyed) {
Expand Down
4 changes: 4 additions & 0 deletions src/store/module/notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default {
[types.SET_LOG_MESSAGE_LIST]: (state, cellId) => {
state.logMessageList.push(cellId)
},
[types.RESET_LIST]: state => {
state.logMessageList = []
state.resultList = []
},
[types.SET_RESULT_LIST]: (state, cellId) => {
state.resultList.push(cellId)
},
Expand Down
1 change: 1 addition & 0 deletions src/store/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const SET_OPENED_NOTEBOOK = 'SET_OPENED_NOTEBOOK'
export const SET_ACTIVE_NOTEBOOK = 'SET_ACTIVE_NOTEBOOK'
export const SET_DEMO_LIST = 'SET_DEMO_LIST'
export const SET_LOG_MESSAGE_LIST = 'SET_LOG_MESSAGE_LIST'
export const RESET_LIST = 'RESET_LIST'
export const SET_RESULT_LIST = 'SET_RESULT_LIST'
export const CREATE_FOLDER = 'CREATE_FOLDER'
export const MOVE_NOTEBOOK = 'MOVE_NOTEBOOK'
Expand Down

0 comments on commit 42b02e4

Please sign in to comment.