Skip to content
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
13 changes: 9 additions & 4 deletions src/apps/admin/executequery/Overlays/LoadQueryOverlay.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import type { LoadQueryOverlayRuntime } from "../LoadQuery/runtime";

const { process }: { process: LoadQueryOverlayRuntime } = $props();
Expand All @@ -13,7 +15,10 @@
</button>
{/each}
</div>
<div class="actions">
<button onclick={() => process.closeWindow()}>Cancel</button>
<button class="suggested" disabled={!$selectedQuery} onclick={() => process.Confirm()}>Load</button>
</div>

<ActionBar>
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested disabled={!$selectedQuery} onclick={() => process.Confirm()}>Load</ActionButton>
{/snippet}
</ActionBar>
12 changes: 8 additions & 4 deletions src/apps/admin/executequery/Overlays/SaveQueryOverlay.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import type { SaveQueryOverlayRuntime } from "../SaveQuery/runtime";

const { process }: { process: SaveQueryOverlayRuntime } = $props();
Expand All @@ -10,7 +12,9 @@
<input type="text" bind:value={$queryName} placeholder="Users called 'banana'" />
</div>

<div class="actions">
<button onclick={() => process.closeWindow()}>Cancel</button>
<button onclick={() => process.Confirm()} class="suggested">Save</button>
</div>
<ActionBar>
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested disabled={!$queryName} onclick={() => process.Confirm()}>Save</ActionButton>
{/snippet}
</ActionBar>
38 changes: 25 additions & 13 deletions src/apps/components/addserver/AddServer.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import type { AddServerRuntime } from "./runtime";

const { process }: { process: AddServerRuntime } = $props();
const { loading, action } = process;

let hostname = $state<string>("");
let authCode = $state<string>("");
Expand Down Expand Up @@ -39,16 +42,25 @@
</div>
</div>

