WIP: updates, remove graphql (many things commented out)
This commit is contained in:
parent
38ff5b8e59
commit
d464897b8b
28 changed files with 6391 additions and 5166 deletions
|
@ -4,7 +4,7 @@ import { UntypedFormGroup, UntypedFormControl } from '@angular/forms'
|
|||
import { Observable, BehaviorSubject, forkJoin, of as observableOf, Subject } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
|
||||
import { Apollo, gql } from 'apollo-angular'
|
||||
// import { Apollo, gql } from 'apollo-angular'
|
||||
|
||||
import { MapControlService } from '../map/map-control.service'
|
||||
import { LayerNode } from '../map/models'
|
||||
|
@ -13,236 +13,236 @@ import { Tag, TagAction } from './info-tags/tags.service'
|
|||
import { ConfigService } from '../config.service'
|
||||
import { DataService } from '../_services/data.service'
|
||||
|
||||
const getModelInfoQuery = gql`
|
||||
query modelInfo ($store: String!) {
|
||||
modelInfo(store: $store) {
|
||||
store
|
||||
modelName
|
||||
symbol
|
||||
values {
|
||||
name
|
||||
title
|
||||
unit
|
||||
chartType
|
||||
chartColor
|
||||
}
|
||||
actions {
|
||||
name
|
||||
icon
|
||||
formFields {
|
||||
name
|
||||
type
|
||||
}
|
||||
}
|
||||
formName
|
||||
formFields {
|
||||
name
|
||||
type
|
||||
}
|
||||
tagPlugins
|
||||
tagActions {
|
||||
domain
|
||||
key
|
||||
actions {
|
||||
plugin
|
||||
name
|
||||
link
|
||||
action
|
||||
roles
|
||||
}
|
||||
}
|
||||
downloaders {
|
||||
name
|
||||
icon
|
||||
}
|
||||
legend {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getModelInfoQuery = gql`
|
||||
// query modelInfo ($store: String!) {
|
||||
// modelInfo(store: $store) {
|
||||
// store
|
||||
// modelName
|
||||
// symbol
|
||||
// values {
|
||||
// name
|
||||
// title
|
||||
// unit
|
||||
// chartType
|
||||
// chartColor
|
||||
// }
|
||||
// actions {
|
||||
// name
|
||||
// icon
|
||||
// formFields {
|
||||
// name
|
||||
// type
|
||||
// }
|
||||
// }
|
||||
// formName
|
||||
// formFields {
|
||||
// name
|
||||
// type
|
||||
// }
|
||||
// tagPlugins
|
||||
// tagActions {
|
||||
// domain
|
||||
// key
|
||||
// actions {
|
||||
// plugin
|
||||
// name
|
||||
// link
|
||||
// action
|
||||
// roles
|
||||
// }
|
||||
// }
|
||||
// downloaders {
|
||||
// name
|
||||
// icon
|
||||
// }
|
||||
// legend {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const getTagKeysQuery = gql`
|
||||
query tagKeyList {
|
||||
tagKeyList {
|
||||
keys
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getTagKeysQuery = gql`
|
||||
// query tagKeyList {
|
||||
// tagKeyList {
|
||||
// keys
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const createTagMutation = gql`
|
||||
mutation createTag(
|
||||
$store: String!
|
||||
$id: String!
|
||||
$key: String!
|
||||
$value: String!
|
||||
) {
|
||||
createTag(
|
||||
store: $store,
|
||||
id: $id,
|
||||
key: $key,
|
||||
value: $value
|
||||
) {
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
// const createTagMutation = gql`
|
||||
// mutation createTag(
|
||||
// $store: String!
|
||||
// $id: String!
|
||||
// $key: String!
|
||||
// $value: String!
|
||||
// ) {
|
||||
// createTag(
|
||||
// store: $store,
|
||||
// id: $id,
|
||||
// key: $key,
|
||||
// value: $value
|
||||
// ) {
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const createTagsMutations = gql`
|
||||
mutation createTags(
|
||||
$keys: [String]!
|
||||
$values: [String]!
|
||||
$stores: [String]!
|
||||
$ids: [[String]]!
|
||||
) {
|
||||
createTags(
|
||||
keys: $keys,
|
||||
values: $values,
|
||||
stores: $stores,
|
||||
ids: $ids,
|
||||
) {
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
// const createTagsMutations = gql`
|
||||
// mutation createTags(
|
||||
// $keys: [String]!
|
||||
// $values: [String]!
|
||||
// $stores: [String]!
|
||||
// $ids: [[String]]!
|
||||
// ) {
|
||||
// createTags(
|
||||
// keys: $keys,
|
||||
// values: $values,
|
||||
// stores: $stores,
|
||||
// ids: $ids,
|
||||
// ) {
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const getPlotParamsQuery = gql`
|
||||
query plotParams($store: String!, $id:String!, $value:String!) {
|
||||
plotParams(store: $store, id: $id, value: $value) {
|
||||
baseLines {
|
||||
name
|
||||
value
|
||||
color
|
||||
}
|
||||
bgShapes {
|
||||
name
|
||||
valueTop
|
||||
valueBottom
|
||||
color
|
||||
}
|
||||
barBase
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getPlotParamsQuery = gql`
|
||||
// query plotParams($store: String!, $id:String!, $value:String!) {
|
||||
// plotParams(store: $store, id: $id, value: $value) {
|
||||
// baseLines {
|
||||
// name
|
||||
// value
|
||||
// color
|
||||
// }
|
||||
// bgShapes {
|
||||
// name
|
||||
// valueTop
|
||||
// valueBottom
|
||||
// color
|
||||
// }
|
||||
// barBase
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const getFeatureInfoQuery = gql`
|
||||
query featureInfo($store: String!, $id:String!) {
|
||||
featureInfo(store: $store, id: $id) {
|
||||
id
|
||||
itemName
|
||||
geoInfoItems {
|
||||
key
|
||||
value
|
||||
}
|
||||
surveyInfoItems {
|
||||
key
|
||||
value
|
||||
}
|
||||
infoItems {
|
||||
key
|
||||
value
|
||||
}
|
||||
categorizedInfoItems {
|
||||
name
|
||||
infoItems {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
graph
|
||||
files {
|
||||
name
|
||||
path
|
||||
}
|
||||
images {
|
||||
name
|
||||
path
|
||||
}
|
||||
externalRecordUrl
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getFeatureInfoQuery = gql`
|
||||
// query featureInfo($store: String!, $id:String!) {
|
||||
// featureInfo(store: $store, id: $id) {
|
||||
// id
|
||||
// itemName
|
||||
// geoInfoItems {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// surveyInfoItems {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// infoItems {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// categorizedInfoItems {
|
||||
// name
|
||||
// infoItems {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// graph
|
||||
// files {
|
||||
// name
|
||||
// path
|
||||
// }
|
||||
// images {
|
||||
// name
|
||||
// path
|
||||
// }
|
||||
// externalRecordUrl
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const deleteTagQuery = gql`
|
||||
mutation deleteTag(
|
||||
$store: String!
|
||||
$id: String!
|
||||
$key: String!
|
||||
) {
|
||||
deleteTag(
|
||||
store: $store,
|
||||
id: $id,
|
||||
key: $key,
|
||||
) {
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
// const deleteTagQuery = gql`
|
||||
// mutation deleteTag(
|
||||
// $store: String!
|
||||
// $id: String!
|
||||
// $key: String!
|
||||
// ) {
|
||||
// deleteTag(
|
||||
// store: $store,
|
||||
// id: $id,
|
||||
// key: $key,
|
||||
// ) {
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const getTaggedFeaturesQuery = gql`
|
||||
query taggedFeatures($stores: [String], $ids: [[String]]) {
|
||||
taggedFeatures(stores: $stores, ids: $ids) {
|
||||
store
|
||||
taggedFeatures {
|
||||
id
|
||||
lon
|
||||
lat
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getTaggedFeaturesQuery = gql`
|
||||
// query taggedFeatures($stores: [String], $ids: [[String]]) {
|
||||
// taggedFeatures(stores: $stores, ids: $ids) {
|
||||
// store
|
||||
// taggedFeatures {
|
||||
// id
|
||||
// lon
|
||||
// lat
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
const getTaggedStoresQuery = gql`
|
||||
query taggedStores($stores: [String]) {
|
||||
taggedStores(stores: $stores) {
|
||||
store
|
||||
taggedFeatures {
|
||||
id
|
||||
lon
|
||||
lat
|
||||
tags {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
const executeFeatureActionMutation=gql`
|
||||
mutation executeFeatureAction (
|
||||
$store: String!,
|
||||
$id: String!,
|
||||
$action: String!,
|
||||
$value: String,
|
||||
) {
|
||||
executeFeatureAction(
|
||||
store: $store,
|
||||
id: $id,
|
||||
action: $action,
|
||||
value: $value,
|
||||
) {
|
||||
result
|
||||
}
|
||||
}
|
||||
`
|
||||
// const getTaggedStoresQuery = gql`
|
||||
// query taggedStores($stores: [String]) {
|
||||
// taggedStores(stores: $stores) {
|
||||
// store
|
||||
// taggedFeatures {
|
||||
// id
|
||||
// lon
|
||||
// lat
|
||||
// tags {
|
||||
// key
|
||||
// value
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
// const executeFeatureActionMutation=gql`
|
||||
// mutation executeFeatureAction (
|
||||
// $store: String!,
|
||||
// $id: String!,
|
||||
// $action: String!,
|
||||
// $value: String,
|
||||
// ) {
|
||||
// executeFeatureAction(
|
||||
// store: $store,
|
||||
// id: $id,
|
||||
// action: $action,
|
||||
// value: $value,
|
||||
// ) {
|
||||
// result
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
|
||||
export class TaggedFeature {
|
||||
constructor(
|
||||
|
@ -448,7 +448,7 @@ export class FullInfo {
|
|||
export class InfoDataService {
|
||||
constructor(
|
||||
public configService: ConfigService,
|
||||
private apollo: Apollo,
|
||||
// private apollo: Apollo,
|
||||
public mapControlService: MapControlService,
|
||||
protected dataService: DataService,
|
||||
) {}
|
||||
|
@ -467,75 +467,77 @@ export class InfoDataService {
|
|||
public taggedLayers$ = this.taggedLayers.asObservable()
|
||||
|
||||
getModelInfo(store: string): Observable<ModelInfo> {
|
||||
return this.apollo.query({
|
||||
query: getModelInfoQuery,
|
||||
variables: {
|
||||
store: store,
|
||||
}
|
||||
}).pipe(map(
|
||||
res => {
|
||||
let info: Object = res['data']['modelInfo']
|
||||
let values = (info['values'] || []).map(
|
||||
(value: Object) => new ModelValue(
|
||||
value['name'],
|
||||
value['title'],
|
||||
value['unit'],
|
||||
value['chartType'],
|
||||
value['chartColor'],
|
||||
)
|
||||
)
|
||||
return new ModelInfo(
|
||||
info['store'],
|
||||
info['modelName'],
|
||||
info['symbol'],
|
||||
values,
|
||||
info['actions'] ? info['actions'].map(
|
||||
action => new ModelAction(
|
||||
action['name'],
|
||||
action['icon'],
|
||||
action['formFields'].map(
|
||||
formField => new FormField(
|
||||
formField['name'],
|
||||
formField['type'],
|
||||
formField['dflt']
|
||||
)
|
||||
)
|
||||
)
|
||||
): [],
|
||||
info['formName'],
|
||||
info['formFields'] ? info['formFields'].map(
|
||||
(formField: Object) => new FormField(
|
||||
formField['name'],
|
||||
formField['type'],
|
||||
)
|
||||
) : [],
|
||||
info['tagPlugins'],
|
||||
info['tagActions'] ? info['tagActions'].map(
|
||||
tagAction => new TagAction(
|
||||
// FIXME: set real data!!!
|
||||
'**name**',
|
||||
'**plugin_name**',
|
||||
//tagAction['key'],
|
||||
tagAction.actions[0]['action'],
|
||||
['**role**'],
|
||||
'**link**',
|
||||
)
|
||||
) : [],
|
||||
info['downloaders'] ? info['downloaders'].map(
|
||||
downloader => new Downloader(
|
||||
downloader['name'],
|
||||
downloader['icon'],
|
||||
)
|
||||
) : [],
|
||||
info['legend'] ? info['legend'].map(
|
||||
legendItem => new LegendItem(
|
||||
legendItem['key'],
|
||||
legendItem['value'],
|
||||
)
|
||||
) : [],
|
||||
)
|
||||
}
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getModelInfoQuery,
|
||||
// variables: {
|
||||
// store: store,
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// res => {
|
||||
// let info: Object = res['data']['modelInfo']
|
||||
// let values = (info['values'] || []).map(
|
||||
// (value: Object) => new ModelValue(
|
||||
// value['name'],
|
||||
// value['title'],
|
||||
// value['unit'],
|
||||
// value['chartType'],
|
||||
// value['chartColor'],
|
||||
// )
|
||||
// )
|
||||
// return new ModelInfo(
|
||||
// info['store'],
|
||||
// info['modelName'],
|
||||
// info['symbol'],
|
||||
// values,
|
||||
// info['actions'] ? info['actions'].map(
|
||||
// action => new ModelAction(
|
||||
// action['name'],
|
||||
// action['icon'],
|
||||
// action['formFields'].map(
|
||||
// formField => new FormField(
|
||||
// formField['name'],
|
||||
// formField['type'],
|
||||
// formField['dflt']
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// ): [],
|
||||
// info['formName'],
|
||||
// info['formFields'] ? info['formFields'].map(
|
||||
// (formField: Object) => new FormField(
|
||||
// formField['name'],
|
||||
// formField['type'],
|
||||
// )
|
||||
// ) : [],
|
||||
// info['tagPlugins'],
|
||||
// info['tagActions'] ? info['tagActions'].map(
|
||||
// tagAction => new TagAction(
|
||||
// // FIXME: set real data!!!
|
||||
// '**name**',
|
||||
// '**plugin_name**',
|
||||
// //tagAction['key'],
|
||||
// tagAction.actions[0]['action'],
|
||||
// ['**role**'],
|
||||
// '**link**',
|
||||
// )
|
||||
// ) : [],
|
||||
// info['downloaders'] ? info['downloaders'].map(
|
||||
// downloader => new Downloader(
|
||||
// downloader['name'],
|
||||
// downloader['icon'],
|
||||
// )
|
||||
// ) : [],
|
||||
// info['legend'] ? info['legend'].map(
|
||||
// legendItem => new LegendItem(
|
||||
// legendItem['key'],
|
||||
// legendItem['value'],
|
||||
// )
|
||||
// ) : [],
|
||||
// )
|
||||
// }
|
||||
// ))
|
||||
}
|
||||
|
||||
getPlotDataAndParams(store: string, id: string, value: string, resampling: string): Observable<PlotDataParams> {
|
||||
|
@ -552,71 +554,75 @@ export class InfoDataService {
|
|||
}
|
||||
|
||||
getPlotParams(store: string, id: string, value: string): Observable<PlotParams> {
|
||||
return this.apollo.query({
|
||||
query: getPlotParamsQuery,
|
||||
variables: {
|
||||
store: store,
|
||||
id: id,
|
||||
value: value
|
||||
}
|
||||
}).pipe(map(
|
||||
info => info.data['plotParams'] ? new PlotParams(
|
||||
(info.data['plotParams']['baseLines'] || []).map(
|
||||
bl => new PlotBaseLine(
|
||||
bl['name'],
|
||||
bl['value'],
|
||||
bl['color']
|
||||
)
|
||||
),
|
||||
(info.data['plotParams']['bgShapes'] || []).map(
|
||||
bl => new PlotBgShape(
|
||||
bl['name'],
|
||||
bl['valueTop'],
|
||||
bl['valueBottom'],
|
||||
bl['color']
|
||||
)
|
||||
),
|
||||
info.data['plotParams']['barBase']
|
||||
) : new PlotParams()
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getPlotParamsQuery,
|
||||
// variables: {
|
||||
// store: store,
|
||||
// id: id,
|
||||
// value: value
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// info => info.data['plotParams'] ? new PlotParams(
|
||||
// (info.data['plotParams']['baseLines'] || []).map(
|
||||
// bl => new PlotBaseLine(
|
||||
// bl['name'],
|
||||
// bl['value'],
|
||||
// bl['color']
|
||||
// )
|
||||
// ),
|
||||
// (info.data['plotParams']['bgShapes'] || []).map(
|
||||
// bl => new PlotBgShape(
|
||||
// bl['name'],
|
||||
// bl['valueTop'],
|
||||
// bl['valueBottom'],
|
||||
// bl['color']
|
||||
// )
|
||||
// ),
|
||||
// info.data['plotParams']['barBase']
|
||||
// ) : new PlotParams()
|
||||
// ))
|
||||
}
|
||||
|
||||
getFeatureInfo(store: string, id: string): Observable<FeatureInfo> {
|
||||
return this.apollo.query({
|
||||
query: getFeatureInfoQuery,
|
||||
variables: {
|
||||
store: store,
|
||||
id: id
|
||||
}
|
||||
}).pipe(map(
|
||||
res => {
|
||||
const info = res['data']['featureInfo']
|
||||
const geoInfoItems = info['geoInfoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
const surveyInfoItems = info['surveyInfoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
const infoItems = info['infoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
const categorizedInfoItems = info['categorizedInfoItems'] && info['categorizedInfoItems'].map(
|
||||
ic => new InfoCategory(
|
||||
ic['name'],
|
||||
ic['infoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
)
|
||||
)
|
||||
const tags = info['tags'].map(ii => new Tag(ii['key'], ii['value']))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getFeatureInfoQuery,
|
||||
// variables: {
|
||||
// store: store,
|
||||
// id: id
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// res => {
|
||||
// const info = res['data']['featureInfo']
|
||||
// const geoInfoItems = info['geoInfoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
// const surveyInfoItems = info['surveyInfoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
// const infoItems = info['infoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
// const categorizedInfoItems = info['categorizedInfoItems'] && info['categorizedInfoItems'].map(
|
||||
// ic => new InfoCategory(
|
||||
// ic['name'],
|
||||
// ic['infoItems'].map(ii => new InfoItem(ii['key'], ii['value']))
|
||||
// )
|
||||
// )
|
||||
// const tags = info['tags'].map(ii => new Tag(ii['key'], ii['value']))
|
||||
|
||||
return new FeatureInfo(
|
||||
info['id'],
|
||||
info['itemName'],
|
||||
geoInfoItems,
|
||||
surveyInfoItems,
|
||||
infoItems,
|
||||
categorizedInfoItems,
|
||||
tags,
|
||||
info['graph'] && info['graph'].replace(/width="\d+pt"/, '').replace(/height="\d+pt"/, ''),
|
||||
info['files'] && info['files'].map(att => new Attachment(att['name'], att['path'])),
|
||||
info['images'] && info['images'].map(att => new Attachment(att['name'], att['path'])),
|
||||
info['externalRecordUrl']
|
||||
)
|
||||
}
|
||||
))
|
||||
// return new FeatureInfo(
|
||||
// info['id'],
|
||||
// info['itemName'],
|
||||
// geoInfoItems,
|
||||
// surveyInfoItems,
|
||||
// infoItems,
|
||||
// categorizedInfoItems,
|
||||
// tags,
|
||||
// info['graph'] && info['graph'].replace(/width="\d+pt"/, '').replace(/height="\d+pt"/, ''),
|
||||
// info['files'] && info['files'].map(att => new Attachment(att['name'], att['path'])),
|
||||
// info['images'] && info['images'].map(att => new Attachment(att['name'], att['path'])),
|
||||
// info['externalRecordUrl']
|
||||
// )
|
||||
// }
|
||||
// ))
|
||||
}
|
||||
|
||||
getFullInfo(feature: Feature): Observable<FullInfo> {
|
||||
|
@ -635,13 +641,15 @@ export class InfoDataService {
|
|||
'key': tag['key'],
|
||||
'value': tag['value'],
|
||||
}
|
||||
return this.apollo.mutate({
|
||||
mutation: createTagMutation,
|
||||
variables: variables,
|
||||
}).pipe(map(
|
||||
res => res['data']['createTag']['tags'].map(
|
||||
(tag: Object) => new Tag(tag['key'], tag['value']))
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.mutate({
|
||||
// mutation: createTagMutation,
|
||||
// variables: variables,
|
||||
// }).pipe(map(
|
||||
// res => res['data']['createTag']['tags'].map(
|
||||
// (tag: Object) => new Tag(tag['key'], tag['value']))
|
||||
// ))
|
||||
}
|
||||
|
||||
public createTags(keys: String[], values: String[], source: Object): Observable<Tag[]> {
|
||||
|
@ -651,16 +659,18 @@ export class InfoDataService {
|
|||
'stores': Object.keys(source),
|
||||
'ids': Object.values(source).map(ids => Array.from(<Number[][]>ids)),
|
||||
}
|
||||
return this.apollo.mutate({
|
||||
mutation: createTagsMutations,
|
||||
variables: variables,
|
||||
}).pipe(map(
|
||||
res => {
|
||||
let tags = res['data']['createTags']['tags']
|
||||
return tags.map(
|
||||
(tag: Object) => new Tag(tag['key'], tag['value']))
|
||||
}
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.mutate({
|
||||
// mutation: createTagsMutations,
|
||||
// variables: variables,
|
||||
// }).pipe(map(
|
||||
// res => {
|
||||
// let tags = res['data']['createTags']['tags']
|
||||
// return tags.map(
|
||||
// (tag: Object) => new Tag(tag['key'], tag['value']))
|
||||
// }
|
||||
// ))
|
||||
}
|
||||
|
||||
public deleteTag(tag: Tag | any, fullInfo?: FullInfo): Observable<object> {
|
||||
|
@ -682,10 +692,12 @@ export class InfoDataService {
|
|||
'key': tag.getKey(),
|
||||
}
|
||||
}
|
||||
return this.apollo.mutate({
|
||||
mutation: deleteTagQuery,
|
||||
variables: variables,
|
||||
})
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.mutate({
|
||||
// mutation: deleteTagQuery,
|
||||
// variables: variables,
|
||||
// })
|
||||
}
|
||||
|
||||
public getTagKeys(): Observable<string[]> {
|
||||
|
@ -731,58 +743,64 @@ export class InfoDataService {
|
|||
return observableOf(<TaggedLayer[]>[])
|
||||
}
|
||||
let ids = Object.values(features).map(t => Array.from(t))
|
||||
return this.apollo.query({
|
||||
query: getTaggedFeaturesQuery,
|
||||
variables: {
|
||||
stores: stores,
|
||||
ids: ids
|
||||
}
|
||||
}).pipe(map(
|
||||
res => {
|
||||
let taggedLayers = this._getTaggedLayers(res['data']['taggedFeatures'])
|
||||
// Add features with no tag
|
||||
Object.entries(features).forEach(
|
||||
([store, _features]) => {
|
||||
let taggedFeatures = taggedLayers.find(s => s.store==store)
|
||||
if (!taggedFeatures) {
|
||||
taggedFeatures = new TaggedLayer(store, [])
|
||||
taggedLayers.push(taggedFeatures)
|
||||
}
|
||||
let taggedFeaturesIds = taggedFeatures.features.map(tf => +tf.id)
|
||||
let featureIdsNoTag = Array(..._features).filter(x => !taggedFeaturesIds.includes(x))
|
||||
featureIdsNoTag.forEach(
|
||||
id => {
|
||||
taggedFeatures.features.push(new TaggedFeature(id, undefined, undefined, []))
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
this.taggedFeaturesSelectionService.next(taggedLayers)
|
||||
return taggedLayers
|
||||
}
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getTaggedFeaturesQuery,
|
||||
// variables: {
|
||||
// stores: stores,
|
||||
// ids: ids
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// res => {
|
||||
// let taggedLayers = this._getTaggedLayers(res['data']['taggedFeatures'])
|
||||
// // Add features with no tag
|
||||
// Object.entries(features).forEach(
|
||||
// ([store, _features]) => {
|
||||
// let taggedFeatures = taggedLayers.find(s => s.store==store)
|
||||
// if (!taggedFeatures) {
|
||||
// taggedFeatures = new TaggedLayer(store, [])
|
||||
// taggedLayers.push(taggedFeatures)
|
||||
// }
|
||||
// let taggedFeaturesIds = taggedFeatures.features.map(tf => +tf.id)
|
||||
// let featureIdsNoTag = Array(..._features).filter(x => !taggedFeaturesIds.includes(x))
|
||||
// featureIdsNoTag.forEach(
|
||||
// id => {
|
||||
// taggedFeatures.features.push(new TaggedFeature(id, undefined, undefined, []))
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// )
|
||||
// this.taggedFeaturesSelectionService.next(taggedLayers)
|
||||
// return taggedLayers
|
||||
// }
|
||||
// ))
|
||||
}
|
||||
|
||||
public getTaggedStores(stores: string[]): Observable<TaggedLayer[]> {
|
||||
return this.apollo.query({
|
||||
query: getTaggedStoresQuery,
|
||||
variables: {
|
||||
stores: stores,
|
||||
}
|
||||
}).pipe(map(
|
||||
res => this._getTaggedLayers(res['data']['taggedStores'])
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getTaggedStoresQuery,
|
||||
// variables: {
|
||||
// stores: stores,
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// res => this._getTaggedLayers(res['data']['taggedStores'])
|
||||
// ))
|
||||
}
|
||||
|
||||
public getTagsActionsStores(stores: string[]): Observable<TaggedLayer[]> {
|
||||
return this.apollo.query({
|
||||
query: getTaggedStoresQuery,
|
||||
variables: {
|
||||
stores: stores,
|
||||
}
|
||||
}).pipe(map(
|
||||
res => this._getTaggedLayers(res['data']['taggedStores'])
|
||||
))
|
||||
console.warn('Migrate Graphql')
|
||||
return observableOf()
|
||||
// return this.apollo.query({
|
||||
// query: getTaggedStoresQuery,
|
||||
// variables: {
|
||||
// stores: stores,
|
||||
// }
|
||||
// }).pipe(map(
|
||||
// res => this._getTaggedLayers(res['data']['taggedStores'])
|
||||
// ))
|
||||
}
|
||||
|
||||
// Load tags for selected layers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue