Skip to content

Commit

Permalink
Merge branch 'main' into oliver-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Dec 31, 2023
2 parents ab2564b + 249089d commit 905adac
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 80 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: "Chromatic Publish"
name: Chromatic

on: workflow_dispatch
on:
workflow_dispatch:
pull_request_review:
types: [submitted]

jobs:
test:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
4 changes: 3 additions & 1 deletion guideGlobalMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"PlexonRecordingInterface",
"PlexonSortingInterface",
"AxonaRecordingInterface",
"VideoInterface",
"NeuralynxRecordingInterface",
"AlphaOmegaRecordingInterface",
"DeepLabCutInterface",
Expand All @@ -40,6 +41,7 @@
"SpikeGLXConverterPipe",
"BrukerTiffSinglePlaneConverter",
"BrukerTiffMultiPlaneConverter",
"MiniscopeConverter"
"MiniscopeConverter",
"CellExplorerRecordingInterface"
]
}
28 changes: 28 additions & 0 deletions schemas/json/generated/VideoInterface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"required": [],
"properties": {
"VideoInterface": {
"required": [
"file_paths"
],
"properties": {
"file_paths": {
"type": "array"
},
"verbose": {
"type": "boolean",
"default": false
}
},
"type": "object",
"additionalProperties": false
}
},
"type": "object",
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "source.schema.json",
"title": "Source data schema",
"description": "Schema for the source data, files and directories",
"version": "0.1.0"
}
11 changes: 10 additions & 1 deletion schemas/source-data.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
export default function preprocessSourceDataSchema (schema) {

// Abstract across different interfaces
Object.values(schema.properties ?? {}).forEach((schema: any) => {
Object.entries(schema.properties ?? {}).forEach(([key, schema]: [string, any]) => {

if (key === 'VideoInterface' || key === 'AudioInterface') {
if (schema.properties.file_paths) {
Object.assign(schema.properties.file_paths, {
description: '<b>Only one file supported at this time.</b> Multiple file support coming soon.',
maxItems: 1,
})
}
}

// Do not show steps
if (schema.properties.gain) schema.properties.gain.step = null
Expand Down
11 changes: 7 additions & 4 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,14 @@ function initialize() {

if (globals.mainWindow) return // Do not re-initialize if the main window is already declared

const minHeight = 800;
const minWidth = 1280;

const windowOptions = {
minWidth: 1121,
minHeight: 735,
width: 1121,
height: 735,
minWidth,
minHeight,
width: minWidth,
height: minHeight,
center: true,
show: false,
icon,
Expand Down
27 changes: 23 additions & 4 deletions src/renderer/assets/css/nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,41 @@ a[data-toggle="collapse"] {
padding-bottom: 0px;
}

#main-nav .sidebar-header img {
cursor: pointer;
}

#main-nav .sidebar-body {
display: flex;
flex-direction: column;
justify-content: space-between;
overflow-y: auto;
overflow-y: hidden;
margin-top: 15px;
border-top: 1px solid #d5d5d5;
flex-grow: 1;
border-top: 1px solid #8f8f8f;
}

#main-nav .sidebar-body > *:last-child {
background: var(--color-sidebar);
padding: 3px;
padding-top: 8px;
border-top: 1px solid #8f8f8f;
}

#main-nav .sidebar-body > *:last-child h4 {
margin-top: 0px !important;
}

#main-nav ul.components {
#main-nav .sidebar-body li {
list-style: none;
}

#main-nav ul {
padding-right: 10px;
padding-left: 3px;
margin-right: 0;
margin-top: 10px;
margin-bottom: 0;
overflow-y: auto;
}

#main-nav ul p {
Expand Down
17 changes: 10 additions & 7 deletions src/renderer/src/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ dashboard.logo = logo;
dashboard.name = "NWB GUIDE";
dashboard.renderNameInSidebar = false;

const resourcesGroup = "Resources";

const overviewIcon = `
<svg
style="margin-right: 30px; margin-bottom: -5px"
Expand Down Expand Up @@ -100,11 +102,12 @@ const pages = {
"/": new GettingStartedPage({
label: "Home",
icon: overviewIcon,
hidden: true,
}),
conversion: new GuidedHomePage({
label: "Conversions",
icon: guidedIcon,
group: "Workflow",
group: "Workflows",
pages: {
start: new GuidedStartPage({
label: "Start",
Expand Down Expand Up @@ -177,32 +180,32 @@ const pages = {
inspect: new InspectPage({
label: "Inspect",
icon: inspectIcon,
group: "Workflow",
group: "Workflows",
}),
preview: new PreviewPage({
label: "Neurosift",
icon: neurosiftIcon,
group: "Workflow",
group: "Workflows",
}),
uploads: new UploadsPage({
label: "Uploads",
icon: uploadIcon,
group: "Workflow",
group: "Workflows",
}),
tutorial: new TutorialPage({
label: "Tutorial",
icon: tutorialIcon,
group: "Documentation",
group: resourcesGroup,
}),
docs: new DocumentationPage({
label: "Documentation",
icon: documentationIcon,
group: "Documentation",
group: resourcesGroup,
}),
contact: new ContactPage({
label: "Contact Us",
icon: contactIcon,
group: "Documentation",
group: resourcesGroup,
}),
settings: new SettingsPage({
label: "Settings",
Expand Down
103 changes: 61 additions & 42 deletions src/renderer/src/stories/FileSystemSelector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LitElement, css, html } from "lit";

import { fs, remote } from "../electron/index";
import { List } from "./List";
const { dialog } = remote;

function getObjectTypeReferenceString(type, multiple, { nested, native } = {}) {
Expand Down Expand Up @@ -33,6 +34,10 @@ const componentCSS = css`
cursor: default;
}
nwb-list {
width: 100px;
}
#button-div {
margin-top: 10px;
display: flex;
Expand Down Expand Up @@ -198,50 +203,64 @@ export class FilesystemSelector extends LitElement {

const objectTypeReference = getObjectTypeReferenceString(this.type, this.multiple);

const instanceThis = this;

return html`
<button
title=${isArray ? this.value.map((v, i) => `${i + 1}. ${v}`).join("\n") : this.value}
@click=${() => isMultipleTypes || this.selectFormat()}
@dragenter=${() => {
this.classList.add("active");
}}
@dragleave=${() => {
this.classList.remove("active");
}}
@drop=${async (event) => {
event.preventDefault();
event.stopPropagation();
this.classList.remove("active");
let pathArr = [];
for (const f of event.dataTransfer.files) pathArr.push(f.path ?? f.name);
this.#handleFiles(pathArr);
}}
>
${resolvedValueDisplay
? html`
${resolvedValueDisplay}
${dialog
? ""
: html`<br /><small
>Cannot get full ${isMultipleTypes ? this.type.join(" / ") : this.type}
path${this.multiple ? "s" : ""} on web distribution</small
>`}
`
: html`<span
>Drop ${objectTypeReference}
here${isMultipleTypes
<div>
<button
title=${isArray ? this.value.map((v, i) => `${i + 1}. ${v}`).join("\n") : this.value}
@click=${() => isMultipleTypes || this.selectFormat()}
@dragenter=${() => {
this.classList.add("active");
}}
@dragleave=${() => {
this.classList.remove("active");
}}
@drop=${async (event) => {
event.preventDefault();
event.stopPropagation();
this.classList.remove("active");
let pathArr = [];
for (const f of event.dataTransfer.files) pathArr.push(f.path ?? f.name);
this.#handleFiles(pathArr);
}}
>
${resolvedValueDisplay
? html`
${resolvedValueDisplay}
${dialog
? ""
: `, or click to choose ${getObjectTypeReferenceString(this.type, this.multiple, {
native: true,
})}`}</span
>${this.multiple &&
(this.type === "directory" || (isMultipleTypes && this.type.includes("directory") && !dialog))
? html`<br /><small
>Multiple directory support only available using drag-and-drop.</small
>`
: ""}`}
</button>
: html`<br /><small
>Cannot get full ${isMultipleTypes ? this.type.join(" / ") : this.type}
path${this.multiple ? "s" : ""} on web distribution</small
>`}
`
: html`<span
>Drop ${objectTypeReference}
here${isMultipleTypes
? ""
: `, or click to choose ${getObjectTypeReferenceString(this.type, this.multiple, {
native: true,
})}`}</span
>${this.multiple &&
(this.type === "directory" ||
(isMultipleTypes && this.type.includes("directory") && !dialog))
? html`<br /><small
>Multiple directory support only available using drag-and-drop.</small
>`
: ""}`}
</button>
${this.multiple && this.value.length > 1
? new List({
items: this.value.map((v) => ({ value: v })),
editable: false,
onChange: function () {
instanceThis.value = this.items.map((item) => item.value);
},
})
: ""}
</div>
${isMultipleTypes
? html`<div id="button-div">
${this.type.map(
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/stories/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export class List extends LitElement {
this.items = [...this.items]
}
}

this.onChange() // Register that the object has changed
};

button.onClick = deleteListItem;
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/src/stories/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,20 +266,20 @@ export class Table extends LitElement {
}
};

