diff --git a/locales/data.json b/locales/data.json index 1a1282fe1..3452764a8 100644 --- a/locales/data.json +++ b/locales/data.json @@ -1410,12 +1410,6 @@ "value": "Should not exceed 10 decimals" } ], - "costModelsReadOnly": [ - { - "type": 0, - "value": "You have read only permissions" - } - ], "costModelsRefreshDialog": [ { "type": 0, @@ -11236,6 +11230,12 @@ "value": "Failed to get RBAC information" } ], + "readOnlyPermissions": [ + { + "type": 0, + "value": "You have read only permissions" + } + ], "recommended": [ { "type": 0, diff --git a/locales/translations.json b/locales/translations.json index cacc0756d..b59eaba22 100644 --- a/locales/translations.json +++ b/locales/translations.json @@ -114,7 +114,6 @@ "costModelsPopoverAriaLabel": "Cost model info popover", "costModelsPopoverButtonAriaLabel": "Opens a dialog with cost model info", "costModelsRateTooLong": "Should not exceed 10 decimals", - "costModelsReadOnly": "You have read only permissions", "costModelsRefreshDialog": "Refresh this dialog", "costModelsRemoveTagLabel": "Remove tag value", "costModelsRequiredField": "This field is required", @@ -485,6 +484,7 @@ "rawCostTitle": "Raw cost", "rbacErrorDesc": "There was a problem receiving user permissions. Refreshing this page may fix it. If it does not, please contact your admin.", "rbacErrorTitle": "Failed to get RBAC information", + "readOnlyPermissions": "You have read only permissions", "recommended": "Recommended", "redHatStatusUrl": "https://status.redhat.com", "remove": "Remove", diff --git a/src/api/userAccess.ts b/src/api/userAccess.ts index e61f9ad43..02867a30f 100644 --- a/src/api/userAccess.ts +++ b/src/api/userAccess.ts @@ -26,6 +26,7 @@ export const enum UserAccessType { ocp = 'ocp', rhel = 'ocp', // Todo: update to use RHEL when APIs are available ros = 'ocp', + settings = 'settings', } // If the user-access API is called without a query parameter, all types are returned in the response diff --git a/src/components/permissions/permissions.tsx b/src/components/permissions/permissions.tsx index 1573cc6f5..2926ac576 100644 --- a/src/components/permissions/permissions.tsx +++ b/src/components/permissions/permissions.tsx @@ -45,7 +45,7 @@ type PermissionsProps = PermissionsOwnProps & PermissionsStateProps; const PermissionsBase: React.FC = ({ children = null, - chrome, + // chrome, isFinsightsFeatureEnabled, isIbmFeatureEnabled, isRosFeatureEnabled, @@ -68,7 +68,7 @@ const PermissionsBase: React.FC = ({ const ocp = hasOcpAccess(userAccess); const rhel = isFinsightsFeatureEnabled && hasRhelAccess(userAccess); const ros = isRosFeatureEnabled && hasRosAccess(userAccess); - const settings = isSettingsFeatureEnabled && (chrome.isOrgAdmin || costModel); + const settings = isSettingsFeatureEnabled; switch (pathname) { case formatPath(routes.explorer.path): diff --git a/src/locales/messages.ts b/src/locales/messages.ts index 7b18eec8c..22d21a34f 100644 --- a/src/locales/messages.ts +++ b/src/locales/messages.ts @@ -637,11 +637,6 @@ export default defineMessages({ description: 'Should not exceed 10 decimals', id: 'costModelsRateTooLong', }, - costModelsReadOnly: { - defaultMessage: 'You have read only permissions', - description: 'You have read only permissions', - id: 'costModelsReadOnly', - }, costModelsRefreshDialog: { defaultMessage: 'Refresh this dialog', description: 'Refresh this dialog', @@ -3018,6 +3013,11 @@ export default defineMessages({ description: 'RBAC error title', id: 'rbacErrorTitle', }, + readOnlyPermissions: { + defaultMessage: 'You have read only permissions', + description: 'You have read only permissions', + id: 'readOnlyPermissions', + }, recommended: { defaultMessage: 'Recommended', description: 'Recommended', diff --git a/src/routes/components/dataToolbar/basicToolbar.tsx b/src/routes/components/dataToolbar/basicToolbar.tsx index e3e1521a6..5788db309 100644 --- a/src/routes/components/dataToolbar/basicToolbar.tsx +++ b/src/routes/components/dataToolbar/basicToolbar.tsx @@ -36,6 +36,7 @@ interface BasicToolbarOwnProps { isAllSelected?: boolean; isBulkSelectDisabled?: boolean; isDisabled?: boolean; + isReadOnly?: boolean; itemsPerPage?: number; itemsTotal?: number; onBulkSelected?: (action: string) => void; @@ -124,7 +125,8 @@ export class BasicToolbarBase extends React.Component { - const { isAllSelected, isBulkSelectDisabled, isDisabled, itemsPerPage, itemsTotal, selectedItems } = this.props; + const { isAllSelected, isBulkSelectDisabled, isDisabled, isReadOnly, itemsPerPage, itemsTotal, selectedItems } = + this.props; const { isBulkSelectOpen } = this.state; return getBulkSelect({ @@ -135,6 +137,7 @@ export class BasicToolbarBase extends React.Component, ]; - return ( + const bulkSelect = ( ); + return isReadOnly ? ( + {bulkSelect} + ) : ( + bulkSelect + ); }; diff --git a/src/routes/costModels/costModel/priceListTable.tsx b/src/routes/costModels/costModel/priceListTable.tsx index ee1d8c72f..53f3de499 100644 --- a/src/routes/costModels/costModel/priceListTable.tsx +++ b/src/routes/costModels/costModel/priceListTable.tsx @@ -311,7 +311,7 @@ class PriceListTable extends React.Component{intl.formatMessage(messages.costModelsReadOnly)} +
{intl.formatMessage(messages.readOnlyPermissions)}
) : undefined, onClick: (_evt, _rowIndex, rowData) => { this.setState({ @@ -330,7 +330,7 @@ class PriceListTable extends React.Component{intl.formatMessage(messages.costModelsReadOnly)} +
{intl.formatMessage(messages.readOnlyPermissions)}
) : undefined, onClick: (_evt, _rowIndex, rowData) => { const rowIndex = rowData.data.stateIndex; diff --git a/src/routes/costModels/costModel/sourcesTable.tsx b/src/routes/costModels/costModel/sourcesTable.tsx index e6e21da4a..e8563ccb5 100644 --- a/src/routes/costModels/costModel/sourcesTable.tsx +++ b/src/routes/costModels/costModel/sourcesTable.tsx @@ -34,7 +34,7 @@ const SourcesTable: React.FC = ({ canWrite, costModels, intl, return [ { style: { pointerEvents: 'auto' }, - tooltip: intl.formatMessage(messages.costModelsReadOnly), + tooltip: intl.formatMessage(messages.readOnlyPermissions), isDisabled: true, title: intl.formatMessage(messages.costModelsSourceDelete), }, diff --git a/src/routes/costModels/costModelsDetails/createCostModelButton.tsx b/src/routes/costModels/costModelsDetails/createCostModelButton.tsx index 3fbb0b141..6ba1a1425 100644 --- a/src/routes/costModels/costModelsDetails/createCostModelButton.tsx +++ b/src/routes/costModels/costModelsDetails/createCostModelButton.tsx @@ -36,7 +36,7 @@ const buttonMergeProps = ( return { isDisabled: !canWrite, - tooltip: intl.formatMessage(messages.costModelsReadOnly), + tooltip: intl.formatMessage(messages.readOnlyPermissions), children: ( - + - + - +