[8.4] [Session view][BugFix]Updated orchestrator.parent.type to orchestrator.resource.parent.type in details panel (#138841) (#138944)

* updated field names for Orchestrator Accordion on details panel

* eslint auto-fix

* addressing PR comments

* addressing more comments

(cherry picked from commit a630dafae4)

Co-authored-by: Rickyanto Ang <rickyangwyn@gmail.com>
This commit is contained in:
Kibana Machine 2022-08-16 14:53:53 -04:00 committed by GitHub
parent cc66d5bfed
commit a1d7d13a1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 38 deletions

View file

@ -209,15 +209,15 @@ export interface ProcessEventOrchestrator {
name?: string;
type?: string;
ip?: string;
parent?: {
type?: string;
};
};
namespace?: string;
cluster?: {
name?: string;
id?: string;
};
parent?: {
type?: string;
};
}
export interface ProcessEventCloud {

View file

@ -47,15 +47,15 @@ const MOCK_ORCHESTRATOR_DATA: ProcessEventOrchestrator = {
name: 'pdcsi-node-6hvsp',
type: 'pod',
ip: 'PLACEHOLDER_FOR_RESOURCE.IP',
parent: {
type: 'PLACEHOLDER_FOR_RESOURCE.PARENT.TYPE',
},
},
namespace: 'kube-system',
cluster: {
name: 'elastic-k8s-cluster',
id: 'PLACEHOLDER_FOR_CLUSTER.ID',
},
parent: {
type: 'PLACEHOLDER_FOR_PARENT.TYPE',
},
};
const MOCK_CLOUD_DATA: ProcessEventCloud = {
@ -164,15 +164,15 @@ describe('detail panel host tab helpers tests', () => {
name: undefined,
type: 'pod',
ip: undefined,
parent: {
type: 'PLACEHOLDER_FOR_RESOURCE.PARENT.TYPE',
},
},
namespace: 'kube-system',
cluster: {
name: 'elastic-k8s-cluster',
id: undefined,
},
parent: {
type: 'PLACEHOLDER_FOR_PARENT.TYPE',
},
});
expect(result.resource.name).toEqual(DASH);
expect(result.resource.type).toEqual(MOCK_ORCHESTRATOR_DATA?.resource?.type);
@ -180,7 +180,7 @@ describe('detail panel host tab helpers tests', () => {
expect(result.namespace).toEqual(MOCK_ORCHESTRATOR_DATA?.namespace);
expect(result.cluster.name).toEqual(MOCK_ORCHESTRATOR_DATA?.cluster?.name);
expect(result.cluster.id).toEqual(DASH);
expect(result.parent.type).toEqual(MOCK_ORCHESTRATOR_DATA?.parent?.type);
expect(result.resource.parent.type).toEqual(MOCK_ORCHESTRATOR_DATA?.resource?.parent?.type);
});
it('getOchestratorData returns all data provided', () => {
@ -191,7 +191,7 @@ describe('detail panel host tab helpers tests', () => {
expect(result.namespace).toEqual(MOCK_ORCHESTRATOR_DATA?.namespace);
expect(result.cluster.name).toEqual(MOCK_ORCHESTRATOR_DATA?.cluster?.name);
expect(result.cluster.id).toEqual(MOCK_ORCHESTRATOR_DATA?.cluster?.id);
expect(result.parent.type).toEqual(MOCK_ORCHESTRATOR_DATA?.parent?.type);
expect(result.resource.parent.type).toEqual(MOCK_ORCHESTRATOR_DATA?.resource?.parent?.type);
});
it('getCloudData returns dashes for missing fields', () => {

View file

@ -94,15 +94,15 @@ export const getOrchestratorData = (
name: DASH,
type: DASH,
ip: DASH,
parent: {
type: DASH,
},
},
namespace: DASH,
cluster: {
name: DASH,
id: DASH,
},
parent: {
type: DASH,
},
};
if (!orchestrator) {
@ -115,7 +115,9 @@ export const getOrchestratorData = (
detailPanelOrchestrator.namespace = dataOrDash(orchestrator?.namespace).toString();
detailPanelOrchestrator.cluster.name = dataOrDash(orchestrator?.cluster?.name).toString();
detailPanelOrchestrator.cluster.id = dataOrDash(orchestrator?.cluster?.id).toString();
detailPanelOrchestrator.parent.type = dataOrDash(orchestrator?.parent?.type).toString();
detailPanelOrchestrator.resource.parent.type = dataOrDash(
orchestrator?.resource?.parent?.type
).toString();
return detailPanelOrchestrator;
};

View file

@ -41,9 +41,9 @@ const TEST_ORCHESTRATOR_RESOURCE_NAME = 'pdcsi-node-6hvsp';
const TEST_ORCHESTRATOR_RESOURCE_TYPE = 'pod';
const TEST_ORCHESTRATOR_RESOURCE_IP = 'PLACEHOLDER_FOR_RESOURCE.IP';
const TEST_ORCHESTRATOR_NAMESPACE = 'kube-system';
const TEST_ORCHESTRATOR_PARENT_TYPE = 'elastic-k8s-cluster';
const TEST_ORCHESTRATOR_RESOURCE_PARENT_TYPE = 'elastic-k8s-cluster';
const TEST_ORCHESTRATOR_CLUSTER_ID = 'PLACEHOLDER_FOR_CLUSTER.ID';
const TEST_ORCHESTRATOR_CLUSTER_NAME = 'PLACEHOLDER_FOR_PARENT.TYPE';
const TEST_ORCHESTRATOR_CLUSTER_NAME = 'PLACEHOLDER_FOR_CLUSTER.NAME';
// Cloud data
const TEST_CLOUD_INSTANCE_NAME = 'gke-cluster-1-paulo-default-pool-f0fea4ab-lhx2';
@ -86,15 +86,15 @@ const TEST_ORCHESTRATOR: ProcessEventOrchestrator = {
name: TEST_ORCHESTRATOR_RESOURCE_NAME,
type: TEST_ORCHESTRATOR_RESOURCE_TYPE,
ip: TEST_ORCHESTRATOR_RESOURCE_IP,
parent: {
type: TEST_ORCHESTRATOR_RESOURCE_PARENT_TYPE,
},
},
namespace: TEST_ORCHESTRATOR_NAMESPACE,
cluster: {
name: TEST_ORCHESTRATOR_CLUSTER_NAME,
id: TEST_ORCHESTRATOR_CLUSTER_ID,
},
parent: {
type: TEST_ORCHESTRATOR_PARENT_TYPE,
},
};
const TEST_CLOUD: ProcessEventCloud = {
@ -215,14 +215,14 @@ describe('DetailPanelMetadataTab component', () => {
expect(renderResult.queryByText('resource.type')).toBeVisible();
expect(renderResult.queryByText('resource.ip')).toBeVisible();
expect(renderResult.queryByText('namespace')).toBeVisible();
expect(renderResult.queryByText('parent.type')).toBeVisible();
expect(renderResult.queryByText('resource.parent.type')).toBeVisible();
expect(renderResult.queryByText('cluster.id')).toBeVisible();
expect(renderResult.queryByText('cluster.name')).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_RESOURCE_NAME)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_RESOURCE_TYPE)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_RESOURCE_IP)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_NAMESPACE)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_PARENT_TYPE)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_RESOURCE_PARENT_TYPE)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_CLUSTER_ID)).toBeVisible();
expect(renderResult.queryByText(TEST_ORCHESTRATOR_CLUSTER_NAME)).toBeVisible();

