Skip to content

Commit

Permalink
Merge branch 'main' into reenable_linux_pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored Jun 14, 2024
2 parents 4203a90 + f56ac2f commit befbb9e
Show file tree
Hide file tree
Showing 92 changed files with 1,415 additions and 1,034 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
"build:electron:linux": "electron-builder build --linux --publish never",
"test": "npm run test:app && npm run test:server",
"test:app": "vitest run --exclude \"**/pipelines.test.ts\"",
"test:app:covered": "vitest run --exclude \"**/e2e/*.test.ts\"",
"test:tutorial": "vitest tutorial",
"test:pipelines": "vitest pipelines",
"test:progress": "vitest progress",
"test:metadata": "vitest metadata",
"test:coverage:minimal": "npm run test:app:covered && npm run coverage:server",
"test:server": "pytest src/pyflask/tests/ -s -vv",
"wait5s": "node -e \"setTimeout(() => process.exit(0),5000)\"",
"test:executable": "concurrently -n EXE,TEST --kill-others --success first \"node tests/testPyinstallerExecutable.js --port 3434 --forever\" \"npm run wait5s && pytest src/pyflask/tests/ -s --target http://localhost:3434\"",
Expand Down
4 changes: 2 additions & 2 deletions src/electron/frontend/core/components/BasicTable.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { LitElement, css, html, unsafeCSS } from "lit";
import { styleMap } from "lit/directives/style-map.js";
import { header } from "./forms/utils";
import { header } from "../../utils/text";
import { checkStatus } from "../validation";
import { emojiFontFamily, errorHue, warningHue } from "./globals";

import * as promises from "../promises";
import * as promises from "../../utils/promises";

import "./Button";
import { sortTable } from "./Table";
Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/core/components/DandiResults.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LitElement, css, html } from "lit";

import { get } from "dandi";
import { isStaging, getAPIKey } from "./pages/uploads/utils";
import { isStaging, getAPIKey } from "../../utils/upload";

