-
Notifications
You must be signed in to change notification settings - Fork 192
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
[INNO] ARC-2714 - Adding modals for backfill page #2598
Merged
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
be99c17
- Modal added for backfilling and disconnecting subscription
krazziekay 150023e
- Fixing eslint in a test case
krazziekay 4dd1eed
- WIP - backfill modal
krazziekay 7377807
- WIP - backfill modal
krazziekay e5d872b
Merge branch 'main' of github.com:atlassian/github-for-jira into ARC-…
krazziekay 9379076
Merge branch 'main' into ARC-adding-modals-for-backfill-page
krazziekay e940786
Merge branch 'main' of github.com:atlassian/github-for-jira into ARC-…
krazziekay 54747ff
- WIP - backfill modal
krazziekay ef67e5a
Merge branch 'main' into ARC-adding-modals-for-backfill-page
krazziekay 0b4d49f
- Using the corrected datepicker
krazziekay 2cebe4d
Merge remote-tracking branch 'origin' into ARC-adding-modals-for-back…
krazziekay f3c4998
Merge branch 'main' into ARC-adding-modals-for-backfill-page
krazziekay a3b96bf
- Fixing the delete subscription endpoint
krazziekay f455983
- Test cases added
krazziekay 31caf4a
Merge remote-tracking branch 'origin' into ARC-adding-modals-for-back…
krazziekay d3934ee
- Fixing test cases
krazziekay 5b10a31
- Fixing conflicts
krazziekay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
spa/src/pages/Connections/Modals/DisconnectSubscriptionModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle } from "@atlaskit/modal-dialog"; | ||
import Button from "@atlaskit/button"; | ||
import { SuccessfulConnection } from "../../../../../src/rest-interfaces"; | ||
|
||
/** | ||
* NOTE: While testing in dev mode, please disable the React.StrictMode first, | ||
* otherwise this modal won't show up. | ||
*/ | ||
const DisconnectSubscriptionModal = ({ subscription, setIsModalOpened }: { | ||
subscription: SuccessfulConnection, | ||
setIsModalOpened: (x: boolean) => void | ||
}) => { | ||
const disconnect = () => { | ||
// TODO: API call to disconnect this subscription | ||
console.log("Disconnect", subscription.account.login); | ||
setIsModalOpened(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Modal onClose={() => setIsModalOpened(false)}> | ||
<ModalHeader> | ||
<ModalTitle appearance="warning"> | ||
<>Disconnect {subscription.account.login}?</> | ||
</ModalTitle> | ||
</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Are you sure you want to disconnect your organization <b>{subscription.account.login}</b>? | ||
This means that you will have to redo the backfill of historical data if you ever want to reconnect | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button appearance="subtle" onClick={() => setIsModalOpened(false)}>Cancel</Button> | ||
<Button appearance="danger" onClick={disconnect}> | ||
Disconnect | ||
</Button> | ||
</ModalFooter> | ||
</Modal> | ||
</> | ||
); | ||
}; | ||
|
||
export default DisconnectSubscriptionModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { useEffect, useState } from "react"; | ||
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle } from "@atlaskit/modal-dialog"; | ||
import Button from "@atlaskit/button"; | ||
import { SuccessfulConnection } from "../../../../../src/rest-interfaces"; | ||
import { Checkbox } from "@atlaskit/checkbox"; | ||
import { Label } from "@atlaskit/form"; | ||
import { DatePicker } from "@atlaskit/datetime-picker"; | ||
|
||
/** | ||
* NOTE: While testing in dev mode, please disable the React.StrictMode first, | ||
* otherwise this modal won't show up. | ||
*/ | ||
const RestartBackfillModal = ({ subscription, setIsModalOpened }: { | ||
subscription: SuccessfulConnection, | ||
setIsModalOpened: (x: boolean) => void | ||
}) => { | ||
const [restartFromDateCheck, setRestartFromDateCheck] = useState(false); | ||
const [backfillDate, setBackfillDate] = useState(""); | ||
|
||
/** | ||
* TODO: Remove this later once the issue within datepicker is identified and fixed | ||
* Thread: https://atlassian.slack.com/archives/CFJ9DU39U/p1701912243843529 | ||
* | ||
* The datepicker jumps around when rendered inside a modal, | ||
* Until that is fixed, adding a short disable for the datepicker, | ||
* which is then enabled to avoid having the jumpy effect. | ||
*/ | ||
const [isDisabled, setIsDisabled] = useState(true); | ||
useEffect(() => { | ||
setTimeout(() => setIsDisabled(false), 10); | ||
}, []); | ||
|
||
const backfill = () => { | ||
// TODO: API call to disconnect this subscription | ||
console.log("Backfill for", subscription.account.login, restartFromDateCheck, backfillDate); | ||
setIsModalOpened(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Modal onClose={() => setIsModalOpened(false)}> | ||
<ModalHeader> | ||
<ModalTitle>Backfill your data</ModalTitle> | ||
</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Backfilling data can take a long time, so we’ll only backfill your data from the last 6 months. | ||
If you want to backfill more data, choose a date below. Branches will be backfilled regardless of their age. | ||
</p> | ||
<p> | ||
<Label htmlFor="backfill-date-picker">Choose date</Label> | ||
<DatePicker | ||
selectProps={{ | ||
inputId: "backfill-date-picker", | ||
}} | ||
placeholder="Select date" | ||
isDisabled={isDisabled} // TODO: remove this later | ||
onChange={setBackfillDate} | ||
/> | ||
</p> | ||
<p> | ||
<Checkbox | ||
onChange={() => setRestartFromDateCheck(!restartFromDateCheck)} | ||
label={`Restart the backfill from today to this date`} | ||
name="restart-from-selected-date" | ||
/> | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button appearance="subtle" onClick={() => setIsModalOpened(false)}>Cancel</Button> | ||
<Button appearance="danger" onClick={backfill}> | ||
Backfill data | ||
</Button> | ||
</ModalFooter> | ||
</Modal> | ||
</> | ||
); | ||
}; | ||
|
||
export default RestartBackfillModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It'd be good to create an enum for this instead of using strings
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.
I don't think its supported in webpack.
Simply following up on how we're using it in other places in
spa
. Can see the comment here in this file.