let ogThis = this;
let instanceThis = this;
const isRequired = this.isRequired(k);

const validator = async function (value, callback) {
const validateEmptyCells = ogThis.validateEmptyCells;
const validateEmptyCells = instanceThis.validateEmptyCells;
const willValidate =
validateEmptyCells === true ||
(Array.isArray(validateEmptyCells) && validateEmptyCells.includes(k));

value = ogThis.#getValue(value, colInfo);
value = instanceThis.#getValue(value, colInfo);

// Clear empty values if not validated
if (!value && !willValidate) {
ogThis.#handleValidationResult(
instanceThis.#handleValidationResult(
[], // Clear errors
this.row,
this.col
Expand All @@ -288,9 +288,9 @@ export class Table extends LitElement {
return;
}

if (value && k === ogThis.keyColumn && unresolved[this.row]) {
if (value in ogThis.data) {
ogThis.#handleValidationResult(
if (value && k === instanceThis.keyColumn && unresolved[this.row]) {
if (value in instanceThis.data) {
instanceThis.#handleValidationResult(
[{ message: `${header(k)} already exists`, type: "error" }],
this.row,
this.col
Expand All @@ -306,7 +306,7 @@ export class Table extends LitElement {
}

if (!value && isRequired) {
ogThis.#handleValidationResult(
instanceThis.#handleValidationResult(
[{ message: `${header(k)} is a required property.`, type: "error" }],
this.row,
this.col
Expand Down
Loading

0 comments on commit 905adac

Please sign in to comment.