0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-29 14:16:26 +02:00
This commit is contained in:
Lunny Xiao 2026-05-14 22:26:50 -07:00
parent cc25afa752
commit bacd181db4
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 6 additions and 5 deletions

View File

@ -82,6 +82,8 @@ type WorkflowStoreState = {
const createDefaultFilters = (): WorkflowFilters => ({issue_type: '', source_column: '', target_column: '', labels: []});
const createDefaultActions = (): WorkflowActions => ({column: '', add_labels: [], remove_labels: [], issue_state: ''});
const getErrorMessage = (error: unknown): string => error instanceof Error ? error.message : String(error);
function convertFilters(workflow?: WorkflowEvent | null): WorkflowFilters {
const filters = createDefaultFilters();
if (workflow?.filters && Array.isArray(workflow.filters)) {
@ -151,7 +153,7 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
workflowFilters: createDefaultFilters(),
workflowActions: createDefaultActions(),
workflowDrafts: {} as Record<string, WorkflowDraftState>,
workflowDrafts: {},
getDraft(event_id: string): WorkflowDraftState | undefined {
return store.workflowDrafts[event_id];
@ -319,7 +321,7 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
}
} catch (error) {
console.error('Failed to save workflow:', error);
showErrorToast(`${props.locale.saveWorkflowFailed}: ${error.message}`);
showErrorToast(`${props.locale.saveWorkflowFailed}: ${getErrorMessage(error)}`);
} finally {
store.saving = false;
}
@ -367,7 +369,7 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
console.error('Failed to update workflow status:', error);
// Revert the status change on error
selected.enabled = previousEnabled;
showErrorToast(`${props.locale.updateWorkflowFailed}: ${error.message}`);
showErrorToast(`${props.locale.updateWorkflowFailed}: ${getErrorMessage(error)}`);
}
},
@ -396,7 +398,7 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
}
} catch (error) {
console.error('Error deleting workflow:', error);
showErrorToast(`${props.locale.deleteWorkflowFailed}: ${error.message}`);
showErrorToast(`${props.locale.deleteWorkflowFailed}: ${getErrorMessage(error)}`);
}
},

View File

@ -1,4 +1,3 @@
import '../fomantic/build/fomantic.js';
import '../css/index.css';