From 6108c6178c9159eac40adec3d316402708d51747 Mon Sep 17 00:00:00 2001 From: Dan Labrecque Date: Wed, 7 Feb 2024 15:01:19 -0500 Subject: [PATCH 1/2] Added cloud integration support for cluster info modal --- .../summary/modal/summaryModal.scss | 0 locales/data.json | 63 +++++++++- locales/translations.json | 3 +- src/api/providers.ts | 6 +- src/locales/messages.ts | 22 +++- .../components/pvcChart/modal/pvcModal.scss | 10 -- .../components/pvcChart/modal/pvcModal.tsx | 4 +- .../components/summary/modal/summaryModal.tsx | 2 - .../clusterInfo/cloudIntegration.tsx | 108 ++++++++++++++++++ .../clusterInfo/clusterContent.scss | 7 ++ ...sterInfoContent.tsx => clusterContent.tsx} | 65 ++++++----- .../ocpBreakdown/clusterInfo/clusterInfo.tsx | 23 ++-- .../ocpBreakdown/clusterInfo/modal.scss | 16 --- src/store/providers/providersActions.ts | 5 +- 14 files changed, 243 insertions(+), 91 deletions(-) rename {src => .archive}/routes/details/components/summary/modal/summaryModal.scss (100%) delete mode 100644 src/routes/details/components/pvcChart/modal/pvcModal.scss create mode 100644 src/routes/details/ocpBreakdown/clusterInfo/cloudIntegration.tsx create mode 100644 src/routes/details/ocpBreakdown/clusterInfo/clusterContent.scss rename src/routes/details/ocpBreakdown/clusterInfo/{clusterInfoContent.tsx => clusterContent.tsx} (68%) delete mode 100644 src/routes/details/ocpBreakdown/clusterInfo/modal.scss diff --git a/src/routes/details/components/summary/modal/summaryModal.scss b/.archive/routes/details/components/summary/modal/summaryModal.scss similarity index 100% rename from src/routes/details/components/summary/modal/summaryModal.scss rename to .archive/routes/details/components/summary/modal/summaryModal.scss diff --git a/locales/data.json b/locales/data.json index 55b9f2079..657f03c37 100644 --- a/locales/data.json +++ b/locales/data.json @@ -997,6 +997,12 @@ "value": "Close" } ], + "cloudIntegration": [ + { + "type": 0, + "value": "Cloud integration" + } + ], "cluster": [ { "type": 0, @@ -9711,6 +9717,57 @@ "value": "Infrastructure" } ], + "integration": [ + { + "options": { + "aws": { + "value": [ + { + "type": 0, + "value": "Amazon Web Services source:" + } + ] + }, + "azure": { + "value": [ + { + "type": 0, + "value": "Microsoft Azure source:" + } + ] + }, + "gcp": { + "value": [ + { + "type": 0, + "value": "Google Cloud Platform source:" + } + ] + }, + "oci": { + "value": [ + { + "type": 0, + "value": "Oracle Cloud Infrastructure source:" + } + ] + }, + "ocp": { + "value": [ + { + "type": 0, + "value": "OpenShift source:" + } + ] + }, + "other": { + "value": [] + } + }, + "type": 5, + "value": "value" + } + ], "lastProcessed": [ { "type": 0, @@ -10585,12 +10642,6 @@ "value": "Memory usage and requests" } ], - "ocpSource": [ - { - "type": 0, - "value": "OpenShift source:" - } - ], "ocpVolumeUsageAndRequests": [ { "type": 0, diff --git a/locales/translations.json b/locales/translations.json index 6e685d10e..0e4330053 100644 --- a/locales/translations.json +++ b/locales/translations.json @@ -60,6 +60,7 @@ "chooseKeyPlaceholder": "Choose key", "chooseValuePlaceholder": "Choose value", "close": "Close", + "cloudIntegration": "Cloud integration", "cluster": "Cluster", "clusterId": "Cluster id", "clusterInfo": "Cluster information", @@ -341,6 +342,7 @@ "inactiveSourcesTitle": "A problem was detected with {value}", "inactiveSourcesTitleMultiplier": "A problem was detected with the following integrations", "infrastructure": "Infrastructure", + "integration": "{value, select, aws {Amazon Web Services source:} azure {Microsoft Azure source:} oci {Oracle Cloud Infrastructure source:} gcp {Google Cloud Platform source:} ocp {OpenShift source:} other {}}", "lastProcessed": "Last processed", "learnMore": "Learn more", "limits": "Limits", @@ -428,7 +430,6 @@ "ocpDetailsSupplementaryCostDesc": "All costs not directly attributed to the infrastructure. These costs are determined by applying a price list within a cost model to OpenShift cluster metrics.", "ocpDetailsTitle": "OpenShift Details", "ocpMemoryUsageAndRequests": "Memory usage and requests", - "ocpSource": "OpenShift source:", "ocpVolumeUsageAndRequests": "Volume usage and requests", "openShift": "OpenShift", "openShiftCloudInfrastructure": "OpenShift cloud infrastructure", diff --git a/src/api/providers.ts b/src/api/providers.ts index 0967e62cf..73a89025c 100644 --- a/src/api/providers.ts +++ b/src/api/providers.ts @@ -73,9 +73,11 @@ export const enum ProviderType { rhel = 'ocp', // Todo: Update to use rhel when APIs are available // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values ros = 'ocp', // Todo: Update to use rhel when APIs are available + uuid = 'uuid', } -export function fetchProviders(query: string) { - const queryString = query ? `?${query}` : ''; +export function fetchProviders(query: string, reportType: ProviderType = undefined) { + const separator = reportType === ProviderType.uuid ? '' : '?'; + const queryString = query ? `${separator}${query}` : ''; return axios.get(`sources/${queryString}`); } diff --git a/src/locales/messages.ts b/src/locales/messages.ts index 239eb5372..9638c77e0 100644 --- a/src/locales/messages.ts +++ b/src/locales/messages.ts @@ -350,6 +350,11 @@ export default defineMessages({ description: 'Close', id: 'close', }, + cloudIntegration: { + defaultMessage: 'Cloud integration', + description: 'Cloud integration', + id: 'cloudIntegration', + }, cluster: { defaultMessage: 'Cluster', description: 'Cluster', @@ -2702,11 +2707,6 @@ export default defineMessages({ description: 'Memory usage and requests', id: 'ocpMemoryUsageAndRequests', }, - ocpSource: { - defaultMessage: 'OpenShift source:', - description: 'OpenShift source', - id: 'ocpSource', - }, ocpVolumeUsageAndRequests: { defaultMessage: 'Volume usage and requests', description: 'Volume usage and requests', @@ -3344,6 +3344,18 @@ export default defineMessages({ description: 'Jan 1-31', id: 'sinceDate', }, + source: { + defaultMessage: + '{value, select, ' + + 'aws {Amazon Web Services source:} ' + + 'azure {Microsoft Azure source:} ' + + 'oci {Oracle Cloud Infrastructure source:} ' + + 'gcp {Google Cloud Platform source:} ' + + 'ocp {OpenShift source:} ' + + 'other {}}', + description: 'Select from the following {value} integrations:', + id: 'integration', + }, sourceType: { defaultMessage: 'Integration', description: 'Integration', diff --git a/src/routes/details/components/pvcChart/modal/pvcModal.scss b/src/routes/details/components/pvcChart/modal/pvcModal.scss deleted file mode 100644 index d247c868b..000000000 --- a/src/routes/details/components/pvcChart/modal/pvcModal.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import url("~@patternfly/patternfly/base/patternfly-variables.css"); - -.modalOverride { - & .pf-v5-c-modal-box__body { - margin-top: var(--pf-v5-global--spacer--lg); - } - & .pf-v5-c-modal-box__footer { - display: none; - } -} diff --git a/src/routes/details/components/pvcChart/modal/pvcModal.tsx b/src/routes/details/components/pvcChart/modal/pvcModal.tsx index faaeac59c..03950fef9 100644 --- a/src/routes/details/components/pvcChart/modal/pvcModal.tsx +++ b/src/routes/details/components/pvcChart/modal/pvcModal.tsx @@ -1,5 +1,3 @@ -import './pvcModal.scss'; - import { Modal } from '@patternfly/react-core'; import React from 'react'; import type { WrappedComponentProps } from 'react-intl'; @@ -34,7 +32,7 @@ class PvcModalBase extends React.Component { const { isOpen, title } = this.props; return ( - + ); diff --git a/src/routes/details/components/summary/modal/summaryModal.tsx b/src/routes/details/components/summary/modal/summaryModal.tsx index 69ced9e0b..b7e9e0c4a 100644 --- a/src/routes/details/components/summary/modal/summaryModal.tsx +++ b/src/routes/details/components/summary/modal/summaryModal.tsx @@ -1,5 +1,3 @@ -import './summaryModal.scss'; - import { Modal } from '@patternfly/react-core'; import type { Query } from 'api/queries/query'; import type { ReportPathsType } from 'api/reports/report'; diff --git a/src/routes/details/ocpBreakdown/clusterInfo/cloudIntegration.tsx b/src/routes/details/ocpBreakdown/clusterInfo/cloudIntegration.tsx new file mode 100644 index 000000000..3c09ef270 --- /dev/null +++ b/src/routes/details/ocpBreakdown/clusterInfo/cloudIntegration.tsx @@ -0,0 +1,108 @@ +import { Text, TextList, TextListItem, TextVariants } from '@patternfly/react-core'; +import type { Provider } from 'api/providers'; +import { ProviderType } from 'api/providers'; +import type { AxiosError } from 'axios'; +import messages from 'locales/messages'; +import React, { useEffect } from 'react'; +import { useIntl } from 'react-intl'; +import { useDispatch, useSelector } from 'react-redux'; +import type { AnyAction } from 'redux'; +import type { ThunkDispatch } from 'redux-thunk'; +import { routes } from 'routes'; +import { NotAvailable } from 'routes/components/page/notAvailable'; +import { LoadingState } from 'routes/components/state/loadingState'; +import type { RootState } from 'store'; +import { FetchStatus } from 'store/common'; +import { providersActions, providersSelectors } from 'store/providers'; +import { formatPath, getReleasePath } from 'utils/paths'; + +import { styles } from './modal.styles'; + +interface CloudIntegrationOwnProps { + uuid?: string; +} + +export interface CloudIntegrationStateProps { + provider: Provider; + providerError: AxiosError; + providerFetchStatus: FetchStatus; + providerQueryString: string; + uuid?: string; +} + +export interface CloudIntegrationMapProps { + // TBD... +} + +type CloudIntegrationProps = CloudIntegrationOwnProps; + +const CloudIntegration: React.FC = ({ uuid }: CloudIntegrationProps) => { + const intl = useIntl(); + + const { provider, providerError, providerFetchStatus } = useMapToProps({ uuid }); + + const title = intl.formatMessage(messages.optimizations); + + if (providerError) { + return ; + } + + const release = getReleasePath(); + + if (providerFetchStatus === FetchStatus.inProgress) { + return ( +
+ +
+ ); + } + return ( + <> + {intl.formatMessage(messages.cloudIntegration)} + + + + {intl.formatMessage(messages.source, { value: provider?.source_type?.toLowerCase() })} + + {provider?.name} + + {provider?.cost_models?.length === 0 && ( + + {intl.formatMessage(messages.assignCostModel)} + + )} + + + ); +}; + +// eslint-disable-next-line no-empty-pattern +const useMapToProps = ({ uuid }): CloudIntegrationStateProps => { + const dispatch: ThunkDispatch = useDispatch(); + + const providerQueryString = uuid; + const provider = useSelector( + (state: RootState) => providersSelectors.selectProviders(state, ProviderType.uuid, providerQueryString) as Provider + ); + const providerError = useSelector((state: RootState) => + providersSelectors.selectProvidersError(state, ProviderType.uuid, providerQueryString) + ); + const providerFetchStatus = useSelector((state: RootState) => + providersSelectors.selectProvidersFetchStatus(state, ProviderType.uuid, providerQueryString) + ); + + useEffect(() => { + if (!providerError && providerFetchStatus !== FetchStatus.inProgress) { + dispatch(providersActions.fetchProviders(ProviderType.uuid, providerQueryString)); + } + }, []); + + return { + provider, + providerError, + providerFetchStatus, + providerQueryString, + }; +}; + +export { CloudIntegration }; diff --git a/src/routes/details/ocpBreakdown/clusterInfo/clusterContent.scss b/src/routes/details/ocpBreakdown/clusterInfo/clusterContent.scss new file mode 100644 index 000000000..21831c538 --- /dev/null +++ b/src/routes/details/ocpBreakdown/clusterInfo/clusterContent.scss @@ -0,0 +1,7 @@ +@import url("~@patternfly/patternfly/base/patternfly-variables.css"); + +.textContentOverride { + &.pf-v5-c-content ul { + padding-left: var(--pf-v5-global--spacer--lg); + } +} diff --git a/src/routes/details/ocpBreakdown/clusterInfo/clusterInfoContent.tsx b/src/routes/details/ocpBreakdown/clusterInfo/clusterContent.tsx similarity index 68% rename from src/routes/details/ocpBreakdown/clusterInfo/clusterInfoContent.tsx rename to src/routes/details/ocpBreakdown/clusterInfo/clusterContent.tsx index 3597b2ec5..fcfd1844a 100644 --- a/src/routes/details/ocpBreakdown/clusterInfo/clusterInfoContent.tsx +++ b/src/routes/details/ocpBreakdown/clusterInfo/clusterContent.tsx @@ -1,3 +1,5 @@ +import './clusterContent.scss'; + import { Text, TextContent, TextList, TextListItem, TextVariants } from '@patternfly/react-core'; import type { Providers } from 'api/providers'; import { ProviderType } from 'api/providers'; @@ -18,6 +20,7 @@ import { FetchStatus } from 'store/common'; import { providersActions, providersQuery, providersSelectors } from 'store/providers'; import { formatPath, getReleasePath } from 'utils/paths'; +import { CloudIntegration } from './cloudIntegration'; import { styles } from './modal.styles'; interface ClusterInfoContentOwnProps { @@ -37,7 +40,7 @@ export interface ClusterInfoContentMapProps { type ClusterInfoContentProps = ClusterInfoContentOwnProps; -const ClusterInfoContent: React.FC = ({ clusterId }: ClusterInfoContentProps) => { +const ClusterContent: React.FC = ({ clusterId }: ClusterInfoContentProps) => { const intl = useIntl(); const { providers, providersError, providersFetchStatus } = useMapToProps(); @@ -56,40 +59,40 @@ const ClusterInfoContent: React.FC = ({ clusterId }: Cl const release = getReleasePath(); + if (providersFetchStatus === FetchStatus.inProgress) { + return ( +
+ +
+ ); + } return ( -
- {providersFetchStatus === FetchStatus.inProgress ? ( -
- -
- ) : ( - - {intl.formatMessage(messages.clusterId)} + + {intl.formatMessage(messages.clusterId)} + + + {clusterId} + {intl.formatMessage(messages.ocpClusterDetails)} + + {clusterInfo?.cost_models?.length === 0 && ( + + {intl.formatMessage(messages.assignCostModel)} + + )} + + {clusterInfo && ( + <> + {intl.formatMessage(messages.redHatIntegration)} - {clusterId} - {intl.formatMessage(messages.ocpClusterDetails)} + {intl.formatMessage(messages.source, { value: 'ocp' })} + {clusterInfo.name} - {clusterInfo?.cost_models?.length === 0 && ( - - {intl.formatMessage(messages.assignCostModel)} - - )} - {clusterInfo && ( - <> - {intl.formatMessage(messages.redHatIntegration)} - - - {intl.formatMessage(messages.ocpSource)} - {clusterInfo.name} - - - - )} - + {clusterInfo?.infrastructure?.uuid && } + )} -
+ ); }; @@ -97,7 +100,7 @@ const ClusterInfoContent: React.FC = ({ clusterId }: Cl const useMapToProps = (): ClusterInfoContentStateProps => { const dispatch: ThunkDispatch = useDispatch(); - // PermissionsWraper has already made an API request using ProviderType.all + // PermissionsWraper has already made an API request const providersQueryString = getProvidersQuery(providersQuery); const providers = useSelector((state: RootState) => providersSelectors.selectProviders(state, ProviderType.all, providersQueryString) @@ -123,4 +126,4 @@ const useMapToProps = (): ClusterInfoContentStateProps => { }; }; -export { ClusterInfoContent }; +export { ClusterContent }; diff --git a/src/routes/details/ocpBreakdown/clusterInfo/clusterInfo.tsx b/src/routes/details/ocpBreakdown/clusterInfo/clusterInfo.tsx index 5fd6547dc..cee7f7ba9 100644 --- a/src/routes/details/ocpBreakdown/clusterInfo/clusterInfo.tsx +++ b/src/routes/details/ocpBreakdown/clusterInfo/clusterInfo.tsx @@ -1,11 +1,10 @@ -import './modal.scss'; - -import { Button, ButtonVariant, Modal } from '@patternfly/react-core'; +import { Button, ButtonVariant } from '@patternfly/react-core'; +import { Modal, ModalBody, ModalHeader, ModalVariant } from '@patternfly/react-core/next'; import messages from 'locales/messages'; import React, { useState } from 'react'; import { useIntl } from 'react-intl'; -import { ClusterInfoContent } from './clusterInfoContent'; +import { ClusterContent } from './clusterContent'; import { styles } from './modal.styles'; interface ClusterInfoOwnProps { @@ -26,19 +25,19 @@ const ClusterInfo: React.FC = ({ clusterId }: ClusterInfoProps setIsOpen(!isOpen); }; + // PatternFly modal appends to document.body, which is outside the scoped "costManagement" dom tree. + // Use className="costManagement" to override PatternFly styles or append the modal to an element within the tree + return ( <> - - + + + + + ); diff --git a/src/routes/details/ocpBreakdown/clusterInfo/modal.scss b/src/routes/details/ocpBreakdown/clusterInfo/modal.scss deleted file mode 100644 index cfc10503f..000000000 --- a/src/routes/details/ocpBreakdown/clusterInfo/modal.scss +++ /dev/null @@ -1,16 +0,0 @@ -@import url("~@patternfly/patternfly/base/patternfly-variables.css"); - -.modalOverride { - & .pf-v5-c-modal-box__body { - margin-top: var(--pf-v5-global--spacer--lg); - } - & .pf-v5-c-modal-box__footer { - display: none; - } -} - -.textContentOverride { - &.pf-v5-c-content dl { - // grid-column-gap: 1rem; - } -} diff --git a/src/store/providers/providersActions.ts b/src/store/providers/providersActions.ts index 980014c6c..21719694c 100644 --- a/src/store/providers/providersActions.ts +++ b/src/store/providers/providersActions.ts @@ -1,5 +1,4 @@ -import type { Providers } from 'api/providers'; -import type { ProviderType } from 'api/providers'; +import type { Providers, ProviderType } from 'api/providers'; import { fetchProviders as apiGetProviders } from 'api/providers'; import type { AxiosError } from 'axios'; import type { ThunkAction } from 'store/common'; @@ -32,7 +31,7 @@ export function fetchProviders(reportType: ProviderType, reportQueryString: stri dispatch(fetchProvidersRequest(meta)); - return apiGetProviders(reportQueryString) + return apiGetProviders(reportQueryString, reportType) .then(res => { dispatch(fetchProvidersSuccess(res.data, meta)); }) From 3e520346e2b020ff297aba08868771106f36d5ee Mon Sep 17 00:00:00 2001 From: Dan Labrecque Date: Thu, 8 Feb 2024 13:44:07 -0500 Subject: [PATCH 2/2] Clean up unused messages --- locales/data.json | 436 +++------------------ locales/translations.json | 28 +- src/components/permissions/permissions.tsx | 2 +- src/locales/messages.ts | 148 +------ src/routes.tsx | 3 +- src/utils/paths.ts | 19 +- 6 files changed, 56 insertions(+), 580 deletions(-) diff --git a/locales/data.json b/locales/data.json index 657f03c37..64e3cbb18 100644 --- a/locales/data.json +++ b/locales/data.json @@ -671,12 +671,6 @@ "value": "Cancel" } ], - "change": [ - { - "type": 0, - "value": "Change" - } - ], "chartCostForecastConeLegendLabel": [ { "type": 0, @@ -1027,18 +1021,6 @@ "value": "Clusters" } ], - "copyToClipboard": [ - { - "type": 0, - "value": "Copy to clipboard" - } - ], - "copyToClipboardSuccessfull": [ - { - "type": 0, - "value": "Successfully copied to clipboard!" - } - ], "cost": [ { "type": 0, @@ -2310,18 +2292,6 @@ "value": "units" } ], - "current": [ - { - "type": 0, - "value": "Current" - } - ], - "currentConfiguration": [ - { - "type": 0, - "value": "Current configuration" - } - ], "dashboardCumulativeCostComparison": [ { "type": 0, @@ -9717,57 +9687,6 @@ "value": "Infrastructure" } ], - "integration": [ - { - "options": { - "aws": { - "value": [ - { - "type": 0, - "value": "Amazon Web Services source:" - } - ] - }, - "azure": { - "value": [ - { - "type": 0, - "value": "Microsoft Azure source:" - } - ] - }, - "gcp": { - "value": [ - { - "type": 0, - "value": "Google Cloud Platform source:" - } - ] - }, - "oci": { - "value": [ - { - "type": 0, - "value": "Oracle Cloud Infrastructure source:" - } - ] - }, - "ocp": { - "value": [ - { - "type": 0, - "value": "OpenShift source:" - } - ] - }, - "other": { - "value": [] - } - }, - "type": 5, - "value": "value" - } - ], "lastProcessed": [ { "type": 0, @@ -9780,12 +9699,6 @@ "value": "Learn more" } ], - "limits": [ - { - "type": 0, - "value": "Limits" - } - ], "loadingStateDesc": [ { "type": 0, @@ -10442,12 +10355,6 @@ "value": "Settings in Cost Management" } ], - "notificationsAlertTitle": [ - { - "type": 0, - "value": "Duration based notifications" - } - ], "oci": [ { "type": 0, @@ -10678,248 +10585,6 @@ "value": "Optimizations" } ], - "optimizationsDetails": [ - { - "offset": 0, - "options": { - "=0": { - "value": [ - { - "type": 0, - "value": "No optimizations" - } - ] - }, - "=1": { - "value": [ - { - "type": 1, - "value": "count" - }, - { - "type": 0, - "value": " optimization" - } - ] - }, - "other": { - "value": [ - { - "type": 1, - "value": "count" - }, - { - "type": 0, - "value": " optimizations" - } - ] - } - }, - "pluralType": "cardinal", - "type": 6, - "value": "count" - } - ], - "optimizationsInfo": [ - { - "type": 0, - "value": "Assess and monitor your usage so you can optimize your OpenShift resources." - } - ], - "optimizationsInfoArialLabel": [ - { - "type": 0, - "value": "A description of optimizations" - } - ], - "optimizationsInfoButtonArialLabel": [ - { - "type": 0, - "value": "A dialog with a description of optimizations" - } - ], - "optimizationsLoadingStateDesc": [ - { - "type": 0, - "value": "Searching for your optimizations. Do not refresh the browser" - } - ], - "optimizationsLoadingStateTitle": [ - { - "type": 0, - "value": "Looking for optimizations..." - } - ], - "optimizationsLongTerm": [ - { - "type": 0, - "value": "Last 15 days" - } - ], - "optimizationsMediumTerm": [ - { - "type": 0, - "value": "Last 7 days" - } - ], - "optimizationsNames": [ - { - "options": { - "cluster": { - "value": [ - { - "type": 0, - "value": "Cluster names" - } - ] - }, - "container": { - "value": [ - { - "type": 0, - "value": "Container names" - } - ] - }, - "last_reported": { - "value": [ - { - "type": 0, - "value": "Last reported" - } - ] - }, - "other": { - "value": [] - }, - "project": { - "value": [ - { - "type": 0, - "value": "Project names" - } - ] - }, - "workload": { - "value": [ - { - "type": 0, - "value": "Workload names" - } - ] - }, - "workload_type": { - "value": [ - { - "type": 0, - "value": "Workload types" - } - ] - } - }, - "type": 5, - "value": "value" - } - ], - "optimizationsPerspective": [ - { - "type": 0, - "value": "View optimizations based on" - } - ], - "optimizationsShortTerm": [ - { - "type": 0, - "value": "Last 24 hrs" - } - ], - "optimizationsTableAriaLabel": [ - { - "type": 0, - "value": "Optimizations table" - } - ], - "optimizationsValue": [ - { - "type": 1, - "value": "value" - }, - { - "type": 1, - "value": "units" - } - ], - "optimizationsValues": [ - { - "options": { - "cluster": { - "value": [ - { - "type": 0, - "value": "Cluster name" - } - ] - }, - "container": { - "value": [ - { - "type": 0, - "value": "Container name" - } - ] - }, - "last_reported": { - "value": [ - { - "type": 0, - "value": "Last reported" - } - ] - }, - "other": { - "value": [] - }, - "project": { - "value": [ - { - "type": 0, - "value": "Project name" - } - ] - }, - "workload": { - "value": [ - { - "type": 0, - "value": "Workload name" - } - ] - }, - "workload_type": { - "value": [ - { - "type": 0, - "value": "Workload type" - } - ] - } - }, - "type": 5, - "value": "value" - } - ], - "optimizationsViewAll": [ - { - "type": 0, - "value": "View all optimizations for this project" - } - ], - "optimizationsViewAllDisabled": [ - { - "type": 0, - "value": "This project has not reported data this month." - } - ], "overhead": [ { "type": 0, @@ -11092,44 +10757,6 @@ "value": " % of cost" } ], - "percentPlus": [ - { - "offset": 0, - "options": { - "one": { - "value": [ - { - "type": 0, - "value": "+" - }, - { - "type": 1, - "value": "value" - }, - { - "type": 0, - "value": "%" - } - ] - }, - "other": { - "value": [ - { - "type": 1, - "value": "value" - }, - { - "type": 0, - "value": "%" - } - ] - } - }, - "pluralType": "cardinal", - "type": 6, - "value": "count" - } - ], "percentSymbol": [ { "type": 0, @@ -11465,18 +11092,6 @@ "value": "You have read only permissions" } ], - "recommended": [ - { - "type": 0, - "value": "Recommended" - } - ], - "recommendedConfiguration": [ - { - "type": 0, - "value": "Recommended configuration" - } - ], "redHatIntegration": [ { "type": 0, @@ -12026,6 +11641,57 @@ "value": "dateRange" } ], + "source": [ + { + "options": { + "aws": { + "value": [ + { + "type": 0, + "value": "Amazon Web Services source:" + } + ] + }, + "azure": { + "value": [ + { + "type": 0, + "value": "Microsoft Azure source:" + } + ] + }, + "gcp": { + "value": [ + { + "type": 0, + "value": "Google Cloud Platform source:" + } + ] + }, + "oci": { + "value": [ + { + "type": 0, + "value": "Oracle Cloud Infrastructure source:" + } + ] + }, + "ocp": { + "value": [ + { + "type": 0, + "value": "OpenShift source:" + } + ] + }, + "other": { + "value": [] + } + }, + "type": 5, + "value": "value" + } + ], "sourceType": [ { "type": 0, diff --git a/locales/translations.json b/locales/translations.json index 0e4330053..947b8c971 100644 --- a/locales/translations.json +++ b/locales/translations.json @@ -31,7 +31,6 @@ "breakdownTotalCostDate": "{value} total cost ({dateRange})", "calculationType": "Calculation type", "cancel": "Cancel", - "change": "Change", "chartCostForecastConeLegendLabel": "Cost confidence ({dateRange})", "chartCostForecastConeLegendNoDataLabel": "Cost confidence (no data)", "chartCostForecastConeLegendTooltip": "Cost confidence ({month})", @@ -65,8 +64,6 @@ "clusterId": "Cluster id", "clusterInfo": "Cluster information", "clusters": "Clusters", - "copyToClipboard": "Copy to clipboard", - "copyToClipboardSuccessfull": "Successfully copied to clipboard!", "cost": "Cost", "costBreakdownAriaDesc": "Breakdown of markup, raw, and usage costs", "costBreakdownAriaLabel": "A description of markup, raw cost and usage cost", @@ -192,8 +189,6 @@ "currencyDesc": "Select the preferred currency view for your organization", "currencyOptions": "{units, select, AUD {AUD (A$) - Australian Dollar}CAD {CAD (CA$) - Canadian Dollar}CHF {CHF (CHF) - Swiss Franc}CNY {CNY (CN¥) - Chinese Yuan}DKK {DKK (DKK) - Danish Krone}EUR {EUR (€) - Euro}GBP {GBP (£) - British Pound}HKD {HKD (HK$) - Hong Kong Dollar}JPY {JPY (¥) - Japanese Yen}NOK {NOK (NOK) - Norwegian Krone}NZD {NZD (NZ$) - New Zealand Dollar}SEK {SEK (SEK) - Swedish Krona}SGD {SGD (SGD) - Singapore Dollar}USD {USD ($) - United States Dollar} ZAR {ZAR (ZAR) - South African Rand}other {}}", "currencyUnits": "{units, select, AUD {A$}CAD {CA$}CHF {CHF}CNY {CN¥}DKK {DKK}EUR {€}GBP {£}HKD {HK$}JPY {¥}NOK {NOK}NZD {NZ$}SEK {SEK}SGD {SGD}USD {$} ZAR {ZAR}other {}}", - "current": "Current", - "currentConfiguration": "Current configuration", "dashboardCumulativeCostComparison": "Cumulative cost comparison ({units})", "dashboardDailyUsageComparison": "Daily usage comparison ({units})", "dashboardDatabaseTitle": "Database services cost", @@ -342,10 +337,8 @@ "inactiveSourcesTitle": "A problem was detected with {value}", "inactiveSourcesTitleMultiplier": "A problem was detected with the following integrations", "infrastructure": "Infrastructure", - "integration": "{value, select, aws {Amazon Web Services source:} azure {Microsoft Azure source:} oci {Oracle Cloud Infrastructure source:} gcp {Google Cloud Platform source:} ocp {OpenShift source:} other {}}", "lastProcessed": "Last processed", "learnMore": "Learn more", - "limits": "Limits", "loadingStateDesc": "Searching for your integrations. Do not refresh the browser", "loadingStateTitle": "Looking for integrations...", "maintenanceEmptyStateDesc": "Cost Management is currently undergoing scheduled maintenance and will be unavailable from 13:00 - 19:00 UTC (09:00 AM - 03:00 PM EDT).", @@ -406,7 +399,6 @@ "notAuthorizedStateOptimizations": "Optimizations in Cost Management", "notAuthorizedStateRhel": "RHEL in Cost Management", "notAuthorizedStateSettings": "Settings in Cost Management", - "notificationsAlertTitle": "Duration based notifications", "oci": "Oracle Cloud Infrastructure", "ociComputeTitle": "Virtual machines usage", "ociCostTrendTitle": "Oracle Cloud Infrastructure cumulative cost comparison ({units})", @@ -436,22 +428,6 @@ "openShiftCloudInfrastructureDesc": "Infrastructure cost attributed to OpenShift Container Platform, based on a subset of cloud cost data.", "openShiftDesc": "Total cost for OpenShift Container Platform, comprising the infrastructure cost and cost calculated from metrics.", "optimizations": "Optimizations", - "optimizationsDetails": "{count, plural, =0 {No optimizations} =1 {{count} optimization} other {{count} optimizations}}", - "optimizationsInfo": "Assess and monitor your usage so you can optimize your OpenShift resources.", - "optimizationsInfoArialLabel": "A description of optimizations", - "optimizationsInfoButtonArialLabel": "A dialog with a description of optimizations", - "optimizationsLoadingStateDesc": "Searching for your optimizations. Do not refresh the browser", - "optimizationsLoadingStateTitle": "Looking for optimizations...", - "optimizationsLongTerm": "Last 15 days", - "optimizationsMediumTerm": "Last 7 days", - "optimizationsNames": "{value, select, cluster {Cluster names} container {Container names} last_reported {Last reported} project {Project names} workload {Workload names} workload_type {Workload types} other {}}", - "optimizationsPerspective": "View optimizations based on", - "optimizationsShortTerm": "Last 24 hrs", - "optimizationsTableAriaLabel": "Optimizations table", - "optimizationsValue": "{value}{units}", - "optimizationsValues": "{value, select, cluster {Cluster name} container {Container name} last_reported {Last reported} project {Project name} workload {Workload name} workload_type {Workload type} other {}}", - "optimizationsViewAll": "View all optimizations for this project", - "optimizationsViewAllDisabled": "This project has not reported data this month.", "overhead": "Overhead", "overheadDesc": "Includes distributed costs", "overviewInfoArialLabel": "A description of perspectives", @@ -473,7 +449,6 @@ "paginationTitle": "{placement, select, top {{title} top pagination} bottom {{title} bottom pagination} other {{title} pagination}}", "percent": "{value} %", "percentOfCost": "{value} % of cost", - "percentPlus": "{count, plural, one {+{value}%} other {{value}%}}", "percentSymbol": "%", "percentTotalCost": "{value} {units} ({percent} %)", "perspective": "Perspective", @@ -501,8 +476,6 @@ "rbacErrorTitle": "Failed to get RBAC information", "readOnly": "Read only", "readOnlyPermissions": "You have read only permissions", - "recommended": "Recommended", - "recommendedConfiguration": "Recommended configuration", "redHatIntegration": "Red Hat integration", "redHatStatusUrl": "https://status.redhat.com", "remove": "Remove", @@ -546,6 +519,7 @@ "settingsTagsErrorTitle": "You can not enable more than {value} tags total", "settingsTitle": "Cost Management Settings", "sinceDate": "{dateRange}", + "source": "{value, select, aws {Amazon Web Services source:} azure {Microsoft Azure source:} oci {Oracle Cloud Infrastructure source:} gcp {Google Cloud Platform source:} ocp {OpenShift source:} other {}}", "sourceType": "Integration", "sourceTypes": "{value, select, aws {Amazon Web Services} azure {Microsoft Azure} oci {Oracle Cloud Infrastructure} gcp {Google Cloud Platform} ibm {IBM Cloud} ocp {OpenShift} other {}}", "sources": "Integrations", diff --git a/src/components/permissions/permissions.tsx b/src/components/permissions/permissions.tsx index 2a7c67a12..02802657c 100644 --- a/src/components/permissions/permissions.tsx +++ b/src/components/permissions/permissions.tsx @@ -72,7 +72,7 @@ const PermissionsBase: React.FC = ({ switch (pathname) { case formatPath(routes.explorer.path): case formatPath(routes.overview.path): - return aws || azure || costModel || gcp || ibm || ocp || oci; + return aws || azure || gcp || ibm || ocp || oci; case formatPath(routes.awsBreakdown.path): case formatPath(routes.awsDetails.path): return aws; diff --git a/src/locales/messages.ts b/src/locales/messages.ts index 9638c77e0..cb520bebd 100644 --- a/src/locales/messages.ts +++ b/src/locales/messages.ts @@ -205,11 +205,6 @@ export default defineMessages({ description: 'Cancel', id: 'cancel', }, - change: { - defaultMessage: 'Change', - description: 'Change', - id: 'change', - }, chartCostForecastConeLegendLabel: { defaultMessage: 'Cost confidence ({dateRange})', description: 'Cost confidence (Jan 1-31)', @@ -375,16 +370,6 @@ export default defineMessages({ description: 'Clusters', id: 'clusters', }, - copyToClipboard: { - defaultMessage: 'Copy to clipboard', - description: 'Copy to clipboard', - id: 'copyToClipboard', - }, - copyToClipboardSuccessfull: { - defaultMessage: 'Successfully copied to clipboard!', - description: 'Successfully copied to clipboard!', - id: 'copyToClipboardSuccessfull', - }, cost: { defaultMessage: 'Cost', description: 'Cost', @@ -1091,16 +1076,6 @@ export default defineMessages({ description: 'return the proper unit label based on key: "units"', id: 'currencyUnits', }, - current: { - defaultMessage: 'Current', - description: 'Current', - id: 'current', - }, - currentConfiguration: { - defaultMessage: 'Current configuration', - description: 'Current configuration', - id: 'currentConfiguration', - }, dashboardCumulativeCostComparison: { defaultMessage: 'Cumulative cost comparison ({units})', description: 'Cumulative cost comparison ({units})', @@ -2234,11 +2209,6 @@ export default defineMessages({ description: 'Learn more', id: 'learnMore', }, - limits: { - defaultMessage: 'Limits', - description: 'Limits', - id: 'limits', - }, loadingStateDesc: { defaultMessage: 'Searching for your integrations. Do not refresh the browser', description: 'Searching for your integrations. Do not refresh the browser', @@ -2585,11 +2555,6 @@ export default defineMessages({ description: 'Settings in Cost Management', id: 'notAuthorizedStateSettings', }, - notificationsAlertTitle: { - defaultMessage: 'Duration based notifications', - description: 'Duration based notifications', - id: 'notificationsAlertTitle', - }, oci: { defaultMessage: 'Oracle Cloud Infrastructure', description: 'Oracle Cloud Infrastructure', @@ -2741,102 +2706,6 @@ export default defineMessages({ description: 'Optimizations', id: 'optimizations', }, - optimizationsDetails: { - defaultMessage: '{count, plural, =0 {No optimizations} =1 {{count} optimization} other {{count} optimizations}}', - description: 'Recommendation details', - id: 'optimizationsDetails', - }, - optimizationsInfo: { - defaultMessage: 'Assess and monitor your usage so you can optimize your OpenShift resources.', - description: 'Assess and monitor your usage so you can optimize your OpenShift resources.', - id: 'optimizationsInfo', - }, - optimizationsInfoArialLabel: { - defaultMessage: 'A description of optimizations', - description: 'A description of optimizations', - id: 'optimizationsInfoArialLabel', - }, - optimizationsInfoButtonArialLabel: { - defaultMessage: 'A dialog with a description of optimizations', - description: 'A dialog with a description of optimizations', - id: 'optimizationsInfoButtonArialLabel', - }, - optimizationsLoadingStateDesc: { - defaultMessage: 'Searching for your optimizations. Do not refresh the browser', - description: 'Searching for your optimizations. Do not refresh the browser', - id: 'optimizationsLoadingStateDesc', - }, - optimizationsLoadingStateTitle: { - defaultMessage: 'Looking for optimizations...', - description: 'Looking for optimizations', - id: 'optimizationsLoadingStateTitle', - }, - optimizationsLongTerm: { - defaultMessage: 'Last 15 days', - description: 'Last 15 days', - id: 'optimizationsLongTerm', - }, - optimizationsMediumTerm: { - defaultMessage: 'Last 7 days', - description: 'Last 7 days', - id: 'optimizationsMediumTerm', - }, - optimizationsNames: { - defaultMessage: - '{value, select, ' + - 'cluster {Cluster names} ' + - 'container {Container names} ' + - 'last_reported {Last reported} ' + - 'project {Project names} ' + - 'workload {Workload names} ' + - 'workload_type {Workload types} ' + - 'other {}}', - description: 'Selected items for export', - id: 'optimizationsNames', - }, - optimizationsPerspective: { - defaultMessage: 'View optimizations based on', - description: 'View optimizations based on', - id: 'optimizationsPerspective', - }, - optimizationsShortTerm: { - defaultMessage: 'Last 24 hrs', - description: 'Last 24 hrs', - id: 'optimizationsShortTerm', - }, - optimizationsTableAriaLabel: { - defaultMessage: 'Optimizations table', - description: 'Optimizations table', - id: 'optimizationsTableAriaLabel', - }, - optimizationsValue: { - defaultMessage: '{value}{units}', - description: '2 GiB', - id: 'optimizationsValue', - }, - optimizationsValues: { - defaultMessage: - '{value, select, ' + - 'cluster {Cluster name} ' + - 'container {Container name} ' + - 'last_reported {Last reported} ' + - 'project {Project name} ' + - 'workload {Workload name} ' + - 'workload_type {Workload type} ' + - 'other {}}', - description: 'Selected items for export', - id: 'optimizationsValues', - }, - optimizationsViewAll: { - defaultMessage: 'View all optimizations for this project', - description: 'View all optimizations for this project', - id: 'optimizationsViewAll', - }, - optimizationsViewAllDisabled: { - defaultMessage: 'This project has not reported data this month.', - description: 'This project has not reported data this month.', - id: 'optimizationsViewAllDisabled', - }, overhead: { defaultMessage: 'Overhead', description: 'Overhead', @@ -2946,11 +2815,6 @@ export default defineMessages({ description: '{value} % of cost', id: 'percentOfCost', }, - percentPlus: { - defaultMessage: '{count, plural, one {+{value}%} other {{value}%}}', - description: 'Percent value with plus symbol', - id: 'percentPlus', - }, percentSymbol: { defaultMessage: '%', description: 'Percent symbol', @@ -3105,16 +2969,6 @@ export default defineMessages({ description: 'You have read only permissions', id: 'readOnlyPermissions', }, - recommended: { - defaultMessage: 'Recommended', - description: 'Recommended', - id: 'recommended', - }, - recommendedConfiguration: { - defaultMessage: 'Recommended configuration', - description: 'Recommended configuration', - id: 'recommendedConfiguration', - }, redHatIntegration: { defaultMessage: 'Red Hat integration', description: 'Red Hat integration', @@ -3354,7 +3208,7 @@ export default defineMessages({ 'ocp {OpenShift source:} ' + 'other {}}', description: 'Select from the following {value} integrations:', - id: 'integration', + id: 'source', }, sourceType: { defaultMessage: 'Integration', diff --git a/src/routes.tsx b/src/routes.tsx index 64a18df6f..e06c764ea 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -47,10 +47,9 @@ export const routes = { path: '/azure', }, costModel: { - // Note: Order matters here (i.e., dynamic segment must be defined after costModelsDetails) basePath: `/settings/cost-model`, element: userAccess(CostModel), - path: `/settings/cost-model/:uuid`, + path: `/settings/cost-model/:uuid`, // Note: Order matters (i.e., dynamic segment must be defined after costModelsDetails) }, explorer: { element: userAccess(Explorer), diff --git a/src/utils/paths.ts b/src/utils/paths.ts index 30c141b97..afb9b6483 100644 --- a/src/utils/paths.ts +++ b/src/utils/paths.ts @@ -10,23 +10,6 @@ export const formatPath = path => { return path === routes.overview.path ? basename : `${basename}${path}`; }; -// export const getBaseName = pathname => { -// let release = '/'; -// const pathName = pathname.split('/'); -// -// pathName.shift(); -// -// if (pathName[0] === 'beta') { -// pathName.shift(); -// release = `/beta/`; -// } -// -// if (pathName[1]) { -// return `${release}${pathName[0]}/${pathName[1]}`; -// } -// return `${release}${pathName[0]}`; -// }; - export const getReleasePath = () => { const pathName = window.location.pathname.split('/'); pathName.shift(); @@ -44,7 +27,7 @@ export const getReleasePath = () => { export const usePathname = () => { const location = useLocation(); - // cost models may include UUID in path + // Cost models may include UUID in path const costModelPath = formatPath(routes.costModel.basePath); return location.pathname.startsWith(costModelPath) ? costModelPath : location.pathname.replace(/\/$/, ''); };