From 263defc7ba427382e26aa11e4d15dc27d445eb47 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 1 Apr 2024 03:48:10 +0530 Subject: [PATCH] Fix tag actions --- src/app/_services/actions.service.ts | 60 ++----------------- src/app/app.component.ts | 6 +- .../info/info-tools/action-form.component.ts | 15 ++--- src/app/openapi/index.ts | 2 +- ...ute_tag_action_api_execTagActions_post.ts} | 2 +- src/app/openapi/services/ApiService.ts | 8 +-- 6 files changed, 19 insertions(+), 74 deletions(-) rename src/app/openapi/models/{Body_execute_tag_action_api_execTagAction__action__post.ts => Body_execute_tag_action_api_execTagActions_post.ts} (85%) diff --git a/src/app/_services/actions.service.ts b/src/app/_services/actions.service.ts index 2002409..0d72d28 100644 --- a/src/app/_services/actions.service.ts +++ b/src/app/_services/actions.service.ts @@ -5,9 +5,8 @@ import { map } from 'rxjs/operators' // import { Apollo, gql } from 'apollo-angular' -import { Tag } from '../info/info-tags/tags.service' -import { TaggedLayer, TaggedFeature, FormFieldInput } from '../info/info-data.service' -import { ApiService, ActionsStore, ActionResults } from '../openapi' +import { ApiService, ActionsStore, ActionsResults, + FormFieldInput, TaggedLayer } from '../openapi' export class ActionParam { constructor( @@ -25,13 +24,6 @@ export class Action { ) {} } -// export class ActionsStore { -// constructor( -// public store: string, -// public actions: Action[], -// ) {} -// } - export class ActionResult { constructor( public name: string, @@ -48,13 +40,6 @@ export class ActionResult { // ) {} // } -export class ActionsResults { - constructor( - public message: string, - public actionResults: ActionResults[], - ) {} -} - export class ActionAction { constructor( public plugin: string, @@ -183,50 +168,13 @@ export class ActionsService { actionNames: string[], params: ActionParam[], formFields?: FormFieldInput[] - ): Observable { - return this.apiService.executeTagActionApiExecTagActionActionPost({ + ): Observable { + return this.apiService.executeTagActionApiExecTagActionsPost({ "stores": stores, "ids": ids, "actionNames": actionNames, "params": params, "formFields": formFields }) - // }).pipe(map( - // result => result['data']['executeAction']['result'].map( - // res => new ActionsResults( - // res['message'], - // res['actionResults'].map( - // r => new ActionResults( - // r['name'], - // r['message'], - // r['actionResults'] && r['actionResults'].map( - // actionResults => new ActionResult( - // actionResults['name'], - // actionResults['message'], - // (actionResults['taggedLayers'] || []).map( - // taggedLayer => new TaggedLayer( - // taggedLayer['store'], - // taggedLayer['taggedFeatures'].map( - // taggedFeature => new TaggedFeature( - // taggedFeature['id'], - // taggedFeature['lon'], - // taggedFeature['lat'], - // taggedFeature['tags'].map( - // tag => new Tag( - // tag['key'], - // tag['value'] - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // ) - // )) } } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0f58c35..1be626d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -80,8 +80,8 @@ export class AppComponent implements OnInit { width: '21em' }) - dialogRef.afterClosed().subscribe(result => { - console.log('The dialog was closed') - }) + // dialogRef.afterClosed().subscribe( + // result => {} + // ) } } diff --git a/src/app/info/info-tools/action-form.component.ts b/src/app/info/info-tools/action-form.component.ts index 150be60..8e07d2f 100644 --- a/src/app/info/info-tools/action-form.component.ts +++ b/src/app/info/info-tools/action-form.component.ts @@ -84,16 +84,13 @@ export class ActionFormComponent implements OnInit { ).subscribe( results => { // Update the tags in the info source - let result = results[0].actionResults[0] - let messages = [] - if (result.message) { - messages.push(result.message) - } - if (result.actionResults) { - result.actionResults.forEach( - (element: ActionResult) => messages.push(element.message) - ) + let messages: string[] = [] + if (results.message) { + messages.push(results.message) } + results.actionResults[0].actionResults?.forEach( + element => messages.push(element.message) + ) this.snackBar.open(messages.join(', '), 'Close', {duration: 3000}) } ) diff --git a/src/app/openapi/index.ts b/src/app/openapi/index.ts index 6a8926b..f157e92 100644 --- a/src/app/openapi/index.ts +++ b/src/app/openapi/index.ts @@ -19,7 +19,7 @@ export type { BaseMapWithStores } from './models/BaseMapWithStores'; export type { BaseStyle } from './models/BaseStyle'; export type { BasketDefault } from './models/BasketDefault'; export type { BasketNameOnly } from './models/BasketNameOnly'; -export type { Body_execute_tag_action_api_execTagAction__action__post } from './models/Body_execute_tag_action_api_execTagAction__action__post'; +export type { Body_execute_tag_action_api_execTagActions_post } from './models/Body_execute_tag_action_api_execTagActions_post'; export type { Body_login_for_access_token_api_token_post } from './models/Body_login_for_access_token_api_token_post'; export type { BootstrapData } from './models/BootstrapData'; export type { CategoryGroup } from './models/CategoryGroup'; diff --git a/src/app/openapi/models/Body_execute_tag_action_api_execTagAction__action__post.ts b/src/app/openapi/models/Body_execute_tag_action_api_execTagActions_post.ts similarity index 85% rename from src/app/openapi/models/Body_execute_tag_action_api_execTagAction__action__post.ts rename to src/app/openapi/models/Body_execute_tag_action_api_execTagActions_post.ts index 326fb4d..0e09627 100644 --- a/src/app/openapi/models/Body_execute_tag_action_api_execTagAction__action__post.ts +++ b/src/app/openapi/models/Body_execute_tag_action_api_execTagActions_post.ts @@ -4,7 +4,7 @@ /* eslint-disable */ import type { ActionParam } from './ActionParam'; import type { FormFieldInput } from './FormFieldInput'; -export type Body_execute_tag_action_api_execTagAction__action__post = { +export type Body_execute_tag_action_api_execTagActions_post = { stores: Array; ids: Array>; actionNames: Array; diff --git a/src/app/openapi/services/ApiService.ts b/src/app/openapi/services/ApiService.ts index fc311dd..4a71b06 100644 --- a/src/app/openapi/services/ApiService.ts +++ b/src/app/openapi/services/ApiService.ts @@ -7,7 +7,7 @@ import { HttpClient } from '@angular/common/http'; import type { Observable } from 'rxjs'; import type { ActionsResults } from '../models/ActionsResults'; import type { ActionsStore } from '../models/ActionsStore'; -import type { Body_execute_tag_action_api_execTagAction__action__post } from '../models/Body_execute_tag_action_api_execTagAction__action__post'; +import type { Body_execute_tag_action_api_execTagActions_post } from '../models/Body_execute_tag_action_api_execTagActions_post'; import type { Body_login_for_access_token_api_token_post } from '../models/Body_login_for_access_token_api_token_post'; import type { BootstrapData } from '../models/BootstrapData'; import type { CategoryRead } from '../models/CategoryRead'; @@ -358,12 +358,12 @@ export class ApiService { * @returns ActionsResults Successful Response * @throws ApiError */ - public executeTagActionApiExecTagActionActionPost( - requestBody: Body_execute_tag_action_api_execTagAction__action__post, + public executeTagActionApiExecTagActionsPost( + requestBody: Body_execute_tag_action_api_execTagActions_post, ): Observable { return __request(OpenAPI, this.http, { method: 'POST', - url: '/api/execTagAction/{action}', + url: '/api/execTagActions', body: requestBody, mediaType: 'application/json', errors: {