Skip to content

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

feat: task filter (#15758)

boojack39fc2938644a
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/AdviceStatusIcon.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/AdviceStatusIcon.vue
new file mode 100644
index 0000000000..169172c474
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/AdviceStatusIcon.vue
@@ -0,0 +1,48 @@
+<template>
+ <NTooltip>
+ <template #trigger>
+ <template v-if="status === Advice_Status.SUCCESS">
+ <CheckIcon :size="16" class="text-success" />
+ </template>
+ <template v-else-if="status === Advice_Status.WARNING">
+ <TriangleAlertIcon :size="16" class="text-warning" />
+ </template>
+ <template v-else-if="status === Advice_Status.ERROR">
+ <CircleAlertIcon :size="16" class="text-error" />
+ </template>
+ <template v-else>
+ <PlayIcon :size="16" />
+ </template>
+ </template>
+ {{ statusMessage }}
+ </NTooltip>
+</template>
+
+<script setup lang="ts">
+import {
+ CheckIcon,
+ PlayIcon,
+ TriangleAlertIcon,
+ CircleAlertIcon,
+} from "lucide-vue-next";
+import { NTooltip } from "naive-ui";
+import { computed } from "vue";
+import { Advice_Status } from "@/types/proto/v1/sql_service";
+
+const props = defineProps<{
+ status: Advice_Status;
+}>();
+
+const statusMessage = computed(() => {
+ switch (props.status) {
+ case Advice_Status.SUCCESS:
+ return "Success";
+ case Advice_Status.WARNING:
+ return "Warning";
+ case Advice_Status.ERROR:
+ return "Error";
+ default:
+ return "Not Started";
+ }
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/context.ts b/frontend/src/components/IssueV1/components/SQLCheckSection/context.ts
index 46fcc325e6..e38e0a9c06 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/context.ts
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/context.ts
@@ -6,6 +6,7 @@ import { useIssueContext } from "../../logic";
export type SQLCheckContext = {
enabled: ComputedRef<boolean>;
+ // Key is the database name.
resultMap: Ref<Record<string, CheckReleaseResponse_CheckResult>>;
upsertResult: (key: string, result: CheckReleaseResponse_CheckResult) => void;
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue b/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
index 99d6ea9496..0ebca8e2f7 100644
--- a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
+++ b/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
@@ -1,8 +1,10 @@
<template>
- <div class="!no-underline">
+ <div class="text-gray-500">
<span>(</span>
- <span>{{ summary.done + summary.canceled }}</span>
- <span>/</span>
+ <template v-if="!isCreating">
+ <span>{{ summary.done + summary.canceled }}</span>
+ <span>/</span>
+ </template>
<span>{{ summary.total }}</span>
<span>)</span>
</div>
@@ -12,11 +14,14 @@
import { computed } from "vue";
import type { Stage } from "@/types/proto/v1/rollout_service";
import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { useIssueContext } from "../../logic";
const props = defineProps<{
stage: Stage;
}>();
+const { isCreating } = useIssueContext();
+
const summary = computed(() => {
const tasks = props.stage.tasks;
const summary = {
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
index ec1fec9824..7a4db05a1b 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
@@ -3,7 +3,7 @@
:class="
twMerge(
'task',
- 'group px-2 py-1 pt-2 pr-1 cursor-pointer border rounded lg:flex-1 flex justify-between items-stretch overflow-hidden gap-x-1',
+ 'group px-1.5 py-1 cursor-pointer border rounded lg:flex-1 flex justify-between items-stretch overflow-hidden gap-x-1',
taskClass
)
"
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
new file mode 100644
index 0000000000..4744cb47de
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
@@ -0,0 +1,124 @@
+<template>
+ <div class="w-full flex flex-row gap-4">
+ <div class="flex items-center justify-between">
+ <h3>
+ {{ $t("common.tasks") }}
+ <span>({{ taskList.length }})</span>
+ </h3>
+ </div>
+ <div class="flex flex-row gap-2 items-center">
+ <div
+ class="bg-gray-50 pl-2 p-1 flex flex-row items-center rounded-full gap-1"
+ >
+ <span class="text-xs mr-1 text-gray-600">{{
+ $t("issue.sql-check.sql-checks")
+ }}</span>
+ <template v-for="status in ADVICE_STATUS_FILTERS" :key="status">
+ <NTag
+ v-if="getTaskCount(undefined, status) > 0"
+ @click="
+ emit(
+ 'update:adviceStatusList',
+ adviceStatusList.includes(status)
+ ? adviceStatusList.filter((s) => s !== status)
+ : [...adviceStatusList, status]
+ )
+ "
+ :size="'small'"
+ round
+ :bordered="adviceStatusList.includes(status)"
+ :type="adviceStatusList.includes(status) ? 'info' : 'default'"
+ >
+ <template #avatar>
+ <AdviceStatusIcon :status="status" />
+ </template>
+ <span class="select-none">{{
+ getTaskCount(undefined, status)
+ }}</span>
+ </NTag>
+ </template>
+ </div>
+ <div
+ v-if="!isCreating"
+ class="bg-gray-50 pl-2 p-1 flex flex-row items-center rounded-full gap-1"
+ >
+ <span class="text-xs mr-1 text-gray-600">{{
+ $t("common.status")
+ }}</span>
+ <template v-for="status in TASK_STATUS_FILTERS" :key="status">
+ <NTag
+ v-if="getTaskCount(status) > 0"
+ @click="
+ emit(
+ 'update:taskStatusList',
+ taskStatusList.includes(status)
+ ? taskStatusList.filter((s) => s !== status)
+ : [...taskStatusList, status]
+ )
+ "
+ :size="'small'"
+ round
+ :bordered="taskStatusList.includes(status)"
+ :type="taskStatusList.includes(status) ? 'info' : 'default'"
+ >
+ <template #avatar>
+ <TaskStatusIconV1 :status="status" :size="'small'" />
+ </template>
+ <span class="select-none">{{ getTaskCount(status) }}</span>
+ </NTag>
+ </template>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { NTag } from "naive-ui";
+import { computed } from "vue";
+import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Advice_Status } from "@/types/proto/v1/sql_service";
+import { useIssueContext } from "../../logic";
+import AdviceStatusIcon from "../SQLCheckSection/AdviceStatusIcon.vue";
+import { useIssueSQLCheckContext } from "../SQLCheckSection/context";
+import TaskStatusIconV1 from "../TaskStatusIconV1.vue";
+import { filterTask } from "./filter";
+
+defineProps<{
+ taskStatusList: Task_Status[];
+ adviceStatusList: Advice_Status[];
+}>();
+
+const emit = defineEmits<{
+ (event: "update:taskStatusList", taskStatusList: Task_Status[]): void;
+ (event: "update:adviceStatusList", adviceStatusList: Advice_Status[]): void;
+}>();
+
+const TASK_STATUS_FILTERS: Task_Status[] = [
+ Task_Status.NOT_STARTED,
+ Task_Status.PENDING,
+ Task_Status.RUNNING,
+ Task_Status.DONE,
+ Task_Status.FAILED,
+ Task_Status.CANCELED,
+ Task_Status.SKIPPED,
+];
+const ADVICE_STATUS_FILTERS: Advice_Status[] = [
+ Advice_Status.UNRECOGNIZED,
+ Advice_Status.SUCCESS,
+ Advice_Status.WARNING,
+ Advice_Status.ERROR,
+];
+
+const issueContext = useIssueContext();
+const sqlCheckContext = useIssueSQLCheckContext();
+
+const { isCreating, selectedStage } = issueContext;
+
+const taskList = computed(() => selectedStage.value.tasks);
+
+const getTaskCount = (status?: Task_Status, adviceStatus?: Advice_Status) => {
+ return taskList.value.filter((task) =>
+ filterTask(issueContext, sqlCheckContext, task, { status, adviceStatus })
+ ).length;
+};
+</script>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
index 6b3d3db4fd..884a3ccd8e 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
@@ -1,30 +1,44 @@
<template>
<div class="relative">
<div
- ref="taskBar"
- class="task-list gap-2 px-4 py-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto"
- :class="{
- 'more-bottom': taskBarScrollState.bottom,
- 'more-top': taskBarScrollState.top,
- }"
- :style="{
- 'max-height': `${MAX_LIST_HEIGHT}px`,
- }"
+ v-if="shouldShowTaskFilter"
+ class="w-full sticky top-0 z-10 bg-white px-4 pt-2 pb-1"
>
- <TaskCard
- v-for="(task, i) in taskList.slice(0, state.index)"
- :key="i"
- :task="task"
+ <TaskFilter
+ v-model:task-status-list="state.taskStatusFilters"
+ v-model:advice-status-list="state.adviceStatusFilters"
/>
- <div v-if="taskList.length > state.index" class="col-span-full">
- <NButton
- size="small"
- quaternary
- :loading="state.loading"
- @click="() => loadMore()"
+ </div>
+ <div class="relative w-full">
+ <div
+ ref="taskBar"
+ class="task-list gap-2 px-4 py-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto"
+ :class="{
+ 'more-bottom': taskBarScrollState.bottom,
+ 'more-top': taskBarScrollState.top,
+ }"
+ :style="{
+ 'max-height': `${MAX_LIST_HEIGHT}px`,
+ }"
+ >
+ <TaskCard
+ v-for="(task, i) in filteredTaskList.slice(0, state.index)"
+ :key="i"
+ :task="task"
+ />
+ <div
+ v-if="filteredTaskList.length > state.index"
+ class="col-span-full flex flex-row items-center justify-end"
>
- {{ $t("common.load-more") }}
- </NButton>
+ <NButton
+ size="small"
+ quaternary
+ :loading="isRequesting"
+ @click="state.index += TASK_PER_PAGE"
+ >
+ {{ $t("common.load-more") }}
+ </NButton>
+ </div>
</div>
</div>
</div>
@@ -36,62 +50,124 @@ import { NButton } from "naive-ui";
import { computed, ref, reactive, watch } from "vue";
import { useVerticalScrollState } from "@/composables/useScrollState";
import { batchGetOrFetchDatabases } from "@/store";
+import type { Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Advice_Status } from "@/types/proto/v1/sql_service";
+import { isDev } from "@/utils";
import { useIssueContext, databaseForTask } from "../../logic";
+import { useIssueSQLCheckContext } from "../SQLCheckSection/context";
import TaskCard from "./TaskCard.vue";
+import TaskFilter from "./TaskFilter.vue";
+import { filterTask } from "./filter";
+
+interface LocalState {
+ // index is the number of tasks to show.
+ // It is initialized to TASK_PER_PAGE.
+ index: number;
+ taskStatusFilters: Task_Status[];
+ adviceStatusFilters: Advice_Status[];
+}
-// 3 * lines of cards + 2 * top and bottom padding + 2 * horizontal gaps + jitter
-const MAX_LIST_HEIGHT = 207;
+const MAX_LIST_HEIGHT = 256;
-const state = reactive<{ loading: boolean; index: number }>({
- loading: false,
- index: 0,
+// The default number of tasks to show per page.
+// This is set to 4 in development mode for easier testing.
+const TASK_PER_PAGE = isDev() ? 20 : 20;
+
+const state = reactive<LocalState>({
+ index: TASK_PER_PAGE,
+ taskStatusFilters: [],
+ adviceStatusFilters: [],
});
+const isRequesting = ref(false);
-const { selectedStage, issue } = useIssueContext();
+const issueContext = useIssueContext();
+const { selectedStage, issue, selectedTask, events } = issueContext;
+const sqlCheckContext = useIssueSQLCheckContext();
const taskBar = ref<HTMLDivElement>();
const taskBarScrollState = useVerticalScrollState(taskBar, MAX_LIST_HEIGHT);
-const taskList = computed(() => selectedStage.value.tasks);
+const taskList = computed(() => {
+ return selectedStage.value.tasks;
+});
-const loadMore = useDebounceFn(async () => {
- if (state.index >= taskList.value.length) {
- return;
- }
- state.loading = true;
- try {
- const previous = state.index;
- const next = previous + 20;
+const filteredTaskList = computed(() => {
+ return taskList.value.filter((task) => {
+ if (state.taskStatusFilters.length > 0) {
+ if (!state.taskStatusFilters.includes(task.status)) {
+ return false;
+ }
+ }
+ if (state.adviceStatusFilters.length > 0) {
+ if (
+ !state.adviceStatusFilters.some((status) =>
+ filterTask(issueContext, sqlCheckContext, task, {
+ adviceStatus: status,
+ })
+ )
+ ) {
+ return false;
+ }
+ }
+ return true;
+ });
+});
- const databaseNames = taskList.value
- .slice(previous, next)
- .map((task) => databaseForTask(issue.value, task).name);
- await batchGetOrFetchDatabases(databaseNames);
+const shouldShowTaskFilter = computed(() => {
+ return taskList.value.length > 10;
+});
- state.index = next;
- } finally {
- state.loading = false;
+const loadMore = useDebounceFn(async () => {
+ if (state.index >= filteredTaskList.value.length) {
+ return;
}
+ const databaseNames = filteredTaskList.value
+ .slice(0, state.index)
+ .map((task) => databaseForTask(issue.value, task).name);
+ await batchGetOrFetchDatabases(databaseNames);
}, 500);
watch(
- () => taskList.value.length,
- (length) => {
- if (length > 0) {
- loadMore();
+ [() => filteredTaskList.value, () => state.index],
+ async () => {
+ // If the selected task is not in the filtered task list, select the first task.
+ // This is to ensure that the selected task is always in the filtered task list.
+ if (
+ !filteredTaskList.value
+ .map((task) => task.name)
+ .includes(selectedTask.value.name)
+ ) {
+ events.emit("select-task", { task: filteredTaskList.value[0] });
+ }
+ isRequesting.value = true;
+ try {
+ await loadMore();
+ } catch {
+ // Ignore errors
}
+ isRequesting.value = false;
},
{ immediate: true }
);
+
+watch(
+ () => selectedStage.value.name,
+ () => {
+ // Clear the index when the stage changes.
+ state.index = TASK_PER_PAGE;
+ state.taskStatusFilters = [];
+ state.adviceStatusFilters = [];
+ }
+);
</script>
<style scoped lang="postcss">
.task-list::before {
- @apply absolute top-0 h-4 w-full -ml-2 z-10 pointer-events-none transition-shadow;
+ @apply absolute top-0 h-4 w-full -ml-4 z-10 pointer-events-none transition-shadow;
content: "";
box-shadow: none;
}
.task-list::after {
- @apply absolute bottom-0 h-4 w-full -ml-2 z-10 pointer-events-none transition-shadow;
+ @apply absolute bottom-0 h-4 w-full -ml-4 z-10 pointer-events-none transition-shadow;
content: "";
box-shadow: none;
}
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
new file mode 100644
index 0000000000..1ce5df2119
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
@@ -0,0 +1,55 @@
+import type { Task, Task_Status } from "@/types/proto/v1/rollout_service";
+import { Advice_Status } from "@/types/proto/v1/sql_service";
+import { type IssueContext } from "../../logic";
+import { type SQLCheckContext } from "../SQLCheckSection/context";
+
+export interface TaskFilter {
+ // Only for created tasks.
+ status: Task_Status[];
+ adviceStatus: Advice_Status[];
+}
+
+export const filterTask = (
+ issueContext: IssueContext,
+ sqlCheckContext: SQLCheckContext,
+ task: Task,
+ {
+ status,
+ adviceStatus,
+ }: {
+ status?: Task_Status;
+ adviceStatus?: Advice_Status;
+ }
+): boolean => {
+ const { isCreating, getPlanCheckRunsForTask } = issueContext;
+ if (status) {
+ return task.status === status;
+ }
+ if (adviceStatus) {
+ if (isCreating.value) {
+ const { enabled, resultMap } = sqlCheckContext;
+ if (enabled.value) {
+ const result = resultMap.value[task.target];
+ if (adviceStatus === Advice_Status.UNRECOGNIZED) {
+ return !Boolean(result);
+ }
+ if (adviceStatus === Advice_Status.SUCCESS) {
+ return result && result.advices.length === 0;
+ }
+ return (
+ result &&
+ result.advices.some((advice) => advice.status === adviceStatus)
+ );
+ }
+ } else {
+ const planCheckRuns = getPlanCheckRunsForTask(task);
+ return planCheckRuns.some((run) =>
+ run.results.some(
+ (result) => result.status.toString() === adviceStatus.toString()
+ )
+ );
+ }
+ }
+
+ return false;
+};
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue b/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
new file mode 100644
index 0000000000..bbfad7a1a3
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
@@ -0,0 +1,120 @@
+<template>
+ <NTooltip :disabled="!showTooltip">
+ <template #trigger>
+ <div
+ class="relative flex flex-shrink-0 items-center justify-center select-none overflow-hidden"
+ :class="[classes, containerSize]"
+ >
+ <template
+ v-if="
+ status === Task_Status.NOT_STARTED ||
+ status === Task_Status.STATUS_UNSPECIFIED
+ "
+ >
+ <heroicons-outline:user class="w-4 h-4" />
+ </template>
+ <template v-else-if="status === Task_Status.PENDING">
+ <span
+ class="h-1.5 w-1.5 bg-control rounded-full"
+ aria-hidden="true"
+ />
+ </template>
+ <template v-else-if="status === Task_Status.RUNNING">
+ <div class="flex h-2.5 w-2.5 relative overflow-visible">
+ <span
+ class="w-full h-full rounded-full z-0 absolute animate-ping-slow"
+ style="background-color: rgba(37, 99, 235, 0.5); /* bg-info/50 */"
+ aria-hidden="true"
+ />
+ <span
+ class="w-full h-full rounded-full z-[1] bg-info"
+ aria-hidden="true"
+ />
+ </div>
+ </template>
+ <template v-else-if="status === Task_Status.SKIPPED">
+ <SkipIcon class="w-5 h-5" />
+ </template>
+ <template v-else-if="status === Task_Status.DONE">
+ <heroicons-solid:check class="w-5 h-5" />
+ </template>
+ <template v-else-if="status === Task_Status.FAILED">
+ <span
+ class="h-2.5 w-2.5 rounded-full text-center pb-6 font-medium text-base"
+ aria-hidden="true"
+ >!</span
+ >
+ </template>
+ <template v-else-if="status === Task_Status.CANCELED">
+ <heroicons-solid:minus-sm
+ class="rounded-full select-none bg-white border-2 border-gray-400 text-gray-400"
+ :class="containerSize"
+ />
+ </template>
+ </div>
+ </template>
+ {{ status }}
+ </NTooltip>
+</template>
+
+<script lang="ts" setup>
+import { NTooltip } from "naive-ui";
+import { computed } from "vue";
+import { SkipIcon } from "@/components/Icon";
+import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { useIssueContext } from "../logic";
+
+const props = withDefaults(
+ defineProps<{
+ status: Task_Status;
+ size?: "small" | "medium" | "large";
+ showTooltip?: boolean;
+ }>(),
+ {
+ size: "medium",
+ showTooltip: true,
+ }
+);
+
+const { isCreating } = useIssueContext();
+
+const containerSize = computed((): string => {
+ switch (props.size) {
+ case "small":
+ return "w-4 h-4";
+ case "medium":
+ return "w-6 h-6";
+ case "large":
+ return "w-8 h-8";
+ default:
+ return "w-6 h-6";
+ }
+});
+
+const classes = computed((): string => {
+ const borderSize = props.size === "small" ? "border" : "border-2";
+ switch (props.status) {
+ case Task_Status.NOT_STARTED:
+ case Task_Status.STATUS_UNSPECIFIED:
+ if (!isCreating.value) {
+ return `bg-white border-info text-info rounded-full ${borderSize}`;
+ }
+ return `bg-white border-control rounded-full ${borderSize}`;
+ case Task_Status.PENDING:
+ if (!isCreating.value) {
+ return `bg-white border-info text-info rounded-full ${borderSize}`;
+ }
+ return `bg-white border-control rounded-full ${borderSize}`;
+ case Task_Status.RUNNING:
+ return `bg-white border-info text-info rounded-full ${borderSize}`;
+ case Task_Status.SKIPPED:
+ return "bg-gray-200 text-gray-500 rounded-full";
+ case Task_Status.DONE:
+ return "bg-success text-white rounded-full";
+ case Task_Status.FAILED:
+ return "bg-error text-white rounded-full";
+ default:
+ return "";
+ }
+});
+</script>
diff --git a/frontend/src/components/IssueV1/logic/utils.ts b/frontend/src/components/IssueV1/logic/utils.ts
index 54f5ecf296..ee50ec4268 100644
--- a/frontend/src/components/IssueV1/logic/utils.ts
+++ b/frontend/src/components/IssueV1/logic/utils.ts
@@ -2,7 +2,6 @@ import { NButton } from "naive-ui";
import { h } from "vue";
import { t } from "@/plugins/i18n";
import {
- composeInstanceResourceForDatabase,
pushNotification,
useDatabaseV1Store,
useEnvironmentV1Store,
@@ -14,7 +13,7 @@ import {
unknownEnvironment,
isValidDatabaseName,
} from "@/types";
-import { State } from "@/types/proto/v1/common";
+import { InstanceResource } from "@/types/proto/v1/instance_service";
import { IssueStatus } from "@/types/proto/v1/issue_service";
import type { Plan } from "@/types/proto/v1/plan_service";
import { Task, Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";
@@ -53,14 +52,16 @@ export const databaseForTask = (issue: ComposedIssue, task: Task) => {
const { instance, databaseName } = extractDatabaseResourceName(db.name);
db.databaseName = databaseName;
db.instance = instance;
- const ir = composeInstanceResourceForDatabase(instance, db);
- db.instanceResource = ir;
- db.environment = ir.environment;
- db.effectiveEnvironment = ir.environment;
+ db.instanceResource = InstanceResource.fromPartial({
+ ...db.instanceResource,
+ name: instance,
+ });
+ db.environment = db.instanceResource.environment;
+ db.effectiveEnvironment = db.instanceResource.environment;
db.effectiveEnvironmentEntity =
- useEnvironmentV1Store().getEnvironmentByName(ir.environment) ??
- unknownEnvironment();
- db.state = State.DELETED;
+ useEnvironmentV1Store().getEnvironmentByName(
+ db.instanceResource.environment
+ ) ?? unknownEnvironment();
}
return db;
}
diff --git a/frontend/src/types/v1/instance.ts b/frontend/src/types/v1/instance.ts
index 00ccb1c102..04442f0573 100644
--- a/frontend/src/types/v1/instance.ts
+++ b/frontend/src/types/v1/instance.ts
@@ -68,6 +68,7 @@ export const unknownInstanceResource = (): InstanceResource => {
...instance,
name: UNKNOWN_INSTANCE_NAME,
environment: UNKNOWN_ENVIRONMENT_NAME,
+ activation: true,
};
};