Skip to content

Commit

Permalink
Merge pull request AutomaApp#1604 from Willy-J/main
Browse files Browse the repository at this point in the history
Fix bugs with deleting hosted workflows and opening workflows
  • Loading branch information
Kholid060 authored Dec 29, 2023
2 parents 6972828 + 4aba3b1 commit 5051c3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
26 changes: 25 additions & 1 deletion src/newtab/pages/Workflows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,31 @@ onMounted(() => {
state.activeTab = activeTab || tabs[0].id;
}
if (state.tabs.length !== 0) return;
if (state.tabs.length !== 0) {
if (/\/workflows\/.+/.test(route.path)) {
const routeTab = state.tabs.find((tab) => tab.path === route.path);
if (routeTab) {
if (routeTab.id !== state.activeTab) {
state.activeTab = routeTab.id;
}
} else {
const index = state.tabs.findIndex((tab) => tab.id === state.activeTab);
if (index !== -1) {
Object.assign(state.tabs[index], {
path: route.path,
name: getTabTitle(),
});
setTimeout(() => {
Object.assign(state.tabs[index], {
name: getTabTitle(),
});
}, 1000);
}
}
}
return;
}
addTab({
path: route.path,
Expand Down
6 changes: 3 additions & 3 deletions src/popup/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ function renameWorkflow({ id, name }) {
},
});
}
function deleteWorkflow({ id, name }) {
function deleteWorkflow({ id, hostId, name }) {
dialog.confirm({
title: t('home.workflow.delete'),
okVariant: 'danger',
Expand All @@ -361,7 +361,7 @@ function deleteWorkflow({ id, name }) {
if (state.activeTab === 'local') {
workflowStore.delete(id);
} else {
hostedWorkflowStore.delete(id);
hostedWorkflowStore.delete(hostId);
}
},
});
Expand Down Expand Up @@ -419,7 +419,7 @@ onMounted(async () => {
await automa('app');
if (activeTab === 'team' && !userStore.user?.teams) activeTab = 'local';
else if (activeTab === 'host' && hostedWorkflowStore.toArray.length < 0)
else if (activeTab === 'host' && hostedWorkflowStore.toArray.length < 1)
activeTab = 'local';
state.retrieved = true;
Expand Down

0 comments on commit 5051c3f

Please sign in to comment.