Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: delete sheet (#11105)

ecmadao391dedebec98
diff --git a/backend/store/worksheet.go b/backend/store/worksheet.go
index 422bf360df..2954072249 100644
--- a/backend/store/worksheet.go
+++ b/backend/store/worksheet.go
@@ -293,6 +293,9 @@ func (s *Store) DeleteWorkSheet(ctx context.Context, sheetUID int) error {
}
defer tx.Rollback()
+ if _, err := tx.ExecContext(ctx, `DELETE FROM worksheet_organizer WHERE worksheet_id = $1`, sheetUID); err != nil {
+ return err
+ }
if _, err := tx.ExecContext(ctx, `DELETE FROM worksheet WHERE id = $1`, sheetUID); err != nil {
return err
}
diff --git a/frontend/src/types/sheet.ts b/frontend/src/types/sheet.ts
index 1b82e6d514..0c1755ecae 100644
--- a/frontend/src/types/sheet.ts
+++ b/frontend/src/types/sheet.ts
@@ -1,3 +1,4 @@
+import { VNode } from "vue";
import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";
interface SheetVCSPayload {
@@ -18,4 +19,5 @@ export type AccessOption = {
label: string;
description: string;
value: Worksheet_Visibility;
+ icon: VNode;
};
diff --git a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
index 465ed3b2f9..37002c0b98 100644
--- a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue
@@ -31,7 +31,7 @@
</template>
<div class="access-content space-y-2 w-80">
<div
- v-for="(option, idx) in accessOptions"
+ v-for="option in accessOptions"
:key="option.label"
class="p-2 rounded-sm flex justify-between"
:class="[
@@ -40,24 +40,16 @@
]"
@click="handleChangeAccess(option)"
>
- <div class="access-content--prefix flex">
- <div v-if="idx === 0" class="mt-1">
- <heroicons-outline:lock-closed class="h-5 w-5" />
- </div>
- <div v-if="idx === 1" class="mt-1">
- <heroicons-outline:user-group class="h-5 w-5" />
- </div>
- <div v-if="idx === 2" class="mt-1">
- <heroicons-outline:globe class="h-5 w-5" />
- </div>
- <section class="flex flex-col pl-2">
+ <div class="access-content--prefix">
+ <div class="flex space-x-2 items-center">
+ <component :is="option.icon" class="h-5 w-5" />
<h2 class="text-md flex">
{{ option.label }}
</h2>
- <h3 class="text-xs">
- {{ option.description }}
- </h3>
- </section>
+ </div>
+ <span class="text-xs textinfolabel">
+ {{ option.description }}
+ </span>
</div>
<div
v-show="option.value === currentAccess.value"
@@ -93,6 +85,7 @@
<script lang="ts" setup>
import { useClipboard } from "@vueuse/core";
+import { LockKeyholeIcon, UsersIcon } from "lucide-vue-next";
import {
NButton,
NInput,
@@ -100,7 +93,7 @@ import {
NInputGroupLabel,
NPopover,
} from "naive-ui";
-import { ref, computed, onMounted } from "vue";
+import { ref, computed, onMounted, h } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { SQL_EDITOR_SHARE_MODULE } from "@/router/sqlEditor";
@@ -127,16 +120,19 @@ const accessOptions = computed<AccessOption[]>(() => {
label: t("sql-editor.private"),
value: Worksheet_Visibility.VISIBILITY_PRIVATE,
description: t("sql-editor.private-desc"),
+ icon: h(LockKeyholeIcon),
},
{
label: t("sql-editor.project-read"),
value: Worksheet_Visibility.VISIBILITY_PROJECT_READ,
description: t("sql-editor.project-read-desc"),
+ icon: h(UsersIcon),
},
{
label: t("sql-editor.project-write"),
value: Worksheet_Visibility.VISIBILITY_PROJECT_WRITE,
description: t("sql-editor.project-write-desc"),
+ icon: h(UsersIcon),
},
];
});
diff --git a/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue b/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
index 01e14fd645..811408533c 100644
--- a/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
+++ b/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
@@ -59,6 +59,7 @@
y: dropdown.y,
onClickoutside: () => (dropdown = undefined),
}"
+ @dismiss="dropdown = undefined"
/>
</div>
</div>
diff --git a/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue b/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue
index 461171b7ad..a139be958c 100644
--- a/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue
+++ b/frontend/src/views/sql-editor/Sheet/common/Dropdown.vue
@@ -48,6 +48,10 @@ const props = defineProps<{
transparent?: boolean;
}>();
+const emit = defineEmits<{
+ (event: "dismiss"): void;
+}>();
+
const { t } = useI18n();
const worksheetV1Store = useWorkSheetStore();
const dialog = useDialog();
@@ -170,6 +174,8 @@ const handleAction = async (key: string) => {
editTitle: true,
});
}
+
+ emit("dismiss");
};
const turnSheetToUnsavedTab = (sheet: Worksheet) => {