mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-02 08:27:29 -08:00
31 lines
808 B
TypeScript
31 lines
808 B
TypeScript
import type { WorkflowTitleStatus } from '@/Interface';
|
|
import { useSettingsStore } from '@/stores/settings.store';
|
|
|
|
export function useTitleChange() {
|
|
const prependBeta = (title: string) => {
|
|
const settingsStore = useSettingsStore();
|
|
const { releaseChannel } = settingsStore.settings;
|
|
return releaseChannel === 'stable' ? title : `[${releaseChannel.toUpperCase()}] ${title}`;
|
|
};
|
|
|
|
const titleSet = (workflow: string, status: WorkflowTitleStatus) => {
|
|
let icon = '⚠️';
|
|
if (status === 'EXECUTING') {
|
|
icon = '🔄';
|
|
} else if (status === 'IDLE') {
|
|
icon = '▶️';
|
|
}
|
|
|
|
window.document.title = prependBeta(`n8n - ${icon} ${workflow}`);
|
|
};
|
|
|
|
const titleReset = () => {
|
|
window.document.title = prependBeta('n8n - Workflow Automation');
|
|
};
|
|
|
|
return {
|
|
titleSet,
|
|
titleReset,
|
|
};
|
|
}
|