<div class="actions">
<button
class="test"
disabled={!hostname || port <= 100 || port > 65535}
onclick={() => process.testServer(hostname, port, authCode)}>Test</button
>
<button class="cancel" onclick={() => process.closeWindow()}>Cancel</button>
<button
class="suggested"
disabled={!hostname || port <= 100 || port > 65535}
onclick={() => process.addServer(hostname, port, authCode)}>Add</button
>
</div>
<ActionBar floating>
{#snippet leftContent()}
<ActionButton
disabled={!hostname || port <= 100 || port > 65535 || $loading}
onclick={() => process.testServer(hostname, port, authCode)}
loading={$action === "callServer"}
>
Test
</ActionButton>
{/snippet}
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton
disabled={!hostname || port <= 100 || port > 65535 || $loading}
onclick={() => process.addServer(hostname, port, authCode)}
loading={$action === "addServer"}
suggested
>
Add
</ActionButton>
{/snippet}
</ActionBar>
15 changes: 15 additions & 0 deletions src/apps/components/addserver/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import { Server } from "$ts/env";
import { ErrorIcon, WarningIcon } from "$ts/images/dialog";
import { GoodStatusIcon } from "$ts/images/status";
import { MessageBox } from "$ts/util/dialog";
import { Store } from "$ts/writable";
import type { AppProcessData } from "$types/app";
import axios from "axios";

export class AddServerRuntime extends AppProcess {
loading = Store<boolean>(false);
action = Store<string>("");
//#region LIFECYCLE

constructor(pid: number, parentPid: number, app: AppProcessData) {
Expand All @@ -26,6 +29,8 @@ export class AddServerRuntime extends AppProcess {
async addServer(hostname: string, port: number, authCode?: string) {
this.Log(`addServer: ${hostname}:${port}`);

this.action.set("addServer");

const url = this.createServerUrl(hostname, port);

if (Server.isAdded(url)) {
Expand Down Expand Up @@ -58,13 +63,16 @@ export class AddServerRuntime extends AppProcess {
true
);

this.action.set("");

return;
}

Server.addServer({
url,
authCode,
});
this.action.set("");
this.closeWindow();
}

Expand All @@ -77,6 +85,9 @@ export class AddServerRuntime extends AppProcess {

private async callServer(url: string, authCode?: string) {
this.Log(`callServer: ${url}`);
this.loading.set(true);

if (this.action() === "") this.action.set("callServer");

try {
const response = await axios.get(`/ping`, {
Expand All @@ -85,11 +96,15 @@ export class AddServerRuntime extends AppProcess {
baseURL: url,
params: authCode ? { authcode: authCode } : {},
});

if (response.status !== 200) return false;

return true;
} catch {
return false;
} finally {
this.loading.set(false);
this.action.set("");
}
}

Expand Down
23 changes: 13 additions & 10 deletions src/apps/components/appinfo/AppInfo/Actions.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import InfoBlock from "$lib/InfoBlock.svelte";
import InfoRow from "$lib/InfoBlock/InfoRow.svelte";
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import { onMount } from "svelte";
import type { AppInfoRuntime } from "../runtime";
import ActionSubtle from "$lib/Window/ActionBar/ActionSubtle.svelte";

const { appId, process }: { appId: string; process: AppInfoRuntime } = $props();
const { userPreferences } = process;
Expand All @@ -18,11 +19,13 @@
});
</script>

<InfoBlock className="actions">
<InfoRow>
<p class="id" title={appId}>{appId}</p>
<button onclick={() => process.openPermissions()} {disabled}>Permissions</button>
<button onclick={() => process.killAll()} {disabled}>Kill all</button>
<button class="suggested" onclick={() => process.closeWindow()}>Close</button>
</InfoRow>
</InfoBlock>
<ActionBar floating>
{#snippet leftContent()}
<ActionSubtle mono text={appId} />
{/snippet}
{#snippet rightContent()}
<ActionButton onclick={() => process.openPermissions()}>Permissions</ActionButton>
<ActionButton onclick={() => process.killAll()}>Kill all</ActionButton>
<ActionButton suggested onclick={() => process.closeWindow()}>Close</ActionButton>
{/snippet}
</ActionBar>
18 changes: 10 additions & 8 deletions src/apps/components/apppermissions/AppPermissions/Actions.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<script lang="ts">
import InfoBlock from "$lib/InfoBlock.svelte";
import InfoRow from "$lib/InfoBlock/InfoRow.svelte";
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import { Permissions } from "$ts/permissions";
import type { AppPermissionsRuntime } from "../runtime";

const { process, permissionId }: { process: AppPermissionsRuntime; permissionId: string } = $props();
</script>

<InfoBlock>
<InfoRow className="actions">
<button onclick={() => Permissions.resetPermissionsById(permissionId)} disabled={!permissionId}>Reset all</button>
<button class="suggested" onclick={() => process.closeWindow()}>Close</button>
</InfoRow>
</InfoBlock>
<ActionBar floating>
{#snippet leftContent()}
<ActionButton onclick={() => Permissions.resetPermissionsById(permissionId)} disabled={!permissionId}>Reset all</ActionButton>
{/snippet}
{#snippet rightContent()}
<ActionButton suggested onclick={() => process.closeWindow()}>Close</ActionButton>
{/snippet}
</ActionBar>
26 changes: 13 additions & 13 deletions src/apps/components/arctermcolors/ArcTermColors.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import ActionIconButton from "$lib/Window/ActionBar/ActionIconButton.svelte";
import Custom from "./ArcTermColors/Custom.svelte";
import Presets from "./ArcTermColors/Presets.svelte";
import type { ArcTermColorsRuntime } from "./runtime";
Expand Down Expand Up @@ -33,16 +36,13 @@
{/if}
</div>

<div class="actions">
<button class="lucide icon-folder-open" aria-label="Load colorset..." onclick={() => process.openPreset()}></button>
<button
class="lucide icon-save"
disabled={$mode === "presets"}
aria-label="Save current colorset"
onclick={() => process.savePresetToFile()}
></button>
<div class="master">
<button class="cancel" onclick={() => process.closeWindow()}>Cancel</button>
<button class="apply suggested" onclick={() => process.applyConfiguration()} disabled={!$changed}>Apply</button>
</div>
</div>
<ActionBar floating>
{#snippet leftContent()}
<ActionIconButton icon="folder-open" title="Load colorset..." onclick={() => process.openPreset()} />
<ActionIconButton icon="save" title="Save current colorset" onclick={() => process.savePresetToFile()} />
{/snippet}
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested onclick={() => process.applyConfiguration()} disabled={!$changed}>Apply</ActionButton>
{/snippet}
</ActionBar>
19 changes: 13 additions & 6 deletions src/apps/components/driveinfo/DriveInfo.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts">
import CircularProgress from "$lib/CircularProgress.svelte";
import Spinner from "$lib/Spinner.svelte";
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import AdvancedInfo from "./DriveInfo/AdvancedInfo.svelte";
import Quota from "./DriveInfo/Quota.svelte";
import Usage from "./DriveInfo/Usage.svelte";
Expand Down Expand Up @@ -28,9 +30,14 @@
<Spinner height={32} />
</div>
{/if}
<div class="actions">
{#if isUserFs}
<button class="advanced" onclick={() => (advanced = !advanced)}>{advanced ? "Simple" : "Advanced"}</button>
{/if}
<button class="suggested" onclick={() => process.closeWindow()}>Close</button>
</div>

<ActionBar floating>
{#snippet leftContent()}
{#if isUserFs}
<ActionButton onclick={() => (advanced = !advanced)}>{advanced ? "Simple" : "Advanced"}</ActionButton>
{/if}
{/snippet}
{#snippet rightContent()}
<ActionButton suggested onclick={() => process.closeWindow()}>Close</ActionButton>
{/snippet}
</ActionBar>
13 changes: 9 additions & 4 deletions src/apps/components/fsnewfile/NewFile.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import { Daemon } from "$ts/daemon";
import { onMount } from "svelte";
import type { NewFileRuntime } from "./runtime";
Expand All @@ -24,7 +26,10 @@
<input type="text" bind:value={$newFile} />
</div>
</div>
<div class="bottom">
<button onclick={() => process.closeWindow()}>Cancel</button>
<button class="suggested" disabled={!$newFile} onclick={() => process.createFile()}> Create </button>
</div>

<ActionBar>
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested disabled={!$newFile} onclick={() => process.createFile()}>Create</ActionButton>
{/snippet}
</ActionBar>
13 changes: 9 additions & 4 deletions src/apps/components/fsnewfolder/NewFolder.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import type { NewFolderRuntime } from "./runtime";

const { process }: { process: NewFolderRuntime } = $props();
Expand All @@ -13,7 +15,10 @@
<input type="text" bind:value={$newFolder} />
</div>
</div>
<div class="bottom">
<button onclick={() => process.closeWindow()}>Cancel</button>
<button class="suggested" disabled={!$newFolder} onclick={() => process.createFolder()}> Create </button>
</div>

<ActionBar>
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested disabled={!$newFolder} onclick={() => process.createFolder()}>Create</ActionButton>
{/snippet}
</ActionBar>
27 changes: 15 additions & 12 deletions src/apps/components/fsprogress/FsProgress/Bottom.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import ActionSubtle from "$lib/Window/ActionBar/ActionSubtle.svelte";
import { formatBytes } from "$ts/util/fs";
import type { FsProgressRuntime } from "../runtime";

Expand All @@ -16,15 +19,15 @@
}
</script>

<div class="bottom">
{#if $Progress.max > 0}
<p class="status">
{#if $Progress.type == "quantity"}
{$Progress.done} / {$Progress.max} done
{:else if $Progress.type == "size"}
{formatBytes($Progress.done)} / {formatBytes($Progress.max)} done
{/if}
</p>
{/if}
<button class="cancel" disabled={!$Progress.cancel || canceling} onclick={cancel}> Cancel </button>
</div>
<ActionBar>
{#snippet leftContent()}
{#if $Progress.type == "quantity"}
<ActionSubtle text="{$Progress.done} / {$Progress.max} done" />
{:else if $Progress.type == "size"}
<ActionSubtle text="{formatBytes($Progress.done)} / {formatBytes($Progress.max)} done" />
{/if}
{/snippet}
{#snippet rightContent()}
<ActionButton disabled={!$Progress.cancel || canceling} onclick={cancel}>Cancel</ActionButton>
{/snippet}
</ActionBar>
1 change: 0 additions & 1 deletion src/apps/components/fsprogress/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { AppProcess } from "$ts/apps/process";
import { Stack } from "$ts/env";
import { Store } from "$ts/writable";
import type { AppProcessData } from "$types/app";
import type { RenderArgs } from "$types/process";
import type { ReadableStore } from "$types/writable";
import type { FsProgressOperation } from "./types";

Expand Down
13 changes: 9 additions & 4 deletions src/apps/components/fsrenameitem/RenameItem.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import ActionBar from "$lib/Window/ActionBar.svelte";
import ActionButton from "$lib/Window/ActionBar/ActionButton.svelte";
import type { RenameItemRuntime } from "./runtime";

const { process }: { process: RenameItemRuntime } = $props();
Expand All @@ -13,7 +15,10 @@
<input type="text" bind:value={$newName} />
</div>
</div>
<div class="bottom">
<button onclick={() => process.closeWindow()}>Cancel</button>
<button class="suggested" disabled={!$newName} onclick={() => process.rename()}> Rename </button>
</div>

<ActionBar>
{#snippet rightContent()}
<ActionButton onclick={() => process.closeWindow()}>Cancel</ActionButton>
<ActionButton suggested disabled={!$newName} onclick={() => process.rename()}>Rename</ActionButton>
{/snippet}
</ActionBar>
Loading