Skip to content

Commit

Permalink
feat: preliminary complete the globalHistoryManagement,parameterConfi…
Browse files Browse the repository at this point in the history
…g and login page
  • Loading branch information
CoderSerio authored and CoderSerio committed Sep 24, 2023
1 parent 1fdb503 commit f77c79d
Show file tree
Hide file tree
Showing 10 changed files with 315 additions and 269 deletions.
7 changes: 7 additions & 0 deletions linkis-web-next/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ BACKEND_URL=http://106.52.77.156:19888
VUE_APP_MN_CONFIG_PREFIX=
VUE_APP_MN_CONFIG_SOCKET=/ws/api/entrance/connect
VUE_APP_VERSION=1.3.2


VITE_VUE_APP_HOST=
VITE_BACKEND_URL=http://106.52.77.156:19888
VITE_VUE_APP_MN_CONFIG_PREFIX=
VITE_VUE_APP_MN_CONFIG_SOCKET=/ws/api/entrance/connect
VITE_VUE_APP_VERSION=1.3.2
1 change: 0 additions & 1 deletion linkis-web-next/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
}
},
"plugins": ["vue", "@typescript-eslint"],
"import/prefer-default-export": "off",
"rules": {
"indent": ["error", 4],
"linebreak-style": ["error", "unix"],
Expand Down
6 changes: 3 additions & 3 deletions linkis-web-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
"qs": "^6.11.2",
"vue": "^3.2.47",
"vue-i18n": "^9.4.1",
"vue-router": "^4.2.2"
"vue-router": "^4.2.2",
"vite": "^4.3.9",
"@vitejs/plugin-vue": "^4.1.0"
},
"devDependencies": {
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.1",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@vitejs/plugin-vue": "^4.1.0",
"eslint": "^8.41.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
Expand All @@ -41,7 +42,6 @@
"lint-staged": "^13.3.0",
"prettier": "2.8.8",
"typescript": "^5.0.2",
"vite": "^4.3.9",
"vue-eslint-parser": "^9.3.0"
},
"lint-staged": {
Expand Down
196 changes: 99 additions & 97 deletions linkis-web-next/src/components/editor/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
</template>

<script lang="ts">
// import { debounce } from 'lodash';
import { defineComponent } from 'vue';
// import monaco from './monaco-loader';
import { useMonaco } from './util';
const types = {
code: {
theme: 'defaultView',
},
log: {
language: 'log',
theme: 'logview',
readOnly: true,
glyphMargin: false,
selectOnLineNumbers: false,
wordWrap: 'on',
},
};
// const types = {
// code: {
// theme: 'defaultView',
// },
// log: {
// language: 'log',
// theme: 'logview',
// readOnly: true,
// glyphMargin: false,
// selectOnLineNumbers: false,
// wordWrap: 'on',
// },
// };
export default defineComponent({
props: {
Expand Down Expand Up @@ -48,35 +50,35 @@ export default defineComponent({
},
},
watch: {
modelValue(val) {
val !== this.getEditor()?.getValue() && this.updateMonacoVal(val);
},
// modelValue(val) {
// val !== this.getEditor()?.getValue() && this.updateMonacoVal(val);
// },
editorName() {
return `we-editor-${this.type}`;
},
currentConfig() {
const typeConfig = types[this.type];
const config = merge(
{
automaticLayout: false,
scrollBeyondLastLine: false,
minimap: {
enabled: false,
},
readOnly: this.readOnly,
glyphMargin: true,
},
typeConfig,
this.options,
{
value: this.value,
theme: this.theme,
language: this.language,
},
);
return config;
},
// editorName() {
// return `we-editor-${this.type}`;
// },
// currentConfig() {
// const typeConfig = types[this.type];
// const config = merge(
// {
// automaticLayout: false,
// scrollBeyondLastLine: false,
// minimap: {
// enabled: false,
// },
// readOnly: this.readOnly,
// glyphMargin: true,
// },
// typeConfig,
// this.options,
// {
// value: this.value,
// theme: this.theme,
// language: this.language,
// },
// );
// return config;
// },
},
setup(props) {
const { updateVal, getEditor, createEditor, onFormatDoc } = useMonaco(
Expand All @@ -95,6 +97,7 @@ export default defineComponent({
closeParser: null,
openParser: null,
sqlParser: null,
monaco: null,
};
},
methods: {
Expand All @@ -106,76 +109,75 @@ export default defineComponent({
this.updateVal(val);
},
// initialization(初始化)
initMonaco() {
this.editor = monaco.editor.create(this.$el, this.currentConfig);
this.monaco = monaco;
this.editorModel = this.editor.getModel();
if (this.type !== 'log') {
if (this.scriptType !== 'hdfsScript' && !this.readOnly) {
this.addCommands();
this.addActions();
}
if (this.language === 'hql') {
this.initParser();
} else {
this.deltaDecorations(this.value);
}
}
this.$emit('onload');
this.editor.onDidChangeModelContent(
debounce(() => {
this.$emit('input', this.getValue());
}),
100,
);
this.editor.onContextMenu(
debounce(() => {
// The right-click menu function that needs to change the text(需要调换文字的右键菜单功能)
const selectList = [
{
label: 'Change All Occurrences',
text: '改变所有出现',
},
{ label: 'Format Document', text: '格式化' },
{ label: 'Command Palette', text: '命令面板' },
{ label: 'Cut', text: '剪切' },
{ label: 'Copy', text: '复制' },
];
if (localStorage.getItem('locale') === 'zh-CN') {
selectList.forEach((item) => {
const elmentList = document.querySelectorAll(
`.actions-container .action-label[aria-label="${item.label}"]`,
);
this.changeInnerText(elmentList, item.text);
});
}
}),
100,
);
},
// initMonaco() {
// this.editor = monaco.editor.create(this.$el, this.currentConfig) as any;
// this.monaco = monaco as any;
// this.editorModel = this.editor.getModel();
// if (this.type !== 'log') {
// if (this.scriptType !== 'hdfsScript' && !this.readOnly) {
// this.addCommands();
// this.addActions();
// }
// if (this.language === 'hql') {
// this.initParser();
// } else {
// this.deltaDecorations(this.value);
// }
// }
// this.$emit('onload');
// this.editor.onDidChangeModelContent(
// debounce(() => {
// this.$emit('input', this.getValue());
// }),
// 100,
// );
// this.editor.onContextMenu(
// debounce(() => {
// // The right-click menu function that needs to change the text(需要调换文字的右键菜单功能)
// const selectList = [
// {
// label: 'Change All Occurrences',
// text: '改变所有出现',
// },
// { label: 'Format Document', text: '格式化' },
// { label: 'Command Palette', text: '命令面板' },
// { label: 'Cut', text: '剪切' },
// { label: 'Copy', text: '复制' },
// ];
// if (localStorage.getItem('locale') === 'zh-CN') {
// selectList.forEach((item) => {
// const elmentList = document.querySelectorAll(
// `.actions-container .action-label[aria-label="${item.label}"]`,
// );
// this.changeInnerText(elmentList, item.text);
// });
// }
// }),
// 100,
// );
// },
},
mounted() {
console.log(this.$el, this.$props);
if (this.$el) {
// this.editor = monaco.editor.create(this.$el, this.currentConfig);
// this.monaco = monaco;
// this.editorModel = this.editor.getModel();
this.editor = this.createEditor(
this.$el,
this.$props.editorOptions,
);
) as any;
this.updateMonacoVal();
this.editor!.onDidChangeModelContent(() => {
this.$emit('update:modelValue', monacoEditor!.getValue());
});
this.editor!.onDidBlurEditorText(() => {
this.$emit('blur');
});
// this.editor!.onDidChangeModelContent(() => {
// this.$emit('update:modelValue', monacoEditor!.getValue());
// });
// this.editor!.onDidBlurEditorText(() => {
// this.$emit('blur');
// });
}
},
beforeUnmount() {
// 销毁 editor,进行gc(销毁 editor,进行gc)
this.editor!.dispose();
(this.editor as any)?.dispose();
},
});
</script>
Expand Down
Loading

0 comments on commit f77c79d

Please sign in to comment.