Skip to content
Snippets Groups Projects
Commit f234b758 authored by Ryo Yamashita's avatar Ryo Yamashita Committed by Yas Naoi
Browse files

Issue #3269021 by Ryo Yamashita, yas: Add a new EntityColumn's type in Cloud Dashboard (json-table)

parent a2beaa70
Branches
Tags
6 merge requests!1759Issue #3356778: Release 5.1.1,!1679Issue #3349074: Fix the OpenStack Project create and edit form in SPA that "Member" cannot be saved due to a validation error,!1607Issue #3343582: Add the function to preview OpenStack stack in the SPA,!1032Issue #3284576: Release 5.0.0-alpha2,!832Issue #3274116: Refactor composer.json to use docomoinnovations/drupal-extension,!781Issue #3269930: Add a BDD test suite for checking no resources created by administrator
...@@ -49,6 +49,7 @@ import OPENSTACK_NETWORK_INTERFACE_TEMPLATE from 'constant/entity_info_template/ ...@@ -49,6 +49,7 @@ import OPENSTACK_NETWORK_INTERFACE_TEMPLATE from 'constant/entity_info_template/
import OPENSTACK_KEY_PAIR_TEMPLATE from 'constant/entity_info_template/openstack/key_pair'; import OPENSTACK_KEY_PAIR_TEMPLATE from 'constant/entity_info_template/openstack/key_pair';
import OPENSTACK_VOLUME_TEMPLATE from 'constant/entity_info_template/openstack/volume'; import OPENSTACK_VOLUME_TEMPLATE from 'constant/entity_info_template/openstack/volume';
import OPENSTACK_SNAPSHOT_TEMPLATE from 'constant/entity_info_template/openstack/snapshot'; import OPENSTACK_SNAPSHOT_TEMPLATE from 'constant/entity_info_template/openstack/snapshot';
import VMWARE_VM_TEMPLATE from 'constant/entity_info_template/vmware/vm';
const ENTITY_INFO_LIST = [ const ENTITY_INFO_LIST = [
AWS_CLOUD_INSTANCE_TEMPLATE, AWS_CLOUD_INSTANCE_TEMPLATE,
...@@ -102,6 +103,7 @@ const ENTITY_INFO_LIST = [ ...@@ -102,6 +103,7 @@ const ENTITY_INFO_LIST = [
OPENSTACK_KEY_PAIR_TEMPLATE, OPENSTACK_KEY_PAIR_TEMPLATE,
OPENSTACK_VOLUME_TEMPLATE, OPENSTACK_VOLUME_TEMPLATE,
OPENSTACK_SNAPSHOT_TEMPLATE, OPENSTACK_SNAPSHOT_TEMPLATE,
VMWARE_VM_TEMPLATE,
]; ];
export const UPPERCASE_WORD_SET = new Set([ export const UPPERCASE_WORD_SET = new Set([
......
import EntityInfoTemplate from 'model/EntityInfoTemplate';
// Template for displaying detailed information about entities in VMware.
const VMWARE_VM_TEMPLATE: EntityInfoTemplate = {
cloudServiceProvider: 'vmware',
entityName: 'vm',
entityRecords: [
{
panelName: 'Tag Information',
tableRecordList: [],
keyValueRecords: [
{ labelName: 'Tag Categories', name: 'tag_categories', type: 'json-table', column: [
{ labelName: 'ID', name: 'id', type: 'default' },
{ labelName: 'Associable Types', name: 'associable_types', type: 'array' },
{ labelName: 'Name', name: 'name', type: 'default' },
{ labelName: 'Description', name: 'description', type: 'default' },
{ labelName: 'Used By', name: 'used_by', type: 'array' },
{ labelName: 'Cardinality', name: 'cardinality', type: 'default' },
] },
]
},
]
};
export default VMWARE_VM_TEMPLATE;
...@@ -39,6 +39,11 @@ type EntityColumn = { ...@@ -39,6 +39,11 @@ type EntityColumn = {
name: string; name: string;
type: 'conditions'; type: 'conditions';
value: [string, string]; value: [string, string];
} | {
labelName: string;
name: string;
type: 'json-table';
column: EntityColumn[]
}; };
export default EntityColumn; export default EntityColumn;
...@@ -100,6 +100,39 @@ const EntityInfoPage = ({ entityInfoTemplate }: { ...@@ -100,6 +100,39 @@ const EntityInfoPage = ({ entityInfoTemplate }: {
continue; continue;
} }
if (keyValueRecord.type === 'json-table') {
// type: 'json-table'
const entityColumnList = keyValueRecord.column;
const keyVal: Record<string, string>[] = [];
for (const record of entityData.attributes[keyValueRecord.name]) {
const record2: {
item_key: string,
item_value: string
} = record;
const record3: Record<string, any> = JSON.parse(record2.item_value);
const temp: Record<string, string> = {};
for (const entityColumn of entityColumnList) {
if (entityColumn.name in record3) {
const convertedText = convertDataForUI(
record3[entityColumn.name],
entityColumn,
dataCache
);
temp[entityColumn.name] = convertedText;
}
}
keyVal.push(temp);
}
newPanelData.records.push({
type: 'table',
title: keyValueRecord.labelName,
record: keyVal
});
continue;
}
if (infoRecord.tableRecordList.includes(keyValueRecord.name)) { if (infoRecord.tableRecordList.includes(keyValueRecord.name)) {
// type: 'table' // type: 'table'
const keyVal: Record<string, string>[] = []; const keyVal: Record<string, string>[] = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment