mirror of https://github.com/Fabio286/antares.git
feat: reminder for uncommitted changes closing a tab
This commit is contained in:
parent
76743e8f7c
commit
5bfff649e9
|
@ -24,7 +24,11 @@
|
||||||
@mousedown.left="selectTab({uid: workspace.uid, tab: tab.uid})"
|
@mousedown.left="selectTab({uid: workspace.uid, tab: tab.uid})"
|
||||||
@mouseup.middle="closeTab(tab)"
|
@mouseup.middle="closeTab(tab)"
|
||||||
>
|
>
|
||||||
<a v-if="tab.type === 'query'" class="tab-link">
|
<a
|
||||||
|
v-if="tab.type === 'query'"
|
||||||
|
class="tab-link"
|
||||||
|
:class="{'badge': tab.isChanged}"
|
||||||
|
>
|
||||||
<i class="mdi mdi-18px mdi-code-tags mr-1" />
|
<i class="mdi mdi-18px mdi-code-tags mr-1" />
|
||||||
<span>
|
<span>
|
||||||
<span>{{ tab.content || 'Query' | cutText }} #{{ tab.index }}</span>
|
<span>{{ tab.content || 'Query' | cutText }} #{{ tab.index }}</span>
|
||||||
|
|
|
@ -238,6 +238,9 @@ export default {
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
|
tabUid () {
|
||||||
|
return this.$vnode.key;
|
||||||
|
},
|
||||||
breadcrumbsSchema () {
|
breadcrumbsSchema () {
|
||||||
return this.workspace.breadcrumbs.schema || null;
|
return this.workspace.breadcrumbs.schema || null;
|
||||||
},
|
},
|
||||||
|
@ -306,6 +309,7 @@ export default {
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
||||||
updateTabContent: 'workspaces/updateTabContent',
|
updateTabContent: 'workspaces/updateTabContent',
|
||||||
|
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
||||||
saveHistory: 'history/saveHistory'
|
saveHistory: 'history/saveHistory'
|
||||||
}),
|
}),
|
||||||
async runQuery (query) {
|
async runQuery (query) {
|
||||||
|
@ -344,6 +348,8 @@ export default {
|
||||||
content: query
|
content: query
|
||||||
});
|
});
|
||||||
this.saveHistory(params);
|
this.saveHistory(params);
|
||||||
|
if (!this.autocommit)
|
||||||
|
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.addNotification({ status: 'error', message: response });
|
this.addNotification({ status: 'error', message: response });
|
||||||
|
@ -451,6 +457,7 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
await Schema.commitTab(params);
|
await Schema.commitTab(params);
|
||||||
|
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: false });
|
||||||
this.addNotification({ status: 'success', message: this.$t('message.actionSuccessful', { action: 'COMMIT' }) });
|
this.addNotification({ status: 'success', message: this.$t('message.actionSuccessful', { action: 'COMMIT' }) });
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -468,6 +475,7 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
await Schema.rollbackTab(params);
|
await Schema.rollbackTab(params);
|
||||||
|
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: false });
|
||||||
this.addNotification({ status: 'success', message: this.$t('message.actionSuccessful', { action: 'ROLLBACK' }) });
|
this.addNotification({ status: 'success', message: this.$t('message.actionSuccessful', { action: 'ROLLBACK' }) });
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue