Skip to content

Commit

Permalink
Allow users to cancel a currently running sync on a disabled connecti…
Browse files Browse the repository at this point in the history
…on (#22241)

* Allow users to cancel a currently running sync on a disabled connection

- Changed logic to show/hide action buttons for Connections Status Page
  • Loading branch information
Mark Berger authored Feb 6, 2023
1 parent dfdec66 commit e8386a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
@use "scss/colors";
@use "scss/variables";

.title {
display: flex;
justify-content: space-between;
flex-direction: row;
align-items: center;
min-height: 32px;
}

.actions {
display: flex;

.resetButton,
.syncButton {
display: flex;
align-items: center;
justify-content: center;
}

.resetButton {
margin-right: variables.$spacing-md;
}
gap: variables.$spacing-md;
}

.footer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,31 +162,26 @@ export const ConnectionStatusPage: React.FC = () => {
title={
<div className={styles.title}>
<FormattedMessage id="sources.syncHistory" />
{connection.status === ConnectionStatus.active && (
{connection.status === ConnectionStatus.active && !activeJob?.action && (
<div className={styles.actions}>
{!activeJob?.action && (
<>
<Button className={styles.resetButton} variant="secondary" onClick={onResetDataButtonClick}>
<FormattedMessage id="connection.resetData" />
</Button>
<Button
className={styles.syncButton}
disabled={!allowSync}
onClick={onSyncNowButtonClick}
icon={<RotateIcon height={styles.syncIconHeight} width={styles.syncIconHeight} />}
>
<FormattedMessage id="connection.startSync" />
</Button>
</>
)}
{activeJob?.action && !activeJob.isCanceling && cancelJobBtn}
{activeJob?.action && activeJob.isCanceling && (
<Tooltip control={cancelJobBtn} cursor="not-allowed">
<FormattedMessage id="connection.canceling" />
</Tooltip>
)}
<Button variant="secondary" onClick={onResetDataButtonClick}>
<FormattedMessage id="connection.resetData" />
</Button>
<Button
disabled={!allowSync}
onClick={onSyncNowButtonClick}
icon={<RotateIcon height={styles.syncIconHeight} width={styles.syncIconHeight} />}
>
<FormattedMessage id="connection.startSync" />
</Button>
</div>
)}
{activeJob?.action && !activeJob.isCanceling && cancelJobBtn}
{activeJob?.action && activeJob.isCanceling && (
<Tooltip control={cancelJobBtn} cursor="not-allowed">
<FormattedMessage id="connection.canceling" />
</Tooltip>
)}
</div>
}
>
Expand Down

0 comments on commit e8386a2

Please sign in to comment.