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

Add auto-update workflow #786

Merged
merged 27 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c3f8562
Add auto-update workflow
garrettmflynn May 20, 2024
6e1d109
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 20, 2024
5078d88
Intelligently render bytes
garrettmflynn May 20, 2024
3aa665f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 20, 2024
dc25d64
Merge branch 'main' into autoupdate
garrettmflynn May 20, 2024
60d9e73
Merge branch 'main' into autoupdate
CodyCBakerPhD May 21, 2024
c5d237f
attempt to resolve conflict
CodyCBakerPhD May 29, 2024
bacbce8
Merge branch 'main' into autoupdate
CodyCBakerPhD May 29, 2024
1ed277b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
230e491
fix improper conflicts
CodyCBakerPhD May 29, 2024
8f2ec90
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
ea768a9
remove getting started page; correct relative path to assets
CodyCBakerPhD May 29, 2024
6e2c586
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
c52f4d6
swap to base 10
CodyCBakerPhD May 29, 2024
b093a70
Merge branch 'autoupdate' of https://github.com/neurodatawithoutborde…
CodyCBakerPhD May 29, 2024
c45b055
fix relative paths again
CodyCBakerPhD May 29, 2024
96d5c89
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
c36b461
fix relative paths again
CodyCBakerPhD May 29, 2024
391bca4
fix relative paths again
CodyCBakerPhD May 29, 2024
d6cd1b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
be5a4eb
Merge branch 'main' into autoupdate
garrettmflynn May 29, 2024
a78b4d7
Update SettingsPage.js
garrettmflynn May 29, 2024
43b1ed6
Update SettingsPage.js
garrettmflynn May 29, 2024
4aa5384
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
de0dd02
Merge branch 'main' into autoupdate
CodyCBakerPhD May 29, 2024
e28a5e7
Merge branch 'main' into autoupdate
CodyCBakerPhD May 29, 2024
d0f90ad
Merge branch 'main' into autoupdate
CodyCBakerPhD May 29, 2024
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
51 changes: 51 additions & 0 deletions src/electron/frontend/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* Update Notification Box */
#update-available:not(:empty) {
margin-top: 15px;
background-color: #ffe5d2;
color: black;
padding: 15px 10px;
border: 1px solid #f6c39c;
border-radius: 5px;
}

#update-available .update-container {
display: flex;
align-items: center;
gap: 15px;
}

#update-available .update-container::before {
content: "";
width: 6px;
height: 6px;
margin-left: 5px;
background-color: #d17128;
border-radius: 50%;
}

#update-available .header {
display: flex;
align-items: center;
gap: 5px;
}

#update-available h4 {
margin: 0;
}

#update-available span {
color: gray;
font-size: 80%;
}

#update-available .header svg {
height: 15px;
width: auto;
cursor: pointer;
}

#update-available .controls {
margin-left: auto;
display: flex;
gap: 10px;
}
19 changes: 17 additions & 2 deletions src/electron/frontend/assets/css/nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ a[data-toggle="collapse"] {

#main-nav .sidebar-body a {
font-size: 14px;
display: block;
line-height: 45px;
display: flex;
align-items: center;
position: relative;
padding: 15px 0px;
padding-left: 20px;
margin-bottom: 5px;
text-align: left;
Expand All @@ -170,6 +172,19 @@ a[data-toggle="collapse"] {
border-left: 4px solid transparent;
}

[data-update-available] [data-id="settings"] > div {
display: flex;
flex-direction: column;
}

[data-update-available] [data-id="settings"] > div::after {
content: "Update Available";
color: gray;
font-size: 70%;
font-weight: normal;
line-height: 1.5;
}

#main-nav .sidebar-body svg {
fill: #000;
}
Expand Down
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/dandi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/electron/frontend/assets/icons/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/exploration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/electron/frontend/assets/icons/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/inspect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/neurosift-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/preview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/electron/frontend/assets/icons/settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/electron/frontend/core/components/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Main, checkIfPageIsSkipped } from "./Main.js";
import { Sidebar } from "./sidebar.js";
import { NavigationSidebar } from "./NavigationSidebar.js";

