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

Remove Global Pages #524

Merged
merged 3 commits into from
Nov 22, 2023
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: 1 addition & 1 deletion src/renderer/src/stories/pages/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class Page extends LitElement {
Object.assign(element.style, {
textAlign: "left",
display: "block",
})
});

const progressBar = new ProgressBar();
elements.progress = progressBar;
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/stories/pages/guided-mode/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export function resolveGlobalOverrides(subject, globalState) {
delete subjectMetadataCopy.sessions; // Remove extra key from metadata

const overrides = structuredClone(globalState.project ?? {}); // Copy project-wide metadata
merge(subjectMetadataCopy, overrides.Subject);

merge(subjectMetadataCopy, overrides.Subject ?? (overrides.Subject = {})); // Ensure Subject exists

return overrides;
}
Expand Down
12 changes: 5 additions & 7 deletions src/renderer/src/stories/pages/guided-mode/options/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ export const openProgressSwal = (options, callback) => {
};

export const run = async (url, payload, options = {}) => {
let internalSwal;

let internalSwal

if (options.swal === false) {}
else if (!options.swal || options.swal === true) {

if (options.swal === false) {
} else if (!options.swal || options.swal === true) {
if (!("showCancelButton" in options)) {
options.showCancelButton = true;
options.customClass = { actions: "swal-conversion-actions" };
Expand All @@ -40,12 +38,12 @@ export const run = async (url, payload, options = {}) => {
signal: cancelController.signal,
};

const popup = internalSwal = await openProgressSwal(options, (result) => {
const popup = (internalSwal = await openProgressSwal(options, (result) => {
if (!result.isConfirmed) cancelController.abort();
}).then(async (swal) => {
if (options.onOpen) await options.onOpen(swal);
return swal;
});
}));

const element = popup.getHtmlContainer();
const actions = popup.getActions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,12 @@ export class GuidedNewDatasetPage extends Page {
};

updateForm = () => {
let projectGlobalState = this.info.globalState.project;
if (!projectGlobalState) projectGlobalState = this.info.globalState.project = {};

// Properly clone the schema to produce multiple pages from the project metadata schema
const schema = { ...projectMetadataSchema };
schema.properties = { ...schema.properties };

this.state = merge(global.data.output_locations, structuredClone(this.info.globalState.project));

const pages = schemaToPages.call(this, globalSchema, ["project"], { validateEmptyValues: false }, (info) => {
info.title = `${info.label} Global Metadata`;
return info;
});

pages.forEach((page) => {
page.header = {
subtitle: `Enter any ${page.info.label}-level metadata that can serve as the common default across each experiment session`,
};
this.addPage(page.info.label, page);
});

this.form = new JSONSchemaForm({
schema,
results: this.state,
Expand Down
Loading