ui: add alert/prompt/confirm helper function (#1018)

This commit is contained in:
undefined authored and GitHub committed 2025-07-19 11:27:37 +01:00
1 parent 2d7979105e
commit d4271b3fbd
12 files changed
+176 -196

No files matched your search

@@ -4,7 +4,7 @@ import { map } from 'lodash';
import React from 'react';
import ReactDOM from 'react-dom/client';
import FileSelectAutoComplete from 'vj/components/autocomplete/FileSelectAutoComplete';
import { ActionDialog, ConfirmDialog, InfoDialog } from 'vj/components/dialog/index';
import { ActionDialog, confirm, InfoDialog } from 'vj/components/dialog/index';
import createHint from 'vj/components/hint';
import Notification from 'vj/components/notification';
import { previewFile } from 'vj/components/preview/preview.page';
@@ -255,10 +255,7 @@ const page = new NamedPage('problem_files', () => {
async function handleClickRemove(ev, type) {
const file = [$(ev.currentTarget).parent().parent().attr('data-filename')];
const action = await new ConfirmDialog({
$body: tpl.typoMsg(i18n('Confirm to delete the file?')),
}).open();
if (action !== 'yes') return;
if (!(await confirm(i18n('Confirm to delete the file?')))) return;
try {
await request.post('./files', {
operation: 'delete_files',
@@ -275,10 +272,7 @@ const page = new NamedPage('problem_files', () => {
async function handleClickRemoveSelected(type) {
const selectedFiles = ensureAndGetSelectedFiles(type);
if (selectedFiles === null) return;
const action = await new ConfirmDialog({
$body: tpl.typoMsg(i18n('Confirm to delete the selected files?')),
}).open();
if (action !== 'yes') return;
if (!(await confirm(i18n('Confirm to delete the selected files?')))) return;
try {
await request.post('', {
operation: 'delete_files',