From bc3fffeef5700f7115743320330270f378d635aa Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 17:49:27 +0200 Subject: [PATCH 1/7] add nicer section for provisioned and cloned cells, add option to display network seed --- src/renderer/src/lib/helpers/other.ts | 32 +++-- src/renderer/src/lib/locale/en/common.json | 10 +- .../settings/(menu)/[slug]/+page.svelte | 74 ++++++------ .../[slug]/components/AppSettings.svelte | 2 +- .../[slug]/components/CellDetails.svelte | 110 ++++++++++++++++++ .../[slug]/components/SystemSettings.svelte | 58 ++++----- .../settings/components/DashedSection.svelte | 6 +- src/shared/types/holochain.ts | 11 +- 8 files changed, 226 insertions(+), 77 deletions(-) create mode 100644 src/renderer/src/routes/settings/(menu)/[slug]/components/CellDetails.svelte diff --git a/src/renderer/src/lib/helpers/other.ts b/src/renderer/src/lib/helpers/other.ts index de62a7e2..d192fcec 100644 --- a/src/renderer/src/lib/helpers/other.ts +++ b/src/renderer/src/lib/helpers/other.ts @@ -1,5 +1,4 @@ -import { encodeHashToBase64 } from '@holochain/client'; -import type { ModalStore, ToastStore } from '@skeletonlabs/skeleton'; +import { CellType, encodeHashToBase64, type CellInfo } from '@holochain/client'; import type { AppstoreAppClient, AppVersionEntry, Entity } from 'appstore-tools'; import localforage from 'localforage'; @@ -14,23 +13,42 @@ import { ExtendedAppInfoSchema, type InitializeAppPorts } from '$shared/types'; -import type { Modals } from '$types'; import { AppstoreFilterListsSchema } from '$types/happs'; -import { createModalParams, showModalError } from './display'; - export const getCellId = (cellInfo: unknown): CellId | undefined => { const parsedCellInfo = CellInfoSchema.safeParse(cellInfo); - if (!parsedCellInfo.success || 'stem' in parsedCellInfo.data) { + if (!parsedCellInfo.success || CellType.Stem in parsedCellInfo.data) { return undefined; } - return 'provisioned' in parsedCellInfo.data + return CellType.Provisioned in parsedCellInfo.data ? parsedCellInfo.data.provisioned.cell_id : parsedCellInfo.data.cloned.cell_id; }; +export function getCellNetworkSeed(cellInfo: any): string | undefined { + if (CellType.Provisioned in cellInfo) { + return cellInfo.provisioned.dna_modifiers.network_seed; + } + if (CellType.Cloned in cellInfo) { + return cellInfo.cloned.dna_modifiers.network_seed; + } + return undefined; +} + +export function getCellName(cellInfo: any): string | undefined { + if (CellType.Provisioned in cellInfo) { + return cellInfo.provisioned.name; + } + if (CellType.Cloned in cellInfo) { + return cellInfo.cloned.name; + } + if (CellType.Stem in cellInfo) { + return cellInfo.stem.name; + } +} + export const isNonEmptyString = (value: unknown): value is string => typeof value === 'string' && value.trim() !== ''; diff --git a/src/renderer/src/lib/locale/en/common.json b/src/renderer/src/lib/locale/en/common.json index 2da4592e..7249f61a 100644 --- a/src/renderer/src/lib/locale/en/common.json +++ b/src/renderer/src/lib/locale/en/common.json @@ -25,14 +25,16 @@ "continue": "Continue", "copiedToClipboard": "Copied to clipboard", "copy": "Copy", + "copied": "Copied", "country": "Country", "description": "Description", "details": "Details", - "developerTools": "Developer tools", + "developerTools": "Developer Tools", "developerToolsAllow": "Developer tools allow you to", "devhubInstalled": "DevHub installed", "disabled": "Disabled", "discoverInstallAndManageYourApps": "Discover, install and manage your apps", + "dnaHash": "DNA hash", "downloadError": "Download Error", "enabled": "Enabled", "enterAppName": "Enter app name", @@ -47,6 +49,7 @@ "generatingKeyRecoveryFile": "Generating key recovery file...", "getStarted": "Get started", "gettingAppBytes": "Getting app bytes", + "hide": "hide", "hideUnverifiedApps": "Hide unverified apps", "holochainLauncher": "Holochain Launcher", "holochainVersion": "Holochain version", @@ -79,6 +82,8 @@ "networkSeedDescription": "The network seed is the string of characters used to generate a Holochain network. Anyone who has this network seed can join the network. The default network is public!", "next": "Next", "noAppsInstalled": "No apps installed.", + "noClonedCells": "No cloned cells", + "nothingToCopy": "Nothing to Copy", "of": "of", "oneLineDescription": "One line description", "open": "Open", @@ -91,6 +96,7 @@ "passwordsDontMatch": "Passwords don't match!", "pollingForNewApps": "Polling for new apps...", "pubKey": "Pub Key", + "publicKey": "public key", "public": "Public", "publish": "Publish", "publishYourApp": "Publish your App", @@ -99,6 +105,7 @@ "region": "Region", "releases": "Releases", "reset": "Reset", + "roleName": "Role Name", "searchForApps": "Search for apps", "setUpYourPublisherProfile": "Set up your publisher profile", "setLauncherPassword": "Set Launcher Password", @@ -107,6 +114,7 @@ "setupProgress": "Setup Progress", "startingHolochain": "Starting Holochain...", "startingLairKeystore": "Starting Lair Keystore...", + "show": "show", "systemInformation": "System information", "systemSettings": "System settings", "theDeveloperToolkitSyncs": "The developer toolkit syncs with the app publishing network. Your local device will host files and potentially large amounts of data.", diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte index 53db380e..38379824 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte @@ -1,5 +1,5 @@ + +
+
+
+

+ {$i18n.t('roleName')}: + {getCellName(cellInfo)} +

+ {#if cellId} +

+ {$i18n.t('dnaHash')}: + {encodeHashToBase64(cellId[0])} +

+ {/if} +
+ {$i18n.t('networkSeed')}: + + + {showNetworkSeed + ? networkSeed + : '•••••••••••••••••••••••••••••••••••••••••••••'} + + + {#if showNetworkSeed} + { + showNetworkSeed = false; + }} + on:keypress={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + showNetworkSeed = false; + } + }} + role="button" + viewBox="0 0 26 18" + fill="none" + style="cursor: pointer; fill: white; opacity: 0.8" + version="1.1" + xmlns="http://www.w3.org/2000/svg" + > + {capitalizeFirstLetter($i18n.t('hide')) + ' ' + $i18n.t('networkSeed')} + + + {:else} + { + showNetworkSeed = true; + }} + on:keypress={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + showNetworkSeed = true; + } + }} + role="button" + width="23" + height="15" + viewBox="0 0 26 18" + fill="none" + style="cursor: pointer; fill: white; opacity: 0.8" + xmlns="http://www.w3.org/2000/svg" + > + {capitalizeFirstLetter($i18n.t('show')) + ' ' + $i18n.t('networkSeed')} + + + {/if} + +
+
+
+
diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte index 5c007817..b5f12e0b 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte @@ -84,35 +84,39 @@ {#if $installDevhub.isPending} {/if} - - - {#if $isDevhubInstalled.data} -

{$i18n.t('devhubInstalled')}

- {:else} - +
+ {$i18n.t('developerToolsAllow')} + {$i18n.t('uploadAndPublish')} +
+ {/if} +
+ +
+ -
- {$i18n.t('developerToolsAllow')} - {$i18n.t('uploadAndPublish')}
- {/if} - - - - + +
+ diff --git a/src/renderer/src/routes/settings/components/DashedSection.svelte b/src/renderer/src/routes/settings/components/DashedSection.svelte index e1c62766..ee55be23 100644 --- a/src/renderer/src/routes/settings/components/DashedSection.svelte +++ b/src/renderer/src/routes/settings/components/DashedSection.svelte @@ -3,9 +3,9 @@ export let borderColor = 'border-white/15'; -
-

{title}

-
+
+

{title}

+
diff --git a/src/shared/types/holochain.ts b/src/shared/types/holochain.ts index 10ab8efb..a2ad0b27 100644 --- a/src/shared/types/holochain.ts +++ b/src/shared/types/holochain.ts @@ -26,15 +26,24 @@ export const CellInfoSchema = z.union([ z.object({ provisioned: z.object({ cell_id: CellIdSchema, + dna_modifiers: z.any(), + name: z.string(), }), }), z.object({ cloned: z.object({ cell_id: CellIdSchema, + clone_id: z.string(), + original_dna_hash: z.instanceof(Uint8Array), + dna_modifiers: z.any(), + name: z.string(), + enabled: z.boolean(), }), }), z.object({ stem: z.object({}), + name: z.string().optional(), + dna_modifiers: z.any(), }), ]); @@ -56,7 +65,7 @@ export const InstalledAppInfoStatusSchema = z.union([ export type InstalledAppInfoStatus = z.infer; export const AppInfoSchema = z.object({ - agent_pub_key: z.instanceof(Uint8Array), + agent_pub_key: z.any(), installed_app_id: z.string(), cell_info: z.record(z.string(), z.array(CellInfoSchema)), status: InstalledAppInfoStatusSchema, From a3d730a4dc3274c3376269d98fdf516188dbda00 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 18:32:34 +0200 Subject: [PATCH 2/7] change serttings window default size, make app settings view go back to detail view when changing selected app --- src/main/index.ts | 4 +-- src/main/windows.ts | 18 ++++++++++--- src/renderer/src/lib/helpers/navigation.ts | 4 +-- src/renderer/src/lib/locale/en/common.json | 3 ++- .../src/routes/settings/(menu)/+layout.svelte | 2 +- .../src/routes/settings/(menu)/+page.svelte | 2 +- .../settings/(menu)/[slug]/+page.svelte | 16 +++++++---- .../[slug]/components/AppSettings.svelte | 27 +++++++++++-------- .../[slug]/components/KeyManagement.svelte | 2 ++ src/shared/const/index.ts | 5 ++-- 10 files changed, 54 insertions(+), 29 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 36e18280..4c183b84 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -24,7 +24,7 @@ import { DEVHUB_APP_ID, DISTRIBUTION_TYPE_DEFAULT_APP, MAIN_WINDOW, - MIN_HEIGH, + MIN_HEIGHT, SETTINGS_WINDOW, WINDOW_SIZE, } from '$shared/const'; @@ -942,7 +942,7 @@ const router = t.router({ } await launchHolochain(password, LAIR_URL!); IS_LAUNCHED = true; - PRIVILEDGED_LAUNCHER_WINDOWS[MAIN_WINDOW].setSize(WINDOW_SIZE, MIN_HEIGH, true); + PRIVILEDGED_LAUNCHER_WINDOWS[MAIN_WINDOW].setSize(WINDOW_SIZE, MIN_HEIGHT, true); loadOrServe(PRIVILEDGED_LAUNCHER_WINDOWS[SETTINGS_WINDOW], { screen: SETTINGS_WINDOW }); }), initializeDefaultAppPorts: t.procedure.query(async () => { diff --git a/src/main/windows.ts b/src/main/windows.ts index 2af3a504..c46154f3 100644 --- a/src/main/windows.ts +++ b/src/main/windows.ts @@ -15,7 +15,14 @@ import serve from 'electron-serve'; import path from 'path'; import url from 'url'; -import { MAIN_WINDOW, MIN_HEIGH, SETTINGS_SIZE, SETTINGS_WINDOW, WINDOW_SIZE } from '$shared/const'; +import { + MAIN_WINDOW, + MIN_HEIGHT, + SETTINGS_HEIGHT, + SETTINGS_WIDTH, + SETTINGS_WINDOW, + WINDOW_SIZE, +} from '$shared/const'; import type { AdminWindow, ExtendedAppInfo } from '$shared/types'; import { LAUNCHER_ERROR } from '$shared/types'; @@ -53,19 +60,21 @@ const createAdminWindow = ({ optWidth, frame = false, icon, + height, }: { title: string; optWidth?: number; frame?: boolean; icon?: Electron.NativeImage; + height?: number; }) => new BrowserWindow({ frame: frame, width: optWidth || WINDOW_SIZE, minWidth: optWidth || WINDOW_SIZE, - height: WINDOW_SIZE, + height: height ? height : WINDOW_SIZE, icon, - minHeight: MIN_HEIGH, + minHeight: MIN_HEIGHT, title: title, show: false, webPreferences: { @@ -85,7 +94,8 @@ export const setupAppWindows = (launcherEmitter: LauncherEmitter) => { const settingsWindow = createAdminWindow({ title: 'Settings - Holochain Launcher', frame: true, - optWidth: SETTINGS_SIZE, + optWidth: SETTINGS_WIDTH, + height: SETTINGS_HEIGHT, icon: mainIcon, }); diff --git a/src/renderer/src/lib/helpers/navigation.ts b/src/renderer/src/lib/helpers/navigation.ts index fcea29ff..40cf32be 100644 --- a/src/renderer/src/lib/helpers/navigation.ts +++ b/src/renderer/src/lib/helpers/navigation.ts @@ -6,7 +6,7 @@ import { SEARCH_URL_QUERY } from '$const'; import { ANIMATION_DURATION, APPS_VIEW, - MIN_HEIGH, + MIN_HEIGHT, WINDOW_SIZE, WINDOW_SIZE_LARGE } from '$shared/const'; @@ -20,7 +20,7 @@ export const setSearchInput = (event: CustomEvent) => { const getWindowSize = (destination: MainScreenRoute) => destination === APPS_VIEW - ? { width: WINDOW_SIZE, height: MIN_HEIGH } + ? { width: WINDOW_SIZE, height: MIN_HEIGHT } : { width: WINDOW_SIZE_LARGE, height: WINDOW_SIZE }; const resizeWindow = ({ width, height }: { width: number; height: number }) => diff --git a/src/renderer/src/lib/locale/en/common.json b/src/renderer/src/lib/locale/en/common.json index 7249f61a..04d5fa65 100644 --- a/src/renderer/src/lib/locale/en/common.json +++ b/src/renderer/src/lib/locale/en/common.json @@ -96,7 +96,7 @@ "passwordsDontMatch": "Passwords don't match!", "pollingForNewApps": "Polling for new apps...", "pubKey": "Pub Key", - "publicKey": "public key", + "publicKey": "Public Key", "public": "Public", "publish": "Publish", "publishYourApp": "Publish your App", @@ -120,6 +120,7 @@ "theDeveloperToolkitSyncs": "The developer toolkit syncs with the app publishing network. Your local device will host files and potentially large amounts of data.", "thisAppHasNotBeenVerifiedByTheHolochainFoundation": "This app has not been verified by the Holochain Foundation. Make sure you trust it before installing.", "uninstall": "Uninstall", + "uninstallApp": "Uninstall App", "uninstallAppModalBody": "Are you sure you want to uninstall the app? This will delete all associated data.", "updateAppDetails": "Update App Details", "updateAvailable": "Update available", diff --git a/src/renderer/src/routes/settings/(menu)/+layout.svelte b/src/renderer/src/routes/settings/(menu)/+layout.svelte index 77483f29..1bc6977e 100644 --- a/src/renderer/src/routes/settings/(menu)/+layout.svelte +++ b/src/renderer/src/routes/settings/(menu)/+layout.svelte @@ -9,7 +9,7 @@
diff --git a/src/renderer/src/routes/settings/(menu)/+page.svelte b/src/renderer/src/routes/settings/(menu)/+page.svelte index 6078069b..fedd7b90 100644 --- a/src/renderer/src/routes/settings/(menu)/+page.svelte +++ b/src/renderer/src/routes/settings/(menu)/+page.svelte @@ -5,7 +5,7 @@ const defaultHolochainVersion = client.defaultHolochainVersion.createQuery(); -
+

{$i18n.t('holochainVersion')}

{#if $defaultHolochainVersion.data} diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte index 38379824..2882ce4d 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte @@ -13,9 +13,6 @@ createModalParams, filterHash, getAppStoreDistributionHash, - getCellId, - getCellName, - getCellNetworkSeed, getVersionByActionHash, isDev, showModalError, @@ -26,7 +23,7 @@ import { i18n, trpc } from '$services'; import { DISTRIBUTION_TYPE_APPSTORE, SETTINGS_WINDOW } from '$shared/const'; import { getErrorMessage } from '$shared/helpers'; - import { CellInfoSchema, type UpdateUiFromHash } from '$shared/types'; + import { type UpdateUiFromHash } from '$shared/types'; import type { Modals } from '$types'; import { DashedSection } from '../../components'; @@ -44,7 +41,6 @@ checkForAppUiUpdatesQuery, fetchUiBytesMutation, appVersionsAppstoreQueryFunction, - getAppDetailsQuery } = createAppQueries(); const utils = client.createUtils(); @@ -58,6 +54,16 @@ let selectedIndex = 0; + let prevousSelectedApp: any; + + $: { + if (selectedApp !== prevousSelectedApp) { + // Reset to Details view + selectedIndex = 0; + prevousSelectedApp = selectedApp; + } + } + $: selectedApp = $installedApps.data?.find( (app) => app.appInfo.installed_app_id === $page.params.slug ); diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte index 22862a9d..9cbe5dd8 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte @@ -3,24 +3,29 @@ import { Button } from '$components'; import { i18n } from '$services'; + import DashedSection from '../../../components/DashedSection.svelte'; export let uninstallLogic: () => void; export let update: boolean; export let isHeadless = false; -
+
{#if !isHeadless} -
- -
+ +
+ + +
+ +
{/if}
diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/KeyManagement.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/KeyManagement.svelte index b84c30f6..8d291823 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/KeyManagement.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/KeyManagement.svelte @@ -95,6 +95,7 @@ }); }; +
@@ -152,3 +153,4 @@
+
\ No newline at end of file diff --git a/src/shared/const/index.ts b/src/shared/const/index.ts index 68974cfb..7726b202 100644 --- a/src/shared/const/index.ts +++ b/src/shared/const/index.ts @@ -11,8 +11,9 @@ export const ANIMATION_DURATION = 300; export const WINDOW_SIZE = 600; export const WINDOW_SIZE_LARGE = 780; -export const SETTINGS_SIZE = 850; -export const MIN_HEIGH = 225; +export const SETTINGS_WIDTH = 1000; +export const SETTINGS_HEIGHT = 725; +export const MIN_HEIGHT = 225; export const DISTRIBUTION_TYPE_APPSTORE = 'appstore'; export const DISTRIBUTION_TYPE_FILESYSTEM = 'filesystem'; From 8ebe2c880ab453af09373e1256425a9aba29e4fd Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 19:44:53 +0200 Subject: [PATCH 3/7] add trash can icon to uninstall button --- src/renderer/src/lib/icons/TrashCan.svelte | 10 ++++++++++ .../(menu)/[slug]/components/AppSettings.svelte | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/renderer/src/lib/icons/TrashCan.svelte diff --git a/src/renderer/src/lib/icons/TrashCan.svelte b/src/renderer/src/lib/icons/TrashCan.svelte new file mode 100644 index 00000000..bc4e5f55 --- /dev/null +++ b/src/renderer/src/lib/icons/TrashCan.svelte @@ -0,0 +1,10 @@ + + + diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte index 9cbe5dd8..989980a0 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte @@ -4,6 +4,7 @@ import { Button } from '$components'; import { i18n } from '$services'; import DashedSection from '../../../components/DashedSection.svelte'; + import TrashCan from '$icons/TrashCan.svelte'; export let uninstallLogic: () => void; export let update: boolean; @@ -13,7 +14,7 @@
{#if !isHeadless} -
+
- {/if} From bbefd222d63941eb5ed2c3bbac196b883adc4247 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 20:18:01 +0200 Subject: [PATCH 4/7] improve factory reset UI --- src/renderer/src/lib/locale/en/common.json | 2 + .../src/routes/settings/(menu)/+layout.svelte | 2 +- .../[slug]/components/AppSettings.svelte | 8 +++- .../[slug]/components/SystemSettings.svelte | 40 ++++++++++++------- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/renderer/src/lib/locale/en/common.json b/src/renderer/src/lib/locale/en/common.json index 04d5fa65..576b7f11 100644 --- a/src/renderer/src/lib/locale/en/common.json +++ b/src/renderer/src/lib/locale/en/common.json @@ -44,6 +44,7 @@ "factoryResetClick": "Click here to factory reset your Holochain Launcher", "factoryResetConfirm": "Confirm Factory Reset", "factoryResetError": "Factory Reset Failed", + "factoryResetHolochainLauncher": "Fully reset Holochain Launcher. This will delete all your apps alongside any associated data as well as your private keys.", "factoryResetModalBody": "WARNING: This will delete all your apps alongside any data therein as well as your private keys.", "fetchingAppData": "Fetching app data", "generatingKeyRecoveryFile": "Generating key recovery file...", @@ -121,6 +122,7 @@ "thisAppHasNotBeenVerifiedByTheHolochainFoundation": "This app has not been verified by the Holochain Foundation. Make sure you trust it before installing.", "uninstall": "Uninstall", "uninstallApp": "Uninstall App", + "uninstallAppAndRemoveAllData": "Uninstall this app and remove all associated data.", "uninstallAppModalBody": "Are you sure you want to uninstall the app? This will delete all associated data.", "updateAppDetails": "Update App Details", "updateAvailable": "Update available", diff --git a/src/renderer/src/routes/settings/(menu)/+layout.svelte b/src/renderer/src/routes/settings/(menu)/+layout.svelte index 1bc6977e..9c231667 100644 --- a/src/renderer/src/routes/settings/(menu)/+layout.svelte +++ b/src/renderer/src/routes/settings/(menu)/+layout.svelte @@ -21,7 +21,7 @@
-
+
diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte index 989980a0..1eea43db 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/AppSettings.svelte @@ -14,8 +14,8 @@
{#if !isHeadless} -
- +
+ {$i18n.t('uninstallAppAndRemoveAllData')}
+ {:else} +
+ No Settings available for this app. +
{/if}
diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte index b5f12e0b..0682e8cb 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte @@ -84,7 +84,7 @@ {#if $installDevhub.isPending} {/if} -
+
{#if $isDevhubInstalled.data}

{$i18n.t('devhubInstalled')}

@@ -105,18 +105,30 @@
{/if} - -
- -
-
+ +
+ + DANGER ZONE +
+
+ +
+
{$i18n.t('factoryResetHolochainLauncher')}
+
+ + + +
+
+
+
From 4934df9d74f7d5aab9e6fae33d4ac73d3dcc2e5a Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 20:21:13 +0200 Subject: [PATCH 5/7] fix flex direction --- src/renderer/src/routes/settings/(menu)/+layout.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/routes/settings/(menu)/+layout.svelte b/src/renderer/src/routes/settings/(menu)/+layout.svelte index 9c231667..854a385c 100644 --- a/src/renderer/src/routes/settings/(menu)/+layout.svelte +++ b/src/renderer/src/routes/settings/(menu)/+layout.svelte @@ -21,7 +21,7 @@
-
+
From da0c93258965324f4c84d1601eab9c012fd08fa0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 23:09:59 +0200 Subject: [PATCH 6/7] fix UI updates --- .../src/appstore/appstore-app-client.ts | 5 +++-- src/renderer/src/lib/locale/en/common.json | 2 +- src/renderer/src/lib/queries/happs.ts | 21 ++++++++++++------- .../settings/(menu)/[slug]/+page.svelte | 2 +- .../[slug]/components/SystemSettings.svelte | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/libs/appstore/src/appstore/appstore-app-client.ts b/libs/appstore/src/appstore/appstore-app-client.ts index a85fa12d..8013e064 100644 --- a/libs/appstore/src/appstore/appstore-app-client.ts +++ b/libs/appstore/src/appstore/appstore-app-client.ts @@ -113,6 +113,7 @@ export class AppstoreAppClient { allowlist: AppStoreAllowList, denyList?: AppStoreDenyList, ): Promise | undefined> { + if (!allowlist) throw new Error('allowList undefined.'); // logic // we need to check that there is a new version available and that the happ bundle hash is the same but the ui hash is different const appVersionEntity = await this.appstoreZomeClient.getAppVersion(appVersionId); @@ -125,14 +126,14 @@ export class AppstoreAppClient { appVersionEntity.content.for_app, ); + const appEntryList = allowlist[encodeHashToBase64(appVersionEntity.content.for_app)]; + const isUpdateCandidate = (entity: Entity) => entity.content.published_at > appVersionEntity.content.published_at && entity.content.bundle_hashes.happ_hash === appVersionEntity.content.bundle_hashes.happ_hash && entity.content.bundle_hashes.ui_hash !== appVersionEntity.content.bundle_hashes.ui_hash; - const appEntryList = allowlist[encodeHashToBase64(appVersionEntity.content.for_app)]; const isAllowedVersion = (entity: Entity) => - !appEntryList || appEntryList.appVersions === 'all' || appEntryList.appVersions.includes(encodeHashToBase64(entity.action)); diff --git a/src/renderer/src/lib/locale/en/common.json b/src/renderer/src/lib/locale/en/common.json index 576b7f11..665d03b0 100644 --- a/src/renderer/src/lib/locale/en/common.json +++ b/src/renderer/src/lib/locale/en/common.json @@ -68,7 +68,7 @@ "installingApp": "Installing app", "installingAppStore": "Installing App Store...", "installingDevHub": "Installing Dev Hub...", - "isUpdatedSuccessfully": " is updated successfully", + "updatedSuccessfully": " updated successfully", "kando": "KanDo", "keyManagement": "Key Management", "launch": "Launch", diff --git a/src/renderer/src/lib/queries/happs.ts b/src/renderer/src/lib/queries/happs.ts index d140fbe5..de1068ec 100644 --- a/src/renderer/src/lib/queries/happs.ts +++ b/src/renderer/src/lib/queries/happs.ts @@ -34,6 +34,7 @@ import { NO_PUBLISHERS_AVAILABLE_ERROR } from '$shared/types'; import { type AppData, type AppWithAction, type PublishNewVersionData } from '$types'; +import { HolochainFoundationList } from '$types/happs'; type ClientType = DevhubAppClient | AppstoreAppClient; @@ -300,7 +301,7 @@ export const createPublishNewVersionMutation = (queryClient: QueryClient) => { if (happHash !== previousHappHash) throw new Error( - 'happ sha256 does not match the happ sha256 of previous versions. Since coordinator zome updates are currently not supported, only app versions with the same happ file are allowed to be published under the same app entry' + 'happ sha256 does not match the happ sha256 of previous versions. Since coordinator zome updates are currently not supported, only app versions with the same .happ file are allowed to be published in subsequent releases for the same app.' ); const hashes: BundleHashes = { @@ -358,20 +359,26 @@ export const createCheckForAppUiUpdatesQuery = return createQuery({ queryKey: [CHECK_FOR_APP_UI_UPDATES_QUERY_KEY, appVersionActionHashes], queryFn: async () => { + console.log("Checking for UI updates...") const appStoreClient = getAppStoreClientOrThrow(); const distinctVersionHashes = appVersionActionHashes; const filterLists = await fetchFilterLists(appStoreClient, isDev); const updates = await Promise.all( distinctVersionHashes.map(async (hash) => { - const maybeUpdate = await appStoreClient.checkForUiUpdate( - decodeHashFromBase64(hash!), - filterLists.allowlists[hash!], - filterLists.denylist - ); + let maybeUpdate; + try { + maybeUpdate = await appStoreClient.checkForUiUpdate( + decodeHashFromBase64(hash!), + filterLists.allowlists[HolochainFoundationList.value], + filterLists.denylist + ); + } catch (e) { + console.error("Failed to check for UI update: ", e); + } return maybeUpdate ? { [hash]: maybeUpdate } : null; }) ); - + console.log("Got updates: ", updates); return updates.reduce((acc, update) => (update ? { ...acc, ...update } : acc), {}); } }); diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte index 2882ce4d..de4156f9 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/+page.svelte @@ -94,7 +94,7 @@ modalStore.close(); toastStore.trigger({ - message: `${selectedApp?.appInfo.installed_app_id} ${$i18n.t('isUpdatedSuccessfully')}` + message: `${selectedApp?.appInfo.installed_app_id} ${$i18n.t('updatedSuccessfully')}` }); }; diff --git a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte index 0682e8cb..af43f7a9 100644 --- a/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte +++ b/src/renderer/src/routes/settings/(menu)/[slug]/components/SystemSettings.svelte @@ -110,7 +110,7 @@ DANGER ZONE
-
+
{$i18n.t('factoryResetHolochainLauncher')}
From 331ee71fc1e93a93ba86952517a03e55a1bb4afd Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Sep 2024 23:19:53 +0200 Subject: [PATCH 7/7] add hover effect to Add App button --- src/renderer/src/lib/locale/en/common.json | 2 +- .../src/routes/(main)/apps-view/components/BaseButton.svelte | 2 +- .../src/routes/(main)/apps-view/components/ListOfApps.svelte | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/lib/locale/en/common.json b/src/renderer/src/lib/locale/en/common.json index 665d03b0..8a0eff20 100644 --- a/src/renderer/src/lib/locale/en/common.json +++ b/src/renderer/src/lib/locale/en/common.json @@ -1,6 +1,6 @@ { "add": "Add", - "addApps": "Add Apps", + "addApp": "Add App", "addNewRelease": "Add new release", "addPublisher": "Add Publisher", "addhApp": "Add a hApp", diff --git a/src/renderer/src/routes/(main)/apps-view/components/BaseButton.svelte b/src/renderer/src/routes/(main)/apps-view/components/BaseButton.svelte index c2e06700..88723c29 100644 --- a/src/renderer/src/routes/(main)/apps-view/components/BaseButton.svelte +++ b/src/renderer/src/routes/(main)/apps-view/components/BaseButton.svelte @@ -3,7 +3,7 @@ export let onClick = () => {}; export let initials: string = ''; export let src: string | undefined = undefined; - export let border: string = 'border-4 border-white border-opacity-20'; + export let border: string = 'border-4 border-white border-opacity-20 hover:border-opacity-30'; export let fontSize: number | undefined = undefined; export let fill: string = 'fill-white'; export let background: string = 'bg-transparent'; diff --git a/src/renderer/src/routes/(main)/apps-view/components/ListOfApps.svelte b/src/renderer/src/routes/(main)/apps-view/components/ListOfApps.svelte index f7af16ed..1ad33d9e 100644 --- a/src/renderer/src/routes/(main)/apps-view/components/ListOfApps.svelte +++ b/src/renderer/src/routes/(main)/apps-view/components/ListOfApps.svelte @@ -49,7 +49,7 @@ initials="+" onClick={handleNavigationWithAnimationDelay()(APP_STORE)} > - {$i18n.t('addApps')} + {$i18n.t('addApp')}