Skip to content

Commit

Permalink
Merge pull request #25 from xtt55/0.7.0
Browse files Browse the repository at this point in the history
Closes #20, closes #24; update version to 0.7.0
  • Loading branch information
wushengyeyouya authored Sep 17, 2019
2 parents f5507fd + dfd3d34 commit efbc745
Show file tree
Hide file tree
Showing 14 changed files with 2,086 additions and 2,020 deletions.
2 changes: 1 addition & 1 deletion docs/en_US/ch1/Front-end_deployment_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Scriptis is a data analysis tool based on Linkis. Before deploying Scriptis, you

1. Select the corresponding installation package to download.

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

## 2 Deploy

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/ch1/前台部署文档.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Scriptis是基于Linkis开发的数据分析工具,部署Scriptis前需要先
## 1、准备工作

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

## 2、部署
    分为两种部署方式,自动化部署和手动部署
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scriptis",
"version": "0.6.0",
"version": "0.7.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down Expand Up @@ -40,6 +40,7 @@
"eslint-config-google": "^0.13.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "^5.0.0",
"filemanager-webpack-plugin": "^2.0.5",
"monaco-editor-webpack-plugin": "^1.7.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.1.0",
Expand Down
68 changes: 27 additions & 41 deletions src/js/component/editor/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import _ from 'lodash';
import { parser } from 'dt-sql-parser';
import storage from '@/js/helper/storage';
import highRiskGrammar from './highRiskGrammar';
const types = {
code: {
theme: 'defaultView',
Expand Down Expand Up @@ -51,8 +50,9 @@ export default {
editor: null,
editorModel: null,
decorations: null,
parseErrorLine: 0,
isParserClose: false,
closeParser: null,
openParser: null,
};
},
computed: {
Expand Down Expand Up @@ -86,8 +86,10 @@ export default {
'value': function(newValue, oldValue) {
if (this.editor) {
this.$emit('on-operator');
this.sqlParser(newValue);
if (newValue == this.getValue()) {
if (!this.isParserClose) {
this.sqlParser(newValue);
}
if (newValue == this.getValue() ) {
return;
}
let readOnly = this.editor.getConfiguration().readOnly;
Expand Down Expand Up @@ -126,8 +128,9 @@ export default {
this.editor = monaco.editor.create(this.$el, this.currentConfig);
this.monaco = monaco;
this.editorModel = this.editor.getModel();
this.isParserClose = !!storage.get('isParserClose', 'local');
if (this.type !== 'log') {
if (this.scriptType !== 'hdfsScript' && !this.readOnly) {
if (this.scriptType !== 'hdfsScript' && !this.readOnly ) {
this.addCommands();
this.addActions();
}
Expand Down Expand Up @@ -168,7 +171,6 @@ export default {
folded sections
for a certain model when it is connected to an editor instance.
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.
There are very many things that influence how rendering occurs:
the current theme
the current wrapping settings set on the editor
Expand Down Expand Up @@ -253,7 +255,6 @@ export default {
if (window.monaco) {
const monaco = window.monaco;
const vm = this;
this.editor.addAction({
id: 'editor.action.execute',
label: '运行脚本',
Expand All @@ -265,7 +266,6 @@ export default {
vm.$emit('on-run');
},
});
this.editor.addAction({
id: 'format',
label: '格式化',
Expand All @@ -277,7 +277,6 @@ export default {
editor.trigger('anyString', 'editor.action.formatDocument');
},
});
this.editor.addAction({
id: 'find',
label: '查找',
Expand All @@ -289,7 +288,6 @@ export default {
editor.trigger('find', 'actions.find');
},
});
this.editor.addAction({
id: 'replace',
label: '替换',
Expand All @@ -301,7 +299,6 @@ export default {
editor.trigger('findReplace', 'editor.action.startFindReplaceAction');
},
});
this.editor.addAction({
id: 'commentLine',
label: '行注释',
Expand All @@ -313,7 +310,6 @@ export default {
editor.trigger('commentLine', 'editor.action.commentLine');
},
});
this.editor.addAction({
id: 'paste',
label: '粘贴',
Expand All @@ -331,7 +327,6 @@ export default {
return null;
},
});
this.editor.addAction({
id: 'gotoLine',
label: '跳到指定行',
Expand All @@ -343,11 +338,10 @@ export default {
editor.trigger('gotoLine', 'editor.action.gotoLine');
},
});
if (this.language === 'hql') {
// 控制语法检查
const closeParser = this.editor.createContextKey('closeParser', true);
const openParser = this.editor.createContextKey('openParser', false);
this.closeParser = this.editor.createContextKey('closeParser', !this.isParserClose);
this.openParser = this.editor.createContextKey('openParser', this.isParserClose);
this.editor.addAction({
id: 'closeParser',
label: '关闭语法检查',
Expand All @@ -358,14 +352,14 @@ export default {
contextMenuGroupId: 'control',
contextMenuOrder: 2.0,
run(editor) {
storage.set('isParserClose', true, 'local');
vm.isParserClose = true;
// 控制右键菜单的显示
openParser.set(true);
closeParser.set(false);
vm.openParser.set(true);
vm.closeParser.set(false);
vm.sqlParser();
},
});
this.editor.addAction({
id: 'openParser',
label: '打开语法检查',
Expand All @@ -375,28 +369,29 @@ export default {
contextMenuGroupId: 'control',
contextMenuOrder: 2.1,
run(editor) {
storage.set('isParserClose', false, 'local');
vm.isParserClose = false;
openParser.set(false);
closeParser.set(true);
vm.openParser.set(false);
vm.closeParser.set(true);
vm.sqlParser();
},
});
}
}
},
sqlParser: _.debounce(function(value, cb) {
const _this = this;
const vm = this;
let highRiskList = [];
const lang = _this.language;
const app = _this.application;
const lang = vm.language;
const app = vm.application;
if (lang === 'python' || (app === 'spark' && ['java', 'hql'].indexOf(lang) !== -1) || app === 'hive') {
// 高危语法的高亮
highRiskList = _this.setHighRiskGrammar();
const decora = _this.decorations || [];
highRiskList = vm.setHighRiskGrammar();
const decora = vm.decorations || [];
let isParseSuccess = true;
if (lang === 'hql') {
const val = value || _this.value;
const validParser = _this.isParserClose ? null : parser.parseSyntax(val, 'hive');
const val = value || vm.value;
const validParser = vm.isParserClose ? null : parser.parseSyntax(val, 'hive');
let newDecora = [];
if (validParser) {
isParseSuccess = false;
Expand Down Expand Up @@ -426,21 +421,12 @@ export default {
},
},
}];
// 跳到指定行
const line = validParser.loc.first_line;
if (_this.parseErrorLine !== line) {
_this.parseErrorLine = line;
_this.editor.revealPositionInCenter({
lineNumber: line,
column: validParser.loc.first_column,
});
}
}
// 第一个参数是旧的,用于清空decorations
_this.decorations = _this.editor.deltaDecorations(decora, newDecora.concat(highRiskList));
_this.$emit('is-parse-success', isParseSuccess);
vm.decorations = vm.editor.deltaDecorations(decora, newDecora.concat(highRiskList));
vm.$emit('is-parse-success', isParseSuccess);
} else {
_this.decorations = _this.editor.deltaDecorations(decora, highRiskList);
vm.decorations = vm.editor.deltaDecorations(decora, highRiskList);
}
if (cb) {
cb(isParseSuccess);
Expand Down Expand Up @@ -497,4 +483,4 @@ export default {
},
};
</script>
<style lang="scss" src="./index.scss"></style>
<style lang="scss" src="./index.scss"></style>
Loading

0 comments on commit efbc745

Please sign in to comment.