Skip to content

Commit 0221df2

Browse files
authored
feat: 未命名版本配置项修改态支持diff (#199)
1 parent 8a59d4a commit 0221df2

3 files changed

Lines changed: 55 additions & 26 deletions

File tree

ui/src/views/space/service/detail/config/components/version-diff/aside-menu/configs-kv.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import { Search, RightShape } from 'bkui-vue/lib/icon';
5959
import { IConfigKvType } from '../../../../../../../../../types/config';
6060
import { ISingleLineKVDIffItem } from '../../../../../../../../../types/service';
61-
import { getReleaseKvList } from '../../../../../../../../api/config';
61+
import { getKvList, getReleaseKvList } from '../../../../../../../../api/config';
6262
import SearchInput from '../../../../../../../../components/search-input.vue';
6363
import tableEmpty from '../../../../../../../../components/table/table-empty.vue';
6464
@@ -164,10 +164,20 @@
164164
if (typeof releaseId !== 'number') {
165165
return [];
166166
}
167-
const res = await getReleaseKvList(bkBizId.value, Number(currentAppId), releaseId, {
168-
start: 0,
169-
all: true,
170-
});
167+
let res;
168+
if (releaseId === 0) {
169+
// 未命名版本
170+
res = await getKvList(bkBizId.value, Number(currentAppId), {
171+
start: 0,
172+
all: true,
173+
});
174+
} else {
175+
res = await getReleaseKvList(bkBizId.value, Number(currentAppId), releaseId, {
176+
start: 0,
177+
all: true,
178+
});
179+
}
180+
171181
return res.details;
172182
};
173183

ui/src/views/space/service/detail/config/config-list/config-table-list/tables/table-with-kv.vue

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,26 @@
109109
@click="handleEditOrView(row, index)">
110110
{{ versionData.id === 0 ? t('编辑') : t('查看') }}
111111
</bk-button>
112-
<bk-button
113-
v-cursor="{ active: !hasEditServicePerm }"
114-
v-if="row.kv_state === 'REVISE'"
115-
:class="{ 'bk-text-with-no-perm': !hasEditServicePerm }"
116-
:disabled="!hasEditServicePerm"
117-
text
118-
theme="primary"
119-
@click="handleUnModify(row, index)">
120-
{{ t('撤销') }}
121-
</bk-button>
112+
<template v-if="row.kv_state === 'REVISE'">
113+
<bk-button
114+
v-if="row.kv_state === 'REVISE'"
115+
:disabled="!hasEditServicePerm"
116+
text
117+
theme="primary"
118+
@click="handleDiff(row)">
119+
{{ t('对比') }}
120+
</bk-button>
121+
<bk-button
122+
v-cursor="{ active: !hasEditServicePerm }"
123+
v-if="row.kv_state === 'REVISE'"
124+
:class="{ 'bk-text-with-no-perm': !hasEditServicePerm }"
125+
:disabled="!hasEditServicePerm"
126+
text
127+
theme="primary"
128+
@click="handleUnModify(row, index)">
129+
{{ t('撤销') }}
130+
</bk-button>
131+
</template>
122132
<bk-button
123133
v-if="versionData.status.publish_status !== 'editing'"
124134
text

ui/src/views/space/service/detail/config/config-list/config-table-list/tables/table-with-templates.vue

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,25 @@
135135
@click="handleEditOpen(item, itemIndex)">
136136
{{ t('编辑') }}
137137
</bk-button>
138-
<bk-button
139-
v-if="item.file_state === 'REVISE'"
140-
v-cursor="{ active: !hasEditServicePerm }"
141-
text
142-
theme="primary"
143-
:class="{ 'bk-text-with-no-perm': !hasEditServicePerm }"
144-
:disabled="!hasEditServicePerm"
145-
@click="handleUnModify(item, itemIndex)">
146-
{{ t('撤销') }}
147-
</bk-button>
138+
<template v-if="item.file_state === 'REVISE'">
139+
<bk-button
140+
v-cursor="{ active: !hasEditServicePerm }"
141+
text
142+
theme="primary"
143+
:disabled="!hasEditServicePerm"
144+
@click="handleConfigDiff(group.id, item)">
145+
{{ t('对比') }}
146+
</bk-button>
147+
<bk-button
148+
v-cursor="{ active: !hasEditServicePerm }"
149+
text
150+
theme="primary"
151+
:class="{ 'bk-text-with-no-perm': !hasEditServicePerm }"
152+
:disabled="!hasEditServicePerm"
153+
@click="handleUnModify(item, itemIndex)">
154+
{{ t('撤销') }}
155+
</bk-button>
156+
</template>
148157
<DownloadConfigBtn
149158
type="config"
150159
:bk-biz-id="props.bkBizId"
@@ -1137,7 +1146,7 @@
11371146
width: 140px;
11381147
}
11391148
.operation {
1140-
width: 150px;
1149+
width: 200px;
11411150
}
11421151
.exception-tips {
11431152
margin: 20px 0;

0 commit comments

Comments
 (0)