Skip to content

Commit

Permalink
Implement printUnauthorized utility for FE
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpzx committed Dec 5, 2024
1 parent 4b675f3 commit c192c89
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions frontend/src/modules/S3_Datasets/components/DatasetFolders.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
} from 'design';
import { SET_ERROR, useDispatch } from 'globalErrors';
import { deleteDatasetStorageLocation, useClient } from 'services';
import { emptyPrintUnauthorized } from 'utils';

import { listDatasetStorageLocations } from '../services';
import { FolderCreateModal } from './FolderCreateModal';
Expand Down Expand Up @@ -224,10 +225,9 @@ export const DatasetFolders = (props) => {
</Link>
</TableCell>
<TableCell>
{`s3://${
folder.restricted?.S3BucketName ||
'UNAUTHORIZED_INFO'
}/${folder.S3Prefix}`}
{`s3://${emptyPrintUnauthorized(
folder.restricted?.S3BucketName
)}/${folder.S3Prefix}`}
</TableCell>
<TableCell>{folder.description}</TableCell>
<TableCell>
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/modules/S3_Datasets/components/DatasetTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { listDatasetTables, deleteDatasetTable, useClient } from 'services';
import { syncTables } from '../services';

import { DatasetStartCrawlerModal } from './DatasetStartCrawlerModal';
import { isFeatureEnabled } from 'utils';
import { emptyPrintUnauthorized, isFeatureEnabled } from 'utils';

export const DatasetTables = (props) => {
const { dataset, isAdmin } = props;
Expand Down Expand Up @@ -261,11 +261,12 @@ export const DatasetTables = (props) => {
</Link>
</TableCell>
<TableCell>
{table.restricted?.GlueDatabaseName ||
'UNAUTHORIZED_INFO'}
{emptyPrintUnauthorized(
table.restricted?.GlueDatabaseName
)}
</TableCell>
<TableCell>
{table.restricted?.S3Prefix || 'UNAUTHORIZED_INFO'}
{emptyPrintUnauthorized(table.restricted?.S3Prefix)}
</TableCell>
<TableCell>
{isAdmin && (
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/utils/helpers/emptyPrintUnauthorized.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function emptyPrintUnauthorized(param) {
return param ? param : 'UNAUTHORIZED_INFO';
}

export { emptyPrintUnauthorized };
1 change: 1 addition & 0 deletions frontend/src/utils/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './bytesToSize';
export * from './dayjs';
export * from './emptyPrintUnauthorized';
export * from './listToTree';
export * from './moduleUtils';
export * from './linkMarkup';
Expand Down

0 comments on commit c192c89

Please sign in to comment.