Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class DatasetDetailDynamicComponent implements OnInit, OnDestroy {

actionItems: ActionItems = {
datasets: [],
instruments: undefined,
};

constructor(
Expand Down Expand Up @@ -100,6 +101,10 @@ export class DatasetDetailDynamicComponent implements OnInit, OnDestroy {

this.subscriptions.push(
this.store.select(selectCurrentInstrument).subscribe((instrument) => {
if (instrument) {
console.log("Updatding action items");
this.actionItems.instruments = [instrument];
}
this.instrument = instrument;
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { MatButtonModule } from "@angular/material/button";
import { MatIconModule } from "@angular/material/icon";
import { MatTableModule } from "@angular/material/table";
import { PipesModule } from "shared/pipes/pipes.module";
import { DatePipe } from "@angular/common";
import { ReactiveFormsModule } from "@angular/forms";
import { MatDialogModule, MatDialogRef } from "@angular/material/dialog";
import { RouterModule } from "@angular/router";
Expand Down Expand Up @@ -99,7 +100,7 @@ describe("1000: ConfigurableActionComponent", () => {
StoreModule.forRoot({}),
],
declarations: [ConfigurableActionComponent],
providers: [provideMockStore()],
providers: [provideMockStore(), DatePipe],
});
TestBed.overrideComponent(ConfigurableActionComponent, {
set: {
Expand Down Expand Up @@ -983,4 +984,92 @@ describe("1000: ConfigurableActionComponent", () => {
current_action.target,
);
});

it("1140: should build dependency graph", () => {
const variables = {
files: "#Dataset0FilesPath",
first: "@files[0]",
copy: "@first",
};

const graph = component.buildDependenciesGraph(variables);

expect(graph["files"]).toEqual(new Set());
expect(graph["first"]).toEqual(new Set(["files"]));
expect(graph["copy"]).toEqual(new Set(["first"]));
});

it("1150:should support multiple dependencies", () => {
const variables = {
a: "@b",
b: "@c",
c: "@a",
};

const graph = component.buildDependenciesGraph(variables);

expect(graph["a"]).toEqual(new Set(["b"]));
expect(graph["b"]).toEqual(new Set(["c"]));
expect(graph["c"]).toEqual(new Set(["a"]));
});

it("1160: should resolve dependent variables", () => {
component.actionConfig = {
variables: {
files: "#Dataset0FilesPath",
first: "@files[0]",
},
} as any;

component.update_status();

expect(component.variables["files"]).toEqual([
"/file/1",
"/file/2",
"/file/3",
]);

expect(component.variables["first"]).toBe("/file/1");
});

it("1170: should resolve chained dependencies", () => {
component.actionConfig = {
variables: {
files: "#Dataset0FilesPath",
first: "@files[0]",
copy: "@first",
},
} as any;

component.update_status();

expect(component.variables["copy"]).toBe("/file/1");
});

it("1180: should detect cyclic dependencies", () => {
spyOn(console, "error");

component.actionConfig = {
variables: {
a: "@b",
b: "@a",
},
} as any;

component.update_status();

expect(console.error).toHaveBeenCalled();
});

it("1190: should resolve selectors after variable substitution", () => {
component.actionConfig = {
variables: {
year: "#date_format(2026-05-12T14:53:45Z, yyyy)",
},
} as any;

component.update_status();

expect(component.variables["year"]).toBe("2026");
});
});
Loading
Loading