Commit c81bbbaa authored by rockyl's avatar rockyl

增加自定义模块支持

证书详情编辑弹窗
parent 24b63e1e
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"Close": "Close", "Close": "Close",
"Still Close": "Still Close", "Still Close": "Still Close",
"Save": "Save", "Save": "Save",
"Reset": "Reset",
"Copy": "Copy", "Copy": "Copy",
"Exit": "Exit", "Exit": "Exit",
"Props": "Props", "Props": "Props",
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
"Export": "Export", "Export": "Export",
"Upload": "Upload", "Upload": "Upload",
"Edit": "Edit", "Edit": "Edit",
"Env": "Env", "EditEnv": "EditEnv",
"EditCustomModule": "EditCustomModule",
"ID": "ID", "ID": "ID",
"Name": "Name", "Name": "Name",
"Alias": "Alias", "Alias": "Alias",
...@@ -115,7 +117,6 @@ ...@@ -115,7 +117,6 @@
"details": "Details", "details": "Details",
"preview": "Preview", "preview": "Preview",
"pack": "Pack", "pack": "Pack",
"data-mapping": "DataMapping",
"exit": "Exit", "exit": "Exit",
"undo": "Undo", "undo": "Undo",
"redo": "Redo" "redo": "Redo"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"Close": "关闭", "Close": "关闭",
"Still Close": "仍然关闭", "Still Close": "仍然关闭",
"Save": "保存", "Save": "保存",
"Reset": "重置",
"Copy": "复制", "Copy": "复制",
"Exit": "退出", "Exit": "退出",
"Props": "属性", "Props": "属性",
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
"Export": "导出", "Export": "导出",
"Upload": "上传", "Upload": "上传",
"Edit": "编辑", "Edit": "编辑",
"Env": "环境", "EditEnv": "编辑环境",
"EditCustomModule": "编辑自定义模块",
"ID": "ID", "ID": "ID",
"Name": "名字", "Name": "名字",
"Alias": "别名", "Alias": "别名",
...@@ -115,7 +117,6 @@ ...@@ -115,7 +117,6 @@
"details": "详情", "details": "详情",
"preview": "预览", "preview": "预览",
"pack": "发布", "pack": "发布",
"data-mapping": "数据映射",
"exit": "退出", "exit": "退出",
"undo": "撤销", "undo": "撤销",
"redo": "重做" "redo": "重做"
......
...@@ -40,8 +40,12 @@ export default new Vuex.Store({ ...@@ -40,8 +40,12 @@ export default new Vuex.Store({
'addDataMapping', 'addDataMapping',
'deleteDataMapping', 'deleteDataMapping',
'modifyDataMapping', 'modifyDataMapping',
'addEnvMapping',
'deleteEnvMapping',
'modifyEnvMapping',
'modifyActiveView', 'modifyActiveView',
'behavior_save', 'behavior_save',
'modifyCustoms',
] ]
}) })
] ]
......
...@@ -18,12 +18,14 @@ export const envStore = { ...@@ -18,12 +18,14 @@ export const envStore = {
}, },
processes: [], processes: [],
scripts: [], scripts: [],
customs: [],
}, },
mutations: { mutations: {
updateEnv(state, env) { updateEnv(state, env) {
Object.assign(state, env); Object.assign(state, env);
state.processes = parseItem(state.processes); state.processes = parseItem(state.processes);
state.scripts = parseItem(state.scripts); state.scripts = parseItem(state.scripts);
state.customs = parseItem(state.customs);
state.initialized = true; state.initialized = true;
}, },
......
...@@ -43,6 +43,7 @@ export const projectStore = { ...@@ -43,6 +43,7 @@ export const projectStore = {
assets: [], assets: [],
dataMapping: [], dataMapping: [],
processes: [], processes: [],
customs: [],
}, },
activeComponent: {}, activeComponent: {},
activeComponentCopy: {}, // 当前选中节点的镜像,用来处理拖拽时数据变化频繁的问题 activeComponentCopy: {}, // 当前选中节点的镜像,用来处理拖拽时数据变化频繁的问题
...@@ -65,19 +66,21 @@ export const projectStore = { ...@@ -65,19 +66,21 @@ export const projectStore = {
const localData = state.data; const localData = state.data;
if (data) { if (data) {
const {views, assets, dataMapping, processes, options, } = JSON.parse(data); const {views, assets, dataMapping, processes, options, customs, } = JSON.parse(data);
Vue.set(localData, 'options', options || getDefaultOptions()); Vue.set(localData, 'options', options || getDefaultOptions());
Vue.set(localData, 'views', views || []); Vue.set(localData, 'views', views || []);
Vue.set(localData, 'assets', assets || []); Vue.set(localData, 'assets', assets || []);
Vue.set(localData, 'dataMapping', dataMapping || []); Vue.set(localData, 'dataMapping', dataMapping || []);
Vue.set(localData, 'processes', processes || []); Vue.set(localData, 'processes', processes || []);
Vue.set(localData, 'customs', customs || []);
} else { } else {
Vue.set(localData, 'options', getDefaultOptions()); Vue.set(localData, 'options', getDefaultOptions());
Vue.set(localData, 'views', []); Vue.set(localData, 'views', []);
Vue.set(localData, 'assets', []); Vue.set(localData, 'assets', []);
Vue.set(localData, 'dataMapping', []); Vue.set(localData, 'dataMapping', []);
Vue.set(localData, 'processes', []); Vue.set(localData, 'processes', []);
Vue.set(localData, 'customs', []);
} }
}, },
/** /**
...@@ -344,6 +347,10 @@ export const projectStore = { ...@@ -344,6 +347,10 @@ export const projectStore = {
modifyEnvMapping(state) { modifyEnvMapping(state) {
}, },
modifyCustoms(state, customs){
state.data.customs = customs;
},
}, },
getters: { getters: {
project(state) { project(state) {
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
} }
} }
.right-part{ .right-part {
color: $--color-text-regular; color: $--color-text-regular;
line-height: 15px; line-height: 15px;
.el-button{ .el-button {
padding: 2px; padding: 2px;
} }
} }
...@@ -44,49 +44,60 @@ ...@@ -44,49 +44,60 @@
background-color: $--pane-background-color; background-color: $--pane-background-color;
} }
.data-mapping-dialog { .mapping-list {
height: 200px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
button{ button {
align-self: flex-start; align-self: flex-start;
margin-bottom: 5px;
} }
.scrollbar{ .item + .item {
flex: 1; margin-top: 5px;
.view{
padding-right: 10px;
}
.item + .item{
margin-top: 10px;
} }
.item{ .item {
display: flex; display: flex;
align-items: center; align-items: center;
&:hover{ &:hover {
& > button{ & > button {
visibility: visible; visibility: visible;
} }
} }
.el-icon-connection{ .el-icon-connection {
padding: 0 5px; padding: 0 5px;
} }
button{ button {
margin-left: 5px; margin-left: 5px;
visibility: hidden; visibility: hidden;
} }
} }
}
.details-dialog {
.operate-bar{
display: flex;
justify-content: flex-end;
padding: 5px;
} }
} .scrollbar {
height: 40vh;
.project-details-dialog { .view {
padding-right: 10px;
.custom-module-list{
display: flex;
flex-direction: column;
.item + .item {
margin-top: 5px;
}
}
}
}
} }
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
</split-panes> </split-panes>
<inspector splitpanes-min="20" :splitpanes-size="getSize(0, 1)"></inspector> <inspector splitpanes-min="20" :splitpanes-size="getSize(0, 1)"></inspector>
</split-panes> </split-panes>
<project-details-dialog ref="projectDialogsDialog"/> <details-dialog ref="dialogsDialog"/>
<data-mapping-dialog ref="dataMappingDialog"/>
</div> </div>
</template> </template>
...@@ -24,16 +23,14 @@ ...@@ -24,16 +23,14 @@
import Views from "./Editor/Views"; import Views from "./Editor/Views";
import Playground from "./Editor/Playground"; import Playground from "./Editor/Playground";
import Assets from "./Editor/Assets"; import Assets from "./Editor/Assets";
import ProjectDetailsDialog from "./Editor/dialogs/ProjectDetailsDialog"; import DetailsDialog from "./Editor/dialogs/DetailsDialog";
import DataMappingDialog from "./Editor/dialogs/DataMappingDialog";
import {playWaiting} from "../utils"; import {playWaiting} from "../utils";
import i18n from "../i18n"; import i18n from "../i18n";
export default { export default {
name: 'Editor', name: 'Editor',
components: { components: {
DataMappingDialog, DetailsDialog,
ProjectDetailsDialog,
Assets, Assets,
Playground, Playground,
Views, Views,
...@@ -155,7 +152,7 @@ ...@@ -155,7 +152,7 @@
} }
break; break;
case 'details': case 'details':
this.$refs.projectDialogsDialog.show(); this.$refs.dialogsDialog.show();
break; break;
case 'pack': case 'pack':
const loading = this.$loading({ const loading = this.$loading({
...@@ -195,9 +192,6 @@ ...@@ -195,9 +192,6 @@
case 'redo': case 'redo':
this.$store.commit('undoRedo', -1); this.$store.commit('undoRedo', -1);
break; break;
case 'data-mapping':
this.$refs.dataMappingDialog.show();
break;
case 'exit': case 'exit':
const {projectID} = this.$route.params; const {projectID} = this.$route.params;
if (await this.localVersionExist(projectID)) { if (await this.localVersionExist(projectID)) {
......
<template>
<el-dialog :title="$t('Project details')" width="70%" :visible.sync="visible" @open="onOpen"
:close-on-click-modal="false"
:append-to-body="true"
:show-close="false"
custom-class="details-dialog"
>
<el-tabs v-model="activeName">
<el-tab-pane label="项目" name="project">
<project-editor/>
</el-tab-pane>
<el-tab-pane label="环境常量" name="env">
<env-editor/>
</el-tab-pane>
<el-tab-pane label="数据映射" name="data-mapping">
<data-mapping-editor/>
</el-tab-pane>
<el-tab-pane label="自定义模块" name="custom">
<custom-editor/>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="onClose">{{$t('Close')}}</el-button>
</div>
</el-dialog>
</template>
<script>
import ProjectEditor from "./editors/ProjectEditor";
import EnvEditor from "./editors/EnvEditor";
import CustomEditor from "./editors/CustomEditor";
import DataMappingEditor from "./editors/DataMappingEditor";
export default {
name: "DetailsDialog",
components: {DataMappingEditor, CustomEditor, EnvEditor, ProjectEditor},
data() {
return {
visible: false,
activeName: 'project',
}
},
methods: {
show() {
this.visible = true;
},
onClose() {
this.visible = false;
},
onOpen() {
},
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view">
<el-checkbox-group :value="customs" class="custom-module-list" @input="onChange">
<el-checkbox class="item" v-for="customMeta in customMetas" :key="customMeta.id" :label="customMeta.id">
{{customMeta.alias || customMeta.name}}
</el-checkbox>
</el-checkbox-group>
</el-scrollbar>
</template>
<script>
import {mapState, mapMutations} from 'vuex'
export default {
name: "CustomEditor",
data() {
return {
visible: false,
}
},
computed: {
...mapState({
customMetas: state => state.env.customs,
customs: state => state.project.data.customs,
}),
},
methods: {
...mapMutations([
'modifyCustoms',
]),
onChange(v){
this.modifyCustoms(v);
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template> <template>
<el-dialog :title="$t('Data mapping')" width="70%" :visible.sync="visible" @open="onOpen"
:append-to-body="true" :close-on-click-modal="false">
<div class="data-mapping-dialog">
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view"> <el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view">
<div class="mapping-list">
<el-button icon="el-icon-plus" size="mini" circle @click="onAdd"/>
<div class="item" v-for="(link, index) in mapping"> <div class="item" v-for="(link, index) in mapping">
<el-input size="mini" style="width: 30%" v-model="link.name" @change="onChange"/> <el-input size="mini" style="width: 30%" v-model="link.name" @change="onChange"/>
<el-icon class="el-icon-connection"/> <el-icon class="el-icon-connection"/>
<el-input size="mini" v-model="link.path" @change="onChange"/> <el-input size="mini" v-model="link.path" @change="onChange"/>
<el-button icon="el-icon-minus" circle size="mini" @click="toDeleteItem(link, index)"/> <el-button icon="el-icon-minus" circle size="mini" type="danger" @click="toDeleteItem(link, index)"/>
</div> </div>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="onAdd">{{$t('Add')}}</el-button>
<el-button size="mini" type="primary" @click="onConfirm">{{$t('Confirm')}}</el-button>
</div> </div>
</el-dialog> </el-scrollbar>
</template> </template>
<script> <script>
import {mapState, mapMutations} from 'vuex' import {mapState, mapMutations} from 'vuex'
export default { export default {
name: "DataMappingDialog", name: "DataMappingEditor",
data() { data() {
return { return {
visible: false, visible: false,
...@@ -30,20 +24,17 @@ ...@@ -30,20 +24,17 @@
}, },
computed: { computed: {
...mapState({ ...mapState({
mapping: state=> state.project.data.dataMapping, mapping: state => state.project.data.dataMapping,
}), }),
}, },
methods: { methods: {
show() {
this.visible = true;
},
onAdd() { onAdd() {
this.addDataMapping(); this.addDataMapping();
}, },
onChange(){ onChange() {
this.modifyDataMapping(); this.modifyDataMapping();
}, },
toDeleteItem(link, index){ toDeleteItem(link, index) {
this.$confirm(this.$t('Are you sure to delete this item'), this.$t('Alert'), { this.$confirm(this.$t('Are you sure to delete this item'), this.$t('Alert'), {
confirmButtonText: this.$t('Confirm'), confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'), cancelButtonText: this.$t('Cancel'),
...@@ -52,12 +43,6 @@ ...@@ -52,12 +43,6 @@
this.deleteDataMapping(index); this.deleteDataMapping(index);
}).catch((e) => { }).catch((e) => {
}); });
},
onConfirm() {
this.visible = false;
},
onOpen() {
}, },
...mapMutations([ ...mapMutations([
'addDataMapping', 'addDataMapping',
......
<template> <template>
<el-dialog :title="$t('Env editor')" width="70%" :visible.sync="visible" @open="onOpen"
:append-to-body="true" :close-on-click-modal="false">
<div class="data-mapping-dialog">
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view"> <el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view">
<div class="mapping-list">
<el-button icon="el-icon-plus" size="mini" circle @click="onAdd"/>
<div class="item" v-for="(link, index) in env"> <div class="item" v-for="(link, index) in env">
<el-input size="mini" style="width: 30%" v-model="link.name" @change="onChange"/> <el-input size="mini" style="width: 30%" v-model="link.name" @change="onChange"/>
<el-icon class="el-icon-connection"/> <el-icon class="el-icon-connection"/>
<el-input size="mini" v-model="link.value" @change="onChange"/> <el-input size="mini" v-model="link.value" @change="onChange"/>
<el-button icon="el-icon-minus" circle size="mini" @click="toDeleteItem(link, index)"/> <el-button icon="el-icon-minus" circle size="mini" type="danger" @click="toDeleteItem(link, index)"/>
</div> </div>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="onAdd">{{$t('Add')}}</el-button>
<el-button size="mini" type="primary" @click="onConfirm">{{$t('Confirm')}}</el-button>
</div> </div>
</el-dialog> </el-scrollbar>
</template> </template>
<script> <script>
import {mapState, mapMutations} from 'vuex' import {mapState, mapMutations} from 'vuex'
export default { export default {
name: "EnvEditorDialog", name: "EnvEditor",
data() { data() {
return { return {
visible: false, visible: false,
...@@ -30,20 +24,17 @@ ...@@ -30,20 +24,17 @@
}, },
computed: { computed: {
...mapState({ ...mapState({
env: state=> state.project.data.options.env, env: state => state.project.data.options.env,
}), }),
}, },
methods: { methods: {
show() {
this.visible = true;
},
onAdd() { onAdd() {
this.addEnvMapping(); this.addEnvMapping();
}, },
onChange(){ onChange() {
this.modifyEnvMapping(); this.modifyEnvMapping();
}, },
toDeleteItem(link, index){ toDeleteItem(link, index) {
this.$confirm(this.$t('Are you sure to delete this item'), this.$t('Alert'), { this.$confirm(this.$t('Are you sure to delete this item'), this.$t('Alert'), {
confirmButtonText: this.$t('Confirm'), confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'), cancelButtonText: this.$t('Cancel'),
...@@ -52,17 +43,8 @@ ...@@ -52,17 +43,8 @@
this.deleteEnvMapping(index); this.deleteEnvMapping(index);
}).catch((e) => { }).catch((e) => {
}); });
},
onConfirm() {
this.visible = false;
},
onOpen() {
}, },
...mapMutations([ ...mapMutations([
'addDataMapping',
'deleteDataMapping',
'modifyDataMapping',
'addEnvMapping', 'addEnvMapping',
'deleteEnvMapping', 'deleteEnvMapping',
'modifyEnvMapping', 'modifyEnvMapping',
......
<template> <template>
<el-dialog :title="$t('Project details')" width="70%" :visible.sync="visible" @open="onOpen" <div>
:close-on-click-modal="false" <el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="view">
:append-to-body="true"
:show-close="false"
>
<div class="project-details-dialog">
<el-form @submit.native.prevent ref="form" :model="options" size="mini" label-position="right" <el-form @submit.native.prevent ref="form" :model="options" size="mini" label-position="right"
label-width="150px"> label-width="150px">
<el-form-item prop="pageTitle" :label="$t('Page title')"> <el-form-item prop="pageTitle" :label="$t('Page title')">
...@@ -53,23 +49,20 @@ ...@@ -53,23 +49,20 @@
<el-input type="textarea" v-model="options.tpl" :rows="10"/> <el-input type="textarea" v-model="options.tpl" :rows="10"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar>
<div class="operate-bar">
<el-button size="mini" @click="onReset">{{$t('Reset')}}</el-button>
<el-button size="mini" type="primary" @click="onSave">{{$t('Save')}}</el-button>
</div> </div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="onEditEnv">{{$t('Env')}}</el-button>
<el-button size="mini" @click="onCancel">{{$t('Cancel')}}</el-button>
<el-button size="mini" type="primary" @click="onConfirm">{{$t('Save')}}</el-button>
</div> </div>
<env-editor-dialog ref="envEditorDialog"/>
</el-dialog>
</template> </template>
<script> <script>
import {mapState, mapGetters, mapMutations} from 'vuex'; import {mapState, mapGetters, mapMutations} from 'vuex';
import EnvEditorDialog from "./EnvEditorDialog";
export default { export default {
name: "ProjectDetailsDialog", name: "ProjectEditor",
components: {EnvEditorDialog}, components: {},
data() { data() {
const scaleMode = this.$t('scaleMode'); const scaleMode = this.$t('scaleMode');
const rendererType = this.$t('rendererType'); const rendererType = this.$t('rendererType');
...@@ -88,26 +81,15 @@ ...@@ -88,26 +81,15 @@
]) ])
}, },
methods: { methods: {
show() { ...mapMutations([
this.visible = true; 'modifyProject',
}, ]),
onEditEnv() { onReset() {
this.$refs.envEditorDialog.show();
},
onCancel() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.visible = false;
}, },
onConfirm() { onSave() {
this.visible = false;
this.modifyProject(); this.modifyProject();
}, },
onOpen() {
},
...mapMutations([
'modifyProject',
]),
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment