fix: fix the delete permission of volume snapshot

No delete operation in detail page if the snapshot has created some volumes

Change-Id: Iabe91d109c134b256360b377328f2055733ad987
This commit is contained in:
xusongfu 2022-08-23 14:28:48 +08:00
parent 329f810c4d
commit 45178c2e1f
4 changed files with 17 additions and 11 deletions

View File

@ -2140,6 +2140,7 @@
"Snapshot Failed": "Snapshot Failed",
"Snapshot In Progress": "Snapshot In Progress",
"Snapshot Instance": "Snapshot Instance",
"Snapshot Source": "Snapshot Source",
"Snapshots can be converted into volume and used to create an instance from the volume.": "Snapshots can be converted into volume and used to create an instance from the volume.",
"Snapshotting": "Snapshotting",
"Soft Delete Instance": "Soft Delete Instance",

View File

@ -2140,6 +2140,7 @@
"Snapshot Failed": "生成快照失败",
"Snapshot In Progress": "快照进行中",
"Snapshot Instance": "创建云主机快照",
"Snapshot Source": "快照源",
"Snapshots can be converted into volume and used to create an instance from the volume.": "快照可以转换成云硬盘,用于从云硬盘启动云主机。",
"Snapshotting": "创建快照中",
"Soft Delete Instance": "软删除云主机",

View File

@ -24,16 +24,15 @@ export class BaseDetail extends Base {
const options = [
{
label: t('Volume'),
dataIndex: 'volume',
render: (value) => {
dataIndex: 'volume_id',
render: (value, record) => {
if (!value) {
return '-';
}
const { id, name } = value;
const link = this.getLinkRender(
'volumeDetail',
name || id,
{ id },
record.volume_name || value,
{ id: value },
{ tab: 'snapshot' }
);
return link;
@ -41,7 +40,7 @@ export class BaseDetail extends Base {
},
];
return {
title: t('Volume Info'),
title: t('Snapshot Source'),
options,
};
}

View File

@ -52,11 +52,16 @@ export class SnapshotStore extends Base {
return data;
}
async detailDidFetch(item) {
const { volume_id } = item;
const { volume } = await this.volumeClient.show(volume_id);
item.volume = volume;
return item;
async detailDidFetch(item, allProjects) {
const params = {
uuid: item.id,
};
if (allProjects) {
params.all_projects = true;
}
const { volume_snapshots = [] } = await this.listFetchByClient(params);
const { child_volumes = [], volume_name } = volume_snapshots[0] || {};
return { ...item, child_volumes, volume_name };
}
updateParamsSortPage = (params, sortKey, sortOrder) => {