Skip to content

feat(frontend): 部署单据支持再次提单 #10058 #10220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4399,5 +4399,7 @@
"请选择标签": "请选择标签",
"编辑集群别名": "编辑集群别名",
"目标分区异常": "目标分区异常",
"SQLServer 起始端口": "SQLServer 起始端口",
"每台主机 oplog 容量占比": "每台主机 oplog 容量占比",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { HostInfo } from '@services/types';
import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
cluster_alias: string;
cluster_name: string;
Expand All @@ -19,9 +21,9 @@ export interface Apply extends DetailBase {
};
query_port: number;
resource_spec?: {
cold: SpecInfo;
cold?: SpecInfo;
follower: SpecInfo;
hot: SpecInfo;
observer: SpecInfo;
hot?: SpecInfo;
observer?: SpecInfo;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { HostInfo } from '@services/types';
import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
cluster_alias: string;
cluster_name: string;
Expand All @@ -18,9 +20,9 @@ export interface Apply extends DetailBase {
master: HostInfo[];
};
resource_spec: {
client: SpecInfo;
cold: SpecInfo;
hot: SpecInfo;
client?: SpecInfo;
cold?: SpecInfo;
hot?: SpecInfo;
master: SpecInfo;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { HostInfo } from '@services/types';
import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
cluster_alias: string;
cluster_name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { HostInfo } from '@services/types';
import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
cluster_alias: string;
cluster_name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DetailBase, SpecInfo } from '../common';

export interface ReplicasetApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
cap_spec: string;
city_code: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DetailBase, SpecInfo } from '../common';

export interface ShardApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
cap_key: string;
cap_spec: string;
Expand All @@ -22,4 +23,5 @@ export interface ShardApply extends DetailBase {
mongos: SpecInfo;
};
start_port: number;
sub_zone_ids: string[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import type { DetailBase, SpecInfo } from '../common';

export interface HaApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
charset: string;
city_code: string;
city_name: string;
cluster_count: number;
db_app_abbr: string;
db_module_id: number;
db_module_name: string;
db_version: string;
Expand All @@ -22,7 +24,6 @@ export interface HaApply extends DetailBase {
proxy: { bk_cloud_id: number; bk_host_id: number; ip: string }[];
};
resource_spec?: {
backend: SpecInfo;
backend_group: SpecInfo;
proxy: SpecInfo;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import type { DetailBase, SpecInfo } from '../common';

export interface SingleApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
charset: string;
city_code: string;
city_name: string;
cluster_count: number;
db_app_abbr: string;
db_module_id: number;
db_module_name: string;
db_version: string;
disaster_tolerance_level: string;
domains: {
key: string;
master: string;
Expand All @@ -18,11 +21,10 @@ export interface SingleApply extends DetailBase {
nodes?: {
backend: { bk_cloud_id: number; bk_host_id: number; ip: string }[];
};
resource_spec: {
resource_spec?: {
backend: SpecInfo;
};
spec: string;
spec_display: string;
start_mysql_port: number;
start_proxy_port: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
ack_quorum: number;
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
cluster_alias: string;
cluster_name: string;
Expand All @@ -18,7 +20,7 @@ export interface Apply extends DetailBase {
password: string;
port: number;
replication_num: number;
resource_spec: {
resource_spec?: {
bookkeeper: SpecInfo;
broker: SpecInfo;
zookeeper: SpecInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { DetailBase, SpecInfo } from '../common';

export interface ClusterApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
cap_key: string;
cap_spec: string;
city_code: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import type { DetailBase, SpecInfo } from '../common';
export interface InsApply extends DetailBase {
append_apply: boolean; // 是否是追加部署
bk_cloud_id: number;
bk_cloud_name: string;
city_code?: string; // 追加就非必填
cluster_type: string;
db_app_abbr: string;
db_version?: string; // 追加就非必填
disaster_tolerance_level: string;
infos: {
Expand All @@ -24,9 +26,11 @@ export interface InsApply extends DetailBase {
cluster_name: string;
databases: number;
}[];
ip_source: string;
port?: number; // 追加就非必填
redis_pwd: string;
// 如果是新部署,则一定从资源池部署
resource_spec: {
resource_spec?: {
backend_group: SpecInfo;
};
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import type { DetailBase, SpecInfo } from '../common';

export interface Apply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
city_code: string;
city_name: string;
cluster_alias: string;
cluster_name: string;
db_app_abbr: string;
db_module_id: number;
db_module_name: string;
db_version: string;
disaster_tolerance_level: string;
ip_source: string;
nodes?: {
riak: {
Expand All @@ -16,7 +20,7 @@ export interface Apply extends DetailBase {
ip: string;
}[];
};
resource_spec: {
resource_spec?: {
riak: SpecInfo;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import type { DetailBase, SpecInfo } from '../common';

export interface HaApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
charset: string;
city_code: string;
city_name: string;
cluster_count: number;
db_app_abbr: string;
db_module_id: number;
db_module_name: string;
db_version: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import type { DetailBase, SpecInfo } from '../common';

export interface SingleApply extends DetailBase {
bk_cloud_id: number;
bk_cloud_name: string;
charset: string;
city_code: string;
city_name: string;
cluster_count: number;
db_app_abbr: string;
db_module_id: number;
db_module_name: string;
db_version: string;
disaster_tolerance_level: string;
domains: {
key: string;
master: string;
Expand All @@ -27,7 +30,6 @@ export interface SingleApply extends DetailBase {
};
resource_spec?: {
backend: SpecInfo;
backend_group: SpecInfo;
};
spec: string;
spec_display: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@
);

watch(
() => [bizId.value, bizList.value],
[bizId, bizList],
() => {
currentBiz.value = _.find(bizList.value, (item) => item.bk_biz_id === bizId.value);
const englishName = currentBiz.value?.english_name;
hasEnglishName.value = !!englishName;
appAbbr.value = englishName ?? '';
// 从申请实例 跳转过来,需要同步数据出去
if (route.query.bizId && currentBiz.value) {
// 从申请实例 跳转过来,或单据克隆,需要同步数据出去
if ((route.query.bizId || route.query.ticketType) && currentBiz.value) {
handleAppChange(currentBiz.value);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,26 @@

const { t } = useI18n();

const MIN_COUNT = 2;

const isAllCheck = ref(true);
const subZone = ref<number>(0);
const subZones = ref([]);
const subZones = ref([] as number[]);

if (modelValue.value) {
if (modelValue.value.length >= MIN_COUNT) {
subZones.value = modelValue.value;
isAllCheck.value = false;
} else if (modelValue.value.length === 1) {
[subZone.value] = modelValue.value;
}
}

const rules = [
{
required: true,
trigger: 'change',
validator: (value: number[]) => {
const MIN_COUNT = 2;

if (max.value === 1) {
return value.length > 0 ? true : Promise.resolve(t('园区不能为空'));
}
Expand Down
37 changes: 36 additions & 1 deletion dbm-ui/frontend/src/views/db-manage/doris/apply/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,10 @@
import _ from 'lodash';
import { useI18n } from 'vue-i18n';

import type { Doris } from '@services/model/ticket/ticket';
import type { BizItem, HostInfo } from '@services/types';

import { useApplyBase } from '@hooks';
import { useApplyBase, useTicketDetail } from '@hooks';

import { Affinity, DBTypes, TicketTypes } from '@common/const';

Expand All @@ -409,6 +410,40 @@
const router = useRouter();
const { t } = useI18n();

useTicketDetail<Doris.Apply>(TicketTypes.DORIS_APPLY, {
onSuccess(ticketDetail) {
const { details } = ticketDetail;

Object.assign(formData, {
bk_biz_id: ticketDetail.bk_biz_id,
remark: ticketDetail.remark,
});
Object.assign(formData.details, {
bk_cloud_id: details.bk_cloud_id,
city_code: details.city_code,
cluster_alias: details.cluster_alias,
cluster_name: details.cluster_name,
db_version: details.db_version,
disaster_tolerance_level: details.disaster_tolerance_level,
http_port: details.http_port,
ip_source: details.ip_source,
query_port: details.query_port,
});

if (details.ip_source === 'resource_pool') {
const resourceSpec = Object.entries(details.resource_spec!).reduce((prev, [specType, specInfo]) => {
return Object.assign(prev, {
[specType]: {
count: specInfo.count,
spec_id: specInfo.spec_id,
},
});
}, {});
Object.assign(formData.details.resource_spec, resourceSpec);
}
},
});

const makeMapByHostId = (hostList: HostInfo[]) =>
hostList.reduce(
(result, item) => ({
Expand Down
Loading
Loading