diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/plugin.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/plugin.component.ts index 6107ace47..bd60a9a59 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/plugin.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/plugin.component.ts @@ -305,21 +305,21 @@ export class PluginAddressesComponent { if (!group.tableAction || !group.pluginPkgInfo) return const iface = this.value() - const prefill: Record = {} + if (!iface) return - if (iface) { - prefill['urlPluginMetadata'] = { - packageId: this.packageId() || null, - hostId: iface.addressInfo.hostId, - interfaceId: iface.id, - internalPort: iface.addressInfo.internalPort, - } - } + const { addressInfo } = iface this.actionService.present({ pkgInfo: group.pluginPkgInfo, actionInfo: group.tableAction, - prefill, + prefill: { + urlPluginMetadata: { + packageId: this.packageId() || null, + hostId: addressInfo.hostId, + interfaceId: iface.id, + internalPort: addressInfo.internalPort, + }, + }, }) } @@ -332,26 +332,30 @@ export class PluginAddressesComponent { if (!group.pluginPkgInfo) return const iface = this.value() - const prefill: Record = {} + if (!iface) return - if (iface && address.hostnameInfo.metadata.kind === 'plugin') { - prefill['urlPluginMetadata'] = { - packageId: this.packageId() || null, - hostId: iface.addressInfo.hostId, - interfaceId: iface.id, - internalPort: iface.addressInfo.internalPort, - hostname: address.hostnameInfo.hostname, - port: address.hostnameInfo.port, - ssl: address.hostnameInfo.ssl, - public: address.hostnameInfo.public, - info: address.hostnameInfo.metadata.info, - } - } + const { hostnameInfo } = address + const { addressInfo } = iface + const hostMeta = hostnameInfo.metadata + + if (hostMeta.kind !== 'plugin') return this.actionService.present({ pkgInfo: group.pluginPkgInfo, actionInfo: { id: actionId, metadata }, - prefill, + prefill: { + urlPluginMetadata: { + packageId: this.packageId() || null, + hostId: addressInfo.hostId, + interfaceId: iface.id, + internalPort: addressInfo.internalPort, + hostname: hostnameInfo.hostname, + port: hostnameInfo.port, + ssl: hostnameInfo.ssl, + public: hostnameInfo.public, + info: hostMeta.info, + }, + }, }) } } diff --git a/web/projects/ui/src/app/routes/portal/routes/services/components/task.component.ts b/web/projects/ui/src/app/routes/portal/routes/services/components/task.component.ts index 1d445c856..757b52e64 100644 --- a/web/projects/ui/src/app/routes/portal/routes/services/components/task.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/services/components/task.component.ts @@ -154,20 +154,21 @@ export class ServiceTaskComponent { } async handle() { + const task = this.task() const title = this.title() const pkg = this.pkg() - const metadata = pkg?.actions[this.task().actionId] + const metadata = pkg?.actions[task.actionId] if (title && pkg && metadata) { this.actionService.present({ pkgInfo: { - id: this.task().packageId, + id: task.packageId, title, status: getInstalledBaseStatus(pkg.statusInfo), icon: pkg.icon, }, - actionInfo: { id: this.task().actionId, metadata }, - requestInfo: this.task(), + actionInfo: { id: task.actionId, metadata }, + prefill: task.input?.value, }) } } diff --git a/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts b/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts index 00df3ee56..45bffd4a2 100644 --- a/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts @@ -23,7 +23,6 @@ import { FormComponent, } from 'src/app/routes/portal/components/form.component' import { InvalidService } from 'src/app/routes/portal/components/form/containers/control.directive' -import { TaskInfoComponent } from 'src/app/routes/portal/modals/config-dep.component' import { ActionService } from 'src/app/services/action.service' import { ApiService } from 'src/app/services/api/embassy-api.service' import { DataModel } from 'src/app/services/patch-db/data-model' @@ -41,7 +40,6 @@ export type PackageActionData = { id: string metadata: T.ActionMetadata } - requestInfo?: T.Task prefill?: Record } @@ -63,13 +61,6 @@ export type PackageActionData = { } - @if (requestInfo) { - - } - [] = [ @@ -148,7 +132,7 @@ export class ActionInputModal { this.api.getActionInput({ packageId: this.pkgInfo.id, actionId: this.actionId, - prefill: this.context.data.prefill ?? null, + prefill: this.prefill ?? null, }), ).pipe( map(res => { @@ -156,12 +140,12 @@ export class ActionInputModal { const originalValue = res.value || {} this.eventId = res.eventId - const operations = this.requestInfo?.input + const operations = this.prefill ? compare( JSON.parse(JSON.stringify(originalValue)), utils.deepMerge( JSON.parse(JSON.stringify(originalValue)), - this.requestInfo.input.value, + this.prefill, ) as object, ) : null @@ -170,11 +154,6 @@ export class ActionInputModal { spec: res.spec, originalValue, operations, - visibleOperations: - operations?.filter(op => { - const key = op.path.split('/')[1] - return (res.spec[key!] as any)?.type !== 'hidden' - }) ?? null, } }), catchError(e => { diff --git a/web/projects/ui/src/app/services/action.service.ts b/web/projects/ui/src/app/services/action.service.ts index df9b965e0..a94a755a6 100644 --- a/web/projects/ui/src/app/services/action.service.ts +++ b/web/projects/ui/src/app/services/action.service.ts @@ -27,7 +27,6 @@ export class ActionService { private readonly formDialog = inject(FormDialogService) async present(data: PackageActionData) { - data.prefill = data.prefill ?? data.requestInfo?.input?.value const { pkgInfo, actionInfo } = data if (actionInfo.metadata.hasInput) {