Skip to content
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: 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>
42 changes: 16 additions & 26 deletions src/js/component/table/body.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div>
<div
class="list-view-phantom"
class="list-view-phantom"
:style="{
width: contentWidth + 'px'
}">
}">
</div>
<div
ref="content"
Expand All @@ -16,8 +16,8 @@
}"
v-for="(col, index) in visibleData"
:key="index">
<slot
:col="col"
<slot
:col="col"
:index="index"></slot>
</div>
</div>
Expand All @@ -40,17 +40,14 @@ export default {
type: Array,
required: true,
},

estimatedItemSize: {
type: Number,
default: 30,
},

itemSizeGetter: {
type: Function,
},
},

data() {
return {
viewWidth: 0,
Expand Down Expand Up @@ -83,7 +80,7 @@ export default {
},
computed: {
contentWidth() {
const { data, lastMeasuredIndex, estimatedItemSize } = this;
const {data, lastMeasuredIndex, estimatedItemSize} = this;
let itemCount = data.length;
if (lastMeasuredIndex >= 0) {
const lastMeasuredSizeAndOffset = this.getLastMeasuredSizeAndOffset();
Expand All @@ -96,19 +93,19 @@ export default {
watch: {
data: {
handler() {
let { v, h } = this.cacheVH;
let {v, h} = this.cacheVH;
this.handleScroll(v, h);
},
deep: true,
},
},
},
mounted() {
this.updateVisibleData();
this.viewWidth = this.$refs.content.clientWidth;
},
methods: {
getItemSizeAndOffset(index) {
const { lastMeasuredIndex, sizeAndOffsetCahce, data, itemSizeGetter } = this;
const {lastMeasuredIndex, sizeAndOffsetCahce, data, itemSizeGetter} = this;
if (lastMeasuredIndex >= index) {
return sizeAndOffsetCahce[index];
}
Expand Down Expand Up @@ -139,25 +136,21 @@ export default {
}
return sizeAndOffsetCahce[index];
},

getLastMeasuredSizeAndOffset() {
return this.lastMeasuredIndex >= 0 ? this.sizeAndOffsetCahce[this.lastMeasuredIndex] : { offset: 0, size: 0 };
return this.lastMeasuredIndex >= 0 ? this.sizeAndOffsetCahce[this.lastMeasuredIndex] : {offset: 0, size: 0};
},

findNearestItemIndex(scrollLeft) {
const { data } = this;
const {data} = this;
let total = 0;
for (let i = 0, j = data.length; i < j; i++) {
const size = this.getItemSizeAndOffset(i).size;
total += size;
if (total >= scrollLeft || i === j - 1) {
if (total >= scrollLeft || i === j -1) {
return i;
}
}

return 0;
},

updateVisibleData(scrollLeft) {
let canScrollWidth = this.contentWidth - this.viewWidth;
scrollLeft = scrollLeft || 0;
Expand All @@ -168,13 +161,12 @@ export default {
const end = this.findNearestItemIndex(scrollLeft + (this.$el.clientWidth || 1400));
this.visibleData = this.data.slice(start, Math.min(end + 3, this.data.length));
this.startIndex = start;
this.$refs.content.style.webkitTransform = `translate3d(${this.getItemSizeAndOffset(start).offset}px, 0, 0)`;
this.$refs.content.style.webkitTransform = `translate3d(${ this.getItemSizeAndOffset(start).offset }px, 0, 0)`;
},

handleScroll(v, h) {
const { scrollLeft } = h;
this.cacheVH = { v, h };
this.$emit('on-scroll', { v, h });
const {scrollLeft} = h;
this.cacheVH = {v, h};
this.$emit('on-scroll', {v, h});
this.updateVisibleData(scrollLeft);
},
},
Expand All @@ -189,7 +181,6 @@ right: 0;
z-index: -1;
height: 100%;
}

.list-view-content {
display: flex;
left: 0;
Expand All @@ -198,12 +189,11 @@ top: 0;
position: absolute;
height: 100%;
}

.list-view-item {
height: 100%;
color: #666;
box-sizing: border-box;
flex-shrink: 0;
text-align: center;
}
</style>
</style>
Loading