diff --git a/container-runtime/package-lock.json b/container-runtime/package-lock.json index 2ff4bb8c6..097c3ccb7 100644 --- a/container-runtime/package-lock.json +++ b/container-runtime/package-lock.json @@ -64,7 +64,7 @@ }, "../sdk/dist": { "name": "@start9labs/start-sdk", - "version": "0.3.6-alpha8", + "version": "0.3.6-beta.4", "license": "MIT", "dependencies": { "@iarna/toml": "^2.2.5", @@ -72,8 +72,8 @@ "@noble/hashes": "^1.4.0", "isomorphic-fetch": "^3.0.0", "lodash.merge": "^4.6.2", - "mime": "^4.0.3", - "ts-matches": "^5.5.1", + "mime-types": "^2.1.35", + "ts-matches": "^6.2.1", "yaml": "^2.2.2" }, "devDependencies": { @@ -6799,11 +6799,11 @@ "isomorphic-fetch": "^3.0.0", "jest": "^29.4.3", "lodash.merge": "^4.6.2", - "mime": "^4.0.3", + "mime-types": "^2.1.35", "peggy": "^3.0.2", "prettier": "^3.2.5", "ts-jest": "^29.0.5", - "ts-matches": "^5.5.1", + "ts-matches": "^6.2.1", "ts-node": "^10.9.1", "ts-pegjs": "^4.2.1", "tsx": "^4.7.1", diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts index bc2da8871..add6a1f69 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts @@ -51,6 +51,7 @@ function todo(): never { const MANIFEST_LOCATION = "/usr/lib/startos/package/embassyManifest.json" export const EMBASSY_JS_LOCATION = "/usr/lib/startos/package/embassy.js" const EMBASSY_POINTER_PATH_PREFIX = "/embassyConfig" as utils.StorePath +const EMBASSY_DEPENDS_ON_PATH_PREFIX = "/embassyDependsOn" as utils.StorePath const matchResult = object({ result: any, @@ -695,7 +696,12 @@ export class SystemForEmbassy implements System { effects: Effects, rawDepends: { [x: string]: readonly string[] }, ) { - const dependsOn: Record = { + const storedDependsOn = (await effects.store.get({ + packageId: this.manifest.id, + path: EMBASSY_DEPENDS_ON_PATH_PREFIX, + })) as Record + + const dependsOn: Record = storedDependsOn ? storedDependsOn : { ...Object.fromEntries( Object.entries(this.manifest.dependencies || {})?.map((x) => [ x[0], @@ -704,6 +710,12 @@ export class SystemForEmbassy implements System { ), ...rawDepends, } + + await effects.store.set({ + path: EMBASSY_DEPENDS_ON_PATH_PREFIX, + value: dependsOn, + }) + await effects.setDependencies({ dependencies: Object.entries(dependsOn).flatMap( ([key, value]): T.Dependencies => { @@ -721,13 +733,7 @@ export class SystemForEmbassy implements System { }, ] } - return [ - { - kind: "exists", - id: key, - versionRange, - }, - ] + return [] } const versionRange = dependency.version const kind = "running" diff --git a/container-runtime/src/index.ts b/container-runtime/src/index.ts index ec6a998f4..38c0aec1e 100644 --- a/container-runtime/src/index.ts +++ b/container-runtime/src/index.ts @@ -11,7 +11,7 @@ new RpcListener(getDependencies) /** -So, this is going to be sent into a running comtainer along with any of the other node modules that are going to be needed and used. +So, this is going to be sent into a running container along with any of the other node modules that are going to be needed and used. Once the container is started, we will go into a loading/ await state. This is the init system, and it will always be running, and it will be waiting for a command to be sent to it. @@ -38,5 +38,5 @@ There are /** TODO: -Should I seperate those adapter in/out? +Should I separate those adapter in/out? */ diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html index 286f3ef5b..ef99965b5 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html @@ -35,6 +35,9 @@ diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index b48b49dd9..42b9d3c8a 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -143,7 +143,7 @@ export class AppShowPage { fixText = 'Update' fixAction = () => this.installDep(pkg, manifest, depId) } else if (depError.type === 'actionRequired') { - errorText = 'Action Required (see above)' + errorText = 'Action Required (see below)' } else if (depError.type === 'notRunning') { errorText = 'Not running' fixText = 'Start' diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.html b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.html index 2aee18f05..2ee3d6698 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.html @@ -1,45 +1,42 @@ - - Required Actions - + - - -

{{ request.actionName }}

-

- Service: - - {{ request.dependency.title }} -

-

- Reason: - {{ request.reason || 'no reason provided' }} -

-
-
-
- - - Requested Actions - - - -

{{ request.actionName }}

-

- Service: - - {{ request.dependency.title }} -

-

- Reason: - {{ request.reason || 'no reason provided' }} -

-
-
+ Action Requests + +
+ + + +

{{ request.actionName }}

+

+ {{ request.reason || 'no reason provided' }} | + + {{ request.severity === 'critical' ? 'Required' : 'Requested' }} + +

+
+
+
diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.scss b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.scss index c83e6f6a7..0120a3060 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.scss +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.scss @@ -1,5 +1,5 @@ -.light { - color: var(--ion-color-dark); +ion-icon { + margin-right: 32px; } .highlighted { @@ -7,10 +7,33 @@ font-weight: bold; } -.dependency { - display: inline-flex; - img { - max-width: 16px; - margin: 0 2px 0 5px; +.severity { + font-variant-caps: all-small-caps; + font-weight: bold; + letter-spacing: 0.2px; + font-size: 16px; +} + +.line { + + &:after { + content: ''; + display: block; + border-left: 1px solid var(--border-color); + border-bottom: 1px solid var(--border-color); + height: 100%; + width: 24px; + position: absolute; + left: -20px; + top: -33px; } +} + +.indent { + margin-left: 41px +} + +:host ::ng-deep ion-item { + display: table-row; + width: fit-content; } \ No newline at end of file diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.ts index 0fefe17be..37c66aecf 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-action-requests/app-show-action-requests.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { T } from '@start9labs/start-sdk' import { ActionService } from 'src/app/services/action.service' +import { DependencyInfo } from 'src/app/pages/apps-routes/app-show/app-show.page' import { getDepDetails } from 'src/app/util/dep-info' @Component({ @@ -19,22 +20,21 @@ export class AppShowActionRequestsComponent { @Input() manifest!: T.Manifest - get actionRequests() { - const critical: (T.ActionRequest & { - actionName: string - dependency: { - title: string - icon: string - } | null - })[] = [] - const important: (T.ActionRequest & { - actionName: string - dependency: { - title: string - icon: string - } | null - })[] = [] + @Input() + dep?: DependencyInfo + + pkgId!: string + + ngOnInit() { + this.pkgId = this.dep ? this.dep?.id : this.manifest.id + } + get actionRequests() { + const reqs: { + [key: string]: (T.ActionRequest & { + actionName: string + })[] + } = {} Object.values(this.pkg.requestedActions) .filter(r => r.active) .forEach(r => { @@ -49,20 +49,17 @@ export class AppShowActionRequestsComponent { ? null : getDepDetails(this.pkg, this.allPkgs, r.request.packageId), } - - if (r.request.severity === 'critical') { - critical.push(toReturn) - } else { - important.push(toReturn) + if (!reqs[r.request.packageId]) { + reqs[r.request.packageId] = [] } + reqs[r.request.packageId].push(toReturn) }) - - return { critical, important } + return reqs } - constructor(private readonly actionService: ActionService) {} - async handleAction(request: T.ActionRequest) { + async handleAction(request: T.ActionRequest, e: Event) { + e.stopPropagation() const self = request.packageId === this.manifest.id this.actionService.present({ pkgInfo: { diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.html b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.html index 059dc208b..3b96a5ac8 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.html @@ -5,27 +5,37 @@ *ngFor="let dep of dependencies" (click)="dep.action()" > - - - - -

- - {{ dep.title }} -

-

{{ dep.version }}

-

- - {{ dep.errorText || 'satisfied' }} - -

-
+
+
+ + + + +

+ + {{ dep.title }} +

+

{{ dep.version }}

+

+ + {{ dep.errorText || 'satisfied' }} + +

+
+
+ +
{{ dep.actionText }} diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.scss b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.scss index dd0cbe2b8..80b1dad30 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.scss +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.scss @@ -1,3 +1,26 @@ .icon { padding-right: 4px; } + +img { + position: relative; + z-index: 10; +} + +.container { + display: flex; + flex-direction: column; + margin: 8px; +} + +.dep-details { + display: flex; + align-items: center; + flex-direction: row; + gap: 1.2rem; +} + +ion-label h2 { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.ts index 3a2fee53b..097aa06c2 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-dependencies/app-show-dependencies.component.ts @@ -1,5 +1,10 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { DependencyInfo } from '../../app-show.page' +import { T } from '@start9labs/start-sdk' +import { + PackageDataEntry, + StateInfo, +} from 'src/app/services/patch-db/data-model' @Component({ selector: 'app-show-dependencies', @@ -10,4 +15,15 @@ import { DependencyInfo } from '../../app-show.page' export class AppShowDependenciesComponent { @Input() dependencies: DependencyInfo[] = [] + + @Input() + allPkgs!: NonNullable< + T.AllPackageData & Record> + > + + @Input() + pkg!: T.PackageDataEntry & { stateInfo: StateInfo } + + @Input() + manifest!: T.Manifest } diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index 8ca8864e2..6e3136577 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1699,6 +1699,15 @@ export module Mock { hasInput: true, group: null, }, + rpc: { + name: 'Set RPC', + description: 'Create RPC Credentials', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, properties: { name: 'View Properties', description: 'view important information about Bitcoin', @@ -1997,7 +2006,26 @@ export module Mock { status: { main: 'stopped', }, - actions: {}, + actions: { + config: { + name: 'Config', + description: 'LND needs configuration before starting', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, + connect: { + name: 'Connect', + description: 'View LND connection details', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, + }, serviceInterfaces: { grpc: { id: 'grpc', @@ -2068,6 +2096,24 @@ export module Mock { registry: 'https://registry.start9.com/', developerKey: 'developer-key', requestedActions: { + config: { + active: true, + request: { + packageId: 'lnd', + actionId: 'config', + severity: 'critical', + reason: 'LND needs configuration before starting', + }, + }, + connect: { + active: true, + request: { + packageId: 'lnd', + actionId: 'connect', + severity: 'important', + reason: 'View LND connection details', + }, + }, 'bitcoind/config': { active: true, request: { @@ -2079,10 +2125,24 @@ export module Mock { kind: 'partial', value: { color: '#ffffff', + testnet: false, + }, + }, + }, + }, + 'bitcoind/rpc': { + active: true, + request: { + packageId: 'bitcoind', + actionId: 'rpc', + severity: 'important', + reason: `LND want's its own RPC credentials`, + input: { + kind: 'partial', + value: { rpcsettings: { rpcuser: 'lnd', }, - testnet: false, }, }, }, diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index c843f8f5f..9a80967a1 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -232,6 +232,15 @@ export const mockPatchData: DataModel = { hasInput: true, group: null, }, + rpc: { + name: 'Set RPC', + description: 'Create RPC Credentials', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, properties: { name: 'View Properties', description: 'view important information about Bitcoin', @@ -487,7 +496,26 @@ export const mockPatchData: DataModel = { status: { main: 'stopped', }, - actions: {}, + actions: { + config: { + name: 'Config', + description: 'LND needs configuration before starting', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, + connect: { + name: 'Connect', + description: 'View LND connection details', + warning: null, + visibility: 'enabled', + allowedStatuses: 'any', + hasInput: true, + group: null, + }, + }, serviceInterfaces: { grpc: { id: 'grpc', @@ -559,6 +587,24 @@ export const mockPatchData: DataModel = { registry: 'https://registry.start9.com/', developerKey: 'developer-key', requestedActions: { + config: { + active: true, + request: { + packageId: 'lnd', + actionId: 'config', + severity: 'critical', + reason: 'LND needs configuration before starting', + }, + }, + connect: { + active: true, + request: { + packageId: 'lnd', + actionId: 'connect', + severity: 'important', + reason: 'View LND connection details', + }, + }, 'bitcoind/config': { active: true, request: { @@ -570,10 +616,24 @@ export const mockPatchData: DataModel = { kind: 'partial', value: { color: '#ffffff', + testnet: false, + }, + }, + }, + }, + 'bitcoind/rpc': { + active: true, + request: { + packageId: 'bitcoind', + actionId: 'rpc', + severity: 'important', + reason: `LND want's its own RPC credentials`, + input: { + kind: 'partial', + value: { rpcsettings: { rpcuser: 'lnd', }, - testnet: false, }, }, }, diff --git a/web/projects/ui/src/manifest.webmanifest b/web/projects/ui/src/manifest.webmanifest index 984106d74..9dca24b6a 100644 --- a/web/projects/ui/src/manifest.webmanifest +++ b/web/projects/ui/src/manifest.webmanifest @@ -20,5 +20,5 @@ "type": "image/png", "purpose": "any" } - ], + ] }