diff --git a/README.md b/README.md index 68bf7ec..a43baeb 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ Scriptis English | [Chinese](docs/zh_CN/README.md) +### !This project has been merged into [DataSphereStudio](https://github.com/WeBankFinTech/DataSphereStudio) ## Introduction - Scriptis is for interactive data analysis with script development(SQL, Pyspark, HiveQL), task submission(Spark, Hive), UDF, function, resource management and intelligent diagnosis. -![运行时功能](docs/zh_CN/images/readme/running.gif) +![running](docs/en_US/images/readme/running.gif) ## Features @@ -30,11 +30,22 @@ Scriptis is for interactive data analysis with script development(SQL, Pyspark, ## QuickStart -Read the Quick Start [Quick Start](/docs/en_US/ch3/Scriptis_Quick_Start.md) +Read the Quick Start [Quick Start](docs/en_US/ch1/Front-end_deployment_documentation.md) ## Comparison with similar scheduler systems + ![Comparison](/docs/en_US/images/readme/Comparison.png) +## Documentations + +[Quick Start](docs/en_US/ch1/Front-end_deployment_documentation.md) + +[Quick Use](docs/en_US/ch3/Scriptis_Quick_Start.md) + +[User Manual](docs/en_US/ch4/Scriptis_Manual.md) + +[Compilation](docs/en_US/ch2/Compilation.md) + ## Community If you desire immediate response, please kindly raise issues to us or scan the below QR code by WeChat and QQ to join our group: diff --git a/docs/en_US/ch1/Front-end_deployment_documentation.md b/docs/en_US/ch1/Front-end_deployment_documentation.md index c754809..5fa0ac6 100644 --- a/docs/en_US/ch1/Front-end_deployment_documentation.md +++ b/docs/en_US/ch1/Front-end_deployment_documentation.md @@ -4,15 +4,15 @@ 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.5.0-dist.zip. +2. Unzip the downloaded installation package in the installation directory: unzip wedatasphere-scriptis-0.7.0-dist.zip. ## 2 Deploy -​ There are two deployment methods, automated and manual deployment. +​ There are two deployment methods, automated and manual deployment. ### 2.1 Automated deployment -Go to the frontend directory ```wedatasphere-scriptis``` and edit ```vi config.sh ``` to change the interface address of the frontend and backend port. backend port interface address is the gateway address of linkis. +Go to the frontend directory ```wedatasphere-scriptis``` and edit ```vi config.sh ``` to change the interface address of the frontend and backend port. backend port interface address is the gateway address of linkis. ### (3) Modify and save the configuration file created above @@ -29,7 +29,7 @@ scriptis_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/( After the modification, run the following command in the directory: ```sudo sh install.sh > install.log 2>&1``` -Next, you can access ```http://scriptis_ipaddr:scriptis_port``` directly via Chrome, scriptis_port is the port configured in config.sh and scriptis_ipaddr is the IP of the machine that used for installation. +Next, you can access ```http://scriptis_ipaddr:scriptis_port``` directly via Chrome, scriptis_port is the port configured in config.sh and scriptis_ipaddr is the IP of the machine that used for installation. If encounter access failure, please check install.log and find out the errors. @@ -48,11 +48,11 @@ server { #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { - root /appcom/Install/scriptis/ROOT; # directory where package decompressed + root /appcom/Install/scriptis/ROOT; # directory where package decompressed #in the fronted index index.html index.html; } - location /ws {#webSocket configure spport + location /ws {#webSocket configure spport proxy_pass http://192.168.xxx.xxx:9001;#IP port of the linkis gateway service proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -84,11 +84,11 @@ server { 3. Copy the frontend package to the corresponding directory: ```/appcom/Install/scriptis/ROOT; # directory where package decompressed in the frontend``` 4. Start service: ```sudo systemctl restart nginx``` -5. You can directly access ```http://nginx_ip:nginx_port``` via Chrome after execution. +5. You can directly access ```http://nginx_ip:nginx_port``` via Chrome after execution. ## 3 FAQs -(1) limitations on the size of files that being uploaded +(1) limitations on the size of files that being uploaded ``` sudo vi /etc/nginx/nginx.conf diff --git a/docs/en_US/ch2/Compilation.md b/docs/en_US/ch2/Compilation.md new file mode 100644 index 0000000..1049426 --- /dev/null +++ b/docs/en_US/ch2/Compilation.md @@ -0,0 +1,102 @@ +# Compilation + +## Getting Started + +### Prerequisites + +Install Node.js on your computer. Download Link: [http://nodejs.cn/download/](http://nodejs.cn/download/). Recommend using the latest stable version. + +**Only do this step at the first time.** + +### Installation + +Run the following commands in terminal: + +``` +git clone https://github.com/WeBankFinTech/Scriptis.git +cd wds-ide +npm install +``` + + Commands explanation: + +1. Pull remote repository to local: `git clone https://github.com/WeBankFinTech/Scriptis.git` + +2. Change to the root directory of the project: `cd wds-ide` + +3. Install all dependencies required for the project: `npm install` + +**Only do this step at the first time.** + +### Configuration + +You need to make some configurations in your code, such as port address of backend server and socket address of backend server in .env.development file in root directory. + +``` +// Port address of backend server +VUE_APP_MN_CONFIG_PREFIX=http://yourIp:yourPort/yourPath +// Socket address +VUE_APP_MN_CONFIG_SOCKET=/yourSocketPath +``` + +You can refer to the official documentation of vue-cli for detailed explanation. [Modes and environment variables](https://cli.vuejs.org/guide/mode-and-env.html#modes) + +### Building project + +You can run the following command in terminal to build the project: + +``` +npm run build +``` + +A folder named "dist" would appear in your project's root directory if the command has run successfully and you can directly put "dist" to your static server. + +### How to run + +You would need to run the following command in terminal if you want to run project on your local browser and see corresponding effects after making changes to the code. + +``` +npm run serve +``` + +Access the application in browser (Chrome recommended) via link: [http://localhost:8080/](http://localhost:8080/) . + +Changes you make to the code would dynamically reflect on the +effects shown on browser when using the method described above to run project. + +**Notes: Since frontend and backend are developed separately, when running on local browser you need to allow cross domain access in order to access the port of backend server.** + +e.g. Chrome browser: + +Configuration in Windows: + +1. Close all browser windows. + +2. Create a shortcut of chrome, right-click to choose "properties" , then go to "Shortcut" tab find "Target" and add`--args --disable-web-security --user-data-dir=C:\MyChromeDevUserData` to it . +3. Use shortcut to open the browser. + +Configuration in MacOS: + +Run the following command. (You need to replace "yourname" in the path. If it's not working, check the path of MyChromeDevUserData on your machine and copy its path to the place right after "--user-data-dir=") + +``` +open -n /Applications/Google\ Chrome.app/ --args --disable-web-security --user-data-dir=/Users/yourname/MyChromeDevUserData/ +``` + +### FAQ + +#### Failed installation when running npm install + +Try to use Taobao npm mirror: + +``` +npm install -g cnpm --registry=https://registry.npmmirror.com +``` + +Next, run the following command instead of npm install: + +``` +cnpm install +``` + +Note that you can still use `npm run serve` and `npm run build` to run and build project. \ No newline at end of file diff --git a/docs/en_US/images/readme/Comparison.png b/docs/en_US/images/readme/Comparison.png index f1f6841..df3144c 100644 Binary files a/docs/en_US/images/readme/Comparison.png and b/docs/en_US/images/readme/Comparison.png differ diff --git a/docs/en_US/images/readme/cs.gif b/docs/en_US/images/readme/cs.gif index 7d3125e..d735e1b 100644 Binary files a/docs/en_US/images/readme/cs.gif and b/docs/en_US/images/readme/cs.gif differ diff --git a/docs/en_US/images/readme/datasource.gif b/docs/en_US/images/readme/datasource.gif index d592c7c..555a208 100644 Binary files a/docs/en_US/images/readme/datasource.gif and b/docs/en_US/images/readme/datasource.gif differ diff --git a/docs/en_US/images/readme/results.gif b/docs/en_US/images/readme/results.gif index 7bde948..cfef7ce 100644 Binary files a/docs/en_US/images/readme/results.gif and b/docs/en_US/images/readme/results.gif differ diff --git a/docs/en_US/images/readme/running.gif b/docs/en_US/images/readme/running.gif index eb868d1..9d310bc 100644 Binary files a/docs/en_US/images/readme/running.gif and b/docs/en_US/images/readme/running.gif differ diff --git a/docs/en_US/images/readme/script.gif b/docs/en_US/images/readme/script.gif index 13ba262..39b729d 100644 Binary files a/docs/en_US/images/readme/script.gif and b/docs/en_US/images/readme/script.gif differ diff --git a/docs/en_US/images/readme/setup.gif b/docs/en_US/images/readme/setup.gif index 4aee4c0..7515448 100644 Binary files a/docs/en_US/images/readme/setup.gif and b/docs/en_US/images/readme/setup.gif differ diff --git a/docs/zh_CN/README.md b/docs/zh_CN/README.md index 5567745..18c6849 100644 --- a/docs/zh_CN/README.md +++ b/docs/zh_CN/README.md @@ -5,6 +5,7 @@ Scriptis [English](../../README.md) | Chinese +### !项目已被并入 [DataSphereStudio](https://github.com/WeBankFinTech/DataSphereStudio) ## 引言: Scriptis是一款支持在线写SQL、Pyspark、HiveQL等脚本,提交给**Linkis**(Linkis是什么?[点我了解](https://github.com/WeBankFinTech/Linkis/blob/master/docs/zh_CN/README.md))执行的数据分析Web工具,且支持UDF、函数、资源管控和智能诊断等企业级特性。 diff --git "a/docs/zh_CN/ch1/\345\211\215\345\217\260\351\203\250\347\275\262\346\226\207\346\241\243.md" "b/docs/zh_CN/ch1/\345\211\215\345\217\260\351\203\250\347\275\262\346\226\207\346\241\243.md" index c299352..cd5a68d 100644 --- "a/docs/zh_CN/ch1/\345\211\215\345\217\260\351\203\250\347\275\262\346\226\207\346\241\243.md" +++ "b/docs/zh_CN/ch1/\345\211\215\345\217\260\351\203\250\347\275\262\346\226\207\346\241\243.md" @@ -3,7 +3,7 @@ Scriptis是基于Linkis开发的数据分析工具,部署Scriptis前需要先 ## 1、准备工作 1. 点击release 选择对应的安装包进行下载 -2. 将下载下来的安装包在安装目录进行解压:unzip wedatasphere-scriptis-0.5.0-dist.zip +2. 将下载下来的安装包在安装目录进行解压:unzip wedatasphere-scriptis-0.7.0-dist.zip ## 2、部署     分为两种部署方式,自动化部署和手动部署 @@ -31,7 +31,7 @@ scriptis_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/( ### 2.2 手动部署 1.安装Nginx:```sudo yum install nginx -y``` -2.修改配置文件:sudo vi /etc/nginx/conf.d/scriptis.conf +2.修改配置文件:sudo vi /etc/nginx/conf.d/scriptis.conf 添加如下内容: ``` server { diff --git a/docs/zh_CN/images/readme/cs.gif b/docs/zh_CN/images/readme/cs.gif index 7d3125e..4df76a1 100644 Binary files a/docs/zh_CN/images/readme/cs.gif and b/docs/zh_CN/images/readme/cs.gif differ diff --git a/docs/zh_CN/images/readme/datasource.gif b/docs/zh_CN/images/readme/datasource.gif index d592c7c..eedea96 100644 Binary files a/docs/zh_CN/images/readme/datasource.gif and b/docs/zh_CN/images/readme/datasource.gif differ diff --git a/docs/zh_CN/images/readme/results.gif b/docs/zh_CN/images/readme/results.gif index 7bde948..c95943c 100644 Binary files a/docs/zh_CN/images/readme/results.gif and b/docs/zh_CN/images/readme/results.gif differ diff --git a/docs/zh_CN/images/readme/running.gif b/docs/zh_CN/images/readme/running.gif index eb868d1..81ff072 100644 Binary files a/docs/zh_CN/images/readme/running.gif and b/docs/zh_CN/images/readme/running.gif differ diff --git a/docs/zh_CN/images/readme/script.gif b/docs/zh_CN/images/readme/script.gif index 13ba262..a503694 100644 Binary files a/docs/zh_CN/images/readme/script.gif and b/docs/zh_CN/images/readme/script.gif differ diff --git a/docs/zh_CN/images/readme/setup.gif b/docs/zh_CN/images/readme/setup.gif index 4aee4c0..dabb635 100644 Binary files a/docs/zh_CN/images/readme/setup.gif and b/docs/zh_CN/images/readme/setup.gif differ diff --git a/package.json b/package.json index 1353103..050820e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scriptis", - "version": "0.5.0", + "version": "0.7.2", "private": true, "scripts": { "serve": "vue-cli-service serve", @@ -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", diff --git a/src/js/component/editor/editor.vue b/src/js/component/editor/editor.vue index ac71ba4..6f44e38 100644 --- a/src/js/component/editor/editor.vue +++ b/src/js/component/editor/editor.vue @@ -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', @@ -51,8 +50,9 @@ export default { editor: null, editorModel: null, decorations: null, - parseErrorLine: 0, isParserClose: false, + closeParser: null, + openParser: null, }; }, computed: { @@ -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; @@ -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(); } @@ -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 @@ -253,7 +255,6 @@ export default { if (window.monaco) { const monaco = window.monaco; const vm = this; - this.editor.addAction({ id: 'editor.action.execute', label: '运行脚本', @@ -265,7 +266,6 @@ export default { vm.$emit('on-run'); }, }); - this.editor.addAction({ id: 'format', label: '格式化', @@ -277,7 +277,6 @@ export default { editor.trigger('anyString', 'editor.action.formatDocument'); }, }); - this.editor.addAction({ id: 'find', label: '查找', @@ -289,7 +288,6 @@ export default { editor.trigger('find', 'actions.find'); }, }); - this.editor.addAction({ id: 'replace', label: '替换', @@ -301,7 +299,6 @@ export default { editor.trigger('findReplace', 'editor.action.startFindReplaceAction'); }, }); - this.editor.addAction({ id: 'commentLine', label: '行注释', @@ -313,7 +310,6 @@ export default { editor.trigger('commentLine', 'editor.action.commentLine'); }, }); - this.editor.addAction({ id: 'paste', label: '粘贴', @@ -331,7 +327,6 @@ export default { return null; }, }); - this.editor.addAction({ id: 'gotoLine', label: '跳到指定行', @@ -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: '关闭语法检查', @@ -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: '打开语法检查', @@ -375,9 +369,10 @@ 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(); }, }); @@ -385,18 +380,18 @@ export default { } }, 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; @@ -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); @@ -497,4 +483,4 @@ export default { }, }; - + \ No newline at end of file diff --git a/src/js/component/table/body.vue b/src/js/component/table/body.vue index 5e18472..a96ecef 100644 --- a/src/js/component/table/body.vue +++ b/src/js/component/table/body.vue @@ -1,10 +1,10 @@ diff --git a/src/js/module/fnSidebar/fnSidebar.vue b/src/js/module/fnSidebar/fnSidebar.vue index 14a7b9b..a1aea68 100644 --- a/src/js/module/fnSidebar/fnSidebar.vue +++ b/src/js/module/fnSidebar/fnSidebar.vue @@ -180,7 +180,7 @@ export default { created() { this.initTreeData(); this.$nextTick(() => { - api.fetch('/publicservice/authenticate').then((rst) => { + api.fetch('/udf/authenticate').then((rst) => { this.isUdfManager = rst.isUDFManager; }); }); @@ -191,7 +191,7 @@ export default { const fnTree = storage.get(tmp, 'SESSION'); if (!fnTree || _.isEmpty(fnTree)) { this.treeLoading = true; - api.fetch('/publicservice/list', { + api.fetch('/udf/list', { type: 'self', treeId: -1, category: this.FNTYPE, @@ -222,7 +222,7 @@ export default { benchCheck(...args) { if (this.loading) return this.$Message.warning('请等待接口返回!'); const node = args[0].node.data; - const url = `/publicservice/isload`; + const url = `/udf/isload`; this.loading = true; api.fetch(url, { udfId: node.id, @@ -252,7 +252,7 @@ export default { let params = null; let url = null; if (!data.isLeaf) { - url = '/publicservice/tree/add'; + url = '/udf/tree/add'; params = { parent: this.currentNode.data.id, name: data.name, @@ -261,7 +261,7 @@ export default { }; this.calling(url, params, 'new', data.isLeaf); } else { - url = '/publicservice/add'; + url = '/udf/add'; params = { isShared: data.shared, udfInfo: { @@ -293,7 +293,7 @@ export default { let params = null; let url = null; if (!data.isLeaf) { - url = '/publicservice/tree/update'; + url = '/udf/tree/update'; params = { id: this.currentNode.data.id, parent: this.currentNode.parent.data.id, @@ -302,7 +302,7 @@ export default { category: this.FNTYPE, }; } else { - url = '/publicservice/update'; + url = '/udf/update'; params = { isShared: data.shared, udfInfo: { @@ -413,12 +413,12 @@ export default { let url; let param; if (this.currentNode.isLeaf) { - url = `/publicservice/delete/${this.currentNode.data.id}`; + url = `/udf/delete/${this.currentNode.data.id}`; param = { isShared: this.currentNode.data.shared, }; } else { - url = `/publicservice/tree/delete/${this.currentNode.data.id}`; + url = `/udf/tree/delete/${this.currentNode.data.id}`; param = {}; } api.fetch(url, param, 'get').then((rst) => { @@ -436,7 +436,7 @@ export default { if (this.treeLoading) return this.$Message.warning('请等待接口返回!'); this.treeLoading = true; const node = this.fnTree.find((item) => item.type === 'share'); - api.fetch('/publicservice/list', { + api.fetch('/udf/list', { type: node.type, treeId: node.id, category: this.FNTYPE, @@ -447,7 +447,7 @@ export default { const params = { udfName: this.currentNode.data.name, }; - api.fetch('/publicservice/getSharedUsers', params).then((rst) => { + api.fetch('/udf/getSharedUsers', params).then((rst) => { this.$refs.share.open({ tree: list, node: this.currentNode, isView: !flag, shareUser: rst.shareUsers.toString() }); }); } @@ -481,7 +481,7 @@ export default { useFormat: node.useFormat, }, }; - api.fetch('/publicservice/shareUDF', params).then(() => { + api.fetch('/udf/shareUDF', params).then(() => { this.loading = false; this.$Message.success(`函数${this.currentNode.data.name}已共享成功!`); this.refresh('edit'); @@ -495,7 +495,7 @@ export default { udfName: this.currentNode.data.name, sharedUsers: option.sharedUsers, }; - api.fetch('/publicservice/updateSharedUsers', params).then(() => { + api.fetch('/udf/updateSharedUsers', params).then(() => { this.loading = false; this.$Message.success(`修改共享用户成功!`); }).catch((err) => { @@ -511,7 +511,7 @@ export default { udfId: this.currentNode.data.id, udfName: this.currentNode.data.name, }; - api.fetch('/publicservice/setExpire', params).then((rst) => { + api.fetch('/udf/setExpire', params).then((rst) => { this.currentNode.data.shared = false; this.$Message.success('函数已设置为过期,请到共享函数中查看!'); }); @@ -564,7 +564,7 @@ export default { // 请求文件夹数据 loadDataFn(node, cb) { this.treeLoading = true; - api.fetch('/publicservice/list', { + api.fetch('/udf/list', { type: node.data.type, treeId: node.data.id, category: this.FNTYPE, @@ -624,7 +624,7 @@ export default { const parent = this.lookForChangeNode(id, this.fnTree, 'tree'); if (parent) { this.treeLoading = true; - api.fetch('/publicservice/list', { + api.fetch('/udf/list', { type: parent.type, treeId: parent.id, category: this.FNTYPE, diff --git a/src/js/module/fnSidebar/index.js b/src/js/module/fnSidebar/index.js index 3c92a36..51db65f 100644 --- a/src/js/module/fnSidebar/index.js +++ b/src/js/module/fnSidebar/index.js @@ -6,7 +6,7 @@ export default { data: {}, methods: { getAllLoadedFunction(cb) { - api.fetch(`/publicservice/all`).then((rst) => { + api.fetch(`/udf/all`).then((rst) => { cb({ list: rst.udfTree.udfInfos, isError: false, diff --git a/src/js/module/footer/index.vue b/src/js/module/footer/index.vue index 7da3cee..fe26068 100644 --- a/src/js/module/footer/index.vue +++ b/src/js/module/footer/index.vue @@ -38,7 +38,7 @@ export default { }, methods: { getRunningJob() { - api.fetch('/publicservice/list', { + api.fetch('/jobhistory/list', { pageSize: 100, status: 'Running,Inited,Scheduled', }, 'get').then((rst) => { diff --git a/src/js/module/globalHistory/index.vue b/src/js/module/globalHistory/index.vue index 04e5ac2..c96f87e 100644 --- a/src/js/module/globalHistory/index.vue +++ b/src/js/module/globalHistory/index.vue @@ -27,7 +27,7 @@ v-model="searchBar.proxyUser" placeholder="请输入用户名搜索" style="width:120px;" - :readonly="isLogModuleShow"> + :readonly="isLogModuleShow" /> s.rule.test(params.row.fileName)); const ext = match ? match.ext : '.hql'; if (!params.row.logPath) { - await api.fetch(`/query/${params.row.taskID}/get`, 'get').then((rst) => { + await api.fetch(`/jobhistory/${params.row.taskID}/get`, 'get').then((rst) => { params.row.logPath = rst.task.logPath; }); } const name = `history_item_${params.row.taskID}${ext}`; const md5Id = util.md5(name); - this.$router.push({path: '/', query: { - id: md5Id, - taskID: params.row.taskID, - filename: name, - filepath: '', - saveAs: true, - type: 'historyScript', - code: params.row.executionCode, - }}); + this.$router.push({ path: '/', + query: { + id: md5Id, + taskID: params.row.taskID, + filename: name, + filepath: '', + saveAs: true, + type: 'historyScript', + code: params.row.executionCode, + } }); } }, getLogs(jobId) { - api.fetch(`/query/${jobId}/get`, 'get').then((res) => { + api.fetch(`/jobhistory/${jobId}/get`, 'get').then((res) => { this.searchBar.lastId = Number(this.searchBar.id); this.searchBar.id = jobId; this.searchBar.lastProxyUser = this.searchBar.proxyUser; @@ -402,7 +402,7 @@ export default { const errCode = res.task.errCode ? '\n错误码:' + res.task.errCode : ''; const errDesc = res.task.errDesc ? '\n错误描述:' + res.task.errDesc : ''; const info = '未获取到日志!' + errCode + errDesc; - this.logs = {all: info, error: '', warning: '', info: ''}; + this.logs = { all: info, error: '', warning: '', info: '' }; this.fromLine = 1; return; } @@ -412,7 +412,7 @@ export default { }, 'get').then((rst) => { this.isLoading = false; if (rst) { - const log = {all: '', error: '', warning: '', info: ''}; + const log = { all: '', error: '', warning: '', info: '' }; const convertLogs = util.convertLog(rst.log); Object.keys(convertLogs).forEach((key) => { if (convertLogs[key]) { @@ -471,7 +471,7 @@ export default { changePage(page) { this.isLoading = true; const params = this.getParams(page); - api.fetch('/publicservice/list', params, 'get').then((rst) => { + api.fetch('/jobhistory/list', params, 'get').then((rst) => { this.isLoading = false; this.list = rst.tasks; this.pageSetting.current = page; @@ -484,7 +484,7 @@ export default { search() { this.isLoading = true; const params = this.getParams(); - api.fetch('/publicservice/list', params, 'get').then((rst) => { + api.fetch('/jobhistory/list', params, 'get').then((rst) => { this.pageSetting.total = rst.totalPage; this.isLoading = false; this.list = rst.tasks; diff --git a/src/js/module/globalHistory/log.vue b/src/js/module/globalHistory/log.vue index bf83be6..239cc4c 100644 --- a/src/js/module/globalHistory/log.vue +++ b/src/js/module/globalHistory/log.vue @@ -153,5 +153,5 @@ export default { }, }; - diff --git a/src/js/module/globalValiable/index.js b/src/js/module/globalValiable/index.js index 5493632..01aa6b6 100644 --- a/src/js/module/globalValiable/index.js +++ b/src/js/module/globalValiable/index.js @@ -7,7 +7,7 @@ export default { }, methods: { getGlobalVariable(cb) { - api.fetch('/publicservice/listGlobalVariable', 'get').then((res) => { + api.fetch('/variable/listGlobalVariable', 'get').then((res) => { cb({ list: res.globalVariables, isError: false, diff --git a/src/js/module/globalValiable/index.vue b/src/js/module/globalValiable/index.vue index 1f080ac..6502e0c 100644 --- a/src/js/module/globalValiable/index.vue +++ b/src/js/module/globalValiable/index.vue @@ -126,7 +126,7 @@ export default { }, methods: { getGlobalValiableList() { - api.fetch('/publicservice/listGlobalVariable', 'get').then((res) => { + api.fetch('/variable/listGlobalVariable', 'get').then((res) => { this.formDynamic.items = res.globalVariables.map((item, index) => { return Object.assign(item); }); @@ -157,7 +157,7 @@ export default { }, save() { this.loading = true; - api.fetch('/publicservice/saveGlobalVariable ', { + api.fetch('/variable/saveGlobalVariable ', { globalVariables: this.formDynamic.items, }).then((res) => { this.loading = false; diff --git a/src/js/module/hdfsSidebar/hdfsSidebar.vue b/src/js/module/hdfsSidebar/hdfsSidebar.vue index ca150ba..a40f554 100644 --- a/src/js/module/hdfsSidebar/hdfsSidebar.vue +++ b/src/js/module/hdfsSidebar/hdfsSidebar.vue @@ -235,7 +235,7 @@ export default { getRootPath(cb) { this.rootPath = storage.get('hdfsRootPath', 'SESSION'); if (!this.rootPath) { - api.fetch(`/publicservice/getUserRootPath`, { + api.fetch(`/filesystem/getUserRootPath`, { pathType: 'hdfs', }, 'get').then((rst) => { if (rst.userHDFSRootPath) { @@ -254,7 +254,7 @@ export default { } }, getTree(cb) { - api.fetch(`/publicservice/getDirFileTrees`, { + api.fetch(`/filesystem/getDirFileTrees`, { path: this.rootPath, }, 'get') .then((rst) => { @@ -354,7 +354,7 @@ export default { }); }, handleCreating(node, cb) { - api.fetch('/publicservice/createNewDir', { + api.fetch('/filesystem/createNewDir', { path: node.path, }).then(() => { cb(true); @@ -363,7 +363,7 @@ export default { }); }, rename(path, oldPath, cb) { - api.fetch('/publicservice/rename', { + api.fetch('/filesystem/rename', { oldDest: oldPath, newDest: path, }).then((rst) => { @@ -386,7 +386,7 @@ export default { cb(false); return this.$Message.error(`文件${path}已经存在`); } - api.fetch('/publicservice/rename', { + api.fetch('/filesystem/rename', { oldDest: args.node.path, newDest: path, }).then(() => { @@ -435,7 +435,7 @@ export default { const path = this.currentNode.data.path; this.loading = true; this.dispatch('Workbench:remove', path, () => { - api.fetch('/publicservice/deleteDirOrFile', { + api.fetch('/filesystem/deleteDirOrFile', { path, }).then((rst) => { this.$Message.success('删除成功'); @@ -481,7 +481,7 @@ export default { }, loadDataFn(node, cb) { this.treeLoading = true; - api.fetch(`/publicservice/getDirFileTrees`, { + api.fetch(`/filesystem/getDirFileTrees`, { path: node.data.path, }, 'get') .then((rst) => { @@ -529,7 +529,7 @@ export default { nodePath = path.slice(0, path.lastIndexOf('/')); } if (_.isEmpty(this.fileTree)) return this.initData(); - api.fetch(`/publicservice/getDirFileTrees`, { + api.fetch(`/filesystem/getDirFileTrees`, { path: nodePath, }, 'get') .then((rst) => { @@ -667,7 +667,7 @@ export default { escapeQuotes = true; quote = option.quote; } - const url = `/publicservice/formate?path=${option.exportPath}&encoding=${encoding}&fieldDelimiter=${fieldDelimiter}&hasHeader=${option.isHasHeader}&escapeQuotes=${escapeQuotes}"e=${quote}`; + const url = `/filesystem/formate?path=${option.exportPath}&encoding=${encoding}&fieldDelimiter=${fieldDelimiter}&hasHeader=${option.isHasHeader}&escapeQuotes=${escapeQuotes}"e=${quote}`; api.fetch(url, {}, { method: 'get', timeout: '600000', diff --git a/src/js/module/header/index.vue b/src/js/module/header/index.vue index 9bfe357..2ece011 100644 --- a/src/js/module/header/index.vue +++ b/src/js/module/header/index.vue @@ -73,7 +73,7 @@ export default { }, methods: { init() { - api.fetch('/publicservice/getBaseInfo', 'get').then((rst) => { + api.fetch('/application/getBaseInfo', 'get').then((rst) => { if (!_.isEmpty(rst)) { this.userName = rst.userInfo.basic.userName; storage.set('baseInfo', rst); diff --git a/src/js/module/logView/index.vue b/src/js/module/logView/index.vue index 310fe39..0bbc9a3 100755 --- a/src/js/module/logView/index.vue +++ b/src/js/module/logView/index.vue @@ -52,7 +52,7 @@ - diff --git a/src/js/module/resourceSimple/job.vue b/src/js/module/resourceSimple/job.vue index d2258fa..04dd7bd 100644 --- a/src/js/module/resourceSimple/job.vue +++ b/src/js/module/resourceSimple/job.vue @@ -96,7 +96,7 @@ export default { methods: { getJobList() { this.jobList = []; - api.fetch('/publicservice/list', { + api.fetch('/jobhistory/list', { pageSize: 100, status: 'Running,Inited,Scheduled', }, 'get').then((rst) => { diff --git a/src/js/module/setting/setting.vue b/src/js/module/setting/setting.vue index 587776c..ca37ccb 100644 --- a/src/js/module/setting/setting.vue +++ b/src/js/module/setting/setting.vue @@ -110,7 +110,7 @@ export default { creator = IDE; appName = type.slice(IDE.length + 1, type.length); } - api.fetch('/publicservice/getFullTreesByAppName', { + api.fetch('/configuration/getFullTreesByAppName', { appName, creator, }, 'get').then((rst) => { @@ -135,7 +135,7 @@ export default { }, save() { this.loading = true; - api.fetch('/publicservice/saveFullTree', { + api.fetch('/configuration/saveFullTree', { fullTree: this.fullTree, }).then((rst) => { this.getAppVariable(this.activeMenu); diff --git a/src/js/module/workSidebar/workSidebar.vue b/src/js/module/workSidebar/workSidebar.vue index 9f8db20..f421f6c 100644 --- a/src/js/module/workSidebar/workSidebar.vue +++ b/src/js/module/workSidebar/workSidebar.vue @@ -250,7 +250,7 @@ export default { getRootPath(cb) { this.rootPath = storage.get('shareRootPath', 'SESSION'); if (!this.rootPath) { - api.fetch(`/publicservice/getUserRootPath`, { + api.fetch(`/filesystem/getUserRootPath`, { pathType: 'file', }, 'get').then((rst) => { if (rst.userLocalRootPath) { @@ -269,7 +269,7 @@ export default { } }, getTree(cb) { - api.fetch(`/publicservice/getDirFileTrees`, { + api.fetch(`/filesystem/getDirFileTrees`, { path: this.rootPath, }, 'get') .then((rst) => { @@ -364,8 +364,8 @@ export default { }, handleCreating(node, cb) { const url = node.isLeaf - ? '/publicservice/createNewFile' - : '/publicservice/createNewDir'; + ? '/filesystem/createNewFile' + : '/filesystem/createNewDir'; api.fetch(url, { path: node.path, }).then(() => { @@ -375,7 +375,7 @@ export default { }); }, rename(path, oldPath, cb) { - api.fetch('/publicservice/rename', { + api.fetch('/filesystem/rename', { oldDest: oldPath, newDest: path, }).then((rst) => { @@ -398,7 +398,7 @@ export default { cb(false); return this.$Message.error(`文件${path}已经存在`); } - api.fetch('/publicservice/rename', { + api.fetch('/filesystem/rename', { oldDest: args.node.path, newDest: path, }).then(() => { @@ -450,7 +450,7 @@ export default { // 否则调用接口,文件在后台删除,前台保存会报错! if (flag === 'save' || flag === 'none') { this.loading = true; - api.fetch('/publicservice/deleteDirOrFile', { + api.fetch('/filesystem/deleteDirOrFile', { path, }).then((rst) => { this.loading = false; @@ -503,7 +503,7 @@ export default { loadDataFn(node, cb) { this.treeLoading = true; api.fetch( - `/publicservice/getDirFileTrees`, { + `/filesystem/getDirFileTrees`, { path: node.data.path, }, 'get' @@ -557,7 +557,7 @@ export default { } else if (type === 'new' && path) { nodePath = path.slice(0, path.lastIndexOf('/')); } - api.fetch(`/publicservice/getDirFileTrees`, { + api.fetch(`/filesystem/getDirFileTrees`, { path: nodePath, }, 'get').then((rst) => { this.treeLoading = false; @@ -707,7 +707,7 @@ export default { // 没有children数据,请求加载目录数据之后展开目录,已加载数据则直接展开 if (needLoadDirs.length > 0) { const loadDirPromises = needLoadDirs.map((path) => { - return api.fetch(`/publicservice/getDirFileTrees`, { + return api.fetch(`/filesystem/getDirFileTrees`, { path: path, }, 'get').then((res) => res.dirFileTrees); }); @@ -834,7 +834,7 @@ export default { escapeQuotes = true; quote = option.quote; } - const url = `/publicservice/formate?path=${option.exportPath}&encoding=${encoding}&fieldDelimiter=${fieldDelimiter}&hasHeader=${option.isHasHeader}&escapeQuotes=${escapeQuotes}"e=${quote}`; + const url = `/filesystem/formate?path=${option.exportPath}&encoding=${encoding}&fieldDelimiter=${fieldDelimiter}&hasHeader=${option.isHasHeader}&escapeQuotes=${escapeQuotes}"e=${quote}`; api.fetch(url, {}, { method: 'get', timeout: '600000', diff --git a/src/js/module/workbench/container.vue b/src/js/module/workbench/container.vue index 5542d68..51cfb29 100644 --- a/src/js/module/workbench/container.vue +++ b/src/js/module/workbench/container.vue @@ -356,7 +356,7 @@ export default { cb && cb(true); }, 'Workbench:checkExist'(option, cb) { - api.fetch('/publicservice/isExist', { + api.fetch('/filesystem/isExist', { path: option.path, }, 'get').then((rst) => { // 如果文件已存在,则返回false @@ -381,7 +381,7 @@ export default { } const md5Path = util.md5(option.path); const methodName = 'Workbench:add'; - api.fetch('/publicservice/openFile', { + api.fetch('/filesystem/openFile', { path: option.path, }, 'get').then((rst) => { const ismodifyByOldTab = option.code && !rst.fileContent; diff --git a/src/js/module/workbench/script/editor.vue b/src/js/module/workbench/script/editor.vue index 7149ce9..d7c2b02 100644 --- a/src/js/module/workbench/script/editor.vue +++ b/src/js/module/workbench/script/editor.vue @@ -80,6 +80,7 @@ import module from '../index'; import setting from './setting.vue'; import api from '@/js/service/api'; +import storage from '@/js/helper/storage'; import _ from 'lodash'; export default { components: { @@ -118,7 +119,7 @@ export default { watch: { listenResource(val) { if (!val) { - api.fetch('/publicservice/list', { + api.fetch('/jobhistory/list', { pageSize: 100, status: 'Running,Inited,Scheduled', }, 'get').then((rst) => { @@ -139,6 +140,17 @@ export default { this.$refs.editor.insertValueIntoEditor(args.value); } }, + 'Workbench:setParseAction'(id) { + if (id === this.script.id) { + const editor = this.$refs.editor; + if (editor) { + const isParserClose = !!storage.get('isParserClose', 'local'); + editor.isParserClose = isParserClose; + editor.closeParser && editor.closeParser.set(!isParserClose); + editor.openParser && editor.openParser.set(isParserClose); + } + } + }, undo() { this.$refs.editor.undo(); }, @@ -162,13 +174,8 @@ export default { this.loading = true; this.$emit('on-run', selectCode, (status) => { // status是start表示已经开始执行 - if (status === 'start') { - this.loading = false; - // 执行开始时,脚本的按钮设置为running状态 - this.script.running = true; - } - // 当抛出的为错误或者execute接口报错时,loading状态改为false,否则无法再次点击执行 - if (status === 'execute' || status === 'error') { + let list = ['execute', 'error', 'start', 'downgrade']; + if (list.indexOf(status) > -1) { this.loading = false; } }); diff --git a/src/js/module/workbench/script/execute.js b/src/js/module/workbench/script/execute.js index 1462940..6a27297 100644 --- a/src/js/module/workbench/script/execute.js +++ b/src/js/module/workbench/script/execute.js @@ -16,7 +16,7 @@ function Execute(data) { this.progress = 0; this.id = null; this.status = null; - // 仅/api/publicservice/${id}/get接口使用 + // 仅/api/filesystem/${id}/get接口使用 this.taskID = null; this.postType = data.data.postType || 'socket'; delete data.data.postType; @@ -40,6 +40,7 @@ function Execute(data) { }); this.on('execute:queryState', () => { this.queryStatus({ isKill: false }); + this.queryProgress(); }); this.on('stateEnd', () => { this.getResultPath(); @@ -76,7 +77,7 @@ function Execute(data) { if (execute.data.websocketTag === socketTag && data.method === method) { // clearTimeout(execute.executeTimout); timeoutCheck(execute); - api.fetch('/publicservice/list', { + api.fetch('/jobhistory/list', { pageSize: 100, status: 'Running,Inited,Scheduled', }, 'get').then((rst) => { @@ -121,9 +122,6 @@ function Execute(data) { }); this.on('downgrade', ({ data, execute }) => { execute.postType = 'http'; - if (data) { - execute.httpExecute(); - } }); this.on('dataError', ({ data, execute }) => { execute.run = false; @@ -156,6 +154,9 @@ Execute.prototype.restore = function({ execID, taskID }) { Execute.prototype.on = function(name, cb) { this.event.$on(name, cb); }; +Execute.prototype.off = function() { + this.event.$off(); +}; Execute.prototype.once = function(name, cb) { this.event.$once(name, cb); }; @@ -220,7 +221,7 @@ Execute.prototype.queryLog = function() { Execute.prototype.getResultPath = function() { this.trigger('steps', 'ResultLoading'); - api.fetch(`/publicservice/${this.taskID}/get`, 'get') + api.fetch(`/jobhistory/${this.taskID}/get`, 'get') .then((rst) => { this.resultsetInfo = rst.task; this.trigger('querySuccess', { @@ -239,7 +240,7 @@ Execute.prototype.getResultPath = function() { Execute.prototype.getResultList = function() { if (this.resultsetInfo && this.resultsetInfo.resultLocation) { api.fetch( - '/publicservice/getDirFileTrees', { + '/filesystem/getDirFileTrees', { path: `${this.resultsetInfo.resultLocation}`, }, 'get' @@ -272,7 +273,7 @@ Execute.prototype.getFirstResult = function() { taskID: this.taskID, status: this.status, }); - const url = `/publicservice/openFile`; + const url = `/filesystem/openFile`; const pageSize = 5000; api.fetch(url, { path: this.currentResultPath, @@ -302,7 +303,7 @@ Execute.prototype.updateLastHistory = function(option, cb) { failedReason: '', }); } - api.fetch(`/publicservice/${this.taskID}/get`, 'get') + api.fetch(`/jobhistory/${this.taskID}/get`, 'get') .then((res) => { const task = res.task; if (cb) { @@ -527,7 +528,7 @@ function setModelAndGetCode(execute, method) { const model = method.slice(method.lastIndexOf('/') + 1, method.length); if (model === 'backgroundservice') { execute.model = 'background'; - api.fetch(`/publicservice/${execute.taskID}/get`, 'get').then((res) => { + api.fetch(`/jobhistory/${execute.taskID}/get`, 'get').then((res) => { execute.executionCode = res.task.executionCode; resolve(execute.executionCode); }).catch((err) => { diff --git a/src/js/module/workbench/script/history.vue b/src/js/module/workbench/script/history.vue index 1aceee8..196c223 100644 --- a/src/js/module/workbench/script/history.vue +++ b/src/js/module/workbench/script/history.vue @@ -171,7 +171,7 @@ export default { const match = supportModes.find((s) => s.rule.test(params.row.fileName)); const ext = match ? match.ext : '.hql'; if (!params.row.logPath) { - await api.fetch(`/publicservice/${params.row.taskID}/get`, 'get').then((rst) => { + await api.fetch(`/jobhistory/${params.row.taskID}/get`, 'get').then((rst) => { params.row.logPath = rst.task.logPath; }); } @@ -196,11 +196,11 @@ export default { async downloadLog(params) { const name = params.row.fileName + '__' + Date.now() + '.log'; if (!params.row.logPath) { - await api.fetch(`/publicservice/${params.row.taskID}/get`, 'get').then((rst) => { + await api.fetch(`/jobhistory/${params.row.taskID}/get`, 'get').then((rst) => { this.$set(params.row, 'logPath', rst.task.logPath); }); } - axios.post(module.data.API_PATH + 'publicservice/download', { + axios.post(module.data.API_PATH + 'filesystem/download', { path: params.row.logPath, }).then((rst) => { const link = document.createElement('a'); diff --git a/src/js/module/workbench/script/historyScript.vue b/src/js/module/workbench/script/historyScript.vue index 3d9aba9..7704d9f 100644 --- a/src/js/module/workbench/script/historyScript.vue +++ b/src/js/module/workbench/script/historyScript.vue @@ -137,7 +137,7 @@ export default { this.scriptViewState = this.script.scriptViewState; } else { try { - api.fetch(`/publicservice/${this.work.taskID}/get`, 'get').then((rst) => { + api.fetch(`/jobhistory/${this.work.taskID}/get`, 'get').then((rst) => { const option = rst.task; const supportedMode = _.find(this.getSupportModes(), (p) => p.rule.test(this.work.filename)); this.work.data = this.script = new HistoryScript(Object.assign(supportedMode, option, { @@ -210,7 +210,7 @@ export default { const hasResult = this.script.resultList[resultSet].hasOwnProperty('result'); if (!hasResult) { const pageSize = 5000; - const url = '/publicservice/openFile'; + const url = '/filesystem/openFile'; api.fetch(url, { path: resultPath, pageSize, @@ -258,7 +258,7 @@ export default { } }, async getLogs(option) { - const url = `/publicservice/openLog`; + const url = `/filesystem/openLog`; if (!option.logPath) { this.script.log = { all: '', error: '', warning: '', info: '' }; this.script.logLine = 1; @@ -284,7 +284,7 @@ export default { }); }, async getResult(option) { - const url1 = `/publicservice/getDirFileTrees`; + const url1 = `/filesystem/getDirFileTrees`; await api.fetch(url1, { path: option.resultLocation, }, 'get').then((rst) => { @@ -293,7 +293,7 @@ export default { this.script.resultList = rst.dirFileTrees.children.sort((a, b) => parseInt(a.name, 10) - parseInt(b.name, 10)); if (this.script.resultList.length) { const currentResultPath = rst.dirFileTrees.children[0].path; - const url2 = `/publicservice/openFile`; + const url2 = `/filesystem/openFile`; api.fetch(url2, { path: currentResultPath, page: 1, diff --git a/src/js/module/workbench/script/result.vue b/src/js/module/workbench/script/result.vue index 8fafbef..551a2bb 100644 --- a/src/js/module/workbench/script/result.vue +++ b/src/js/module/workbench/script/result.vue @@ -110,12 +110,12 @@ + diff --git a/src/js/module/workbench/script/script.vue b/src/js/module/workbench/script/script.vue index 1ce076f..24ca048 100644 --- a/src/js/module/workbench/script/script.vue +++ b/src/js/module/workbench/script/script.vue @@ -119,6 +119,7 @@