-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add control to execute forget command for an export #1552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
01de67b
49684fa
94d8484
5ecaf0a
dbaa1a4
07975d7
e669fe0
1572a21
d6b2179
507d112
7b63c94
e2d05d1
487e7d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,9 @@ | |
| &__search { | ||
| width: 220px; | ||
| } | ||
|
|
||
| &__buttons-container { | ||
| display: flex; | ||
| gap: var(--g-spacing-2); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,30 @@ | ||
| import {duration} from '@gravity-ui/date-utils'; | ||
| import {Ban, CircleStop} from '@gravity-ui/icons'; | ||
| import type {Column as DataTableColumn} from '@gravity-ui/react-data-table'; | ||
| import {Text} from '@gravity-ui/uikit'; | ||
| import {Icon, Text, Tooltip} from '@gravity-ui/uikit'; | ||
|
|
||
| import {ButtonWithConfirmDialog} from '../../components/ButtonWithConfirmDialog/ButtonWithConfirmDialog'; | ||
| import {CellWithPopover} from '../../components/CellWithPopover/CellWithPopover'; | ||
| import type {TOperation} from '../../types/api/operationList'; | ||
| import {EStatusCode} from '../../types/api/operationList'; | ||
| import {operationsApi} from '../../store/reducers/operations'; | ||
| import type {TOperation} from '../../types/api/operations'; | ||
| import {EStatusCode} from '../../types/api/operations'; | ||
| import {EMPTY_DATA_PLACEHOLDER, HOUR_IN_SECONDS, SECOND_IN_MS} from '../../utils/constants'; | ||
| import {formatDateTime} from '../../utils/dataFormatters/dataFormatters'; | ||
| import {parseProtobufTimestampToMs} from '../../utils/timeParsers'; | ||
|
|
||
| import {COLUMNS_NAMES, COLUMNS_TITLES} from './constants'; | ||
| import i18n from './i18n'; | ||
| import {b} from './shared'; | ||
|
|
||
| export function getColumns(): DataTableColumn<TOperation>[] { | ||
| import './Operations.scss'; | ||
|
|
||
| export function getColumns({ | ||
| database, | ||
| refreshTable, | ||
| }: { | ||
| database: string; | ||
| refreshTable: VoidFunction; | ||
| }): DataTableColumn<TOperation>[] { | ||
| return [ | ||
| { | ||
| name: COLUMNS_NAMES.ID, | ||
|
|
@@ -114,5 +126,77 @@ export function getColumns(): DataTableColumn<TOperation>[] { | |
| return Date.now() - createTime; | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Actions', | ||
| sortable: false, | ||
| resizeable: false, | ||
| header: '', | ||
| render: ({row}) => { | ||
| return ( | ||
| <OperationsActions | ||
| operation={row} | ||
| database={database} | ||
| refreshTable={refreshTable} | ||
| /> | ||
| ); | ||
| }, | ||
| }, | ||
| ]; | ||
| } | ||
|
|
||
| interface OperationsActionsProps { | ||
| operation: TOperation; | ||
| database: string; | ||
| refreshTable: VoidFunction; | ||
| } | ||
|
|
||
| function OperationsActions({operation, database, refreshTable}: OperationsActionsProps) { | ||
| const [cancelOperation, {isLoading: isLoadingCancel}] = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As for me it would be nice to show success toast if action is completed. What do you think? |
||
| operationsApi.useCancelOperationMutation(); | ||
| const [forgetOperation, {isLoading: isForgetLoading}] = | ||
| operationsApi.useForgetOperationMutation(); | ||
|
|
||
| const id = operation.id; | ||
| if (!id) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className={b('buttons-container')}> | ||
|
||
| <Tooltip openDelay={0} content={i18n('header_forget')} placement="right"> | ||
| <div> | ||
| <ButtonWithConfirmDialog | ||
| buttonView="outlined" | ||
| dialogHeader={i18n('header_forget')} | ||
| dialogText={i18n('text_forget')} | ||
| onConfirmAction={() => | ||
| forgetOperation({id, database}) | ||
| .unwrap() | ||
| .then(() => refreshTable()) | ||
| } | ||
| buttonDisabled={isLoadingCancel} | ||
| > | ||
| <Icon data={Ban} /> | ||
| </ButtonWithConfirmDialog> | ||
| </div> | ||
| </Tooltip> | ||
| <Tooltip openDelay={0} content={i18n('header_cancel')} placement="right"> | ||
| <div> | ||
| <ButtonWithConfirmDialog | ||
| buttonView="outlined" | ||
| dialogHeader={i18n('header_cancel')} | ||
| dialogText={i18n('text_cancel')} | ||
| onConfirmAction={() => | ||
| cancelOperation({id, database}) | ||
| .unwrap() | ||
| .then(() => refreshTable()) | ||
| } | ||
| buttonDisabled={isForgetLoading} | ||
| > | ||
| <Icon data={CircleStop} /> | ||
| </ButtonWithConfirmDialog> | ||
| </div> | ||
| </Tooltip> | ||
| </div> | ||
| ); | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import type { | ||
| OperationCancelRequestParams, | ||
| OperationForgetRequestParams, | ||
| OperationListRequestParams, | ||
| } from '../../types/api/operations'; | ||
|
|
||
| import {api} from './api'; | ||
|
|
||
| export const operationsApi = api.injectEndpoints({ | ||
| endpoints: (build) => ({ | ||
| getOperationList: build.query({ | ||
| queryFn: async (params: OperationListRequestParams, {signal}) => { | ||
| try { | ||
| const data = await window.api.getOperationList(params, {signal}); | ||
| return {data}; | ||
| } catch (error) { | ||
| return {error}; | ||
| } | ||
| }, | ||
| providesTags: ['All'], | ||
| }), | ||
| cancelOperation: build.mutation({ | ||
| queryFn: async (params: OperationCancelRequestParams, {signal}) => { | ||
| try { | ||
| const data = await window.api.cancelOperation(params, {signal}); | ||
| return {data}; | ||
| } catch (error) { | ||
| return {error}; | ||
| } | ||
| }, | ||
| }), | ||
| forgetOperation: build.mutation({ | ||
| queryFn: async (params: OperationForgetRequestParams, {signal}) => { | ||
| try { | ||
| const data = await window.api.forgetOperation(params, {signal}); | ||
| return {data}; | ||
| } catch (error) { | ||
| return {error}; | ||
| } | ||
| }, | ||
| }), | ||
| }), | ||
| overrideExisting: 'throw', | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks strange... What if we remove

ydb-critical-dialog__error-iconin case when we show issues tree?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is seems formatting is broken when expand issues
