Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#98 clear logMessageList & resultList after toggling menu #101

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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