Skip to content

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

Iterate throught stage/task list according to the order

天舟ede6b332c7b7
diff --git a/frontend/src/store/modules/pipeline.ts b/frontend/src/store/modules/pipeline.ts
index d152c41d8c..384da967ca 100644
--- a/frontend/src/store/modules/pipeline.ts
+++ b/frontend/src/store/modules/pipeline.ts
@@ -25,11 +25,12 @@ function convert(
const updater = pipeline.attributes.updater as Principal;
const stageList: Stage[] = [];
- for (const item of includedList || []) {
- if (item.type == "stage") {
- const stageIdList = pipeline.relationships!.stage
- .data as ResourceIdentifier[];
- for (const idItem of stageIdList) {
+ const stageIdList = pipeline.relationships!.stage
+ .data as ResourceIdentifier[];
+ // Needs to iterate through stageIdList to maintain the order
+ for (const idItem of stageIdList) {
+ for (const item of includedList || []) {
+ if (item.type == "stage") {
if (idItem.id == item.id) {
const stage: Stage = rootGetters["stage/convertPartial"](
item,
diff --git a/frontend/src/store/modules/stage.ts b/frontend/src/store/modules/stage.ts
index c8b28dddd5..a8c373d6ce 100644
--- a/frontend/src/store/modules/stage.ts
+++ b/frontend/src/store/modules/stage.ts
@@ -34,18 +34,11 @@ function convertPartial(
environment.id = parseInt(environmentId);
const taskList: Task[] = [];
- for (const item of includedList || []) {
- if (
- item.type == "environment" &&
- (stage.relationships!.environment.data as ResourceIdentifier).id ==
- item.id
- ) {
- environment = rootGetters["environment/convert"](item, includedList);
- }
-
- if (item.type == "task") {
- const taskIdList = stage.relationships!.task.data as ResourceIdentifier[];
- for (const idItem of taskIdList) {
+ const taskIdList = stage.relationships!.task.data as ResourceIdentifier[];
+ // Needs to iterate through taskIdList to maintain the order
+ for (const idItem of taskIdList) {
+ for (const item of includedList || []) {
+ if (item.type == "task") {
if (idItem.id == item.id) {
const task: Task = rootGetters["task/convertPartial"](
item,
@@ -57,6 +50,16 @@ function convertPartial(
}
}
+ for (const item of includedList || []) {
+ if (
+ item.type == "environment" &&
+ (stage.relationships!.environment.data as ResourceIdentifier).id ==
+ item.id
+ ) {
+ environment = rootGetters["environment/convert"](item, includedList);
+ }
+ }
+
const result: Omit<Stage, "pipeline"> = {
...(stage.attributes as Omit<
Stage,