refactor(项目管理): 环境管理环境参数修改

This commit is contained in:
rubyliu 2024-02-28 21:33:30 +08:00 committed by 刘瑞斌
parent 4d832ce503
commit 5e266613e6
7 changed files with 26 additions and 23 deletions

View File

@ -1,5 +1,3 @@
import { key } from 'localforage';
export interface EnvListItem {
name: string;
id: string;
@ -36,11 +34,12 @@ export interface EnvConfig {
commmonVariables?: EnvConfigItem[];
httpConfig?: EnvConfigItem[];
dataSource?: DataSourceItem[];
hostConfig?: EnvConfigItem[];
hostConfig?: EnvConfigItem;
authConfig?: EnvConfigItem;
preScript?: EnvConfigItem[];
postScript?: EnvConfigItem[];
assertions?: EnvConfigItem[];
preProcessorConfig?: EnvConfigItem;
postProcessorConfig?: EnvConfigItem;
assertionConfig?: EnvConfigItem;
pluginConfigMap?: EnvConfigItem;
}
export interface EnvDetailItem {
id?: string;

View File

@ -11,9 +11,9 @@
const params = computed({
set: (value: any) => {
store.currentEnvDetailInfo.config.assertions = value;
store.currentEnvDetailInfo.config.assertionConfig = value;
},
get: () => store.currentEnvDetailInfo.config.assertions || [],
get: () => store.currentEnvDetailInfo.config.assertionConfig || [],
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="flex flex-row items-center gap-[8px]">
<a-switch type="line" size="small" />
<a-switch v-model:model-value="currentList.enable" type="line" size="small" />
<div class="text-[var(--color-text-1)]">{{ t('project.environmental.host.config') }}</div>
</div>
<div class="mt-[8px]">
@ -10,7 +10,7 @@
:models="batchFormModels"
:form-mode="ruleFormMode"
add-text="project.menu.rule.addRule"
:default-vals="currentList"
:default-vals="currentList.hosts"
show-enable
:is-show-drag="false"
></MsBatchForm>
@ -35,14 +35,15 @@
const store = useProjectEnvStore();
const currentList = computed({
get: () => (store.currentEnvDetailInfo.config.hostConfig || []) as FakeTableListItem[],
set: (value: EnvConfigItem[] | undefined) => {
store.currentEnvDetailInfo.config.hostConfig = value;
get: () => store.currentEnvDetailInfo.config.hostConfig || {},
set: (value: EnvConfigItem) => {
console.log(value);
store.currentEnvDetailInfo.config.hostConfig = value || {};
},
});
const batchFormRef = ref();
onClickOutside(batchFormRef, () => {
currentList.value = batchFormRef.value?.getFormResult();
currentList.value.hosts = batchFormRef.value?.getFormResult();
});
type UserModalMode = 'create' | 'edit';
const batchFormModels: Ref<FormItemModel[]> = ref([

View File

@ -43,7 +43,6 @@
</template>
<script lang="ts" async setup>
import { defineModel } from 'vue';
import { TableData } from '@arco-design/web-vue';
import MsButton from '@/components/pure/ms-button/index.vue';
@ -69,9 +68,12 @@
const tableStore = useTableStore();
const addVisible = ref(false);
const currentId = ref('');
const innerParam = defineModel<TableData[]>('modelValue', {
type: Array,
default: () => [],
const innerParam = computed({
set: (value: TableData[]) => {
store.currentEnvDetailInfo.config.httpConfig = value;
},
get: () => store.currentEnvDetailInfo.config.httpConfig || [],
});
const columns: MsTableColumn = [
@ -124,6 +126,7 @@
showSetting: true,
showPagination: false,
showMode: false,
debug: true,
});
const form = reactive({

View File

@ -12,9 +12,9 @@
// TODO:
const params = computed<any>({
set: (value: any) => {
store.currentEnvDetailInfo.config.postScript = value;
store.currentEnvDetailInfo.config.postProcessorConfig = value;
},
get: () => store.currentEnvDetailInfo.config.postScript || [],
get: () => store.currentEnvDetailInfo.config.postProcessorConfig || {},
});
</script>

View File

@ -12,9 +12,9 @@
// TODO:
const params = computed<any>({
set: (value: any) => {
store.currentEnvDetailInfo.config.preScript = value;
store.currentEnvDetailInfo.config.preProcessorConfig = value;
},
get: () => store.currentEnvDetailInfo.config.preScript || [],
get: () => store.currentEnvDetailInfo.config.preProcessorConfig || {},
});
</script>

View File

@ -230,7 +230,7 @@
const envList = ref<EnvListItem[]>([]); //
const evnGroupList = ref<EnvListItem[]>([]); //
const showType = ref<EnvAuthScopeEnum>(EnvAuthScopeEnum.PROJECT_GROUP); //
const showType = ref<EnvAuthScopeEnum>(EnvAuthScopeEnum.PROJECT); //
const activeKey = computed(() => store.currentId); // id