Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.11.0 #79

Merged
merged 3 commits into from
Dec 9, 2024
Merged
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# production
/build

.next

# misc
.DS_Store
.env.local
Expand Down
52 changes: 45 additions & 7 deletions lib/components/TimeSeriesViewer/StateStorageConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,31 @@ const convertStateForStorage = state => {
// available time steps
const {
availableTimeSteps
} = state;
} = state.timeStep;
if (availableTimeSteps instanceof Set) {
newState.availableTimeSteps = Array.from(availableTimeSteps);
newState.timeStep.availableTimeSteps = Array.from(availableTimeSteps);
} else {
newState.availableTimeSteps = [];
newState.timeStep.availableTimeSteps = [];
}
const {
variables: timeStepVariables
} = state.timeStep;
Object.keys(timeStepVariables).forEach((key, index) => {
const {
variables: timeStepVariablesSet,
dateTimeVariables
} = timeStepVariables[key];
if (timeStepVariablesSet instanceof Set && timeStepVariablesSet.size > 0) {
newState.timeStep.variables[key].variables = Array.from(timeStepVariablesSet);
} else {
newState.timeStep.variables[key].variables = [];
}
if (dateTimeVariables instanceof Set && dateTimeVariables.size > 0) {
newState.timeStep.variables[key].dateTimeVariables = Array.from(dateTimeVariables);
} else {
newState.timeStep.variables[key].dateTimeVariables = [];
}
});
return newState;
};

Expand Down Expand Up @@ -149,15 +168,34 @@ const convertStateFromStorage = state => {
} else {
newState.availableQualityFlags = new Set();
}
// available quality flags
// available time steps
const {
availableTimeSteps
} = state;
} = state.timeStep;
if (Array.isArray(availableTimeSteps)) {
newState.availableTimeSteps = new Set(availableTimeSteps);
newState.timeStep.availableTimeSteps = new Set(availableTimeSteps);
} else {
newState.availableTimeSteps = new Set();
newState.timeStep.availableTimeSteps = new Set();
}
const {
variables: timeStepVariables
} = state.timeStep;
Object.keys(timeStepVariables).forEach((key, index) => {
const {
variables: timeStepVariablesSet,
dateTimeVariables
} = timeStepVariables[key];
if (Array.isArray(timeStepVariablesSet)) {
newState.timeStep.variables[key].variables = new Set(timeStepVariablesSet);
} else {
newState.timeStep.variables[key].variables = new Set();
}
if (Array.isArray(dateTimeVariables)) {
newState.timeStep.variables[key].dateTimeVariables = new Set(dateTimeVariables);
} else {
newState.timeStep.variables[key].dateTimeVariables = new Set();
}
});
return newState;
};
exports.convertStateFromStorage = convertStateFromStorage;
4 changes: 2 additions & 2 deletions lib/components/TimeSeriesViewer/TimeSeriesViewerAxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ const TimeStepOption = () => {
const [state, dispatch] = _TimeSeriesViewerContext.default.useTimeSeriesViewerState();
const {
availableTimeSteps
} = state;
} = state.timeStep;
const {
timeStep: selectedTimeStep
} = state.selection;
Expand Down Expand Up @@ -624,7 +624,7 @@ function TimeSeriesViewerAxes() {
}
}, "x Axis (Time)"), /*#__PURE__*/_react.default.createElement("div", {
className: classes.optionsContainer
}, state.availableTimeSteps.size < 3 ? null : /*#__PURE__*/_react.default.createElement("div", {
}, state.timeStep.availableTimeSteps.size < 3 ? null : /*#__PURE__*/_react.default.createElement("div", {
style: {
marginRight: _Theme.default.spacing(4)
}
Expand Down
23 changes: 19 additions & 4 deletions lib/components/TimeSeriesViewer/TimeSeriesViewerContext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export namespace DEFAULT_STATE {
export const isDefault: boolean;
}
export const availableQualityFlags: Set<any>;
export const availableTimeSteps: Set<string>;
export namespace timeStep_1 {
export const availableTimeSteps: Set<string>;
const variables_2: {};
export { variables_2 as variables };
}
export { timeStep_1 as timeStep };
}
/**
Time Step Definitions and Functions
Expand Down Expand Up @@ -163,6 +168,7 @@ export const TIME_STEPS: {
'1day': {
key: string;
matchFileTableSuffix: string[];
matchFileTableIncludes: string[];
tmi: string;
seconds: number;
};
Expand Down Expand Up @@ -257,7 +263,10 @@ export function getTestableItems(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
};
FETCH_STATUS: {
AWAITING_CALL: string;
Expand Down Expand Up @@ -417,7 +426,10 @@ declare function useTimeSeriesViewerState(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
} | ({
mode: string;
status: string;
Expand Down Expand Up @@ -489,7 +501,10 @@ declare function useTimeSeriesViewerState(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
} | (() => void))[];
declare namespace TimeSeriesViewerPropTypes {
export function productCode_3(props: any, propName: any, componentName: any): Error | null;
Expand Down
Loading
Loading