Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

ACLP: add `linode id to label` translation logic for legend rows, add `entities` to `CloudPulseResouces` interface ([#12558](https://github.com/linode/manager/pull/12558))
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ export const getDimensionName = (props: DimensionNameProperties): string => {
return mapResourceIdToName(value, resources);
}

if (key === 'linode_id') {
return (
resources.find((resource) => resource.entities?.[value] !== undefined)
?.entities?.[value] ?? value
);
}

if (key === 'metric_name' && hideMetricName) {
return '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { deepEqual } from '../Utils/FilterBuilder';
import type { Filter, FilterValue } from '@linode/api-v4';

export interface CloudPulseResources {
engineType?: string;
entities?: Record<string, string>;
id: string;
label: string;
region?: string;
Expand Down
1 change: 1 addition & 0 deletions packages/manager/src/mocks/serverHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3171,6 +3171,7 @@ export const handlers = [
metric: {
entity_id: '123',
metric_name: 'average_cpu_usage',
linode_id: '1',
node_id: 'primary-1',
},
values: [
Expand Down
13 changes: 13 additions & 0 deletions packages/manager/src/queries/cloudpulse/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@ export const useResourcesQuery = (
enabled,
select: (resources) => {
return resources.map((resource) => {
const entities: Record<string, string> = {};

// handle separately for firewall resource type
if (resourceType === 'firewall') {
resource.entities?.forEach(
(entity: { id: number; label: string; type: string }) => {
if (entity.type === 'linode') {
entities[String(entity.id)] = entity.label;
}
}
);
}
return {
engineType: resource.engine,
id: String(resource.id),
label: resource.label,
region: resource.region,
regions: resource.regions ? resource.regions : [],
tags: resource.tags,
entities,
};
});
},
Expand Down