Skip to content

Commit bd7b66b

Browse files
青羽青羽
authored andcommitted
1.remove auto-save of temp scripts;
2.fix the problem of wrong result set selection; 3.optimizing log input; 4.optimize panel menu.
1 parent d6f5677 commit bd7b66b

File tree

4 files changed

+88
-35
lines changed

4 files changed

+88
-35
lines changed

src/js/component/panel/panelItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default {
103103
} else if (this.isDiy) {
104104
styleAttr = Object.assign({
105105
'position': 'fixed',
106-
'z-index': 1100,
106+
'z-index': 100,
107107
}, this.diyStyle);
108108
} else {
109109
styleAttr = {
@@ -112,7 +112,7 @@ export default {
112112
'right': 0,
113113
'top': 0,
114114
'bottom': 0,
115-
'z-index': 1100,
115+
'z-index': 100,
116116
};
117117
}
118118
return styleAttr;

src/js/module/workbench/container.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@
4141
<DropdownItem name="right">关闭右边</DropdownItem>
4242
<DropdownItem
4343
name="fullScreen"
44-
divided>全屏</DropdownItem>
45-
<DropdownItem name="releaseFullScreen">取消全屏</DropdownItem>
44+
divided
45+
v-if="!isTopPanelFull">全屏</DropdownItem>
46+
<DropdownItem
47+
name="releaseFullScreen"
48+
v-else>取消全屏</DropdownItem>
4649
</DropdownMenu>
4750
</Dropdown>
4851
</div>
@@ -84,7 +87,7 @@
8487
<span>关闭提示</span>
8588
</p>
8689
<div class="modal-content">
87-
<p>{{ closeModal.text }}</p>
90+
<p style="word-break: break-all;">{{ closeModal.text }}</p>
8891
</div>
8992
<div slot="footer">
9093
<Button
@@ -334,6 +337,7 @@ export default {
334337
if (!repeatWork) {
335338
if (this.worklist.length >= 10) {
336339
this.$Notice.close('boyondQuota');
340+
cb && cb(false);
337341
return this.$Notice.warning({
338342
title: '警告',
339343
desc: '您打开的脚本已超出10个,请关闭其他脚本再打开!',
@@ -468,6 +472,9 @@ export default {
468472
if (cb) {
469473
cb();
470474
}
475+
setTimeout(() => {
476+
this.dispatch('Workbench:save', this.worklist[this.worklist.length - 1]);
477+
}, 500);
471478
});
472479
}, 300);
473480
});
@@ -508,6 +515,7 @@ export default {
508515
}), '');
509516
this.current = work.id;
510517
this.dispatch('IndexedDB:toggleTab', work.id);
518+
this.dispatch('Workbench:setParseAction', work.id);
511519
this.panelControl(this.isTopPanelFull ? 'fullScreen' : 'releaseFullScreen');
512520
}
513521
},