// Defined by Garrett late in GUIDE development to clearly separate global styles unrelated to SODA (May 20th, 2024)
import "../../assets/css/custom.css";

// Global styles to apply with the dashboard
import "../../assets/css/variables.css";
import "../../assets/css/nativize.css";
Expand All @@ -31,7 +34,6 @@ import "../../../../../node_modules/@sweetalert2/theme-bulma/bulma.css";
import "../../assets/css/guided.css";
import { isElectron } from "../../utils/electron.js";
import { isStorybook, reloadPageToHome } from "../globals.js";

import { getCurrentProjectName, updateAppProgress } from "../progress/index.js";

// import "https://jsuites.net/v4/jsuites.js"
Expand Down Expand Up @@ -295,7 +297,12 @@ export class Dashboard extends LitElement {
const section = info.section;

let state = globalState.sections[section];
if (!state) state = globalState.sections[section] = { open: false, active: false, pages: {} };
if (!state)
state = globalState.sections[section] = {
open: false,
active: false,
pages: {},
};

let pageState = state.pages[id];
if (!pageState)
Expand Down
43 changes: 40 additions & 3 deletions src/electron/frontend/core/components/ProgressBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,37 @@ import { LitElement, html, css, unsafeCSS } from 'lit';
export type ProgressProps = {
size?: string,

isBytes?: boolean,

format?: {
n: number,
total: number,
[key: string]: any,
},
}
}

export function humanReadableBytes(size: number | string) {

// Define the units
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

// Initialize the index to 0
let index = 0;

// Convert the size to a floating point number
size = parseFloat(size);

// Loop until the size is less than 1024 and increment the unit
while (size >= 1000 && index < units.length - 1) {
size /= 1000;
index += 1;
}

// Return the size formatted with 2 decimal places and the appropriate unit
return `${size.toFixed(2)} ${units[index]}`;
}


const animationDuration = 500 // ms

export class ProgressBar extends LitElement {
Expand Down Expand Up @@ -88,12 +112,14 @@ export class ProgressBar extends LitElement {

declare format: any
declare size: string
declare isBytes: boolean


constructor(props: ProgressProps = {}) {
super();
this.size = props.size ?? 'medium'
this.format = props.format ?? {}
this.isBytes = props.isBytes ?? false
if (!('n' in this.format)) this.format.n = 0
if (!('total' in this.format)) this.format.total = 0
}
Expand All @@ -103,6 +129,17 @@ export class ProgressBar extends LitElement {
const percent = this.format.total ? 100 * (this.format.n / this.format.total) : 0;
const remaining = this.format.rate && this.format.total ? (this.format.total - this.format.n) / this.format.rate : 0; // Seconds

const numerator = this.isBytes ? humanReadableBytes(this.format.n) : this.format.n
const denominator = this.isBytes ? humanReadableBytes(this.format.total) : this.format.total


const elapsed = this.format.elapsed

let subMessage = ''
if ('elapsed' in this.format && 'rate' in this.format) subMessage = `${elapsed?.toFixed(1)}s elapsed, ${remaining.toFixed(1)}s remaining`
else if ('elapsed' in this.format) subMessage = `${elapsed?.toFixed(1)}s elapsed`
else if ('rate' in this.format) subMessage = `${remaining.toFixed(1)}s remaining`

return html`
<div class="bar">
${this.format.prefix ? html`<div>
Expand All @@ -112,10 +149,10 @@ export class ProgressBar extends LitElement {
<div class="progress">
<div style="width: ${percent}%"></div>
</div>
<small>${this.format.n} / ${this.format.total} (${percent.toFixed(1)}%)</small>
<small>${numerator} / ${denominator} (${percent.toFixed(1)}%)</small>
</div>
<div>
${'elapsed' in this.format && 'rate' in this.format ? html`<small>${this.format.elapsed?.toFixed(1)}s elapsed, ${remaining.toFixed(1)}s remaining</small>` : ''}
${subMessage ? html`<small>${subMessage}</small>` : ''}
</div>
</div>
`;
Expand Down

This file was deleted.

Loading
Loading