mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
backend changes
This commit is contained in:
@@ -133,6 +133,7 @@ export class ActionInputModal {
|
||||
readonly warning = this.context.data.actionInfo.metadata.warning
|
||||
readonly pkgInfo = this.context.data.pkgInfo
|
||||
readonly requestInfo = this.context.data.requestInfo
|
||||
eventId: string | null = null
|
||||
|
||||
buttons: ActionButton<any>[] = [
|
||||
{
|
||||
@@ -151,6 +152,7 @@ export class ActionInputModal {
|
||||
).pipe(
|
||||
map(res => {
|
||||
const originalValue = res.value || {}
|
||||
this.eventId = res.eventId
|
||||
|
||||
return {
|
||||
spec: res.spec,
|
||||
@@ -174,7 +176,12 @@ export class ActionInputModal {
|
||||
|
||||
async execute(input: object) {
|
||||
if (await this.checkConflicts(input)) {
|
||||
await this.actionService.execute(this.pkgInfo.id, this.actionId, input)
|
||||
await this.actionService.execute(
|
||||
this.pkgInfo.id,
|
||||
this.eventId,
|
||||
this.actionId,
|
||||
input,
|
||||
)
|
||||
this.context.$implicit.complete()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ export class ActionService {
|
||||
},
|
||||
})
|
||||
.pipe(filter(Boolean))
|
||||
.subscribe(() => this.execute(pkgInfo.id, actionInfo.id))
|
||||
.subscribe(() => this.execute(pkgInfo.id, null, actionInfo.id))
|
||||
} else {
|
||||
this.execute(pkgInfo.id, actionInfo.id)
|
||||
this.execute(pkgInfo.id, null, actionInfo.id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -96,14 +96,20 @@ export class ActionService {
|
||||
}
|
||||
}
|
||||
|
||||
async execute(packageId: string, actionId: string, input?: object) {
|
||||
async execute(
|
||||
packageId: string,
|
||||
eventId: string | null,
|
||||
actionId: string,
|
||||
input?: object,
|
||||
) {
|
||||
const loader = this.loader.open('Loading').subscribe()
|
||||
|
||||
try {
|
||||
const res = await this.api.runAction({
|
||||
packageId,
|
||||
eventId,
|
||||
actionId,
|
||||
input: input || null,
|
||||
input: input ?? null,
|
||||
})
|
||||
|
||||
if (!res) return
|
||||
|
||||
@@ -347,12 +347,14 @@ export namespace RR {
|
||||
|
||||
export type GetActionInputReq = { packageId: string; actionId: string } // package.action.get-input
|
||||
export type GetActionInputRes = {
|
||||
eventId: string
|
||||
spec: IST.InputSpec
|
||||
value: object | null
|
||||
}
|
||||
|
||||
export type ActionReq = {
|
||||
packageId: string
|
||||
eventId: string | null
|
||||
actionId: string
|
||||
input: object | null
|
||||
} // package.action.run
|
||||
|
||||
@@ -1108,6 +1108,7 @@ export class MockApiService extends ApiService {
|
||||
): Promise<RR.GetActionInputRes> {
|
||||
await pauseFor(2000)
|
||||
return {
|
||||
eventId: 'ANZXNWIFRTTBZ6T52KQPZILIQQODDHXQ',
|
||||
value: Mock.MockConfig,
|
||||
spec: await Mock.getActionInputSpec(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user