src/js/module/workbench/script/historyScript.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@
4343
<DropdownMenu slot="list">
4444
<DropdownItem name="fullScreen">全屏</DropdownItem>
4545
<DropdownItem name="releaseFullScreen">取消全屏</DropdownItem>
46-
<DropdownItem name="min">最小化</DropdownItem>
47-
<DropdownItem name="releaseMin">取消最小化</DropdownItem>
46+
<DropdownItem
47+
name="min"
48+
v-if="!scriptViewState.bottomPanelMin">最小化</DropdownItem>
49+
<DropdownItem
50+
name="releaseMin"
51+
v-else>取消最小化</DropdownItem>
4852
</DropdownMenu>
4953
</Dropdown>
5054
</div>
@@ -183,7 +187,9 @@ export default {
183187
},
184188
configLogPanel(name) {
185189
if (name == 'fullScreen' || name == 'releaseFullScreen') {
186-
this.$refs.bottomPanel[name]();
190+
this.$refs.bottomPanel[name]({
191+
isDiy: false,
192+
});
187193
}
188194
if (name == 'min') {
189195
this.scriptViewState.bottomPanelHeight = 32;
@@ -199,9 +205,8 @@ export default {
199205
},
200206
changeResultSet(data, cb) {
201207
const resultSet = _.isUndefined(data.currentSet) ? this.script.resultSet : data.currentSet;
202-
this.$set(this.script.resultList[data.lastSet], 'result', data.lastResult);
203-
// 拿到index对应的result
204-
const resultPath = this.script.resultList[resultSet].path;
208+
const findResult = this.script.resultList.find((item) => item.name === `_${resultSet}.dolphin`);
209+
const resultPath = findResult && findResult.path;
205210
const hasResult = this.script.resultList[resultSet].hasOwnProperty('result');
206211
if (!hasResult) {
207212
const pageSize = 5000;

src/js/module/workbench/script/script.vue

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,18 @@
6565
@on-click="configLogPanel">
6666
<Icon type="md-list" />
6767
<DropdownMenu slot="list">
68-
<DropdownItem name="fullScreen">全屏</DropdownItem>
69-
<DropdownItem name="releaseFullScreen">取消全屏</DropdownItem>
70-
<DropdownItem name="min">最小化</DropdownItem>
71-
<DropdownItem name="releaseMin">取消最小化</DropdownItem>
68+
<DropdownItem
69+
name="fullScreen"
70+
v-if="!isBottomPanelFull">全屏</DropdownItem>
71+
<DropdownItem
72+
name="releaseFullScreen"
73+
v-else>取消全屏</DropdownItem>
74+
<DropdownItem
75+
name="min"
76+
v-if="!scriptViewState.bottomPanelMin">最小化</DropdownItem>
77+
<DropdownItem
78+
name="releaseMin"
79+
v-else>取消最小化</DropdownItem>
7280
</DropdownMenu>
7381
</Dropdown>
7482
</div>
@@ -153,6 +161,7 @@ export default {
153161
saveLoading: false,
154162
isLogShow: false,
155163
autoSaveTimer: null,
164+
isBottomPanelFull: false,
156165
};
157166
},
158167
computed: {
@@ -235,11 +244,13 @@ export default {
235244
if (resultList) {
236245
this.script.result = resultList[resultList.resultSet].result;
237246
this.script.resultList = _.dropRight(_.toArray(resultList), 3);
238-
this.$nextTick(() => {
239-
this.$refs.result.resultSet = resultList.resultSet;
240-
this.$refs.result.initPage();
241-
});
242247
this.showPanelTab(resultList.showPanel);
248+
if (this.$refs.result) {
249+
this.$nextTick(() => {
250+
this.$refs.result.resultSet = resultList.resultSet;
251+
this.$refs.result.initPage();
252+
});
253+
}
243254
}
244255
} });
245256
this.dispatch('IndexedDB:getLog', { tabId: this.script.id,
@@ -403,6 +414,10 @@ export default {
403414
// 执行
404415
this.execute = new Execute(data);
405416
this.isLogShow = false;
417+
this.localLog = {
418+
log: { all: '', error: '', warning: '', info: '' },
419+
logLine: 1,
420+
};
406421
if (option && option.isRestore) {
407422
this.execute.restore(option);
408423
} else {
@@ -456,16 +471,16 @@ export default {
456471
Object.keys(convertLogs).forEach((key) => {
457472
const convertLog = convertLogs[key];
458473
if (convertLog) {
459-
this.script.log[key] += convertLog + '\n';
474+
this.localLog.log[key] += convertLog + '\n';
460475
}
461476
if (key === 'all') {
462-
this.script.logLine += convertLog.split('\n').length;
477+
this.localLog.logLine += convertLog.split('\n').length;
463478
}
464479
});
465-
this.dispatch('IndexedDB:appendLog', {
466-
tabId: this.script.id,
467-
rst: this.script.log,
468-
});
480+
481+
if (this.scriptViewState.showPanel === 'log') {
482+
this.localLogShow();
483+
}
469484
});
470485
471486
this.execute.on('history', (ret) => {
@@ -526,7 +541,6 @@ export default {
526541
}
527542
});
528543
this.execute.on('result', (ret) => {
529-
this.script.running = false;
530544
this.showPanelTab('result');
531545
const storeResult = {
532546
'headRows': ret.metadata,
@@ -650,10 +664,18 @@ export default {
650664
this.showPanelTab('history');
651665
this.isLogShow = true;
652666
}
667+
this.dispatch('IndexedDB:appendLog', {
668+
tabId: this.script.id,
669+
rst: this.script.log,
670+
});
653671
});
654672
this.execute.on('stateEnd', () => {
655673
// 执行成功的时候resolve,用于改变modal框中的loading状态
656674
cb && cb('end');
675+
this.dispatch('IndexedDB:appendLog', {
676+
tabId: this.script.id,
677+
rst: this.localLog.log,
678+
});
657679
});
658680
this.execute.on('querySuccess', ({ type, task }) => {
659681
const costTime = util.convertTimestamp(task.costTime);
@@ -747,9 +769,11 @@ export default {
747769
},
748770
autoSave() {
749771
clearTimeout(this.autoSaveTimer);
750-
this.autoSaveTimer = setTimeout(() => {
751-
this.save();
752-
}, 1000 * 60 * 3);
772+
if (!this.work.saveAs) {
773+
this.autoSaveTimer = setTimeout(() => {
774+
this.save();
775+
}, 1000 * 60 * 5);
776+
}
753777
},
754778
save() {
755779
const params = {
@@ -804,10 +828,28 @@ export default {
804828
},
805829
showPanelTab(type) {
806830
this.scriptViewState.showPanel = type;
831+
if (type === 'log') {
832+
this.localLogShow();
833+
}
834+
},
835+
localLogShow() {
836+
if (this.localLog) {
837+
this.script.log = this.localLog.log;
838+
this.script.logLine = this.localLog.logLine;
839+
}
807840
},
808841
configLogPanel(name) {
809-
if (name == 'fullScreen' || name == 'releaseFullScreen') {
810-
this.$refs.bottomPanel[name]();
842+
if (name == 'fullScreen') {
843+
this.isBottomPanelFull = true;
844+
this.$refs.bottomPanel[name]({
845+
isDiy: false,
846+
});
847+
}
848+
if (name == 'releaseFullScreen') {
849+
this.isBottomPanelFull = false;
850+
this.$refs.bottomPanel[name]({
851+
isDiy: false,
852+
});
811853
}
812854
if (name == 'min') {
813855
this.scriptViewState.bottomPanelHeight = 32;
@@ -823,9 +865,8 @@ export default {
823865
},
824866
changeResultSet(data, cb) {
825867
const resultSet = _.isUndefined(data.currentSet) ? this.script.resultSet : data.currentSet;
826-
// this.$set(this.script.resultList[resultSet], 'result', data.lastResult);
827-
// 拿到index对应的result
828-
const resultPath = this.script.resultList[resultSet].path;
868+
const findResult = this.script.resultList.find((item) => item.name === `_${resultSet}.dolphin`);
869+
const resultPath = findResult && findResult.path;
829870
const hasResult = this.script.resultList[resultSet].hasOwnProperty('result');
830871
if (!hasResult) {
831872
const pageSize = 5000;
@@ -861,7 +902,6 @@ export default {
861902
});
862903
cb();
863904
}).catch((err) => {
864-
this.$refs.result.resultSet = data.lastSet;
865905
cb();
866906
});
867907
} else {

0 commit comments

Comments
 (0)