Skip to content

Commit 24ccbf9

Browse files
Merge pull request #15772 from vikram-raj/console-4709-public-3
CONSOLE-4709: Remove kebab factory uses from resourceQuota and pod-list pages
2 parents 846beeb + 2f725d8 commit 24ccbf9

File tree

4 files changed

+36
-79
lines changed

4 files changed

+36
-79
lines changed

frontend/packages/console-app/console-extensions.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@
432432
"kind": "VolumeAttributesClass",
433433
"group": "storage.k8s.io"
434434
},
435-
"provider": { "$codeRef": "volumeAttributesClassProvider.useVolumeAttributesClassActionsProvider" }
435+
"provider": {
436+
"$codeRef": "volumeAttributesClassProvider.useVolumeAttributesClassActionsProvider"
437+
}
436438
},
437439
"flags": {
438440
"required": ["VAC_PLATFORM_SUPPORT"]
@@ -528,6 +530,28 @@
528530
"provider": { "$codeRef": "prometheusProvider.usePrometheusActionsProvider" }
529531
}
530532
},
533+
{
534+
"type": "console.action/resource-provider",
535+
"properties": {
536+
"model": {
537+
"group": "",
538+
"version": "v1",
539+
"kind": "ResourceQuota"
540+
},
541+
"provider": { "$codeRef": "defaultProvider.useDefaultActionsProvider" }
542+
}
543+
},
544+
{
545+
"type": "console.action/resource-provider",
546+
"properties": {
547+
"model": {
548+
"group": "quota.openshift.io",
549+
"version": "v1",
550+
"kind": "ClusterResourceQuota"
551+
},
552+
"provider": { "$codeRef": "defaultProvider.useDefaultActionsProvider" }
553+
}
554+
},
531555
{
532556
"type": "console.page/route",
533557
"properties": {
@@ -1286,8 +1310,8 @@
12861310
"kind": "VolumeAttributesClass"
12871311
}
12881312
},
1289-
"flags": {
1290-
"required": ["VAC_PLATFORM_SUPPORT"]
1313+
"flags": {
1314+
"required": ["VAC_PLATFORM_SUPPORT"]
12911315
}
12921316
},
12931317
{

frontend/public/components/pod-list.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import { sortResourceByValue } from './factory/Table/sort';
5454
import { PROMETHEUS_BASE_PATH, PROMETHEUS_TENANCY_BASE_PATH } from './graphs/consts';
5555
import { PodTraffic } from './pod-traffic';
5656
import { useK8sWatchResource } from './utils/k8s-watch-hook';
57-
import { Kebab } from './utils/kebab';
5857
import { LabelList } from './utils/label-list';
5958
import { OwnerReferences } from './utils/owner-references';
6059
import { ResourceLink, resourcePath } from './utils/resource-link';
@@ -97,8 +96,6 @@ const fetchPodMetrics = (namespace: string): Promise<UIActions.PodMetrics> => {
9796
return Promise.all(promises).then((data: unknown[]) => _.assign({}, ...data));
9897
};
9998

100-
export const menuActions = [...(Kebab.factory.common || [])];
101-
10299
const tableColumnInfo = [
103100
{ id: 'name' },
104101
{ id: 'namespace' },

frontend/public/components/resource-quota.jsx

Lines changed: 9 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { FLAGS } from '@console/shared/src/constants/common';
1818
import { YellowExclamationTriangleIcon } from '@console/shared/src/components/status/icons';
1919
import { DASH } from '@console/shared/src/constants/ui';
2020
import { DetailsPage, MultiListPage } from './factory';
21-
import { Kebab, ResourceKebab } from './utils/kebab';
2221
import { SectionHeading } from './utils/headings';
2322
import { navFactory } from './utils/horizontal-nav';
2423
import { ResourceLink } from './utils/resource-link';
@@ -54,50 +53,22 @@ import {
5453
actionsCellProps,
5554
cellIsStickyProps,
5655
} from '@console/app/src/components/data-view/ConsoleDataView';
57-
58-
const { common } = Kebab.factory;
59-
60-
const resourceQuotaMenuActions = [...common];
61-
const clusterResourceQuotaMenuActions = [...common];
62-
const appliedClusterResourceQuotaMenuActions = (namespace) => [
63-
Kebab.factory.ModifyLabels,
64-
Kebab.factory.ModifyAnnotations,
65-
(kind, obj) => {
66-
return {
67-
// t('public~Edit AppliedClusterResourceQuota')
68-
labelKey: 'public~Edit AppliedClusterResourceQuota',
69-
href: `/k8s/ns/${namespace}/${referenceForModel(AppliedClusterResourceQuotaModel)}/${
70-
obj.metadata.name
71-
}/yaml`,
72-
accessReview: {
73-
group: kind.apiGroup,
74-
resource: kind.plural,
75-
name: obj.metadata.name,
76-
namespace,
77-
verb: 'update',
78-
},
79-
};
80-
},
81-
Kebab.factory.Delete,
82-
];
56+
import LazyActionMenu from '@console/shared/src/components/actions/LazyActionMenu';
8357

8458
const isClusterQuota = (quota) => !quota.metadata.namespace;
8559

8660
const clusterQuotaReference = referenceForModel(ClusterResourceQuotaModel);
8761
const appliedClusterQuotaReference = referenceForModel(AppliedClusterResourceQuotaModel);
8862

89-
const quotaActions = (quota, namespace = undefined) => {
90-
if (quota.metadata.namespace) {
91-
return resourceQuotaMenuActions;
63+
const quotaActions = (quota) => {
64+
if (quota.kind === 'ResourceQuota') {
65+
return <LazyActionMenu context={{ [referenceForModel(ResourceQuotaModel)]: quota }} />;
9266
}
9367

9468
if (quota.kind === 'ClusterResourceQuota') {
95-
return clusterResourceQuotaMenuActions;
96-
}
97-
98-
if (quota.kind === 'AppliedClusterResourceQuota') {
99-
return appliedClusterResourceQuotaMenuActions(namespace);
69+
return <LazyActionMenu context={{ [clusterQuotaReference]: quota }} />;
10070
}
71+
return null;
10172
};
10273

10374
export const getQuotaResourceTypes = (quota) => {
@@ -174,7 +145,6 @@ const appliedClusterResourceQuotaTableColumnInfo = [
174145
{ id: 'projectAnnotations' },
175146
{ id: 'status' },
176147
{ id: 'created' },
177-
{ id: 'actions' },
178148
];
179149

180150
const QuotaStatus = ({ resourcesAtQuota }) => {
@@ -479,14 +449,7 @@ const getResourceQuotaDataViewRows = (data, columns, namespace) => {
479449
cell: <Timestamp timestamp={metadata.creationTimestamp} />,
480450
},
481451
[resourceQuotaTableColumnInfo[6].id]: {
482-
cell: (
483-
<ResourceKebab
484-
customData={namespace}
485-
actions={quotaActions(obj, namespace)}
486-
kind={resourceKind}
487-
resource={obj}
488-
/>
489-
),
452+
cell: quotaActions(obj),
490453
props: actionsCellProps,
491454
},
492455
};
@@ -548,17 +511,6 @@ const getAppliedClusterResourceQuotaDataViewRows = (data, columns, namespace) =>
548511
[appliedClusterResourceQuotaTableColumnInfo[4].id]: {
549512
cell: <Timestamp timestamp={metadata.creationTimestamp} />,
550513
},
551-
[appliedClusterResourceQuotaTableColumnInfo[5].id]: {
552-
cell: (
553-
<ResourceKebab
554-
customData={namespace}
555-
actions={quotaActions(obj, namespace)}
556-
kind={appliedClusterQuotaReference}
557-
resource={obj}
558-
/>
559-
),
560-
props: actionsCellProps,
561-
},
562514
};
563515

564516
return columns.map(({ id }) => {
@@ -705,13 +657,6 @@ const useAppliedClusterResourceQuotaColumns = () => {
705657
modifier: 'nowrap',
706658
},
707659
},
708-
{
709-
title: '',
710-
id: appliedClusterResourceQuotaTableColumnInfo[5].id,
711-
props: {
712-
...cellIsStickyProps,
713-
},
714-
},
715660
],
716661
[t],
717662
);
@@ -848,22 +793,14 @@ export const AppliedClusterResourceQuotasPage = ({ namespace, mock, showTitle })
848793
};
849794

850795
export const ResourceQuotasDetailsPage = (props) => {
851-
return (
852-
<DetailsPage
853-
{...props}
854-
menuActions={resourceQuotaMenuActions}
855-
pages={[navFactory.details(Details), navFactory.editYaml()]}
856-
/>
857-
);
796+
return <DetailsPage {...props} pages={[navFactory.details(Details), navFactory.editYaml()]} />;
858797
};
859798

860799
export const AppliedClusterResourceQuotasDetailsPage = (props) => {
861-
const params = useParams();
862-
const actions = appliedClusterResourceQuotaMenuActions(params?.ns);
863800
return (
864801
<DetailsPage
865802
{...props}
866-
menuActions={actions}
803+
kind={appliedClusterQuotaReference}
867804
pages={[navFactory.details(Details), navFactory.editYaml()]}
868805
/>
869806
);

frontend/public/locales/en/public.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,6 @@
12461246
"Clear history": "Clear history",
12471247
"Recently used": "Recently used",
12481248
"Clear input value": "Clear input value",
1249-
"Edit AppliedClusterResourceQuota": "Edit AppliedClusterResourceQuota",
12501249
"{{count}} resource reached quota_one": "{{count}} resource reached quota",
12511250
"{{count}} resource reached quota_other": "{{count}} resource reached quotas",
12521251
"none are at quota": "none are at quota",

0 commit comments

Comments
 (0)