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

revert request for log messages #148

Merged
merged 3 commits into from
Mar 22, 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
2 changes: 2 additions & 0 deletions src/assets/css/variable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ $cellCommentColor: #66A0A4;
$cellStringColor: #1021D5;
$cellKeywordColor: #CF2F72;
$pattern-blue-100: #CEE6FD;
$pattern-blue-200: #e6f1fb;
$pattern-blue-300: #3991e1;
$pattern-blue-400: #2492F7;
$pattern-blue-500: #0875DA;
$pattern-blue-600: #0867BF;
Expand Down
2 changes: 1 addition & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
"action_run": "Resume",
"action_stop": "Stop",
"action_rerun": "Repeat Running",
"runScheduleSuccess": "Joined the running instance successfully",
"runScheduleSuccess": "Instance created successfully",
"updateScheduleTask": "Update Schedule Task"
},
"settings": {
Expand Down
2 changes: 1 addition & 1 deletion src/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"action_run": "继续",
"action_stop": "停止",
"action_rerun": "重新运行",
"runScheduleSuccess": "成功加入运行实例",
"runScheduleSuccess": "运行实例创建成功",
"updateScheduleTask": "更新调度任务"
},
"settings": {
Expand Down
17 changes: 15 additions & 2 deletions src/page/Schedules/Schedules/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export default class Schedules extends Vue {
/** full data */
schedulesList = []

/** status */
isToggling = false

/** methods */
filterSchedules = debounce(function () {
this.startLoading()
Expand Down Expand Up @@ -315,8 +318,18 @@ export default class Schedules extends Vue {
}

async handleToggle (row, release_state) {
await this.toggleSchedule({ ...row, release_state })
await this.querySchedules()
if (this.isToggling) {
return
}
this.isToggling = true
try {
await this.toggleSchedule({ ...row, release_state })
} catch (err) {
console.log(err)
} finally {
this.querySchedules()
this.isToggling = false
}
}

isOnline ({ release_state }) {
Expand Down
6 changes: 1 addition & 5 deletions src/page/Workspace/Notebook/LogMessage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { mapState, mapMutations, mapActions } from 'vuex'
export default class LogMessage extends Vue {
logList = []
timer = null
offset = -1

@Watch('status')
onResultChange (newVal, oldVal) {
Expand All @@ -46,7 +45,6 @@ export default class LogMessage extends Vue {
}
@Watch('jobId')
onJobIdChange () {
this.offset = -1
this.getLogs()
}

Expand All @@ -67,7 +65,6 @@ export default class LogMessage extends Vue {
if (!this.isDemo) {
this.addLogMessage({ name: 'logMessageList', notebookId: this.activeNotebook.id, cellId: this.cellId })
}
this.offset = -1
this.getLogs()
}

Expand All @@ -83,11 +80,10 @@ export default class LogMessage extends Vue {

async getLogs () {
try {
const res = await this.getJobLogs({ job_id: this.jobId, offset: this.offset })
const res = await this.getJobLogs(this.jobId)
if (this._isDestroyed) {
return false
}
this.offset = res.data?.offset || -1
this.logList = res.data?.logs ?? []
if (this.status === 'RUNNING') {
this.pollingData()
Expand Down
6 changes: 5 additions & 1 deletion src/page/Workspace/Workflow/components/CodeEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export default class NodeCodeEditor extends Vue {
}
changeContent (value) {
this.$emit('changeContent', value)
this.queryCompleters(value)
// this.queryCompleters(value)
// 清空默认的代码提示
const lnTools = ace.acequire('ace/ext/language_tools')
lnTools?.setCompleters([])

this.$nextTick(() => {
let v = value
Expand Down Expand Up @@ -177,6 +180,7 @@ export default class NodeCodeEditor extends Vue {
name: 'enter',
bindKey: { win: 'Alt-Space', mac: 'Option-Space' },
exec: editor => {
this.queryCompleters(this.contentBackup)
editor.execCommand('startAutocomplete')
}
})
Expand Down
222 changes: 192 additions & 30 deletions src/page/Workspace/Wrapper/WorkspaceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,126 @@
<svg-icon class="node-label-icon" :icon-class="`file_${data.type}_16`" v-else></svg-icon>
{{ node.label }}{{getEnding(node)}}
</span>
<el-dropdown v-if="!(data.folder_id && data.is_demo)" class="node-more node-actions" :style="{'left': treeOffsetWidth + 'px'}" @command="(command) => handleWorkspace(command, node)">
<span class="el-dropdown-link" @click.stop>
<el-button class="icon-bg" icon="el-ksd-icon-more_22" type="text" size="small"></el-button>
</span>
<el-dropdown-menu slot="dropdown">
<template v-if="data.id">
<el-dropdown-item command="changeActiveTab">{{$t('open')}}</el-dropdown-item>
<el-dropdown-item command="handleRename" v-if="!data.is_demo">{{$t('rename')}}</el-dropdown-item>
<el-dropdown-item command="handleClone" >{{$t('clone')}}</el-dropdown-item>
<el-dropdown-item command="handleMove" v-if="!data.is_demo">{{$t('move')}}</el-dropdown-item>
<el-dropdown-item command="handleExport">{{$t('export')}}</el-dropdown-item>
<el-dropdown-item command="handleDelete" v-if="!data.is_demo && !isPublished(data)">
<span class="txt-danger">{{$t('delete')}}</span>
</el-dropdown-item>
</template>
<template v-else>
<el-dropdown-item command="handleCreateFolder">{{$t('workspace.folderCreate')}}</el-dropdown-item>
<el-dropdown-item command="handleCreateNoteBook">{{$t('workspace.notebookCreate')}}</el-dropdown-item>
<el-dropdown-item command="handleCreateWorkflow">{{$t('workspace.workflowCreate')}}</el-dropdown-item>
<el-dropdown-item command="handleMove">{{$t('move')}}</el-dropdown-item>
<el-dropdown-item command="handleRename">{{$t('rename')}}</el-dropdown-item>
<el-dropdown-item command="handleClone">{{$t('clone')}}</el-dropdown-item>
<el-dropdown-item command="handleDelete" v-if="showDeleteFolderBtn(node)">
<span class="txt-danger">{{$t('delete')}}</span>
</el-dropdown-item>
</template>
</el-dropdown-menu>
</el-dropdown>
<el-menu
v-if="!(data.folder_id && data.is_demo)"
class="node-more node-actions"
:style="{'left': treeOffsetWidth + 'px'}"
:mode="'horizontal'"
@select="(command) => handleWorkspace(command, node)"
>
<template v-if="data.id">
<el-submenu
:popper-class="'node-more-submenu'"
:index="'node-more'"
>
<template slot="title">
<el-button
class="icon-bg"
icon="el-ksd-icon-more_22"
type="text"
size="small"
@click.stop
></el-button>
</template>
<el-menu-item
:index="'changeActiveTab'"
>
{{ $t('open') }}
</el-menu-item>
<el-menu-item
v-if="!data.is_demo"
:index="'handleRename'"
>
{{ $t('rename') }}
</el-menu-item>
<el-menu-item
:index="'handleClone'"
>
{{ $t('clone') }}
</el-menu-item>
<el-menu-item
v-if="!data.is_demo"
:index="'handleMove'"
>
{{ $t('move') }}
</el-menu-item>
<el-submenu
:index="$t('export')"
:popper-class="'node-more-submenu-child'"
>
<template slot="title">{{ $t('export') }}</template>
<el-menu-item
:index="'handleExport'"
>
{{ $t('export') + ' ' + getEnding(node) }}
</el-menu-item>
<el-menu-item
:index="'handleExportByzer'"
>
{{ $t('export') + ' .byzer' }}
</el-menu-item>
</el-submenu>
<el-menu-item
v-if="!data.is_demo && !isPublished(data)"
:index="'handleDelete'"
>
<span class="txt-danger">{{ $t('delete') }}</span>
</el-menu-item>
</el-submenu>
</template>
<template v-else>
<el-submenu
:popper-class="'node-more-submenu'"
:index="'node-more'"
>
<template slot="title">
<el-button
class="icon-bg"
icon="el-ksd-icon-more_22"
type="text"
size="small"
@click.stop
></el-button>
</template>
<el-menu-item
:index="'handleCreateFolder'"
>
{{ $t('workspace.folderCreate') }}
</el-menu-item>
<el-menu-item
:index="'handleCreateNoteBook'"
>
{{ $t('workspace.notebookCreate') }}
</el-menu-item>
<el-menu-item
:index="'handleCreateWorkflow'"
>
{{ $t('workspace.workflowCreate') }}
</el-menu-item>
<el-menu-item
:index="'handleMove'"
>
{{ $t('move') }}
</el-menu-item>
<el-menu-item
:index="'handleRename'"
>
{{ $t('rename') }}
</el-menu-item>
<el-menu-item
:index="'handleClone'"
>
{{ $t('clone') }}
</el-menu-item>
<el-menu-item
v-if="showDeleteFolderBtn(node)"
:index="'handleDelete'"
>
<span class="txt-danger">{{ $t('delete') }}</span>
</el-menu-item>
</el-submenu>
</template>
</el-menu>
</div>
</el-tree>
</div>
Expand Down Expand Up @@ -112,6 +204,7 @@ export default class WorkspaceList extends Vue {
originalList = []
nodeScrollWidth = 0
originalWidth = this.defaultWidth

@Watch('leftWidth')
onLeftWidthChange (newVal) {
this.originalWidth = newVal || this.defaultWidth
Expand Down Expand Up @@ -191,6 +284,9 @@ export default class WorkspaceList extends Vue {
}

handleWorkspace (command, node) {
if (!command) {
return
}
this[command](node)
}
async handleCreateFolder (node) {
Expand Down Expand Up @@ -231,6 +327,9 @@ export default class WorkspaceList extends Vue {
handleExport (node) {
this.$emit('handleExport', this.getNotebookItem(node))
}
handleExportByzer (node) {
this.$emit('handleExport', {...this.getNotebookItem(node), output: 'byzer'})
}
handleImport () {
this.$emit('handleImport')
}
Expand Down Expand Up @@ -442,7 +541,7 @@ export default class WorkspaceList extends Vue {
&:hover {
.custom-tree-node {
.node-actions {
display: block;
visibility: visible;
}
}
}
Expand All @@ -454,13 +553,76 @@ export default class WorkspaceList extends Vue {
}
}
.node-actions {
display: none;
visibility: hidden;
position: absolute;
top: 6px;
&.el-menu {
background: none;
}
&.el-menu--horizontal {
border: none;
}
.el-menu-item, .el-submenu__title {
padding: 0 !important;
width: 26px;
height: 23px;
line-height: 23px;
text-align: center;
border: none;
&:hover {
background: none;
}
& > i {
display: none;
}
}
}
}
}
}
}
}
.node-more-submenu {
.el-menu {
width: fit-content;
min-width: 72px;
}
.el-submenu,
.el-menu-item {
padding: 0 20px !important;
&:hover {
color: $pattern-blue-300 !important;
background: $pattern-blue-200;
}
&.is-active {
color: $--color-info !important;
}
.el-submenu__icon-arrow.el-icon-arrow-right {
top: 55%;
right: 10px;
}
}
.el-submenu {
padding: 0 !important;
.el-submenu__title {
padding: 0 20px;
color: $--color-info !important;
&:hover {
color: $pattern-blue-300 !important;
background: $pattern-blue-200;
}
}
& > .el-submenu__title .el-submenu__icon-arrow,
&.is-opened > .el-submenu__title .el-submenu__icon-arrow {
transform: rotateZ(0);
transition: 0s;
}
.node-more-submenu-child {
.el-menu-item {
width: 100%;
min-width: 72px;
}
}
}
}
</style>
5 changes: 2 additions & 3 deletions src/page/Workspace/Wrapper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ export default {
this.changeTabList(newNotobookInfo)
}
},
handleExport (item) {
const { id, type } = item
this.exportNotebook({id, type}).then(res => {
handleExport (params) {
this.exportNotebook(params).then(res => {
const disposition = res.headers['content-disposition']
const fileNameArr = disposition && disposition.split('filename=')
const filename = fileNameArr.length > 1 && JSON.parse(fileNameArr[1])
Expand Down
Loading