fix(环境管理): 修复证书上传后不显示问题
--bug=1021588 --user=赵勇 [项目设置]github#21094环境配置中上传pfx证书没反应,上传失败 https://www.tapd.cn/55049933/s/1323042
This commit is contained in:
parent
1155378c4b
commit
b0ac6aa554
|
@ -1,25 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="float: right;">
|
<div style="float: right">
|
||||||
<el-button size="mini" @click="open" :disabled="isReadOnly">{{ $t('test_track.case.import.click_upload') }}
|
<el-button size="mini" @click="open" :disabled="isReadOnly"
|
||||||
|
>{{ $t("test_track.case.import.click_upload") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="tip">{{ this.$t('commons.ssl.files') }}
|
<div class="tip">{{ this.$t("commons.ssl.files") }}</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ms-border">
|
<div class="ms-border">
|
||||||
<el-table :data="sslConfig.files" highlight-current-row>
|
<el-table :data="sslConfig.files" highlight-current-row>
|
||||||
<el-table-column prop="name" :label="$t('load_test.file_name')" show-overflow-tooltip width="180"/>
|
<el-table-column
|
||||||
<el-table-column prop="type" :label="$t('api_test.definition.request.esb_table.type')" show-overflow-tooltip
|
prop="name"
|
||||||
min-width="100px"/>
|
:label="$t('load_test.file_name')"
|
||||||
<el-table-column prop="password" show-overflow-tooltip min-width="120px" :label="$t('commons.password')">
|
show-overflow-tooltip
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="type"
|
||||||
|
:label="$t('api_test.definition.request.esb_table.type')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="100px"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="password"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="120px"
|
||||||
|
:label="$t('commons.password')"
|
||||||
|
>
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<el-input size="small" v-model="row.password" clearable show-password/>
|
<el-input
|
||||||
|
size="small"
|
||||||
|
v-model="row.password"
|
||||||
|
clearable
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="updateTime" show-overflow-tooltip min-width="120px"
|
<el-table-column
|
||||||
:label="$t('load_test.last_modify_time')">
|
prop="updateTime"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="120px"
|
||||||
|
:label="$t('load_test.last_modify_time')"
|
||||||
|
>
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<span>{{ row.updateTime | datetimeFormat }}</span>
|
<span>{{ row.updateTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -27,35 +49,69 @@
|
||||||
<el-table-column :label="$t('commons.operating')" width="100px">
|
<el-table-column :label="$t('commons.operating')" width="100px">
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<div>
|
<div>
|
||||||
<ms-table-operator-button :tip="$t('commons.update')" icon="el-icon-edit"
|
<ms-table-operator-button
|
||||||
type="primary" @exec="edit(row)"/>
|
:tip="$t('commons.update')"
|
||||||
<ms-table-operator-button :tip="$t('api_test.automation.remove')"
|
icon="el-icon-edit"
|
||||||
icon="el-icon-delete" @exec="remove(row)" type="danger"/>
|
type="primary"
|
||||||
|
@exec="edit(row)"
|
||||||
|
/>
|
||||||
|
<ms-table-operator-button
|
||||||
|
:tip="$t('api_test.automation.remove')"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@exec="remove(row)"
|
||||||
|
type="danger"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<p class="tip">{{ this.$t('commons.ssl.entry') }} </p>
|
<p class="tip">{{ this.$t("commons.ssl.entry") }}</p>
|
||||||
<div class="ms-border">
|
<div class="ms-border">
|
||||||
<el-table :data="sslConfig.entry" highlight-current-row v-if="!loading">
|
<el-table :data="sslConfig.entry" highlight-current-row v-if="!loading">
|
||||||
<el-table-column prop="originalAsName" :label="$t('commons.ssl.original_as_name')" show-overflow-tooltip
|
<el-table-column
|
||||||
width="180"/>
|
prop="originalAsName"
|
||||||
<el-table-column prop="newAsName" :label="$t('commons.ssl.new_as_name')" show-overflow-tooltip
|
:label="$t('commons.ssl.original_as_name')"
|
||||||
min-width="100px">
|
show-overflow-tooltip
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="newAsName"
|
||||||
|
:label="$t('commons.ssl.new_as_name')"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="100px"
|
||||||
|
>
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<el-input size="mini" v-model="row.newAsName"></el-input>
|
<el-input size="mini" v-model="row.newAsName"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="type" show-overflow-tooltip min-width="120px"
|
<el-table-column
|
||||||
:label="$t('api_test.definition.request.esb_table.type')"/>
|
prop="type"
|
||||||
<el-table-column prop="password" show-overflow-tooltip min-width="120px" :label="$t('commons.password')">
|
show-overflow-tooltip
|
||||||
|
min-width="120px"
|
||||||
|
:label="$t('api_test.definition.request.esb_table.type')"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="password"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="120px"
|
||||||
|
:label="$t('commons.password')"
|
||||||
|
>
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<el-input size="mini" v-model="row.password" show-password></el-input>
|
<el-input
|
||||||
|
size="mini"
|
||||||
|
v-model="row.password"
|
||||||
|
show-password
|
||||||
|
></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="sourceName" show-overflow-tooltip min-width="120px" :label="$t('commons.ssl.source')"/>
|
<el-table-column
|
||||||
|
prop="sourceName"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="120px"
|
||||||
|
:label="$t('commons.ssl.source')"
|
||||||
|
/>
|
||||||
<el-table-column :label="$t('commons.ssl.default')" width="100px">
|
<el-table-column :label="$t('commons.ssl.default')" width="100px">
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<el-checkbox v-model="row.default" @change="changeCheck(row)" />
|
<el-checkbox v-model="row.default" @change="changeCheck(row)" />
|
||||||
|
@ -63,7 +119,12 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<ms-s-s-l-file-upload :config="fileConfig" :sslConfig="sslConfig" :callback="addConfig" ref="sslConfigUpload"/>
|
<ms-s-s-l-file-upload
|
||||||
|
:config="fileConfig"
|
||||||
|
:sslConfig="sslConfig"
|
||||||
|
:callback="addConfig"
|
||||||
|
ref="sslConfigUpload"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -71,7 +132,6 @@
|
||||||
import { environmentEntry } from "../../api/environment";
|
import { environmentEntry } from "../../api/environment";
|
||||||
import { SSLConfig } from "../../model/EnvironmentModel";
|
import { SSLConfig } from "../../model/EnvironmentModel";
|
||||||
import MsApiKeyValue from "./commons/ApiKeyValue";
|
import MsApiKeyValue from "./commons/ApiKeyValue";
|
||||||
import {REQUEST_HEADERS} from "../../utils/constants";
|
|
||||||
import MsSelectTree from "../select-tree/SelectTree";
|
import MsSelectTree from "../select-tree/SelectTree";
|
||||||
import MsTableOperatorButton from "../MsTableOperatorButton";
|
import MsTableOperatorButton from "../MsTableOperatorButton";
|
||||||
import { getUUID } from "../../utils";
|
import { getUUID } from "../../utils";
|
||||||
|
@ -79,17 +139,21 @@ import MsSSLFileUpload from "./SSLFileUpload";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsEnvironmentSSLConfig",
|
name: "MsEnvironmentSSLConfig",
|
||||||
components: {MsApiKeyValue, MsSelectTree, MsTableOperatorButton, MsSSLFileUpload},
|
components: {
|
||||||
|
MsApiKeyValue,
|
||||||
|
MsSelectTree,
|
||||||
|
MsTableOperatorButton,
|
||||||
|
MsSSLFileUpload,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
sslConfig: new SSLConfig(),
|
sslConfig: new SSLConfig(),
|
||||||
projectId: String,
|
projectId: String,
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {},
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -97,8 +161,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
projectId() {
|
projectId() {},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
|
@ -111,7 +174,7 @@ export default {
|
||||||
type: file.type,
|
type: file.type,
|
||||||
updateTime: new Date().getTime(),
|
updateTime: new Date().getTime(),
|
||||||
password: config.password,
|
password: config.password,
|
||||||
file: file
|
file: file,
|
||||||
};
|
};
|
||||||
if (!sslFile.type && sslFile.name) {
|
if (!sslFile.type && sslFile.name) {
|
||||||
let type = sslFile.name.substr(sslFile.name.lastIndexOf(".") + 1);
|
let type = sslFile.name.substr(sslFile.name.lastIndexOf(".") + 1);
|
||||||
|
@ -125,18 +188,19 @@ export default {
|
||||||
this.$refs.sslConfigUpload.open(row);
|
this.$refs.sslConfigUpload.open(row);
|
||||||
},
|
},
|
||||||
reload() {
|
reload() {
|
||||||
this.loading = true
|
this.loading = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.loading = false
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getEntry(sslFile) {
|
getEntry(sslFile) {
|
||||||
environmentEntry(sslFile.file, null, sslFile.password).then(response => {
|
environmentEntry(sslFile.file, null, sslFile.password).then(
|
||||||
let data = response.data;
|
(response) => {
|
||||||
|
let data = response.data.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
if (!sslFile.id) {
|
if (!sslFile.id) {
|
||||||
sslFile.id = getUUID();
|
sslFile.id = getUUID();
|
||||||
data.forEach(item => {
|
data.forEach((item) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
item.id = getUUID();
|
item.id = getUUID();
|
||||||
item.sourceId = sslFile.id;
|
item.sourceId = sslFile.id;
|
||||||
|
@ -146,12 +210,12 @@ export default {
|
||||||
item.default = false;
|
item.default = false;
|
||||||
|
|
||||||
this.sslConfig.entry.unshift(item);
|
this.sslConfig.entry.unshift(item);
|
||||||
})
|
});
|
||||||
this.sslConfig.files.unshift(sslFile);
|
this.sslConfig.files.unshift(sslFile);
|
||||||
} else {
|
} else {
|
||||||
// 更新条目
|
// 更新条目
|
||||||
this.remove(sslFile);
|
this.remove(sslFile);
|
||||||
data.forEach(item => {
|
data.forEach((item) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
item.id = getUUID();
|
item.id = getUUID();
|
||||||
item.sourceId = sslFile.id;
|
item.sourceId = sslFile.id;
|
||||||
|
@ -160,11 +224,12 @@ export default {
|
||||||
item.password = "";
|
item.password = "";
|
||||||
item.default = false;
|
item.default = false;
|
||||||
this.sslConfig.entry.unshift(item);
|
this.sslConfig.entry.unshift(item);
|
||||||
})
|
});
|
||||||
this.sslConfig.files.unshift(sslFile);
|
this.sslConfig.files.unshift(sslFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
remove(row) {
|
remove(row) {
|
||||||
const index = this.sslConfig.files.findIndex((d) => d.id === row.id);
|
const index = this.sslConfig.files.findIndex((d) => d.id === row.id);
|
||||||
|
@ -172,22 +237,24 @@ export default {
|
||||||
// 同时删除条目
|
// 同时删除条目
|
||||||
if (this.sslConfig.entry) {
|
if (this.sslConfig.entry) {
|
||||||
let removeKeys = [];
|
let removeKeys = [];
|
||||||
this.sslConfig.entry.forEach(item => {
|
this.sslConfig.entry.forEach((item) => {
|
||||||
if (item && item.sourceId === row.id) {
|
if (item && item.sourceId === row.id) {
|
||||||
const index = this.sslConfig.entry.findIndex((d) => d.sourceId === row.id);
|
const index = this.sslConfig.entry.findIndex(
|
||||||
|
(d) => d.sourceId === row.id
|
||||||
|
);
|
||||||
removeKeys.push(index);
|
removeKeys.push(index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
removeKeys.forEach(index => {
|
removeKeys.forEach((index) => {
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.sslConfig.entry.splice(index, 1);
|
this.sslConfig.entry.splice(index, 1);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeCheck(row) {
|
changeCheck(row) {
|
||||||
if (row.default) {
|
if (row.default) {
|
||||||
this.sslConfig.entry.forEach(item => {
|
this.sslConfig.entry.forEach((item) => {
|
||||||
if (item && item.sourceId !== row.id) {
|
if (item && item.sourceId !== row.id) {
|
||||||
item.default = false;
|
item.default = false;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +262,8 @@ export default {
|
||||||
row.default = true;
|
row.default = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue