Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Refine Quickstart and create seed data for onboarding
天舟af626a2c6977
diff --git a/frontend/src/components/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm.vueindex 3613d7b0b9..fbfce3a0f6 100644--- a/frontend/src/components/CreateDatabasePrepForm.vue+++ b/frontend/src/components/CreateDatabasePrepForm.vue@@ -285,13 +285,6 @@ export default {payload: {},};store.dispatch("issue/createIssue", newIssue).then((createdIssue) => {- // It's a bit earlier to set database.create as true here since we just successfully created the issue- // and the issue might not complete. However, we don't have a reliable way to observe issue completion,- // thus this is the best place to set this.- store.dispatch("uistate/saveIntroStateByKey", {- key: "database.create",- newState: true,- });router.push(`/issue/${issueSlug(createdIssue.name, createdIssue.id)}`);});};diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex ad1ef06277..cd5c824466 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -459,11 +459,6 @@ export default {title: `Successfully created instance '${createdInstance.name}'.`,});- store.dispatch("uistate/saveIntroStateByKey", {- key: "instance.create",- newState: true,- });-// After creating the instance, we will check if migration schema exists on the instance.setTimeout(() => {}, 1000);});diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vueindex 20b2c7cbfd..4706ca2f18 100644--- a/frontend/src/components/ProfileDropdown.vue+++ b/frontend/src/components/ProfileDropdown.vue@@ -108,23 +108,23 @@ export default {newState: false,});store.dispatch("uistate/saveIntroStateByKey", {- key: "environment.create",+ key: "comment.create",newState: false,});store.dispatch("uistate/saveIntroStateByKey", {- key: "instance.create",+ key: "project.visit",newState: false,});store.dispatch("uistate/saveIntroStateByKey", {- key: "project.create",+ key: "environment.visit",newState: false,});store.dispatch("uistate/saveIntroStateByKey", {- key: "database.create",+ key: "instance.visit",newState: false,});store.dispatch("uistate/saveIntroStateByKey", {- key: "schema.update",+ key: "database.visit",newState: false,});store.dispatch("uistate/saveIntroStateByKey", {@@ -136,6 +136,10 @@ export default {newState: false,});+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "guide.project",+ newState: false,+ });store.dispatch("uistate/saveIntroStateByKey", {key: "guide.environment",newState: false,@@ -144,6 +148,10 @@ export default {key: "guide.instance",newState: false,});+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "guide.database",+ newState: false,+ });};const switchToOwner = () => {diff --git a/frontend/src/components/ProjectCreate.vue b/frontend/src/components/ProjectCreate.vueindex 4054406a6a..5cc23bf283 100644--- a/frontend/src/components/ProjectCreate.vue+++ b/frontend/src/components/ProjectCreate.vue@@ -99,7 +99,7 @@ export default {.dispatch("project/createProject", state.project).then((createdProject: Project) => {store.dispatch("uistate/saveIntroStateByKey", {- key: "project.create",+ key: "project.visit",newState: true,});diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vueindex 34d1242a44..b660f0496d 100644--- a/frontend/src/components/Quickstart.vue+++ b/frontend/src/components/Quickstart.vue@@ -120,7 +120,7 @@ export default {const introList: IntroItem[] = reactive([{name: "Bookmark an issue",- link: "/issue/hello-world-1",+ link: "/issue/hello-world-101",allowDBA: true,allowDeveloper: true,done: computed(() => {@@ -128,57 +128,57 @@ export default {}),},{- name: "Add a member",- link: "/setting/member",- allowDBA: false,- allowDeveloper: false,- done: computed(() =>- store.getters["uistate/introStateByKey"]("member.addOrInvite")- ),+ name: "Add a comment",+ link: "/issue/hello-world-101#activity101",+ allowDBA: true,+ allowDeveloper: true,+ done: computed(() => {+ return store.getters["uistate/introStateByKey"]("comment.create");+ }),},{- name: "Add an environment",- link: "/environment",+ name: "Visit project",+ link: "/project",allowDBA: true,- allowDeveloper: false,+ allowDeveloper: true,done: computed(() => {- return store.getters["uistate/introStateByKey"]("environment.create");+ return store.getters["uistate/introStateByKey"]("project.visit");}),},{- name: "Add an instance",- link: "/instance",+ name: "Visit environment",+ link: "/environment",allowDBA: true,allowDeveloper: false,done: computed(() => {- return store.getters["uistate/introStateByKey"]("instance.create");+ return store.getters["uistate/introStateByKey"]("environment.visit");}),},{- name: "Create a project",- link: "/project",+ name: "Visit instance",+ link: "/instance",allowDBA: true,- allowDeveloper: true,+ allowDeveloper: !store.getters["plan/feature"]("bb.dba-workflow"),done: computed(() => {- return store.getters["uistate/introStateByKey"]("project.create");+ return store.getters["uistate/introStateByKey"]("instance.visit");}),},{- name: "Create a database",+ name: "Visit database",link: "/db",allowDBA: true,- allowDeveloper: !store.getters["plan/feature"]("bb.dba-workflow"),+ allowDeveloper: true,done: computed(() =>- store.getters["uistate/introStateByKey"]("database.create")+ store.getters["uistate/introStateByKey"]("database.visit")),},{- name: "Alter schema",- link: "/db",- allowDBA: true,- allowDeveloper: true,+ name: "Add a member",+ link: "/setting/member",+ allowDBA: false,+ allowDeveloper: false,done: computed(() =>- store.getters["uistate/introStateByKey"]("schema.update")+ store.getters["uistate/introStateByKey"]("member.addOrInvite")),},]);diff --git a/frontend/src/views/DatabaseCreate.vue b/frontend/src/views/DatabaseCreate.vueindex b8c7599551..5e04014008 100644--- a/frontend/src/views/DatabaseCreate.vue+++ b/frontend/src/views/DatabaseCreate.vue@@ -501,11 +501,6 @@ export default {}}- store.dispatch("uistate/saveIntroStateByKey", {- key: "database.create",- newState: true,- });-store.dispatch("notification/pushNotification", {module: "bytebase",style: "SUCCESS",diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vueindex 909fec101b..802a7cfb26 100644--- a/frontend/src/views/DatabaseDashboard.vue+++ b/frontend/src/views/DatabaseDashboard.vue@@ -13,13 +13,28 @@</div><DatabaseTable :bordered="false" :databaseList="filteredList" /></div>++ <BBAlert+ v-if="state.showGuide"+ :style="'INFO'"+ :okText="'Do not show again'"+ :cancelText="'Dismiss'"+ :title="'How to setup \'Database\' ?'"+ :description="'Each Bytebase database maps to the one created by \'CREATE DATABASE xxx\'. In Bytebase, a database always belongs to a signle project.\n\nBytebase will periodically sync the database info for every recorded instance. You can also create a new database from the dashboard.'"+ @ok="+ () => {+ doDismissGuide();+ }+ "+ @cancel="state.showGuide = false"+ >+ </BBAlert></template><script lang="ts">import { computed, watchEffect, onMounted, reactive, ref } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";-import cloneDeep from "lodash-es/cloneDeep";import EnvironmentTabFilter from "../components/EnvironmentTabFilter.vue";import DatabaseTable from "../components/DatabaseTable.vue";import { Environment, Database } from "../types";@@ -29,6 +44,7 @@ interface LocalState {searchText: string;databaseList: Database[];selectedEnvironment?: Environment;+ showGuide: boolean;}export default {@@ -51,6 +67,7 @@ export default {router.currentRoute.value.query.environment): undefined,+ showGuide: false,});const currentUser = computed(() => store.getters["auth/currentUser"]());@@ -62,6 +79,16 @@ export default {onMounted(() => {// Focus on the internal search field when mountedsearchField.value.$el.querySelector("#search").focus();++ if (!store.getters["uistate/introStateByKey"]("guide.database")) {+ setTimeout(() => {+ state.showGuide = true;+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "database.visit",+ newState: true,+ });+ }, 1000);+ }});const prepareDatabaseList = () => {@@ -77,6 +104,14 @@ export default {watchEffect(prepareDatabaseList);+ const doDismissGuide = () => {+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "guide.database",+ newState: true,+ });+ state.showGuide = false;+ };+const selectEnvironment = (environment: Environment) => {state.selectedEnvironment = environment;if (environment) {@@ -114,6 +149,7 @@ export default {searchField,state,filteredList,+ doDismissGuide,selectEnvironment,changeSearchText,};diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vueindex 728c569040..17774475d8 100644--- a/frontend/src/views/EnvironmentDashboard.vue+++ b/frontend/src/views/EnvironmentDashboard.vue@@ -58,7 +58,7 @@:okText="'Do not show again'":cancelText="'Dismiss'":title="'How to setup \'Environment\' ?'"- :description="'Each environment in Bytebase maps to one of your testing, staging, prod environment respectively.\n\nEnvironment is a global setting, one Bytebase deployment only contains a single set of environments.\n\nDatabase instances are created under a particular environment and most issues also require specifying an environment first.'"+ :description="'Each environment maps to one of your testing, staging, prod environment respectively.\n\nEnvironment is a global setting, one Bytebase deployment only contains a single set of environments.\n\nDatabase instances are created under a particular environment.'"@ok="() => {doDismissGuide();@@ -90,8 +90,8 @@ interface LocalState {reorderedEnvironmentList: Environment[];selectedIndex: number;showCreateModal: boolean;- showGuide: boolean;reorder: boolean;+ showGuide: boolean;}export default {@@ -113,8 +113,8 @@ export default {reorderedEnvironmentList: [],selectedIndex: -1,showCreateModal: false,- showGuide: false,reorder: false,+ showGuide: false,});const selectEnvironmentOnHash = () => {@@ -156,6 +156,10 @@ export default {if (!store.getters["uistate/introStateByKey"]("guide.environment")) {setTimeout(() => {state.showGuide = true;+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "environment.visit",+ newState: true,+ });}, 1000);}});@@ -210,11 +214,6 @@ export default {.then(() => {state.showCreateModal = false;selectEnvironment(environmentList.value.length - 1);-- store.dispatch("uistate/saveIntroStateByKey", {- key: "environment.create",- newState: true,- });});};diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vueindex db8509184c..fb2d968a1d 100644--- a/frontend/src/views/InstanceDashboard.vue+++ b/frontend/src/views/InstanceDashboard.vue@@ -20,7 +20,7 @@:okText="'Do not show again'":cancelText="'Dismiss'":title="'How to setup \'Instance\' ?'"- :description="'Each instance in Bytebase usually maps to one of your database instance represented by an host:port address. This could be your on-premise MySQL instance, a RDS instance.\n\nBytebase requires read/write (NOT the super privilege) access to the instance in order to perform database operations on behalf of the user.'"+ :description="'Each Bytebase instance belongs to an environment. An instance usually maps to one of your database instance represented by an host:port address. This could be your on-premises MySQL instance, a RDS instance.\n\nBytebase requires read/write (NOT the super privilege) access to the instance in order to perform database operations on behalf of the user.'"@ok="() => {doDismissGuide();@@ -74,6 +74,10 @@ export default {if (!store.getters["uistate/introStateByKey"]("guide.instance")) {setTimeout(() => {state.showGuide = true;+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "instance.visit",+ newState: true,+ });}, 1000);}});diff --git a/frontend/src/views/IssueActivityPanel.vue b/frontend/src/views/IssueActivityPanel.vueindex 476c800687..9f2c75a61a 100644--- a/frontend/src/views/IssueActivityPanel.vue+++ b/frontend/src/views/IssueActivityPanel.vue@@ -692,6 +692,11 @@ export default {comment: newComment.value,};store.dispatch("activity/createActivity", createActivity).then(() => {+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "comment.create",+ newState: true,+ });+newComment.value = "";nextTick(() => sizeToFit(newCommentTextArea.value));diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 063b4216d6..bcab75418d 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -591,15 +591,6 @@ export default {issueStatusPatch,}).then(() => {- if (- newStatus == "DONE" &&- issueTemplate.value.type == "bb.issue.database.schema.update"- ) {- store.dispatch("uistate/saveIntroStateByKey", {- key: "schema.update",- newState: true,- });- }pollIssue(POST_STATUS_CHANGE_ISSUE_POLL_INTERVAL);});};diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vueindex 4985755948..2e45df7d15 100644--- a/frontend/src/views/ProjectDashboard.vue+++ b/frontend/src/views/ProjectDashboard.vue@@ -9,6 +9,22 @@</div><ProjectTable :projectList="filteredList(state.projectList)" /></div>++ <BBAlert+ v-if="state.showGuide"+ :style="'INFO'"+ :okText="'Do not show again'"+ :cancelText="'Dismiss'"+ :title="'How to setup \'Project\' ?'"+ :description="'Bytebase project is similar to the project concept in other common dev tools.\n\nA project has its own members, and every issue and database always belongs to a single project.\n\nA project can also be configured to link to a repository to enable version control workflow.'"+ @ok="+ () => {+ doDismissGuide();+ }+ "+ @cancel="state.showGuide = false"+ >+ </BBAlert></template><script lang="ts">@@ -20,6 +36,7 @@ import { Project } from "../types";interface LocalState {projectList: Project[];searchText: string;+ showGuide: boolean;}export default {@@ -36,6 +53,7 @@ export default {const state = reactive<LocalState>({projectList: [],searchText: "",+ showGuide: false,});const currentUser = computed(() => store.getters["auth/currentUser"]());@@ -43,6 +61,16 @@ export default {onMounted(() => {// Focus on the internal search field when mountedsearchField.value.$el.querySelector("#search").focus();++ if (!store.getters["uistate/introStateByKey"]("guide.project")) {+ setTimeout(() => {+ state.showGuide = true;+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "project.visit",+ newState: true,+ });+ }, 1000);+ }});const prepareProjectList = () => {@@ -61,6 +89,14 @@ export default {state.searchText = searchText;};+ const doDismissGuide = () => {+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "guide.project",+ newState: true,+ });+ state.showGuide = false;+ };+const filteredList = (list: Project[]) => {if (!state.searchText) {// Select "All"@@ -78,6 +114,7 @@ export default {searchField,state,filteredList,+ doDismissGuide,changeSearchText,};},diff --git a/store/seed/release/10001__init_seed.sql b/store/seed/release/10001__init_seed.sqlindex bff60fb2aa..ec0f4156a2 100644--- a/store/seed/release/10001__init_seed.sql+++ b/store/seed/release/10001__init_seed.sql@@ -188,4 +188,234 @@ VALUES'ADMIN','admin',''+ );++-- Create pipeline/stage/task/issue for onboarding+-- Create pipeline 101 "Hello world"+INSERT INTO+ pipeline (+ id,+ creator_id,+ updater_id,+ name,+ `status`+ )+VALUES+ (+ 101,+ 1,+ 1,+ 'Pipeline - Hello world',+ 'OPEN'+ );++-- Create stage 101, 102 for pipeline 101+INSERT INTO+ stage (+ id,+ creator_id,+ updater_id,+ pipeline_id,+ environment_id,+ name+ )+VALUES+ (+ 101,+ 1,+ 1,+ 101,+ 101,+ 'Test'+ );++INSERT INTO+ stage (+ id,+ creator_id,+ updater_id,+ pipeline_id,+ environment_id,+ name+ )+VALUES+ (+ 102,+ 1,+ 1,+ 101,+ 102,+ 'Prod'+ );++-- Create task 101 for stage 101+INSERT INTO+ task (+ id,+ creator_id,+ updater_id,+ pipeline_id,+ stage_id,+ instance_id,+ database_id,+ name,+ `type`,+ `status`,+ payload+ )+VALUES+ (+ 101,+ 1,+ 1,+ 101,+ 101,+ 101,+ NULL,+ 'Welcome',+ 'bb.task.general',+ 'RUNNING',+ '{"statement":"SELECT ''Welcome Builders'';"}'+ );++-- Create task 102 for stage 102+INSERT INTO+ task (+ id,+ creator_id,+ updater_id,+ pipeline_id,+ stage_id,+ instance_id,+ database_id,+ name,+ `type`,+ `status`,+ payload+ )+VALUES+ (+ 102,+ 1,+ 1,+ 101,+ 102,+ 102,+ NULL,+ 'Let''s go',+ 'bb.task.general',+ 'PENDING_APPROVAL',+ '{"statement":"SELECT ''Let''s go'';"}'+ );++-- Create task_run for task 101+INSERT INTO+ task_run (+ creator_id,+ updater_id,+ task_id,+ name,+ `status`,+ `type`,+ error,+ payload+ )+VALUES+ (+ 1,+ 1,+ 101,+ 'Welcome',+ 'FAILED',+ 'bb.task.general',+ 'Something is not right...',+ ''+ );++INSERT INTO+ task_run (+ creator_id,+ updater_id,+ task_id,+ name,+ `status`,+ `type`,+ error,+ payload+ )+VALUES+ (+ 1,+ 1,+ 101,+ 'Welcome',+ 'RUNNING',+ 'bb.task.general',+ 'Let''s give another try',+ ''+ );++-- Create issue 101 "Hello world"+INSERT INTO+ issue (+ id,+ creator_id,+ updater_id,+ project_id,+ pipeline_id,+ name,+ `status`,+ `type`,+ description,+ assignee_id,+ subscriber_id_list+ )+VALUES+ (+ 101,+ 1,+ 1,+ 1,+ 101,+ 'Hello world!',+ 'OPEN',+ 'bb.issue.general',+ 'Welcome to Bytebase, this is the issue interface where developers and DBAs collaborate on database schema management issues such as: ' || char(10, 10) || ' - Creating a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding/altering a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s try some simple tasks:' || char(10, 10) || '1. Bookmark this issue by clicking the star icon on the top of this page' || char(10) || '2. Leave a comment below to greet future comers' || char(10) || '3. Follow the Quickstart on the bottom left to get familiar with other features',+ 1,+ ''+ );++-- Create activity 101+INSERT INTO+ activity (+ id,+ creator_id,+ updater_id,+ container_id,+ `type`+ )+VALUES+ (+ 101,+ 1,+ 1,+ 101,+ 'bb.issue.create'+ );++INSERT INTO+ activity (+ creator_id,+ updater_id,+ container_id,+ `type`,+ `comment`+ )+VALUES+ (+ 1,+ 1,+ 101,+ 'bb.issue.comment.create',+ 'Go fish!');\ No newline at end of filediff --git a/store/seed/test/10130__issue.sql b/store/seed/test/10130__issue.sqlindex 3d31024597..e6af608e6b 100644--- a/store/seed/test/10130__issue.sql+++ b/store/seed/test/10130__issue.sql@@ -23,7 +23,7 @@ VALUES'Hello world!','OPEN','bb.issue.general',- 'Welcome to Bytebase, this is the issue interface where tech leads, developers and DBAs collaborate on database management issues such as: ' || char(10, 10) || ' - Creating a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s bookmark this issue by clicking the star icon on the top of this page.' || char(10, 10) || 'And then click the ''Approve'' button on the top right.',+ 'Welcome to Bytebase, this is the issue interface where developers and DBAs collaborate on database schema management issues such as: ' || char(10, 10) || ' - Creating a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding/Altering a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s try some simple tasks:' || char(10, 10) || '1. Bookmark this issue by clicking the star icon on the top of this page' || char(10) || '2. Leave a comment below to greet future comers',101,'101,102,103,104');