export class DandiResults extends LitElement {
static get styles() {
Expand Down
25 changes: 1 addition & 24 deletions src/electron/frontend/core/components/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html } from "lit";
import useGlobalStyles from "./utils/useGlobalStyles.js";

import { Main, checkIfPageIsSkipped } from "./Main.js";
import { Sidebar } from "./sidebar.js";
Expand Down Expand Up @@ -32,36 +31,14 @@ import "../../../../../node_modules/fomantic-ui/dist/components/accordion.min.cs
import "../../../../../node_modules/@sweetalert2/theme-bulma/bulma.css";
// import "../../node_modules/intro.js/minified/introjs.min.css"
import "../../assets/css/guided.css";
import { isElectron } from "../../utils/electron.js";
import { isElectron } from "../../utils/electron";
import { isStorybook, reloadPageToHome } from "../globals.js";
import { getCurrentProjectName, updateAppProgress } from "../progress/index.js";

// import "https://jsuites.net/v4/jsuites.js"
// import "https://bossanova.uk/jspreadsheet/v4/jexcel.js"

const componentCSS = `
:host {
display: flex;
height: 100%;
width: 100%;
}
nwb-main {
background: #fff;
border-top: 1px solid #c3c3c3;
}
`;

export class Dashboard extends LitElement {
static get styles() {
const style = useGlobalStyles(
componentCSS,
(sheet) => sheet.href && sheet.href.includes("bootstrap"),
this.shadowRoot
);
return style;
}

static get properties() {
return {
renderNameInSidebar: { type: Boolean, reflect: true },
Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/core/components/DateTimeSelector.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, css } from "lit";
import { getTimezoneOffset, formatTimezoneOffset } from "../../../../schemas/timezone.schema";
import { getTimezoneOffset, formatTimezoneOffset } from "../../utils/time";

// Function to format the GMT offset
export function extractISOString(date = new Date(), { offset = false, timezone = undefined } = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Modal } from "../Modal"
import { Page } from "../pages/Page.js"
import { Button } from "../Button.js"
import { JSONSchemaForm } from "../JSONSchemaForm.js"

import { onThrow } from "../../errors";
import { merge } from "../pages/utils.js";
import { save } from "../../progress/index.js";
import { Modal } from "./Modal"
import { Page } from "./pages/Page.js"
import { Button } from "./Button.js"
import { JSONSchemaForm } from "./JSONSchemaForm.js"

import { onThrow } from "../errors";
import { merge } from "../../utils/data";
import { save } from "../progress/index.js";

type SingleIgnorePropsLevel = {
[x:string]: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, css, html } from "lit";
import { List } from "../../List";
import { getMessageType, isErrorImportance } from "../../../validation";
import { List } from "./List";
import { getMessageType, isErrorImportance } from "../validation";

import { unsafeHTML } from "lit/directives/unsafe-html.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, css, html, unsafeCSS } from "lit";

import { errorHue, errorSymbol, successHue, successSymbol, warningHue, warningSymbol, emojiFontFamily } from "../globals";
import { errorHue, errorSymbol, successHue, successSymbol, warningHue, warningSymbol, emojiFontFamily } from "./globals";

export class InstanceListItem extends LitElement {

Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/core/components/InstanceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LitElement, css, html } from "lit";
import "./Button";
import { notify } from "../dependencies";
import { Accordion } from "./Accordion";
import { InstanceListItem } from "./instances/item";
import { InstanceListItem } from "./InstanceListItem";
import { checkStatus } from "../validation";

export class InstanceManager extends LitElement {
Expand Down
20 changes: 9 additions & 11 deletions src/electron/frontend/core/components/JSONSchemaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import { unsafeHTML } from "lit/directives/unsafe-html.js";
import { Accordion } from "./Accordion";

import { checkStatus } from "../validation";
import { header, replaceRefsWithValue } from "./forms/utils";
import { resolve } from "../promises";
import { merge } from "./pages/utils";
import { resolveProperties } from "./pages/guided-mode/data/utils";
import { header } from "../../utils/text";
import { resolveAsJSONSchema } from "../../utils/data";
import { resolve } from "../../utils/promises";
import { merge } from "../../utils/data";
import { resolveProperties } from "../../utils/data";

import { JSONSchemaInput, getEditableItems } from "./JSONSchemaInput";
import { InspectorListItem } from "./preview/inspector/InspectorList";
import { InspectorListItem } from "./InspectorList";

import { Validator } from "jsonschema";
import { successHue, warningHue, errorHue } from "./globals";
import { Button } from "./Button";
import { isObject } from "../../utils/typecheck";

const encode = (str) => {
try {
Expand Down Expand Up @@ -69,11 +71,7 @@ const additionalPropPattern = "additional";

const templateNaNMessage = `<br/><small>Type <b>NaN</b> to represent an unknown value.</small>`;

var validator = new Validator();

const isObject = (item) => {
return item && typeof item === "object" && !Array.isArray(item);
};
const validator = new Validator();

export const getIgnore = (o, path) => {
if (typeof path === "string") path = path.split(".");
Expand Down Expand Up @@ -658,7 +656,7 @@ export class JSONSchemaForm extends LitElement {

set schema(schema) {
this.#schema = schema;
this.#schema = replaceRefsWithValue(schema);
this.#schema = resolveAsJSONSchema(schema);
}

get schema() {
Expand Down
13 changes: 7 additions & 6 deletions src/electron/frontend/core/components/JSONSchemaInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ import { unsafeHTML } from "lit/directives/unsafe-html.js";
import { FilesystemSelector } from "./FileSystemSelector";

import { BasicTable } from "./BasicTable";
import { header, tempPropertyKey, tempPropertyValueKey } from "./forms/utils";
import { header } from "../../utils/text";
import { tempPropertyKey, tempPropertyValueKey } from "./globals.js";

import { Button } from "./Button";
import { List } from "./List";
import { Modal } from "./Modal";

import { capitalize } from "./forms/utils";
import { capitalize } from "../../utils/text";
import { JSONSchemaForm, getIgnore } from "./JSONSchemaForm";
import { Search } from "./Search";
import tippy from "tippy.js";
import { merge } from "./pages/utils";
import { merge } from "../../utils/data";
import { OptionalSection } from "./OptionalSection";
import { InspectorListItem } from "./preview/inspector/InspectorList";
import { InspectorListItem } from "./InspectorList.js";
import { renderDateTime, resolveDateTime } from "./DateTimeSelector";
import { isObject } from "../../utils/typecheck";

const isDevelopment = !!import.meta.env;

Expand Down Expand Up @@ -276,8 +278,7 @@ export function createTable(fullPath, { onUpdate, onThrow, overrides = {} }) {
}

// Schema or value indicates editable object
export const isEditableObject = (schema, value) =>
schema.type === "object" || (value && typeof value === "object" && !Array.isArray(value));
export const isEditableObject = (schema, value) => schema.type === "object" || isObject(value);

export const isAdditionalProperties = (pattern) => pattern === "additional";
export const isPatternProperties = (pattern) => pattern && !isAdditionalProperties(pattern);
Expand Down
16 changes: 0 additions & 16 deletions src/electron/frontend/core/components/Main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html } from "lit";
import useGlobalStyles from "./utils/useGlobalStyles.js";
import { GuidedFooter } from "./pages/guided-mode/GuidedFooter.js";
import { GuidedHeader } from "./pages/guided-mode/GuidedHeader.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
Expand All @@ -19,22 +18,7 @@ export const checkIfPageIsSkipped = (page, workflowValues = {}) => {
return false;
};

const componentCSS = `
:host {
display: grid;
grid-template-rows: fit-content(100%) 1fr fit-content(100%);
}
`;

export class Main extends LitElement {
static get styles() {
return useGlobalStyles(
componentCSS,
(sheet) => sheet.href && sheet.href.includes("bootstrap"),
this.shadowRoot
);
}

static get properties() {
return {
toRender: { type: Object, reflect: false },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { LitElement, css, html } from "lit";
import { InspectorList } from "./inspector/InspectorList";
import { InspectorList } from "./InspectorList";
import { Neurosift, getURLFromFilePath } from "./Neurosift";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import { run } from "../pages/guided-mode/options/utils";
import { run } from "../../utils/run";

import { until } from "lit/directives/until.js";
import { InstanceManager } from "../InstanceManager";
import { path } from "../../../utils/electron.js";
import { FullScreenToggle } from "../FullScreenToggle";
import { InstanceManager } from "./InstanceManager";
import { path } from "../../utils/electron";
import { FullScreenToggle } from "./FullScreenToggle";

export function getSharedPath(array) {
array = array.map((str) => str.replace(/\\/g, "/")); // Convert to Mac-style path
Expand Down
13 changes: 0 additions & 13 deletions src/electron/frontend/core/components/NavigationSidebar.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import { LitElement, html } from "lit";
import useGlobalStyles from "./utils/useGlobalStyles.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";

const autoOpenValue = Symbol("SECTION_AUTO_OPEN");

const componentCSS = `
`;

function isHTML(str) {
var doc = new DOMParser().parseFromString(str, "text/html");
return Array.from(doc.body.childNodes).some((node) => node.nodeType === 1);
}

export class NavigationSidebar extends LitElement {
static get styles() {
return useGlobalStyles(
componentCSS,
(sheet) => sheet.href && sheet.href.includes("bootstrap"),
this.shadowRoot
);
}

static get properties() {
return {
sections: { type: Object, reflect: false },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LitElement, css, html } from "lit";

import { Loader } from "../Loader";
import { FullScreenToggle } from "../FullScreenToggle";
import { baseUrl } from "../../server/globals";
import { Loader } from "./Loader";
import { FullScreenToggle } from "./FullScreenToggle";
import { baseUrl } from "../server/globals";

export function getURLFromFilePath(file, projectName) {
const regexp = new RegExp(`.+(${projectName}.+)`);
Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/core/components/ProgressBar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import { LitElement, html, css, unsafeCSS } from 'lit';
import { humanReadableBytes } from './utils/size';
import { humanReadableBytes } from '../../utils/bytes';

export type ProgressProps = {
size?: string,
Expand Down
5 changes: 2 additions & 3 deletions src/electron/frontend/core/components/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import searchSVG from "../../assets/icons/search.svg?raw";

import tippy from "tippy.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import { isObject } from "../../utils/typecheck";

const ALTERNATIVE_MODES = ["input", "append"];

Expand Down Expand Up @@ -45,9 +46,7 @@ export class Search extends LitElement {

#value;

#isObject(value = this.#value) {
return value && typeof value === "object";
}
#isObject = (value = this.#value) => isObject(value);

#getOption = ({ label, value } = {}) => {
return this.options.find((item) => {
Expand Down
6 changes: 3 additions & 3 deletions src/electron/frontend/core/components/SimpleTable.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { LitElement, css, html, unsafeCSS } from "lit";
import { header, tempPropertyValueKey } from "./forms/utils";
import { header } from "../../utils/text";
import { checkStatus } from "../validation";

import { TableCell } from "./table/Cell";
import { ContextMenu } from "./table/ContextMenu";
import { emojiFontFamily, errorHue, warningHue } from "./globals";
import { emojiFontFamily, errorHue, tempPropertyValueKey, warningHue } from "./globals";

import { Loader } from "./Loader";
import { styleMap } from "lit/directives/style-map.js";
Expand All @@ -14,7 +14,7 @@ import tippy from "tippy.js";
import { sortTable, getEditable } from "./Table";
import { NestedInputCell } from "./table/cells/input";
import { getIgnore } from "./JSONSchemaForm";
import { merge } from "./pages/utils";
import { merge } from "../../utils/data";

var isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
successHue,
warningHue,
issueHue
} from "../globals";
} from "./globals";

export type StatusIndicatorProps = {
label: string | any,
Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/core/components/Table.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, html } from "lit";
import { Handsontable, css } from "./hot";
import { header } from "./forms/utils";
import { header } from "../../utils/text";
import { errorHue, warningHue } from "./globals";
import { checkStatus } from "../validation";
import { emojiFontFamily } from "./globals";
Expand Down
Loading

0 comments on commit befbb9e

Please sign in to comment.