Skip to content

Commit

Permalink
[BACKPORT 2024.2][PLAT-14924][PLAT-12829] - ui fixes
Browse files Browse the repository at this point in the history
Summary: Backport of [[ https://phorge.dev.yugabyte.com/D38448 | diff ]]

Test Plan: Tested manually

Reviewers: kkannan

Reviewed By: kkannan

Subscribers: yugaware, ui

Differential Revision: https://phorge.dev.yugabyte.com/D38450
  • Loading branch information
Lingeshwar committed Sep 26, 2024
1 parent caa112a commit cc6c12c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Fragment, useCallback, useEffect, useState } from 'react';
import axios from 'axios';
import { connect, useDispatch, useSelector } from 'react-redux';
import { toast } from 'react-toastify';
import { FirstStep } from './FirstStep/FirstStep';
import { SecondStep, updateOptions } from './SecondStep/SecondStep';
import { ThirdStep } from './ThirdStep/ThirdStep';
Expand All @@ -21,6 +22,7 @@ import './UniverseSupportBundle.scss';
import { filterTypes } from '../../metrics/MetricsComparisonModal/ComparisonFilterContextProvider';
import { isKubernetesUniverse } from '../../../utils/UniverseUtils';
import { getUniverseStatus } from '../helpers/universeHelpers';
import { RBAC_ERR_MSG_NO_PERM } from '../../../redesign/features/rbac/common/validator/ValidatorUtils';

const stepsObj = {
firstStep: 'firstStep',
Expand Down Expand Up @@ -91,7 +93,10 @@ export const UniverseSupportBundle = (props) => {
}, [supportBundles, listSupportBundle, universeDetails.universeUUID]);

const saveSupportBundle = (universeUUID) => {
dispatch(crateSupportBundle(universeUUID, payload)).then(() => {
dispatch(crateSupportBundle(universeUUID, payload)).then((response) => {
if (response.error && response?.payload?.response?.status === 403) {
toast.error(RBAC_ERR_MSG_NO_PERM, { autoClose: 3000 });
}
handleStepChange(stepsObj.thirdStep);
listSupportBundle(universeUUID);
setPayload(defaultOptions);
Expand Down
52 changes: 33 additions & 19 deletions managed/ui/src/redesign/features/export-log/ExportLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import { TelemetryProviderMin } from './components/DeleteTelProviderModal';
import { getLinkedUniverses } from './utils/helpers';
import { TP_FRIENDLY_NAMES } from './utils/constants';

//RBAC
import { ApiPermissionMap } from '../rbac/ApiAndUserPermMapping';
import { RbacValidator } from '../rbac/common/RbacApiPermValidator';

//styles
import { usePillStyles } from '../../styles/styles';
import { exportLogStyles } from './utils/ExportLogStyles';
Expand Down Expand Up @@ -122,17 +126,25 @@ export const ExportLog: FC<ExportLogProps> = () => {
<img src={EllipsisIcon} alt="more" className="ellipsis-icon" />
</Dropdown.Toggle>
<Dropdown.Menu>
<MenuItem
eventKey="1"
onSelect={() => {
setDeleteModalProps({ name: row.name, uuid: row.uuid });
setDeleteModal(true);
}}
data-testid="ExportLog-DeleteConfiguration"
disabled={!isEmpty(row.linkedUniverses)}
<RbacValidator
accessRequiredOn={ApiPermissionMap.DELETE_TELEMETRY_PROVIDER_BY_ID}
isControl
overrideStyle={{ display: 'block' }}
>
<YBLabelWithIcon icon="fa fa-trash">{t('exportAuditLog.deleteConfig')}</YBLabelWithIcon>
</MenuItem>
<MenuItem
eventKey="1"
onSelect={() => {
setDeleteModalProps({ name: row.name, uuid: row.uuid });
setDeleteModal(true);
}}
data-testid="ExportLog-DeleteConfiguration"
disabled={!isEmpty(row.linkedUniverses)}
>
<YBLabelWithIcon icon="fa fa-trash">
{t('exportAuditLog.deleteConfig')}
</YBLabelWithIcon>
</MenuItem>
</RbacValidator>
</Dropdown.Menu>
</Dropdown>
);
Expand All @@ -147,15 +159,17 @@ export const ExportLog: FC<ExportLogProps> = () => {
{!isEmpty(finalData) ? (
<Box className={classes.exportListContainer}>
<Box display={'flex'} flexDirection={'row'} justifyContent={'flex-end'}>
<YBButton
variant="primary"
size="large"
onClick={() => setOpenExportModal(true)}
data-testid="ExportLog-AddConfig"
>
<i className="fa fa-plus" />
{t('exportAuditLog.addConfiguration')}
</YBButton>
<RbacValidator accessRequiredOn={ApiPermissionMap.CREATE_TELEMETRY_PROVIDER} isControl>
<YBButton
variant="primary"
size="large"
onClick={() => setOpenExportModal(true)}
data-testid="ExportLog-AddConfig"
>
<i className="fa fa-plus" />
{t('exportAuditLog.addConfiguration')}
</YBButton>
</RbacValidator>
</Box>
<Box mt={4} width="100%" height="100%">
<YBTable
Expand Down
4 changes: 2 additions & 2 deletions managed/ui/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@
"tserverRpcPort": "T-Server RPC Port",
"ybcPackagePath": "YBC Package Path",
"yqlServerHttpPort": "YCQL HTTP Port",
"yqlServerRpcPort": "YCQL RPC Port",
"yqlServerRpcPort": "YCQL Port",
"ysqlServerHttpPort": "YSQL HTTP Port",
"ysqlServerRpcPort": "YSQL RPC Port",
"ysqlServerRpcPort": "YSQL Port",
"internalYsqlServerRpcPort": "Internal YSQL Port",
"enhancePGCompatibility": "Enhanced Postgres Compatibility",
"earlyAccess": "Early Access",
Expand Down

0 comments on commit cc6c12c

Please sign in to comment.