11import 'routes/components/dataTable/dataTable.scss' ;
22
3+ import { ProviderType } from 'api/providers' ;
34import type { Query } from 'api/queries/query' ;
45import type { AzureReport } from 'api/reports/azureReports' ;
56import { ReportPathsType , ReportType } from 'api/reports/report' ;
@@ -13,6 +14,7 @@ import { DataTable } from 'routes/components/dataTable';
1314import { styles } from 'routes/components/dataTable/dataTable.styles' ;
1415import { EmptyValueState } from 'routes/components/state/emptyValueState' ;
1516import { Actions } from 'routes/details/components/actions' ;
17+ import { ProviderDetailsModal } from 'routes/details/components/providerDetails' ;
1618import type { ComputedReportItem } from 'routes/utils/computedReport/getComputedReportItems' ;
1719import { getUnsortedComputedReportItems } from 'routes/utils/computedReport/getComputedReportItems' ;
1820import { getBreakdownPath } from 'routes/utils/paths' ;
@@ -26,9 +28,10 @@ import { withRouter } from 'utils/router';
2628interface DetailsTableOwnProps extends RouterComponentProps , WrappedComponentProps {
2729 breadcrumbPath ?: string ;
2830 filterBy ?: any ;
29- isAllSelected ?: boolean ;
3031 groupBy : string ;
3132 groupByTagKey ?: string ;
33+ isAccountInfoDetailsToggleEnabled ?: boolean ;
34+ isAllSelected ?: boolean ;
3235 isLoading ?: boolean ;
3336 onSelect ( items : ComputedReportItem [ ] , isSelected : boolean ) ;
3437 onSort ( sortType : string , isSortAscending : boolean ) ;
@@ -74,12 +77,24 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
7477 }
7578
7679 private initDatum = ( ) => {
77- const { breadcrumbPath, groupBy, groupByTagKey, intl, isAllSelected, query, report, router, selectedItems } =
78- this . props ;
80+ const {
81+ breadcrumbPath,
82+ groupBy,
83+ groupByTagKey,
84+ intl,
85+ isAccountInfoDetailsToggleEnabled,
86+ isAllSelected,
87+ query,
88+ report,
89+ router,
90+ selectedItems,
91+ } = this . props ;
7992 if ( ! report ) {
8093 return ;
8194 }
8295
96+ const isGroupBySubscriptionGuid = groupBy === 'subscription_guid' ;
97+
8398 const rows = [ ] ;
8499 const computedItems = getUnsortedComputedReportItems ( {
85100 report,
@@ -112,10 +127,14 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
112127 name : '' ,
113128 } ,
114129 {
115- orderBy : groupBy === 'subscription_guid' ? 'subscription_name' : groupBy ,
130+ orderBy : isGroupBySubscriptionGuid ? 'subscription_name' : groupBy ,
116131 name : intl . formatMessage ( messages . detailsResourceNames , { value : groupBy } ) ,
117132 ...( computedItems . length && { isSortable : true } ) ,
118133 } ,
134+ {
135+ hidden : ! ( isGroupBySubscriptionGuid && isAccountInfoDetailsToggleEnabled ) ,
136+ name : intl . formatMessage ( messages . costModelsLastUpdated ) ,
137+ } ,
119138 {
120139 name : intl . formatMessage ( messages . monthOverMonthChange ) ,
121140 } ,
@@ -172,6 +191,17 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
172191 </ >
173192 ) ,
174193 } ,
194+ {
195+ hidden : ! ( isGroupBySubscriptionGuid && isAccountInfoDetailsToggleEnabled ) ,
196+ value : (
197+ < ProviderDetailsModal
198+ isLastUpdatedStatus
199+ isOverallStatus
200+ uuId = { item . source_uuid ?. [ 0 ] }
201+ providerType = { ProviderType . azure }
202+ />
203+ ) ,
204+ } ,
175205 { value : monthOverMonth } ,
176206 { value : cost , style : styles . managedColumn } ,
177207 { value : actions } ,
@@ -183,9 +213,15 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
183213 } ) ;
184214 } ) ;
185215
216+ const filteredColumns = ( columns as any [ ] ) . filter ( column => ! column . hidden ) ;
217+ const filteredRows = rows . map ( ( { ...row } ) => {
218+ row . cells = row . cells . filter ( cell => ! cell . hidden ) ;
219+ return row ;
220+ } ) ;
221+
186222 this . setState ( {
187- columns,
188- rows,
223+ columns : filteredColumns ,
224+ rows : filteredRows ,
189225 } ) ;
190226 } ;
191227
0 commit comments