Skip to content

Commit

Permalink
feat(frontend): 支持故障池、待回收池 #7881
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 26506
  • Loading branch information
royalpioneer committed Dec 11, 2024
1 parent da77f11 commit 3ee35e5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 52 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3750,5 +3750,6 @@
"从n业务CMDB空闲机模块导入": "从「{0}」业务 CMDB 空闲机模块导入",
"清空主机现有的所属 DB 和标签,重新进行设置": "清空主机现有的所属 DB 和标签,重新进行设置",
"清空主机现有的所属业务、所属 DB 、标签,重新进行设置": "清空主机现有的所属业务、所属 DB 、标签,重新进行设置",
"添加属性": "添加属性",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@
v-bk-tooltips="t('复制')"
type="copy"
@click="handleCopy(hostItem)" />
<DbIcon
v-bk-tooltips="t('删除')"
style="font-size: 16px"
type="close"
@click="handleRemove(hostItem)" />
</div>
</div>
<BkException
Expand Down Expand Up @@ -133,18 +128,6 @@
copy(hostItem.ip);
};

// 删除单个主机
const handleRemove = (hostItem: DbResourceModel) => {
const hostListResult = hostList.value.reduce<DbResourceModel[]>((result, item) => {
if (item.bk_host_id !== hostItem.bk_host_id) {
result.push(item);
}
return result;
}, []);

hostList.value = hostListResult;
};

defineExpose<Expose>({
getValue() {
return formRef.value.validate().then(() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
required>
<BkSelect
v-model="formData.for_biz"
:allow-empty-values="[0]">
:allow-empty-values="[0]"
:disabled="isBusiness">
<BkOption
v-for="bizItem in bizList"
:key="bizItem.bk_biz_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@
v-bk-tooltips="t('复制')"
type="copy"
@click="handleCopy(hostItem)" />
<DbIcon
v-bk-tooltips="t('删除')"
style="font-size: 16px"
type="close"
@click="handleRemove(hostItem)" />
</div>
</div>
<BkException
Expand Down Expand Up @@ -133,18 +128,6 @@
copy(hostItem.ip);
};

// 删除单个主机
const handleRemove = (hostItem: DbResourceModel) => {
const hostListResult = hostList.value.reduce<DbResourceModel[]>((result, item) => {
if (item.bk_host_id !== hostItem.bk_host_id) {
result.push(item);
}
return result;
}, []);

hostList.value = hostListResult;
};

defineExpose<Expose>({
getValue() {
return formRef.value.validate().then(() => ({
Expand All @@ -163,14 +146,14 @@
flex-direction: column;

.title {
display: flex;
padding: 8px 12px 10px 24px;
font-weight: 700;
font-size: 12px;
font-weight: 700;
color: #313238;
background: #ffffff;
background: #fff;
border: 1px solid #dcdee5;
border-radius: 0 2px 2px 0;
display: flex;

.host-action {
display: flex;
Expand All @@ -192,13 +175,13 @@

.host-header {
display: flex;
align-items: center;
padding: 0 24px;
margin-top: 14px;
margin-bottom: 4px;
font-size: 12px;
line-height: 24px;
color: #63656e;
font-size: 12px;
align-items: center;
}

.host-list {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<BkButton
text
theme="primary">
<DbIcon type="plus-circle" />添加条件
<DbIcon type="plus-circle" /> {{ t('添加属性') }}
</BkButton>
</template>
<BkOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
import { fetchListDbaHost } from '@services/source/dbresourceResource';
import type { HostInfo } from '@services/types';

import { useGlobalBizs } from '@stores';
import { useGlobalBizs, useSystemEnviron } from '@stores';

import DbStatus from '@components/db-status/index.vue';

Expand All @@ -103,14 +103,16 @@
const emits = defineEmits<Emits>();
const route = useRoute();
const globalBizsStore = useGlobalBizs();
const systemEnvironStore = useSystemEnviron();

const isBusiness = route.name === 'BizResourcePool';

const { t } = useI18n();

const tableRef = ref();
const searchContent = ref('');
const bizId = ref(globalBizsStore.currentBizId);
const bizId = ref(isBusiness ? globalBizsStore.currentBizId : systemEnvironStore.urls.DBA_APP_BK_BIZ_ID);

const isBusiness = route.name === 'BizResourcePool';
const tableColumn = [
{
label: 'IP',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
const { results } = await runAsyncList({
ids: props.defaultValue,
});
tagList.value.push(...results);
tagList.value = uniqBy([...tagList.value, ...results], 'value');
}
},
{
Expand All @@ -86,10 +86,10 @@
});
const loadMore = () => {
if (tagList.value.length >= pagination.count || isLoading.value) {
if (pagination.offset >= pagination.count || isLoading.value) {
return;
}
pagination.offset += pagination.limit;
pagination.offset = Math.min(pagination.count, pagination.offset + pagination.limit);
runList({
...pagination,
value: searchVal.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
name="resource_type"
@change="handleChange" />
<ComFactory
:ref="(el: any) => initInputRefCallback(el, 'bk_cloud_ids')"
:ref="(el: any) => initInputRefCallback(el, 'label')"
:model="localValueMemo"
name="bk_cloud_ids"
name="labels"
@change="handleChange" />
<ComFactory
:ref="(el: any) => initInputRefCallback(el, 'agent_status')"
Expand Down Expand Up @@ -72,9 +72,9 @@
name="mem"
@change="handleChange" />
<ComFactory
:ref="(el: any) => initInputRefCallback(el, 'label')"
:ref="(el: any) => initInputRefCallback(el, 'bk_cloud_ids')"
:model="localValueMemo"
name="labels"
name="bk_cloud_ids"
@change="handleChange" />
</div>
<div class="row">
Expand Down Expand Up @@ -165,7 +165,7 @@
os_type: true,
cpu: true,
mem: true,
labels: true,
bk_cloud_ids: true,
mount_point: true,
disk: true,
disk_type: true,
Expand Down

0 comments on commit 3ee35e5

Please sign in to comment.