Fix tag actions
This commit is contained in:
parent
643fa5b715
commit
263defc7ba
6 changed files with 19 additions and 74 deletions
|
@ -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<ActionResults> {
|
||||
return this.apiService.executeTagActionApiExecTagActionActionPost({
|
||||
): Observable<ActionsResults> {
|
||||
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']
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// ))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 => {}
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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})
|
||||
}
|
||||
)
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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<string>;
|
||||
ids: Array<Array<string>>;
|
||||
actionNames: Array<string>;
|
|
@ -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<ActionsResults> {
|
||||
return __request(OpenAPI, this.http, {
|
||||
method: 'POST',
|
||||
url: '/api/execTagAction/{action}',
|
||||
url: '/api/execTagActions',
|
||||
body: requestBody,
|
||||
mediaType: 'application/json',
|
||||
errors: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue