Skip to content

Commit

Permalink
perf(UI): disable save button in table creation when no fields are added
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Nov 25, 2021
1 parent d7f1aa9 commit e8af2d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/renderer/components/WorkspaceTabNewTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="workspace-query-buttons">
<button
class="btn btn-primary btn-sm"
:disabled="!isChanged"
:disabled="!isChanged || !isValid"
:class="{'loading':isSaving}"
title="CTRL+S"
@click="saveChanges"
Expand Down Expand Up @@ -242,6 +242,9 @@ export default {
JSON.stringify(this.originalKeyUsage) !== JSON.stringify(this.localKeyUsage) ||
JSON.stringify(this.originalIndexes) !== JSON.stringify(this.localIndexes) ||
JSON.stringify(this.tableOptions) !== JSON.stringify(this.localOptions);
},
isValid () {
return !!this.localFields.length && !!this.localOptions.name.trim().length;
}
},
watch: {
Expand Down Expand Up @@ -287,7 +290,7 @@ export default {
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
}),
async saveChanges () {
if (this.isSaving) return;
if (this.isSaving || !this.isValid) return;
this.isSaving = true;
const params = {
Expand Down

0 comments on commit e8af2d2

Please sign in to comment.