Update tag actions (WIP)
This commit is contained in:
parent
61f0175957
commit
a0dee656d4
17 changed files with 195 additions and 30 deletions
|
@ -7,6 +7,7 @@ import { map } from 'rxjs/operators'
|
||||||
|
|
||||||
import { Tag } from '../info/info-tags/tags.service'
|
import { Tag } from '../info/info-tags/tags.service'
|
||||||
import { TaggedLayer, TaggedFeature, FormFieldInput } from '../info/info-data.service'
|
import { TaggedLayer, TaggedFeature, FormFieldInput } from '../info/info-data.service'
|
||||||
|
import { ApiService, ActionsStore, ActionResults } from '../openapi'
|
||||||
|
|
||||||
export class ActionParam {
|
export class ActionParam {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -24,12 +25,12 @@ export class Action {
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActionsStore {
|
// export class ActionsStore {
|
||||||
constructor(
|
// constructor(
|
||||||
public store: string,
|
// public store: string,
|
||||||
public actions: Action[],
|
// public actions: Action[],
|
||||||
) {}
|
// ) {}
|
||||||
}
|
// }
|
||||||
|
|
||||||
export class ActionResult {
|
export class ActionResult {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -39,13 +40,13 @@ export class ActionResult {
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActionResults {
|
// export class ActionResults {
|
||||||
constructor(
|
// constructor(
|
||||||
public name: string,
|
// public name: string,
|
||||||
public message: string,
|
// public message: string,
|
||||||
public actionResults: ActionResult[],
|
// public actionResults: ActionResult[],
|
||||||
) {}
|
// ) {}
|
||||||
}
|
// }
|
||||||
|
|
||||||
export class ActionsResults {
|
export class ActionsResults {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -137,7 +138,7 @@ export class ActionsService {
|
||||||
public actionsProviderService$ = this.actionsProviderService.asObservable()
|
public actionsProviderService$ = this.actionsProviderService.asObservable()
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
// private apollo: Apollo,
|
private apiService: ApiService,
|
||||||
) {
|
) {
|
||||||
this.getTagsActionsStores().subscribe(
|
this.getTagsActionsStores().subscribe(
|
||||||
actionsStores => {
|
actionsStores => {
|
||||||
|
@ -147,8 +148,7 @@ export class ActionsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTagsActionsStores(): Observable<ActionsStore[]> {
|
public getTagsActionsStores(): Observable<ActionsStore[]> {
|
||||||
console.warn('Migrate Graphql')
|
return this.apiService.getActionsApiActionsGet()
|
||||||
return observableOf()
|
|
||||||
// return this.apollo.query({
|
// return this.apollo.query({
|
||||||
// query: getTagsActionsQuery,
|
// query: getTagsActionsQuery,
|
||||||
// }).pipe(map(
|
// }).pipe(map(
|
||||||
|
@ -183,18 +183,14 @@ export class ActionsService {
|
||||||
actionNames: string[],
|
actionNames: string[],
|
||||||
params: ActionParam[],
|
params: ActionParam[],
|
||||||
formFields?: FormFieldInput[]
|
formFields?: FormFieldInput[]
|
||||||
): Observable<ActionsResults> {
|
): Observable<ActionResults> {
|
||||||
console.warn('Migrate Graphql')
|
return this.apiService.executeTagActionApiExecTagActionActionPost({
|
||||||
return observableOf()
|
"stores": stores,
|
||||||
// return this.apollo.mutate({
|
"ids": ids,
|
||||||
// mutation: executeTagsActionsQuery,
|
"actionNames": actionNames,
|
||||||
// variables: {
|
"params": params,
|
||||||
// stores: stores,
|
"formFields": formFields
|
||||||
// ids: ids,
|
})
|
||||||
// names: actionNames,
|
|
||||||
// params: params,
|
|
||||||
// formFields: formFields
|
|
||||||
// }
|
|
||||||
// }).pipe(map(
|
// }).pipe(map(
|
||||||
// result => result['data']['executeAction']['result'].map(
|
// result => result['data']['executeAction']['result'].map(
|
||||||
// res => new ActionsResults(
|
// res => new ActionsResults(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<mat-tab-group fxFlexFill>
|
<mat-tab-group fxFlexFill>
|
||||||
<mat-tab *ngFor='let action of source.modelInfo.actions'>
|
<mat-tab *ngFor='let action of source.modelInfo.actions'
|
||||||
|
[disabled]="authenticationService.isNotAuthorized(action.roles) | async">
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
<mat-icon [matTooltip]="action.name">{{ action.icon }}</mat-icon>
|
<mat-icon [matTooltip]="action.name">{{ action.icon }}</mat-icon>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
Download Shapefiles of selected layers (EPSG {{ (configService.conf | async).bsData?.geo.srid }}) [<i><b>Deprecated</b>: use Geopackage</i>]
|
Download Shapefiles of selected layers (EPSG {{ (configService.conf | async).bsData?.geo.srid }}) [<i><b>Deprecated</b>: use Geopackage</i>]
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
<button mat-raised-button [disabled]="authenticationService.isNotAuthorized(['base_map_creator']) | async"
|
<button mat-raised-button [hidden]="authenticationService.isNotAuthorized(['base_map_creator']) | async"
|
||||||
matTooltip="Create a base map with the selected layers"
|
matTooltip="Create a base map with the selected layers"
|
||||||
(click)="createBaseMap()">
|
(click)="createBaseMap()">
|
||||||
Create a base map...
|
Create a base map...
|
||||||
|
|
|
@ -7,12 +7,19 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
||||||
export { OpenAPI } from './core/OpenAPI';
|
export { OpenAPI } from './core/OpenAPI';
|
||||||
export type { OpenAPIConfig } from './core/OpenAPI';
|
export type { OpenAPIConfig } from './core/OpenAPI';
|
||||||
|
|
||||||
|
export type { Action } from './models/Action';
|
||||||
|
export type { ActionParam } from './models/ActionParam';
|
||||||
|
export type { ActionResult } from './models/ActionResult';
|
||||||
|
export type { ActionResults } from './models/ActionResults';
|
||||||
|
export type { ActionsResults } from './models/ActionsResults';
|
||||||
|
export type { ActionsStore } from './models/ActionsStore';
|
||||||
export type { AdminBasket } from './models/AdminBasket';
|
export type { AdminBasket } from './models/AdminBasket';
|
||||||
export type { Attachment } from './models/Attachment';
|
export type { Attachment } from './models/Attachment';
|
||||||
export type { BaseMapWithStores } from './models/BaseMapWithStores';
|
export type { BaseMapWithStores } from './models/BaseMapWithStores';
|
||||||
export type { BaseStyle } from './models/BaseStyle';
|
export type { BaseStyle } from './models/BaseStyle';
|
||||||
export type { BasketDefault } from './models/BasketDefault';
|
export type { BasketDefault } from './models/BasketDefault';
|
||||||
export type { BasketNameOnly } from './models/BasketNameOnly';
|
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_login_for_access_token_api_token_post } from './models/Body_login_for_access_token_api_token_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 { BootstrapData } from './models/BootstrapData';
|
||||||
export type { CategoryGroup } from './models/CategoryGroup';
|
export type { CategoryGroup } from './models/CategoryGroup';
|
||||||
|
@ -28,6 +35,7 @@ export type { Equipment } from './models/Equipment';
|
||||||
export type { FeatureInfo } from './models/FeatureInfo';
|
export type { FeatureInfo } from './models/FeatureInfo';
|
||||||
export type { FileImport } from './models/FileImport';
|
export type { FileImport } from './models/FileImport';
|
||||||
export type { FormField } from './models/FormField';
|
export type { FormField } from './models/FormField';
|
||||||
|
export type { FormFieldInput } from './models/FormFieldInput';
|
||||||
export type { Geo } from './models/Geo';
|
export type { Geo } from './models/Geo';
|
||||||
export type { HTTPValidationError } from './models/HTTPValidationError';
|
export type { HTTPValidationError } from './models/HTTPValidationError';
|
||||||
export type { InfoCategory } from './models/InfoCategory';
|
export type { InfoCategory } from './models/InfoCategory';
|
||||||
|
@ -56,6 +64,9 @@ export type { Surveyor } from './models/Surveyor';
|
||||||
export type { Tag } from './models/Tag';
|
export type { Tag } from './models/Tag';
|
||||||
export type { TagAction } from './models/TagAction';
|
export type { TagAction } from './models/TagAction';
|
||||||
export type { TagActions } from './models/TagActions';
|
export type { TagActions } from './models/TagActions';
|
||||||
|
export type { TaggedFeature } from './models/TaggedFeature';
|
||||||
|
export type { TaggedLayer } from './models/TaggedLayer';
|
||||||
|
export type { Tags } from './models/Tags';
|
||||||
export type { TileServer } from './models/TileServer';
|
export type { TileServer } from './models/TileServer';
|
||||||
export type { Token } from './models/Token';
|
export type { Token } from './models/Token';
|
||||||
export type { UserRead } from './models/UserRead';
|
export type { UserRead } from './models/UserRead';
|
||||||
|
|
11
src/app/openapi/models/Action.ts
Normal file
11
src/app/openapi/models/Action.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ActionParam } from './ActionParam';
|
||||||
|
export type Action = {
|
||||||
|
name: string;
|
||||||
|
roles: Array<string>;
|
||||||
|
params: Array<ActionParam>;
|
||||||
|
};
|
||||||
|
|
10
src/app/openapi/models/ActionParam.ts
Normal file
10
src/app/openapi/models/ActionParam.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export type ActionParam = {
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
dflt: string;
|
||||||
|
};
|
||||||
|
|
10
src/app/openapi/models/ActionResult.ts
Normal file
10
src/app/openapi/models/ActionResult.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { TaggedLayer } from './TaggedLayer';
|
||||||
|
export type ActionResult = {
|
||||||
|
message?: (string | null);
|
||||||
|
taggedLayers?: Array<TaggedLayer>;
|
||||||
|
};
|
||||||
|
|
11
src/app/openapi/models/ActionResults.ts
Normal file
11
src/app/openapi/models/ActionResults.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ActionResult } from './ActionResult';
|
||||||
|
export type ActionResults = {
|
||||||
|
name?: (string | null);
|
||||||
|
message?: (string | null);
|
||||||
|
actionResults?: Array<ActionResult>;
|
||||||
|
};
|
||||||
|
|
10
src/app/openapi/models/ActionsResults.ts
Normal file
10
src/app/openapi/models/ActionsResults.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ActionResults } from './ActionResults';
|
||||||
|
export type ActionsResults = {
|
||||||
|
message?: (string | null);
|
||||||
|
actionResults?: Array<ActionResults>;
|
||||||
|
};
|
||||||
|
|
10
src/app/openapi/models/ActionsStore.ts
Normal file
10
src/app/openapi/models/ActionsStore.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { Action } from './Action';
|
||||||
|
export type ActionsStore = {
|
||||||
|
store: string;
|
||||||
|
actions: Array<Action>;
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { ActionParam } from './ActionParam';
|
||||||
|
import type { FormFieldInput } from './FormFieldInput';
|
||||||
|
export type Body_execute_tag_action_api_execTagAction__action__post = {
|
||||||
|
stores: Array<string>;
|
||||||
|
ids: Array<Array<string>>;
|
||||||
|
actionNames: Array<string>;
|
||||||
|
params: Array<(ActionParam | null)>;
|
||||||
|
formFields: Array<FormFieldInput>;
|
||||||
|
};
|
||||||
|
|
9
src/app/openapi/models/FormFieldInput.ts
Normal file
9
src/app/openapi/models/FormFieldInput.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export type FormFieldInput = {
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@ import type { FormField } from './FormField';
|
||||||
export type ModelAction = {
|
export type ModelAction = {
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
roles?: (Array<string> | null);
|
||||||
formFields: Array<FormField>;
|
formFields: Array<FormField>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
src/app/openapi/models/TaggedFeature.ts
Normal file
12
src/app/openapi/models/TaggedFeature.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { Tags } from './Tags';
|
||||||
|
export type TaggedFeature = {
|
||||||
|
id: string;
|
||||||
|
tags: Tags;
|
||||||
|
lat: number;
|
||||||
|
lon: number;
|
||||||
|
};
|
||||||
|
|
10
src/app/openapi/models/TaggedLayer.ts
Normal file
10
src/app/openapi/models/TaggedLayer.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import type { TaggedFeature } from './TaggedFeature';
|
||||||
|
export type TaggedLayer = {
|
||||||
|
store: string;
|
||||||
|
taggedFeatures: Array<TaggedFeature>;
|
||||||
|
};
|
||||||
|
|
12
src/app/openapi/models/Tags.ts
Normal file
12
src/app/openapi/models/Tags.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* generated using openapi-typescript-codegen -- do no edit */
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export type Tags = {
|
||||||
|
id?: (number | null);
|
||||||
|
geom: string;
|
||||||
|
store: string;
|
||||||
|
ref_id: number;
|
||||||
|
tags: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import type { Observable } from 'rxjs';
|
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_login_for_access_token_api_token_post } from '../models/Body_login_for_access_token_api_token_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 { BootstrapData } from '../models/BootstrapData';
|
||||||
import type { CategoryRead } from '../models/CategoryRead';
|
import type { CategoryRead } from '../models/CategoryRead';
|
||||||
|
@ -335,4 +338,38 @@ export class ApiService {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get Actions
|
||||||
|
* @returns ActionsStore Successful Response
|
||||||
|
* @throws ApiError
|
||||||
|
*/
|
||||||
|
public getActionsApiActionsGet(): Observable<Array<ActionsStore>> {
|
||||||
|
return __request(OpenAPI, this.http, {
|
||||||
|
method: 'GET',
|
||||||
|
url: '/api/actions',
|
||||||
|
errors: {
|
||||||
|
404: `Not found`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Execute Tag Action
|
||||||
|
* @param requestBody
|
||||||
|
* @returns ActionsResults Successful Response
|
||||||
|
* @throws ApiError
|
||||||
|
*/
|
||||||
|
public executeTagActionApiExecTagActionActionPost(
|
||||||
|
requestBody: Body_execute_tag_action_api_execTagAction__action__post,
|
||||||
|
): Observable<ActionsResults> {
|
||||||
|
return __request(OpenAPI, this.http, {
|
||||||
|
method: 'POST',
|
||||||
|
url: '/api/execTagAction/{action}',
|
||||||
|
body: requestBody,
|
||||||
|
mediaType: 'application/json',
|
||||||
|
errors: {
|
||||||
|
404: `Not found`,
|
||||||
|
422: `Validation Error`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue