Skip to content

Commit efbc745

Browse files
Merge pull request #25 from xtt55/0.7.0
Closes #20, closes #24; update version to 0.7.0
2 parents f5507fd + dfd3d34 commit efbc745

File tree

14 files changed

+2086
-2020
lines changed

14 files changed

+2086
-2020
lines changed

docs/en_US/ch1/Front-end_deployment_documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Scriptis is a data analysis tool based on Linkis. Before deploying Scriptis, you
44

55
1. Select the corresponding installation package to download.
66

7-
2. Unzip the downloaded installation package in the installation directory: unzip wedatasphere-scriptis-0.6.0-dist.zip.
7+
2. Unzip the downloaded installation package in the installation directory: unzip wedatasphere-scriptis-0.7.0-dist.zip.
88

99
## 2 Deploy
1010

docs/zh_CN/ch1/前台部署文档.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Scriptis是基于Linkis开发的数据分析工具,部署Scriptis前需要先
33
## 1、准备工作
44

55
1. 点击release 选择对应的安装包进行下载
6-
2. 将下载下来的安装包在安装目录进行解压:unzip wedatasphere-scriptis-0.6.0-dist.zip
6+
2. 将下载下来的安装包在安装目录进行解压:unzip wedatasphere-scriptis-0.7.0-dist.zip
77

88
## 2、部署
99
    分为两种部署方式,自动化部署和手动部署

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scriptis",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -40,6 +40,7 @@
4040
"eslint-config-google": "^0.13.0",
4141
"eslint-plugin-prettier": "^3.1.0",
4242
"eslint-plugin-vue": "^5.0.0",
43+
"filemanager-webpack-plugin": "^2.0.5",
4344
"monaco-editor-webpack-plugin": "^1.7.0",
4445
"node-sass": "^4.9.0",
4546
"sass-loader": "^7.1.0",

src/js/component/editor/editor.vue

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import _ from 'lodash';
99
import { parser } from 'dt-sql-parser';
1010
import storage from '@/js/helper/storage';
1111
import highRiskGrammar from './highRiskGrammar';
12-
1312
const types = {
1413
code: {
1514
theme: 'defaultView',
@@ -51,8 +50,9 @@ export default {
5150
editor: null,
5251
editorModel: null,
5352
decorations: null,
54-
parseErrorLine: 0,
5553
isParserClose: false,
54+
closeParser: null,
55+
openParser: null,
5656
};
5757
},
5858
computed: {
@@ -86,8 +86,10 @@ export default {
8686
'value': function(newValue, oldValue) {
8787
if (this.editor) {
8888
this.$emit('on-operator');
89-
this.sqlParser(newValue);
90-
if (newValue == this.getValue()) {
89+
if (!this.isParserClose) {
90+
this.sqlParser(newValue);
91+
}
92+
if (newValue == this.getValue() ) {
9193
return;
9294
}
9395
let readOnly = this.editor.getConfiguration().readOnly;
@@ -126,8 +128,9 @@ export default {
126128
this.editor = monaco.editor.create(this.$el, this.currentConfig);
127129
this.monaco = monaco;
128130
this.editorModel = this.editor.getModel();
131+
this.isParserClose = !!storage.get('isParserClose', 'local');
129132
if (this.type !== 'log') {
130-
if (this.scriptType !== 'hdfsScript' && !this.readOnly) {
133+
if (this.scriptType !== 'hdfsScript' && !this.readOnly ) {
131134
this.addCommands();
132135
this.addActions();
133136
}
@@ -168,7 +171,6 @@ export default {
168171
folded sections
169172
for a certain model when it is connected to an editor instance.
170173
Once the same model is connected to the same or a different editor instance, editor.restoreViewState can be used to restore the above listed state.
171-
172174
There are very many things that influence how rendering occurs:
173175
the current theme
174176
the current wrapping settings set on the editor
@@ -253,7 +255,6 @@ export default {
253255
if (window.monaco) {
254256
const monaco = window.monaco;
255257
const vm = this;
256-
257258
this.editor.addAction({
258259
id: 'editor.action.execute',
259260
label: '运行脚本',
@@ -265,7 +266,6 @@ export default {
265266
vm.$emit('on-run');
266267
},
267268
});
268-
269269
this.editor.addAction({
270270
id: 'format',
271271
label: '格式化',
@@ -277,7 +277,6 @@ export default {
277277
editor.trigger('anyString', 'editor.action.formatDocument');
278278
},
279279
});
280-
281280
this.editor.addAction({
282281
id: 'find',
283282
label: '查找',
@@ -289,7 +288,6 @@ export default {
289288
editor.trigger('find', 'actions.find');
290289
},
291290
});
292-
293291
this.editor.addAction({
294292
id: 'replace',
295293
label: '替换',
@@ -301,7 +299,6 @@ export default {
301299
editor.trigger('findReplace', 'editor.action.startFindReplaceAction');
302300
},
303301
});
304-
305302
this.editor.addAction({
306303
id: 'commentLine',
307304
label: '行注释',
@@ -313,7 +310,6 @@ export default {
313310
editor.trigger('commentLine', 'editor.action.commentLine');
314311
},
315312
});
316-
317313
this.editor.addAction({
318314
id: 'paste',
319315
label: '粘贴',
@@ -331,7 +327,6 @@ export default {
331327
return null;
332328
},
333329
});
334-
335330
this.editor.addAction({
336331
id: 'gotoLine',
337332
label: '跳到指定行',
@@ -343,11 +338,10 @@ export default {
343338
editor.trigger('gotoLine', 'editor.action.gotoLine');
344339
},
345340
});
346-
347341
if (this.language === 'hql') {
348342
// 控制语法检查
349-
const closeParser = this.editor.createContextKey('closeParser', true);
350-
const openParser = this.editor.createContextKey('openParser', false);
343+
this.closeParser = this.editor.createContextKey('closeParser', !this.isParserClose);
344+
this.openParser = this.editor.createContextKey('openParser', this.isParserClose);
351345
this.editor.addAction({
352346
id: 'closeParser',
353347
label: '关闭语法检查',
@@ -358,14 +352,14 @@ export default {
358352
contextMenuGroupId: 'control',
359353
contextMenuOrder: 2.0,
360354
run(editor) {
355+
storage.set('isParserClose', true, 'local');
361356
vm.isParserClose = true;
362357
// 控制右键菜单的显示
363-
openParser.set(true);
364-
closeParser.set(false);
358+
vm.openParser.set(true);
359+
vm.closeParser.set(false);
365360
vm.sqlParser();
366361
},
367362
});
368-
369363
this.editor.addAction({
370364
id: 'openParser',
371365
label: '打开语法检查',
@@ -375,28 +369,29 @@ export default {
375369
contextMenuGroupId: 'control',
376370
contextMenuOrder: 2.1,
377371
run(editor) {
372+
storage.set('isParserClose', false, 'local');
378373
vm.isParserClose = false;
379-
openParser.set(false);
380-
closeParser.set(true);
374+
vm.openParser.set(false);
375+
vm.closeParser.set(true);
381376
vm.sqlParser();
382377
},
383378
});
384379
}
385380
}
386381
},
387382
sqlParser: _.debounce(function(value, cb) {
388-
const _this = this;
383+
const vm = this;
389384
let highRiskList = [];
390-
const lang = _this.language;
391-
const app = _this.application;
385+
const lang = vm.language;
386+
const app = vm.application;
392387
if (lang === 'python' || (app === 'spark' && ['java', 'hql'].indexOf(lang) !== -1) || app === 'hive') {
393388
// 高危语法的高亮
394-
highRiskList = _this.setHighRiskGrammar();
395-
const decora = _this.decorations || [];
389+
highRiskList = vm.setHighRiskGrammar();
390+
const decora = vm.decorations || [];
396391
let isParseSuccess = true;
397392
if (lang === 'hql') {
398-
const val = value || _this.value;
399-
const validParser = _this.isParserClose ? null : parser.parseSyntax(val, 'hive');
393+
const val = value || vm.value;
394+
const validParser = vm.isParserClose ? null : parser.parseSyntax(val, 'hive');
400395
let newDecora = [];
401396
if (validParser) {
402397
isParseSuccess = false;
@@ -426,21 +421,12 @@ export default {
426421
},
427422
},
428423
}];
429-
// 跳到指定行
430-
const line = validParser.loc.first_line;
431-
if (_this.parseErrorLine !== line) {
432-
_this.parseErrorLine = line;
433-
_this.editor.revealPositionInCenter({
434-
lineNumber: line,
435-
column: validParser.loc.first_column,
436-
});
437-
}
438424
}
439425
// 第一个参数是旧的,用于清空decorations
440-
_this.decorations = _this.editor.deltaDecorations(decora, newDecora.concat(highRiskList));
441-
_this.$emit('is-parse-success', isParseSuccess);
426+
vm.decorations = vm.editor.deltaDecorations(decora, newDecora.concat(highRiskList));
427+
vm.$emit('is-parse-success', isParseSuccess);
442428
} else {
443-
_this.decorations = _this.editor.deltaDecorations(decora, highRiskList);
429+
vm.decorations = vm.editor.deltaDecorations(decora, highRiskList);
444430
}
445431
if (cb) {
446432
cb(isParseSuccess);
@@ -497,4 +483,4 @@ export default {
497483
},
498484
};
499485
</script>
500-
<style lang="scss" src="./index.scss"></style>
486+
<style lang="scss" src="./index.scss"></style>

0 commit comments

Comments
 (0)