-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'backend-configuration' of https://github.com/NeurodataW…
…ithoutBorders/nwb-guide into backend-configuration
- Loading branch information
Showing
4 changed files
with
71 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 57 additions & 58 deletions
115
src/electron/frontend/core/components/pages/guided-mode/options/GuidedStubPreview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
import { html } from "lit"; | ||
import { Page } from "../../Page.js"; | ||
|
||
import { unsafeSVG } from "lit/directives/unsafe-svg.js"; | ||
import folderOpenSVG from "../../../../../assets/icons/folder_open.svg?raw"; | ||
|
||
import { electron } from "../../../../../utils/electron.js"; | ||
import { NWBFilePreview, getSharedPath } from "../../../preview/NWBFilePreview.js"; | ||
const { ipcRenderer } = electron; | ||
|
||
export const getStubArray = (stubs) => | ||
Object.values(stubs) | ||
.map((item) => Object.values(item)) | ||
.flat(); | ||
|
||
export class GuidedStubPreviewPage extends Page { | ||
constructor(...args) { | ||
super(...args); | ||
this.style.height = "100%"; // Fix main section | ||
} | ||
|
||
header = { | ||
subtitle: `Preview file contents on truncated files using the Neurosift application`, | ||
controls: () => | ||
html`<nwb-button | ||
size="small" | ||
@click=${() => { | ||
if (ipcRenderer) | ||
ipcRenderer.send( | ||
"showItemInFolder", | ||
getSharedPath(getStubArray(this.info.globalState.preview.stubs).map((item) => item.file)) | ||
); | ||
}} | ||
>${unsafeSVG(folderOpenSVG)}</nwb-button | ||
>`, | ||
}; | ||
|
||
// NOTE: We may want to trigger this whenever (1) this page is visited AND (2) data has been changed. | ||
footer = { | ||
next: "Run Conversion", | ||
onNext: async () => { | ||
await this.save(); // Save in case the conversion fails | ||
return this.to(1); // Will trigger conversion if necessary | ||
}, | ||
}; | ||
|
||
render() { | ||
|
||
const { preview, project } = this.info.globalState; | ||
|
||
return preview.stubs | ||
? new NWBFilePreview({ project: project.name, files: preview.stubs }) | ||
: html`<p style="text-align: center;">Your conversion preview failed. Please try again.</p>`; | ||
} | ||
} | ||
|
||
customElements.get("nwbguide-guided-stub-review-page") || | ||
customElements.define("nwbguide-guided-stub-review-page", GuidedStubPreviewPage); | ||
import { html } from "lit"; | ||
import { Page } from "../../Page.js"; | ||
|
||
import { unsafeSVG } from "lit/directives/unsafe-svg.js"; | ||
import folderOpenSVG from "../../../../../assets/icons/folder_open.svg?raw"; | ||
|
||
import { electron } from "../../../../../utils/electron.js"; | ||
import { NWBFilePreview, getSharedPath } from "../../../preview/NWBFilePreview.js"; | ||
const { ipcRenderer } = electron; | ||
|
||
export const getStubArray = (stubs) => | ||
Object.values(stubs) | ||
.map((item) => Object.values(item)) | ||
.flat(); | ||
|
||
export class GuidedStubPreviewPage extends Page { | ||
constructor(...args) { | ||
super(...args); | ||
this.style.height = "100%"; // Fix main section | ||
} | ||
|
||
header = { | ||
subtitle: `Preview file contents on truncated files using the Neurosift application`, | ||
controls: () => | ||
html`<nwb-button | ||
size="small" | ||
@click=${() => { | ||
if (ipcRenderer) | ||
ipcRenderer.send( | ||
"showItemInFolder", | ||
getSharedPath(getStubArray(this.info.globalState.preview.stubs).map((item) => item.file)) | ||
); | ||
}} | ||
>${unsafeSVG(folderOpenSVG)}</nwb-button | ||
>`, | ||
}; | ||
|
||
// NOTE: We may want to trigger this whenever (1) this page is visited AND (2) data has been changed. | ||
footer = { | ||
next: "Run Conversion", | ||
onNext: async () => { | ||
await this.save(); // Save in case the conversion fails | ||
return this.to(1); // Will trigger conversion if necessary | ||
}, | ||
}; | ||
|
||
render() { | ||
const { preview, project } = this.info.globalState; | ||
|
||
return preview.stubs | ||
? new NWBFilePreview({ project: project.name, files: preview.stubs }) | ||
: html`<p style="text-align: center;">Your conversion preview failed. Please try again.</p>`; | ||
} | ||
} | ||
|
||
customElements.get("nwbguide-guided-stub-review-page") || | ||
customElements.define("nwbguide-guided-stub-review-page", GuidedStubPreviewPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters