Skip to content

Commit

Permalink
initial commit for web
Browse files Browse the repository at this point in the history
  • Loading branch information
wushengyeyouya committed Nov 30, 2019
1 parent 5617b42 commit b4e789a
Show file tree
Hide file tree
Showing 419 changed files with 68,922 additions and 0 deletions.
15 changes: 15 additions & 0 deletions web/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions web/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VUE_APP_HOST=
VUE_APP_MN_CONFIG_PREFIX=
VUE_APP_MN_CONFIG_SOCKET=/ws/api/entrance/connect
NODE_ENV=pro
2 changes: 2 additions & 0 deletions web/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
iconfont.js
"*.min.js"
91 changes: 91 additions & 0 deletions web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2019 WeBank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'key-spacing': ['error'],
'standard/no-callback-literal': 0,
'handle-callback-err': 0,
'no-return-assign': 0,
'eqeqeq': 0,
'comma-dangle': 0,
'semi': 0,
'space-before-function-paren': 0,
'keyword-spacing': 0,
'no-useless-escape': 0,
'operator-linebreak': 0,
'indent': [
'error',
2,
{
'SwitchCase': 1
}
],
'no-const-assign': 'warn',
'no-this-before-super': 'warn',
'no-undef': 2,
'no-unreachable': 'warn',
'no-unused-vars': 2,
'constructor-super': 'warn',
'valid-typeof': 'warn',
'one-var': 'warn',
'max-len': 'off',
'no-trailing-spaces': 'off',
'require-jsdoc': 'warn',
'camelcase': 'warn',
'no-invalid-this': 'off',
'linebreak-style': 0,
'vue/no-parsing-error': [2, {
'x-invalid-end-tag': false,
'invalid-first-character-of-tag-name': false
}],
'no-tabs': 0,
'vue/html-indent': [2, 2, {
'attribute': 1,
'closeBracket': 0,
'alignAttributesVertically': false
}],
'vue/require-default-prop': 0,
'vue/component-name-in-template-casing': 0,
'vue/html-closing-bracket-spacing': 0,
'vue/html-closing-bracket-newline': 0,
'vue/singleline-html-element-content-newline': 0,
'vue/multiline-html-element-content-newline': 0,
'vue/attributes-order': 0,
'vue/html-self-closing': 0,
'no-useless-constructor': 0,
'no-mixed-operators': 0,
'no-new-func': 0,
'no-template-curly-in-string': 0,
'no-useless-call': 0,
"one-var": 0,
"camelcase": 0,
"no-unused-vars": 0
},
parserOptions: {
parser: 'babel-eslint'
}
}
7 changes: 7 additions & 0 deletions web/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* text=auto
* text eol=lf
*.png binary
*.gif binary
*.ttf binary
*.woff binary
*.eot binary
12 changes: 12 additions & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
.vscode
.cache
.idea/

node_modules/
dist/

package-lock.json
wedatasphere-*.zip
./cn.json
.env.*
28 changes: 28 additions & 0 deletions web/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": false,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true,
"globals": {
"history": false,
"window": false,
"_": false,
"cordova": false,
"angular": false
}
}
22 changes: 22 additions & 0 deletions web/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2019 WeBank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

module.exports = {
presets: [
'@vue/app'
]
}
48 changes: 48 additions & 0 deletions web/cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"dirPath": "src\\js\\module\\resourceSimple",
"resourceSimple": {
"YS": "意书",
"FL": "分类",
"ZH": "知画",
"ZWSJ": "暂无数据",
"KX": "空闲",
"FM": "繁忙",
"QD": "启动",
"LX": "按类别",
"AZT": "按状态",
"DDJK": "请等待接口返回!",
"QDYQWFJS": "启动状态引擎无法结束!",
"WXZYQ": "未选中引擎!",
"RWGLQ": "任务管理器",
"YQGLQ": "引擎管理器",
"DLGLQ": "队列管理器",
"SX": "刷新",
"JSRW": "结束任务",
"JSYQ": "结束引擎",
"PDZ": "排队中",
"ZYSQ": "资源申请中",
"YX": "运行",
"YQ": "引擎",
"RW": "任务",
"WZJBMC": "未知脚本名称",
"ZHJB": "知画脚本",
"YQRW": "引擎和任务",
"JSYQRW": "结束引擎和任务",
"CKJBXX": "查看脚本信息",
"FZJBXX": "复制脚本信息",
"QXZYTJL": "请选择一条记录!",
"WHQD": "未获取到未获取到strongerExecId,请联系管理员查看!",
"WHQDENGINE": "未获取到engineInstance,请联系管理员查看!",
"YXTS": "运行提示",
"YJTZZXJB": "已经停止执行脚本",
"JSYQHRWCG": "结束引擎和任务成功",
"DKCG": "打开成功",
"JBFZDZTRB": "脚本信息已复制到粘贴板,请使用ctrl+v组合键粘贴!",
"XZDL": "请选择队列",
"ZYSYL": "资源使用率",
"H": "",
"NC": "内存",
"ZYSYPHB": "资源使用排行榜",
"ZW": "暂无"
}
}
8 changes: 8 additions & 0 deletions web/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Configuring front-end ports
dss_port="8088"

#URL of the backend linkis gateway
linkis_url="http://localhost:20401"

#dss ip address
dss_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
82 changes: 82 additions & 0 deletions web/find.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright 2019 WeBank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

/* eslint-disable require-jsdoc */
/* eslint-disable no-console */
var fs = require('fs');
var path = require('path');
var reg = /[\u4e00-\u9fa5]+[:]?/g;
var json = {};

// 要处理的目录参数
var dir = process.argv[2];

var dirPath = path.resolve(dir);

json.dirPath = dirPath;
json.found = {};

function findCNText(filePath) {
fs.readdir(filePath, function (err, files) {
if (err) {
console.warn(err)
} else {
files.forEach(function (filename) {
var filedir = path.join(filePath, filename);
fs.stat(filedir, function (eror, stats) {
if (eror) {
console.warn('获取文件stats失败');
} else {
var isFile = stats.isFile();
var isDir = stats.isDirectory();
if (isFile) {
var content = fs.readFileSync(filedir, 'utf-8');
// 忽略html注释
content = content.replace(/<!--[\w\W\r\n]*?-->/gmi, '');
// 忽略js注释
content = content.replace(/(?:^|\n|\r)\s*\/\*[\s\S]*?\*\/\s*(?:\r|\n|$)/g, '');
// content = content.replace(/(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/g, '');
content = content.replace(/\s*\/\/.*(?:\r|\n|$)/g, '');
// 提取中文
var arrs = content.match(reg) || [];
arrs.forEach(item => {
json.found[item] = item;
});

fs.writeFile('./cn.json', JSON.stringify(json), function (err) {
if (err) {
throw err;
}
console.log('done.');
})
}
if (isDir) {
findCNText(filedir);
}
}
})
});
}
});
}

findCNText(dirPath);

// 1.执行node find.js ./src/pages/change, 找出目录下所有需要替换的中文形成json
// 2.然后执行node translate.js 调用API批量翻译,翻译结束结果输出cn.json ,对接口翻译结果检查及修改
// 3.生成的json文件每个key值修改完成后,执行node replace.js, 会把所指定目录下的中文全部按第二步的key值替换为$t('key') 或者 this.$t('key'),或者{{ $t('key') }}
// 4.把json文件内容复制到国际配置里
Loading

0 comments on commit b4e789a

Please sign in to comment.