fix keypair showing in magnum service
If the keypair was deleted, show xxx (the resource has been deleted) Closes-Bug: #2004545 Change-Id: Ibe812917fbdd158a167c18abd2ac5713f743f9c4
This commit is contained in:
parent
021bde48ef
commit
c5953f174a
@ -165,13 +165,13 @@ export class BaseDetail extends Base {
|
|||||||
original_image_id,
|
original_image_id,
|
||||||
image: { name: imageName } = {},
|
image: { name: imageName } = {},
|
||||||
keypair_id,
|
keypair_id,
|
||||||
|
original_keypair_id,
|
||||||
flavor_id,
|
flavor_id,
|
||||||
original_flavor_id,
|
original_flavor_id,
|
||||||
flavor: { name: flavorName } = {},
|
flavor: { name: flavorName } = {},
|
||||||
master_flavor_id,
|
master_flavor_id,
|
||||||
original_master_flavor_id,
|
original_master_flavor_id,
|
||||||
masterFlavor: { name: masterFlavorName } = {},
|
masterFlavor: { name: masterFlavorName } = {},
|
||||||
selfKeypair,
|
|
||||||
} = this.detailData;
|
} = this.detailData;
|
||||||
const imageUrl = original_image_id
|
const imageUrl = original_image_id
|
||||||
? `${original_image_id} (${t('The resource has been deleted')})`
|
? `${original_image_id} (${t('The resource has been deleted')})`
|
||||||
@ -181,12 +181,13 @@ export class BaseDetail extends Base {
|
|||||||
})
|
})
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
const keypairUrl =
|
const keypairUrl = original_keypair_id
|
||||||
keypair_id && selfKeypair
|
? `${original_keypair_id} (${t('The resource has been deleted')})`
|
||||||
? this.getLinkRender('keypairDetail', keypair_id, {
|
: keypair_id
|
||||||
id: keypair_id,
|
? this.getLinkRender('keypairDetail', keypair_id, {
|
||||||
})
|
id: keypair_id,
|
||||||
: keypair_id || '-';
|
})
|
||||||
|
: '-';
|
||||||
|
|
||||||
const flavorUrl = original_flavor_id
|
const flavorUrl = original_flavor_id
|
||||||
? `${original_flavor_id} (${t('The resource has been deleted')})`
|
? `${original_flavor_id} (${t('The resource has been deleted')})`
|
||||||
|
@ -106,14 +106,16 @@ export class StepNetwork extends Base {
|
|||||||
http_proxy,
|
http_proxy,
|
||||||
https_proxy,
|
https_proxy,
|
||||||
no_proxy,
|
no_proxy,
|
||||||
externalNetwork: {
|
|
||||||
selectedRowKeys: [external_network_id],
|
|
||||||
selectedRows: [externalNetwork],
|
|
||||||
},
|
|
||||||
dns_nameserver,
|
dns_nameserver,
|
||||||
master_lb_enabled,
|
master_lb_enabled,
|
||||||
floating_ip_enabled,
|
floating_ip_enabled,
|
||||||
};
|
};
|
||||||
|
if (external_network_id) {
|
||||||
|
values.externalNetwork = {
|
||||||
|
selectedRowKeys: [external_network_id],
|
||||||
|
selectedRows: [externalNetwork],
|
||||||
|
};
|
||||||
|
}
|
||||||
if (fixed_network) {
|
if (fixed_network) {
|
||||||
values.fixedNetwork = fixedNetworkContext || {
|
values.fixedNetwork = fixedNetworkContext || {
|
||||||
selectedRowKeys: [fixed_network],
|
selectedRowKeys: [fixed_network],
|
||||||
|
@ -101,9 +101,11 @@ export class BaseDetail extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get miscellaneousCard() {
|
get miscellaneousCard() {
|
||||||
const { keypair } = this.detailData;
|
const { original_keypair, keypair } = this.detailData;
|
||||||
|
|
||||||
const keypairUrl = keypair
|
const keypairUrl = original_keypair
|
||||||
|
? `${original_keypair} (${t('The resource has been deleted')})`
|
||||||
|
: keypair
|
||||||
? this.getLinkRender('keypairDetail', keypair, {
|
? this.getLinkRender('keypairDetail', keypair, {
|
||||||
id: keypair,
|
id: keypair,
|
||||||
})
|
})
|
||||||
|
@ -93,8 +93,7 @@ export class StepNodeSpec extends Base {
|
|||||||
const {
|
const {
|
||||||
context: { keypair, masterFlavor, flavor, master_count, node_count } = {},
|
context: { keypair, masterFlavor, flavor, master_count, node_count } = {},
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { master_flavor_id, flavor_id, keypair_id, selfKeypair } =
|
const { master_flavor_id, flavor_id, keypair_id } = this.templateDetail;
|
||||||
this.templateDetail;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
master_count: master_count || 1,
|
master_count: master_count || 1,
|
||||||
@ -110,7 +109,7 @@ export class StepNodeSpec extends Base {
|
|||||||
selectedRows: this.flavors.filter((it) => it.id === flavor_id),
|
selectedRows: this.flavors.filter((it) => it.id === flavor_id),
|
||||||
},
|
},
|
||||||
keypair: keypair || {
|
keypair: keypair || {
|
||||||
selectedRowKeys: keypair_id && selfKeypair ? [keypair_id] : [],
|
selectedRowKeys: keypair_id ? [keypair_id] : [],
|
||||||
selectedRows: this.keypairs.filter((it) => it.id === keypair_id),
|
selectedRows: this.keypairs.filter((it) => it.id === keypair_id),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -121,12 +120,10 @@ export class StepNodeSpec extends Base {
|
|||||||
context: { clusterTemplate = {}, keypair, masterFlavor, flavor } = {},
|
context: { clusterTemplate = {}, keypair, masterFlavor, flavor } = {},
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { selectedRows = [] } = clusterTemplate;
|
const { selectedRows = [] } = clusterTemplate;
|
||||||
const { master_flavor_id, flavor_id, keypair_id, selfKeypair } =
|
const { master_flavor_id, flavor_id, keypair_id } = selectedRows[0] || {};
|
||||||
selectedRows[0] || {};
|
|
||||||
const { initKeyPair = keypair } = this.state;
|
const { initKeyPair = keypair } = this.state;
|
||||||
const templateHasSelfKeypair = keypair_id && selfKeypair;
|
|
||||||
const templateInitKeypair = {
|
const templateInitKeypair = {
|
||||||
selectedRowKeys: keypair_id && selfKeypair ? [keypair_id] : [],
|
selectedRowKeys: keypair_id ? [keypair_id] : [],
|
||||||
selectedRows: this.keypairs.filter((it) => it.id === keypair_id),
|
selectedRows: this.keypairs.filter((it) => it.id === keypair_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -148,8 +145,7 @@ export class StepNodeSpec extends Base {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
data: this.keypairs,
|
data: this.keypairs,
|
||||||
initValue:
|
initValue: initKeyPair || templateInitKeypair,
|
||||||
initKeyPair || (templateHasSelfKeypair && templateInitKeypair),
|
|
||||||
isLoading: this.keyPairStore.list.isLoading,
|
isLoading: this.keyPairStore.list.isLoading,
|
||||||
header: getKeyPairHeader(this),
|
header: getKeyPairHeader(this),
|
||||||
tip: t(
|
tip: t(
|
||||||
|
@ -42,8 +42,8 @@ export const getBaseTemplateColumns = (self) => [
|
|||||||
isHideable: true,
|
isHideable: true,
|
||||||
dataIndex: 'keypair_id',
|
dataIndex: 'keypair_id',
|
||||||
hidden: self.isAdminPage,
|
hidden: self.isAdminPage,
|
||||||
render: (value, row) => {
|
render: (value) => {
|
||||||
if (value && row.selfKeypair) {
|
if (value) {
|
||||||
return self.getLinkRender('keypairDetail', value, { id: value });
|
return self.getLinkRender('keypairDetail', value, { id: value });
|
||||||
}
|
}
|
||||||
return value || '-';
|
return value || '-';
|
||||||
|
@ -92,8 +92,9 @@ export class ClusterTemplatesStore extends Base {
|
|||||||
const { keypairs = [] } = (await client.nova.keypairs.list()) || {};
|
const { keypairs = [] } = (await client.nova.keypairs.list()) || {};
|
||||||
return newData.map((it) => {
|
return newData.map((it) => {
|
||||||
const keypair = keypairs.find((k) => k?.keypair?.name === it.keypair_id);
|
const keypair = keypairs.find((k) => k?.keypair?.name === it.keypair_id);
|
||||||
if (keypair) {
|
if (!keypair) {
|
||||||
it.selfKeypair = true;
|
it.original_keypair_id = it.keypair_id;
|
||||||
|
it.keypair_id = null;
|
||||||
}
|
}
|
||||||
return it;
|
return it;
|
||||||
});
|
});
|
||||||
@ -119,8 +120,9 @@ export class ClusterTemplatesStore extends Base {
|
|||||||
const keypair = keypairs.find(
|
const keypair = keypairs.find(
|
||||||
(k) => k?.keypair?.name === item.keypair_id
|
(k) => k?.keypair?.name === item.keypair_id
|
||||||
);
|
);
|
||||||
if (keypair) {
|
if (!keypair) {
|
||||||
item.selfKeypair = true; // Don't need to reset keypair_id to null if not matched
|
item.original_keypair_id = item.keypair_id;
|
||||||
|
item.keypair_id = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fr.status === 'fulfilled') {
|
if (fr.status === 'fulfilled') {
|
||||||
|
@ -61,6 +61,23 @@ export class ClustersStore extends Base {
|
|||||||
return this.client.resize(id, newbody);
|
return this.client.resize(id, newbody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async listDidFetch(items, _, filters) {
|
||||||
|
if (!items.length) return items;
|
||||||
|
const { shouldFetchProject } = filters;
|
||||||
|
const newData = await this.listDidFetchProject(items, {
|
||||||
|
all_projects: shouldFetchProject,
|
||||||
|
});
|
||||||
|
const { keypairs = [] } = (await client.nova.keypairs.list()) || {};
|
||||||
|
return newData.map((it) => {
|
||||||
|
const keypair = keypairs.find((k) => k?.keypair?.name === it.keypair);
|
||||||
|
if (!keypair) {
|
||||||
|
it.original_keypair = it.keypair;
|
||||||
|
it.keypair = null;
|
||||||
|
}
|
||||||
|
return it;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async detailDidFetch(item) {
|
async detailDidFetch(item) {
|
||||||
const template =
|
const template =
|
||||||
(await this.templateClient.show(item.cluster_template_id)) || {};
|
(await this.templateClient.show(item.cluster_template_id)) || {};
|
||||||
@ -75,13 +92,23 @@ export class ClustersStore extends Base {
|
|||||||
const masterFlavorId = item.master_flavor_id || templateMasterFlavorId;
|
const masterFlavorId = item.master_flavor_id || templateMasterFlavorId;
|
||||||
const fixedNetworkId = item.fixed_network || templateFixedNetworkId;
|
const fixedNetworkId = item.fixed_network || templateFixedNetworkId;
|
||||||
const fixedSubnetId = item.fixed_subnet || templateSubnetId;
|
const fixedSubnetId = item.fixed_subnet || templateSubnetId;
|
||||||
const [fr = {}, mfr = {}, fx = {}, sub = {}, stack] = await allSettled([
|
const [kp = {}, fr = {}, mfr = {}, fx = {}, sub = {}, stack] =
|
||||||
flavorId ? this.flavorClient.show(flavorId) : {},
|
await allSettled([
|
||||||
masterFlavorId ? this.flavorClient.show(masterFlavorId) : {},
|
client.nova.keypairs.list(),
|
||||||
fixedNetworkId ? this.networkClient.show(fixedNetworkId) : {},
|
flavorId ? this.flavorClient.show(flavorId) : {},
|
||||||
fixedSubnetId ? this.subnetClient.show(fixedSubnetId) : {},
|
masterFlavorId ? this.flavorClient.show(masterFlavorId) : {},
|
||||||
item.stack_id ? this.stackClient.list({ id: item.stack_id }) : {},
|
fixedNetworkId ? this.networkClient.show(fixedNetworkId) : {},
|
||||||
]);
|
fixedSubnetId ? this.subnetClient.show(fixedSubnetId) : {},
|
||||||
|
item.stack_id ? this.stackClient.list({ id: item.stack_id }) : {},
|
||||||
|
]);
|
||||||
|
if (kp.status === 'fulfilled') {
|
||||||
|
const { keypairs = [] } = kp.value;
|
||||||
|
const keypair = keypairs.find((k) => k?.keypair?.name === item.keypair);
|
||||||
|
if (!keypair) {
|
||||||
|
item.original_keypair = item.keypair;
|
||||||
|
item.keypair = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (fr.status === 'fulfilled') {
|
if (fr.status === 'fulfilled') {
|
||||||
const { flavor } = fr.value;
|
const { flavor } = fr.value;
|
||||||
item.flavor = flavor;
|
item.flavor = flavor;
|
||||||
|
Loading…
Reference in New Issue
Block a user