refactor(editor): Turn titleChange mixin to composable (#6059)
This commit is contained in:
19
packages/editor-ui/src/composables/useTitleChange.ts
Normal file
19
packages/editor-ui/src/composables/useTitleChange.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { WorkflowTitleStatus } from '@/Interface';
|
||||
|
||||
export function useTitleChange() {
|
||||
return {
|
||||
titleSet(workflow: string, status: WorkflowTitleStatus) {
|
||||
let icon = '⚠️';
|
||||
if (status === 'EXECUTING') {
|
||||
icon = '🔄';
|
||||
} else if (status === 'IDLE') {
|
||||
icon = '▶️';
|
||||
}
|
||||
|
||||
window.document.title = `n8n - ${icon} ${workflow}`;
|
||||
},
|
||||
titleReset() {
|
||||
document.title = 'n8n - Workflow Automation';
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user