Skip to content

Commit

Permalink
changes based on review
Browse files Browse the repository at this point in the history
Signed-off-by: Sajid Alam <[email protected]>
  • Loading branch information
SajidAlamQB committed Sep 4, 2024
1 parent 340fbf7 commit d2496ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/actions/pipelines.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getUrl } from '../utils';
import loadJsonData from '../store/load-data';
import { preparePipelineState } from '../store/initial-state';
import {parseUrlParameters, preparePipelineState} from '../store/initial-state';
import { resetData } from './index';

/**
Expand Down Expand Up @@ -99,14 +99,15 @@ export function loadInitialPipelineData() {
// obtain the status of expandAllPipelines to decide whether it needs to overwrite the
// list of visible nodes
const expandAllPipelines = state.expandAllPipelines;
const urlParams = parseUrlParameters();
let newState = await loadJsonData(url).then((data) =>
preparePipelineState(data, true, expandAllPipelines)
preparePipelineState(data, true, expandAllPipelines, urlParams)
);
// If the active pipeline isn't 'main' then request data from new URL
if (requiresSecondRequest(newState.pipeline)) {
const url = getPipelineUrl(newState.pipeline);
newState = await loadJsonData(url).then((data) =>
preparePipelineState(data, false, expandAllPipelines)
preparePipelineState(data, false, expandAllPipelines, urlParams)
);
}
dispatch(resetData(newState));
Expand Down
5 changes: 2 additions & 3 deletions src/store/initial-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const createInitialState = () => ({
runsMetadata: {},
});

const parseUrlParameters = () => {
export const parseUrlParameters = () => {
const search = new URLSearchParams(window.location.search);
return {
pipelineIdFromURL: search.get(params.pipeline),
Expand Down Expand Up @@ -97,7 +97,7 @@ const applyUrlParametersToPipelineState = (state, urlParams) => {
const nodeTypes = ['parameters', 'task', 'data'];

// Use main pipeline if pipeline from URL isn't recognised
if (!newState.pipeline.active && pipelineIdFromURL) {
if (pipelineIdFromURL) {
newState.pipeline.active = newState.pipeline.ids.includes(pipelineIdFromURL)
? pipelineIdFromURL
: newState.pipeline.main;
Expand Down Expand Up @@ -252,7 +252,6 @@ const getInitialState = (props = {}) => {
props.data,
props.data !== 'json',
expandAllPipelines,
urlParams
);

const initialState = {
Expand Down

0 comments on commit d2496ad

Please sign in to comment.