Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show unsaved changes warning modal after table creation #1935

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/studio/src/common/appdb/models/CloseTab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface CloseTabOptions {
ignoreUnsavedChanges?: boolean;
}
9 changes: 5 additions & 4 deletions apps/studio/src/components/CoreTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ import ShortcutHints from './editor/ShortcutHints.vue'
import { FormatterDialect } from '@shared/lib/dialects/models';
import Vue from 'vue';
import { OpenTab } from '@/common/appdb/models/OpenTab';
import { CloseTabOptions } from '@/common/appdb/models/CloseTab';
import TabWithTable from './common/TabWithTable.vue';
import TabIcon from './tab/TabIcon.vue'
import { DatabaseEntity } from "@/lib/db/models"
Expand Down Expand Up @@ -512,8 +513,8 @@ export default Vue.extend({
this.setActiveTab(this.tabItems[this.activeIdx - 1])
}
},
closeCurrentTab() {
if (this.activeTab) this.close(this.activeTab)
closeCurrentTab(_id?:number, options?:CloseTabOptions) {
if (this.activeTab) this.close(this.activeTab, options)
},
handleCreateTab() {
this.createQuery()
Expand Down Expand Up @@ -813,8 +814,8 @@ export default Vue.extend({
}
}
},
async close(tab: OpenTab) {
if (tab.unsavedChanges) {
async close(tab: OpenTab, options?: CloseTabOptions) {
if (tab.unsavedChanges && !options?.ignoreUnsavedChanges) {
this.closingTab = tab
const confirmed = await this.$refs.closeConfirmation.confirm();
this.closingTab = null
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/components/TabTableBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default Vue.extend({
))
if (newTable) {
this.$root.$emit(AppEvent.openTableProperties, { table: newTable })
this.$root.$emit(AppEvent.closeTab, this.tabId)
this.$root.$emit(AppEvent.closeTab, this.tabId, { ignoreUnsavedChanges: true })
}
} catch (error) {
this.error = error
Expand Down