@@ -18,7 +18,6 @@ import { FLAGS } from '@console/shared/src/constants/common';
1818import { YellowExclamationTriangleIcon } from '@console/shared/src/components/status/icons' ;
1919import { DASH } from '@console/shared/src/constants/ui' ;
2020import { DetailsPage , MultiListPage } from './factory' ;
21- import { Kebab , ResourceKebab } from './utils/kebab' ;
2221import { SectionHeading } from './utils/headings' ;
2322import { navFactory } from './utils/horizontal-nav' ;
2423import { 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
8458const isClusterQuota = ( quota ) => ! quota . metadata . namespace ;
8559
8660const clusterQuotaReference = referenceForModel ( ClusterResourceQuotaModel ) ;
8761const 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
10374export const getQuotaResourceTypes = ( quota ) => {
@@ -174,7 +145,6 @@ const appliedClusterResourceQuotaTableColumnInfo = [
174145 { id : 'projectAnnotations' } ,
175146 { id : 'status' } ,
176147 { id : 'created' } ,
177- { id : 'actions' } ,
178148] ;
179149
180150const 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
850795export 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
860799export 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 ) ;
0 commit comments