Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions src/containers/Operations/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,31 @@ import {getOperationProgress, isIndexBuildMetadata} from './utils';

import './Operations.scss';

const IMPORT_EXPORT_KINDS: OperationKind[] = ['import/s3', 'export/s3', 'export/yt'];
function renderStatusCell(row: TOperation) {
const progress = getOperationProgress(row, i18n);

if (row.ready) {
if (!row.status) {
return EMPTY_DATA_PLACEHOLDER;
}

return (
<Text color={row.status === EStatusCode.SUCCESS ? 'positive' : 'danger'}>
{row.status}
</Text>
);
}

if (row.status && row.status !== EStatusCode.SUCCESS) {
return <Text color="danger">{row.status}</Text>;
}

if (progress !== null) {
return progress;
}

return i18n('label_in-progress');
}

export function getColumns({
database,
Expand All @@ -30,7 +54,6 @@ export function getColumns({
kind: OperationKind;
}): DataTableColumn<TOperation>[] {
const isBuildIndex = kind === 'buildindex';
const isImportOrExport = IMPORT_EXPORT_KINDS.includes(kind);

// Helper function to get description tooltip content (buildindex-only)
const getDescriptionTooltip = (operation: TOperation): string => {
Expand Down Expand Up @@ -66,14 +89,7 @@ export function getColumns({
name: COLUMNS_NAMES.STATUS,
header: COLUMNS_TITLES[COLUMNS_NAMES.STATUS],
render: ({row}) => {
if (!row.status) {
return EMPTY_DATA_PLACEHOLDER;
}
return (
<Text color={row.status === EStatusCode.SUCCESS ? 'positive' : 'danger'}>
{row.status}
</Text>
);
return renderStatusCell(row);
},
},
];
Expand All @@ -93,21 +109,6 @@ export function getColumns({
});
}

// Add progress column for operations that have progress data
if (isBuildIndex || isImportOrExport) {
columns.push({
name: COLUMNS_NAMES.PROGRESS,
header: COLUMNS_TITLES[COLUMNS_NAMES.PROGRESS],
render: ({row}) => {
const progress = getOperationProgress(row, i18n);
if (progress === null) {
return EMPTY_DATA_PLACEHOLDER;
}
return progress;
},
});
}

// Add standard columns for non-buildindex operations
if (!isBuildIndex) {
columns.push(
Expand Down
2 changes: 0 additions & 2 deletions src/containers/Operations/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const COLUMNS_NAMES = {
END_TIME: 'end_time',
DURATION: 'duration',
STATE: 'state',
PROGRESS: 'progress',
} as const;

export const COLUMNS_TITLES = {
Expand All @@ -23,7 +22,6 @@ export const COLUMNS_TITLES = {
[COLUMNS_NAMES.END_TIME]: i18n('column_endTime'),
[COLUMNS_NAMES.DURATION]: i18n('column_duration'),
[COLUMNS_NAMES.STATE]: i18n('column_state'),
[COLUMNS_NAMES.PROGRESS]: i18n('column_progress'),
} as const;

export const BASE_COLUMNS = [
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Operations/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"column_endTime": "End Time",
"column_duration": "Duration",
"column_state": "State",
"column_progress": "Progress",
"label_duration-ongoing": "{{value}} (ongoing)",
"label_in-progress": "In progress",
"value_progress_unspecified": "Unspecified",
"value_progress_preparing": "Preparing",
"value_progress_transfer_data": "Transferring Data",
Expand Down
1 change: 0 additions & 1 deletion tests/suites/tenant/diagnostics/tabs/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ test.describe('Operations Tab - Infinite Query', () => {
firstRowData['Status'],
);
expect(firstRowData['State']).toBeTruthy();
expect(firstRowData['Progress']).toBeTruthy();

// Verify loading more indicator is not visible initially
const isLoadingVisible = await diagnostics.operations.isLoadingMoreVisible();
Expand Down
Loading