Skip to content

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

Add task template query parameter

Tianzhou Chen6f191d351919
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index d9e1cd5edb..814e00afa2 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -112,7 +112,7 @@
v-if="quickActionList.includes('datasource.create')"
class="flex flex-col items-center w-28"
>
- <router-link to="/task/new" class="">
+ <router-link to="/task/new?template=bytebase.datasource.create" class="">
<span class="btn-icon-primary inline-flex p-3">
<svg
class="w-6 h-6"
@@ -164,22 +164,24 @@
v-if="quickActionList.includes('ticket.create')"
class="flex flex-col items-center w-28"
>
- <button class="btn-icon-primary p-3">
- <svg
- class="w-6 h-6"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"
- ></path>
- </svg>
- </button>
+ <router-link to="/task/new" class="">
+ <span class="btn-icon-primary inline-flex p-3">
+ <svg
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"
+ ></path>
+ </svg>
+ </span>
+ </router-link>
<h3 class="mt-1 text-center text-base font-normal text-main">Ticket</h3>
</div>
diff --git a/frontend/src/views/TaskDetail.vue b/frontend/src/views/TaskDetail.vue
index 677509ef31..c7e43d2c01 100644
--- a/frontend/src/views/TaskDetail.vue
+++ b/frontend/src/views/TaskDetail.vue
@@ -226,6 +226,19 @@ export default {
const store = useStore();
const router = useRouter();
+ const templateName =
+ router.currentRoute.value.query.template || "bytebase.general";
+ const taskTemplate = taskTemplateList.find(
+ (template) => template.type === templateName
+ )!;
+ if (!taskTemplate) {
+ store.dispatch("notification/pushNotification", {
+ module: "bytebase",
+ style: "CRITICAL",
+ title: `Unknown template '${templateName}'.`,
+ });
+ }
+
const environmentList = computed(() => {
return store.getters["environment/environmentList"]();
});
@@ -233,14 +246,11 @@ export default {
const currentUser = inject<User>(UserStateSymbol);
const refreshState = () => {
- const generalTaskTemplate = taskTemplateList.find(
- (template) => template.type == "bytebase.general"
- )!;
return {
new: props.taskSlug.toLowerCase() == "new",
task:
props.taskSlug.toLowerCase() == "new"
- ? generalTaskTemplate.buildTask({
+ ? taskTemplate.buildTask({
environmentList: environmentList.value,
currentUser: currentUser!,
})