Skip to content
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

Fix error modal in user merge frontend #174

Closed
wants to merge 3 commits into from
Closed
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
40 changes: 21 additions & 19 deletions frontend/components/analysis/RunButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,35 @@ const request = computed<RunAnalysisReq>(() => {
}
})

const startRun = () => {
const startRun = async () => {
emit('started')
clicked.value = true
void withLoading(
() => pactaClient.runAnalysis(request.value)
.then((resp) => { analysisId.value = resp.analysisId })
.then(() => { void refreshAnalysisState() }),
const resp = await withLoading(
() => pactaClient.runAnalysis(request.value),
`${prefix}.runAnalysis`,
)
analysisId.value = resp.analysisId
void refreshAnalysisState()
}
const runAnalysis = () => {
const runAnalysis = async () => {
if (!props.warnForDuplicate) {
startRun()
await startRun()
return
}
confirm({
header: tt('ConfirmationHeader'),
message: tt('ConfirmationMessage'),
icon: 'pi pi-copy',
position: 'center',
blockScroll: true,
reject: () => { clicked.value = false },
rejectLabel: tt('Cancel Run'),
rejectIcon: 'pi pi-times',
acceptLabel: tt('Run Anyway'),
accept: startRun,
acceptIcon: 'pi pi-check',
await new Promise((resolve, reject) => {
confirm({
header: tt('ConfirmationHeader'),
message: tt('ConfirmationMessage'),
icon: 'pi pi-copy',
position: 'center',
blockScroll: true,
reject: () => { clicked.value = false },
rejectLabel: tt('Cancel Run'),
rejectIcon: 'pi pi-times',
acceptLabel: tt('Run Anyway'),
accept: () => { startRun().then(resolve).catch(reject) },
acceptIcon: 'pi pi-check',
})
})
}
const refreshAnalysisState = async () => {
Expand Down
43 changes: 23 additions & 20 deletions frontend/pages/admin/merge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ const fromUserId = useState<string>(`${prefix}.fromUserId`, () => '')
const toUserId = useState<string>(`${prefix}.toUserId`, () => '')
const done = useState<boolean>(`${prefix}.done`, () => false)

// TODO(#168) An example of the error here.
const doMerge = (): void => {
void withLoading(() => pactaClient.mergeUsers({
const doMerge = async () => {
await withLoading(() => pactaClient.mergeUsers({
fromUserId: fromUserId.value,
toUserId: toUserId.value,
}).then((resp) => {
done.value = true
}), `${prefix}.doMerge`)

done.value = true
}

const clickMerge = () => {
confirm({
header: 'Are you 100% sure?',
message: 'This will transfer all assets from the source user to the destination user, and then delete the source user. This cannot be undone. Only proceed if you have tripple checked the user IDs and are confident in this procedure.',
icon: 'pi pi-user-minus',
position: 'center',
blockScroll: true,
reject: () => { /* noop */ },
rejectLabel: 'Cancel',
rejectIcon: 'pi pi-times',
rejectClass: 'p-button-secondary p-button-text',
acceptClass: 'p-button-danger',
acceptLabel: 'Proceed',
accept: doMerge,
acceptIcon: 'pi pi-check',
const clickMerge = async () => {
await new Promise((resolve, reject) => {
confirm({
header: 'Are you 100% sure?',
message: 'This will transfer all assets from the source user to the destination user, and then delete the source user. This cannot be undone. Only proceed if you have tripple checked the user IDs and are confident in this procedure.',
icon: 'pi pi-user-minus',
position: 'center',
blockScroll: true,
reject: () => { /* noop */ },
rejectLabel: 'Cancel',
rejectIcon: 'pi pi-times',
rejectClass: 'p-button-secondary p-button-text',
acceptClass: 'p-button-danger',
acceptLabel: 'Proceed',
accept: () => {
doMerge().then(resolve).catch(reject)
},
acceptIcon: 'pi pi-check',
})
})
}

Expand Down
Loading