View file

@ -433,6 +433,19 @@ export const DetailPanelMetadataTab = ({
</DetailPanelCopy>
),
},
{
title: <DetailPanelListItem>resource.parent.type</DetailPanelListItem>,
description: (
<DetailPanelCopy
textToCopy={`orchestrator.resource.parent.type: "${orchestratorData.resource.parent.type}"`}
tooltipContent={orchestratorData.resource.parent.type}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{orchestratorData.resource.parent.type}
</EuiTextColor>
</DetailPanelCopy>
),
},
{
title: <DetailPanelListItem>namespace</DetailPanelListItem>,
description: (
@ -472,19 +485,6 @@ export const DetailPanelMetadataTab = ({
</DetailPanelCopy>
),
},
{
title: <DetailPanelListItem>parent.type</DetailPanelListItem>,
description: (
<DetailPanelCopy
textToCopy={`orchestrator.parent.type: "${orchestratorData.parent.type}"`}
tooltipContent={orchestratorData.parent.type}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{orchestratorData.parent.type}
</EuiTextColor>
</DetailPanelCopy>
),
},
]}
/>
</>

View file

@ -107,15 +107,15 @@ export interface DetailPanelOrchestrator {
name: string;
type: string;
ip: string;
parent: {
type: string;
};
};
namespace: string;
cluster: {
name: string;
id: string;
};
parent: {
type: string;
};
}
export interface DetailPanelCloud {