Skip to content

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

Add pending state and use animation for the state icon

Tianzhou Chen7161766be974
diff --git a/frontend/src/bbkit/BBStepBar.vue b/frontend/src/bbkit/BBStepBar.vue
index adf70b94c3..47c2f79ef9 100644
--- a/frontend/src/bbkit/BBStepBar.vue
+++ b/frontend/src/bbkit/BBStepBar.vue
@@ -14,18 +14,41 @@
class="relative w-6 h-6 flex items-center justify-center rounded-full"
:class="stepClass(step.status)"
>
- <template v-if="step.status == `PENDING`">
+ <template v-if="step.status == `CREATED`">
<span
class="h-2.5 w-2.5 bg-gray-300 rounded-full"
aria-hidden="true"
></span>
</template>
- <template v-else-if="step.status == `RUNNING`">
+ <template v-if="step.status == `PENDING`">
<span
class="h-2.5 w-2.5 bg-blue-600 rounded-full"
aria-hidden="true"
></span>
</template>
+ <template v-else-if="step.status == `RUNNING`">
+ <svg
+ class="h-6 w-6"
+ style="animation: spin 2.5s linear infinite"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ >
+ <circle
+ class="opacity-25"
+ cx="12"
+ cy="12"
+ r="10"
+ stroke="currentColor"
+ stroke-width="4"
+ ></circle>
+ <path
+ class="opacity-75"
+ fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
+ ></path>
+ </svg>
+ </template>
<template v-else-if="step.status == `DONE`">
<svg
class="w-5 h-5"
@@ -105,10 +128,12 @@ export default {
setup(props, ctx) {
const stepClass = (status: BBStepStatus) => {
switch (status) {
- case "PENDING":
+ case "CREATED":
return "bg-white border-2 border-gray-300 hover:border-gray-400";
- case "RUNNING":
+ case "PENDING":
return "bg-white border-2 border-blue-600 text-blue-600 hover:text-blue-700 hover:border-blue-700";
+ case "RUNNING":
+ return "bg-white text-blue-600 hover:text-blue-700 hover:border-blue-700";
case "DONE":
return "bg-green-600 hover:bg-green-700 text-white";
case "FAILED":
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index fec036c67a..867555e332 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -8,6 +8,7 @@ export type BBTableSectionDataSource<T> = {
};
export type BBStepStatus =
+ | "CREATED"
| "PENDING"
| "RUNNING"
| "DONE"
diff --git a/frontend/src/components/PipelineTable.vue b/frontend/src/components/PipelineTable.vue
index 65810828e8..32a1d2f48e 100644
--- a/frontend/src/components/PipelineTable.vue
+++ b/frontend/src/components/PipelineTable.vue
@@ -13,15 +13,32 @@
>
<template v-if="pipeline.attributes.status == `PENDING`">
<span
- class="h-3 w-3 bg-gray-300 rounded-full"
+ class="h-2 w-2 bg-blue-600 rounded-full"
aria-hidden="true"
></span>
</template>
<template v-else-if="pipeline.attributes.status == `RUNNING`">
- <span
- class="h-2 w-2 bg-blue-600 rounded-full"
- aria-hidden="true"
- ></span>
+ <svg
+ class="h-6 w-6"
+ style="animation: spin 2.5s linear infinite"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ >
+ <circle
+ class="opacity-25"
+ cx="12"
+ cy="12"
+ r="10"
+ stroke="currentColor"
+ stroke-width="4"
+ ></circle>
+ <path
+ class="opacity-75"
+ fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
+ ></path>
+ </svg>
</template>
<template v-else-if="pipeline.attributes.status == `DONE`">
<svg
@@ -113,12 +130,12 @@ interface LocalState {
const statusMap = {
PENDING: {
name: "Pending",
- class: "bg-white border-2 border-gray-300 hover:border-gray-400",
+ class:
+ "bg-white border-2 border-blue-600 text-blue-600 hover:text-blue-700 hover:border-blue-700",
},
RUNNING: {
name: "Running",
- class:
- "bg-white border-2 border-blue-600 text-blue-600 hover:text-blue-700 hover:border-blue-700",
+ class: "bg-white text-blue-600 hover:text-blue-700 hover:border-blue-700",
},
DONE: {
name: "Done",
@@ -176,8 +193,14 @@ export default {
const stageList = function (pipeline: Pipeline): BBStep[] {
return pipeline.attributes.stageProgressList.map((stageProgress) => {
- let stepStatus: BBStepStatus = "PENDING";
+ let stepStatus: BBStepStatus = "CREATED";
switch (stageProgress.status) {
+ case "CREATED":
+ stepStatus = "CREATED";
+ break;
+ case "PENDING":
+ stepStatus = "PENDING";
+ break;
case "RUNNING":
stepStatus = "RUNNING";
break;
@@ -187,9 +210,6 @@ export default {
case "FAILED":
stepStatus = "FAILED";
break;
- case "PENDING":
- stepStatus = "PENDING";
- break;
case "CANCELED":
stepStatus = "CANCELED";
break;
diff --git a/frontend/src/miragejs/seeds/index.js b/frontend/src/miragejs/seeds/index.js
index 036890f82d..4210d4b26e 100644
--- a/frontend/src/miragejs/seeds/index.js
+++ b/frontend/src/miragejs/seeds/index.js
@@ -227,30 +227,21 @@ const workspacesSeeder = (server) => {
const fillStage = (environmentList) => {
const i = Math.floor(Math.random() * 5);
+
if (i % 5 == 0) {
return {
- status: "RUNNING",
+ status: "PENDING",
currentStageId: environmentList[0].id,
stageProgressList: [
{
stageId: environmentList[0].id,
stageName: environmentList[0].name,
- status: "RUNNING",
+ status: "PENDING",
},
{
stageId: environmentList[1].id,
stageName: environmentList[1].name,
- status: "PENDING",
- },
- {
- stageId: environmentList[2].id,
- stageName: environmentList[2].name,
- status: "PENDING",
- },
- {
- stageId: environmentList[3].id,
- stageName: environmentList[3].name,
- status: "PENDING",
+ status: "CREATED",
},
],
};
@@ -277,7 +268,7 @@ const fillStage = (environmentList) => {
{
stageId: environmentList[3].id,
stageName: environmentList[3].name,
- status: "PENDING",
+ status: "CREATED",
},
],
};
@@ -326,12 +317,12 @@ const fillStage = (environmentList) => {
{
stageId: environmentList[2].id,
stageName: environmentList[2].name,
- status: "PENDING",
+ status: "CREATED",
},
{
stageId: environmentList[3].id,
stageName: environmentList[3].name,
- status: "PENDING",
+ status: "CREATED",
},
],
};
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index d6fbcca46f..025545a17b 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -27,13 +27,14 @@ export type Pipeline = ResourceObject & {
title: string;
createdTs: number;
lastUpdatedTs: number;
- status: "RUNNING" | "DONE" | "FAILED" | "CANCELED";
+ status: "PENDING" | "RUNNING" | "DONE" | "FAILED" | "CANCELED";
type: "DDL" | "DML" | "AUTH";
currentStageId: string;
stageProgressList: {
stageId: string;
stageName: string;
status:
+ | "CREATED"
| "PENDING"
| "RUNNING"
| "DONE"
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index c8ec72aee8..253fa295c2 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -67,13 +67,15 @@ export default {
for (const pipeline of pipelineList) {
if (
pipeline.attributes.assignee.id === currentUser!.id &&
- (pipeline.attributes.status === "RUNNING" ||
+ (pipeline.attributes.status === "PENDING" ||
+ pipeline.attributes.status === "RUNNING" ||
pipeline.attributes.status === "FAILED")
) {
state.attentionList.push(pipeline);
} else if (
pipeline.attributes.subscriberIdList.includes(currentUser!.id) &&
- (pipeline.attributes.status === "RUNNING" ||
+ (pipeline.attributes.status === "PENDING" ||
+ pipeline.attributes.status === "RUNNING" ||
pipeline.attributes.status === "FAILED")
) {
state.subscribeList.push(pipeline);