arlas-web-core 19.3.0-dev0 → 20.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/index.d.ts +6 -0
  2. package/{src/index.ts → index.js} +4 -7
  3. package/index.js.map +1 -0
  4. package/models/collaboration.d.ts +29 -0
  5. package/{src/models/collaboration.ts → models/collaboration.js} +6 -30
  6. package/models/collaboration.js.map +1 -0
  7. package/models/contributor.d.ts +57 -0
  8. package/models/contributor.js +116 -0
  9. package/models/contributor.js.map +1 -0
  10. package/models/projections.d.ts +35 -0
  11. package/models/projections.js +38 -0
  12. package/models/projections.js.map +1 -0
  13. package/package.json +3 -9
  14. package/patches/url+0.11.0.patch +12 -0
  15. package/services/collaborativesearch.service.d.ts +353 -0
  16. package/{src/services/collaborativesearch.service.ts → services/collaborativesearch.service.js} +178 -366
  17. package/services/collaborativesearch.service.js.map +1 -0
  18. package/services/config.service.d.ts +31 -0
  19. package/{src/services/config.service.ts → services/config.service.js} +11 -15
  20. package/services/config.service.js.map +1 -0
  21. package/utils/utils.d.ts +22 -0
  22. package/utils/utils.js +63 -0
  23. package/utils/utils.js.map +1 -0
  24. package/.editorconfig +0 -13
  25. package/.gitlab-ci.yml +0 -19
  26. package/.travis.yml +0 -27
  27. package/CHANGELOG.md +0 -446
  28. package/CONTRIBUTING.md +0 -48
  29. package/LICENSE.txt +0 -201
  30. package/NOTICE.txt +0 -10
  31. package/README-NPM.md +0 -78
  32. package/README.md +0 -78
  33. package/arlas-web-core-19.3.0-dev0.tgz +0 -0
  34. package/build.sh +0 -9
  35. package/jsconfig.json +0 -13
  36. package/mkDocs.sh +0 -18
  37. package/package-release.json +0 -25
  38. package/release.sh +0 -429
  39. package/src/models/contributor.ts +0 -161
  40. package/src/models/projections.ts +0 -58
  41. package/src/utils/utils.ts +0 -80
  42. package/tsconfig-build.json +0 -21
  43. package/tsconfig.json +0 -15
  44. package/tslint.json +0 -116
package/release.sh DELETED
@@ -1,429 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
- if [ -z "$GITHUB_CHANGELOG_TOKEN" ] ; then echo "Please set GITHUB_CHANGELOG_TOKEN environment variable"; exit -1; fi
4
-
5
- if [[ ! -d ../ARLAS-web-contributors/ ]] ; then
6
- echo 'Directory "../ARLAS-web-contributors/" is not there, aborting.'
7
- exit
8
- fi
9
-
10
- if [[ ! -d ../ARLAS-web-components/ ]] ; then
11
- echo 'Directory "../ARLAS-web-components/" is not there, aborting.'
12
- exit
13
- fi
14
-
15
- if [[ ! -d ../ARLAS-wui-toolkit/ ]] ; then
16
- echo 'Directory "../ARLAS-wui-toolkit/" is not there, aborting.'
17
- exit
18
- fi
19
-
20
- if [[ ! -d ../ARLAS-d3/ ]] ; then
21
- echo 'Directory "../ARLAS-d3/" is not there, aborting.'
22
- exit
23
- fi
24
-
25
- npmlogin=`npm whoami`
26
- if [ -z "$npmlogin" ] ; then echo "your are not logged on npm"; exit -1; else echo "logged as "$npmlogin ; fi
27
-
28
- level_version=("major" "minor" "patch")
29
-
30
- usage(){
31
- echo "Usage: ./release.sh -core='1.0.0;major' -cont='1.1.0;minor' -comp='1.1.1;patch' -prod -ref_branch=develop"
32
- echo "Usage: ./release.sh -all='1.0.0-dev0;minor'"
33
- echo "Usage: ./release.sh -all='1.0.0;major' -cont='1.1.0;minor'"
34
- echo " -core|--arlas-web-core arlas-web-core version release,level of evolution"
35
- echo " -cont|--arlas-web-contributors arlas-web-contributors version release, level of evolution"
36
- echo " -comp|--arlas-web-components arlas-web-components version release, level of evolution"
37
- echo " -d3|--arlas-d3 arlas-d3 version release, level of evolution"
38
- echo " -tool|--arlas-wui-toolkit arlas-wui-toolkit version release, level of evolution"
39
- echo " -all|--global all project have same version release, level of evolution"
40
- echo " -prod|--production if present publish on public npm and tag from master git branch, if not publish on gisaia private npm and tag from develop, not present by defaut"
41
- echo " if -all and -core or -cont or -comp or -d3 parametes are mixed, the specified version is released"
42
- echo " -ref_branch | --reference_branch from which branch to start the release."
43
- echo " Add -ref_branch=develop for a new official release"
44
- echo " Add -ref_branch=x.x.x for a maintenance release"
45
- exit 1
46
- }
47
-
48
- contains(){
49
- local n=$#
50
- local value=${!n}
51
- for ((i=1;i < $#;i++)) {
52
- if [ "${!i}" == "${value}" ]; then
53
- echo "y"
54
- return 0
55
- fi
56
- }
57
- echo "n"
58
- return 1
59
- }
60
-
61
- checkInput(){
62
- IFS=';' read -ra TAB <<< "$1"
63
- TABLEN=${#TAB[@]}
64
- TWO=2
65
- if [ "$TABLEN" -ne "$TWO" ];
66
- then
67
- usage;
68
- else
69
- if [ $(contains "${level_version[@]}" "${TAB[1]}") == "n" ];
70
- then
71
- echo "Unknown level of evolution value : ${TAB[1]}"
72
- echo "Possible values : "
73
- echo " level for versions : ${level_version[*]}"
74
- usage;
75
- elif [ "$2" == "true" ];
76
- then
77
- if ! [[ ${TAB[0]} =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]]
78
- then
79
- echo ""${TAB[0]}" version value is not valid. Format : vX.Y.Z in --prod mode"
80
- usage;
81
- fi
82
- else
83
- if ! [[ ${TAB[0]} =~ ^[0-9]*\.[0-9]*\.[0-9]*-dev[0-9]*$ ]];
84
- then
85
- echo ""${TAB[0]}" version value is not valid. Format : vX.Y.Z-devN in dev mode"
86
- usage;
87
- fi
88
- fi
89
- fi
90
-
91
- }
92
-
93
- checkfilesize(){
94
- file=$1
95
- minimumsize=1
96
- actualsize=$(wc -c <"$file")
97
- if [ $actualsize -ge $minimumsize ]; then
98
- echo "$file" size is over $minimumsize bytes
99
- else
100
- echo "Dist build contains empty js or ts file, "$file" try again"
101
- exit 1
102
- fi
103
- }
104
-
105
-
106
-
107
- releaseProd(){
108
- local folder="web-core"
109
- if [ "$3" == "components" ];
110
- then
111
- cd ../ARLAS-web-components/
112
- local folder="web-components"
113
- elif [ "$3" == "d3" ];
114
- then
115
- cd ../ARLAS-d3/
116
- local folder="d3"
117
- elif [ "$3" == "contributors" ];
118
- then
119
- cd ../ARLAS-web-contributors/
120
- local folder="web-contributors"
121
- elif [ "$3" == "toolkit" ];
122
- then
123
- cd ../ARLAS-wui-toolkit/
124
- local folder="wui-toolkit"
125
- fi
126
-
127
- echo "=> Get "$4" branch of ARLAS-$folder project"
128
- git checkout "$4"
129
- git pull origin "$4"
130
- echo "=> Test to lint and build the project on "$4" branch"
131
- npm install
132
- npm run tslint
133
- npm run build-release
134
- rm -rf dist
135
-
136
- jq '.name = "arlas-'$folder'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
137
- jq '.version = "'"$1"'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
138
- git add .
139
- commit_message_release="Release prod version $1"
140
-
141
- echo "=> Tag version $1"
142
- npm install
143
- npm run tslint
144
- npm run build-release
145
- #check dist files size
146
- for file in $(find dist -name '*.js' -or -name '*.ts');
147
- do
148
- checkfilesize $file
149
- done
150
- cp package-release.json dist/package.json
151
- cp README-NPM.md dist/README.md
152
- cp LICENSE.txt dist/LICENSE
153
- git tag -a v"$1" -m "$commit_message_release"
154
- git push origin v"$1"
155
-
156
- echo "=> Generate CHANGELOG"
157
- docker run -it --rm -v "$(pwd)":/usr/local/src/your-app gisaia/github-changelog-generator:latest github_changelog_generator \
158
- -u gisaia -p ARLAS-"$folder" --token ${GITHUB_CHANGELOG_TOKEN} --no-pr-wo-labels --no-issues-wo-labels --no-unreleased \
159
- --issue-line-labels conf,documentation,CI,ALL,DONUT,RESULTLIST,POWERBARS,HISTOGRAM,MAP \
160
- --exclude-labels type:duplicate,type:question,type:wontfix,type:invalid \
161
- --bug-labels type:bug --enhancement-labels type:enhancement --breaking-labels type:breaking \
162
- --enhancement-label "**New stuff:**" --issues-label "**Miscellaneous:**" \
163
- --exclude-tags v3.1.2 --since-tag v4.0.0
164
-
165
- echo " -- Remove tag to add generated CHANGELOG"
166
- git tag -d v"$1"
167
- git push origin :v"$1"
168
-
169
- echo " -- Commit release version"
170
- git commit -a -m "$commit_message_release" --allow-empty
171
- git tag v"$1"
172
- git push origin v"$1"
173
- git push origin "$4"
174
-
175
- cd dist
176
- jq '.name = "arlas-'$folder'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
177
- jq '.version = "'"$1"'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
178
- echo "=> Publish to npm"
179
- npm publish
180
- cd ..
181
- rm -rf dist
182
- if [ "$4" == "develop" ];
183
- then
184
- echo "=> Merge develop into master"
185
- git checkout master
186
- git pull origin master
187
- git merge origin/develop
188
- git push origin master
189
-
190
- git checkout develop
191
- git pull origin develop
192
- git rebase origin/master
193
- fi
194
- IFS='.' read -ra TAB <<< "$1"
195
- major=${TAB[0]}
196
- minor=${TAB[1]}
197
- newminor=$(( $minor + 1 ))
198
- newDevVersion=${major}.${newminor}.0
199
- jq '.version = "'"$newDevVersion"'-dev0"' package.json > tmp.$$.json && mv tmp.$$.json package.json
200
- git add .
201
- commit_message="update package.json to"-"$newDevVersion"
202
- git commit -m "$commit_message" --allow-empty
203
- git push origin "$4"
204
- echo "Well done :)"
205
-
206
- }
207
-
208
- releaseDev(){
209
- local folder="web-core"
210
- if [ "$3" == "components" ];
211
- then
212
- cd ../ARLAS-web-components/
213
- local folder="web-components"
214
- elif [ "$3" == "d3" ];
215
- then
216
- cd ../ARLAS-d3/
217
- local folder="d3"
218
- elif [ "$3" == "contributors" ];
219
- then
220
- cd ../ARLAS-web-contributors/
221
- local folder="web-contributors"
222
- elif [ "$3" == "toolkit" ];
223
- then
224
- cd ../ARLAS-wui-toolkit/
225
- local folder="wui-toolkit"
226
- fi
227
- echo "=> Get develop branch of ARLAS-$folder project"
228
- git checkout develop
229
- git pull origin develop
230
- echo "=> Test to lint and build the project on develop branch"
231
- npm install
232
- if [[ -d ./node_modules/@gisaia-team/arlas-web-core ]] ; then
233
- mv node_modules/@gisaia-team/arlas-web-core node_modules 2>/dev/null
234
- fi
235
- npm run tslint
236
- npm run build-release
237
- #check dist files size
238
- for file in $(find dist -name '*.js' -or -name '*.ts');
239
- do
240
- checkfilesize $file
241
- done
242
- cp package-release.json dist/package.json
243
- cp README-NPM.md dist/README.md
244
- cd dist
245
- jq '.name = "@gisaia-team/arlas-'$folder'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
246
- jq '.version = "'"$1"'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
247
- npm publish
248
- cd ..
249
- jq '.version = "'"$1"'"' package.json > tmp.$$.json && mv tmp.$$.json package.json
250
- rm -rf dist
251
- git add .
252
- commit_message_develop="dev automatic release update package.json to"-"$1"
253
- git commit -m"$commit_message_develop" --allow-empty
254
- git push origin develop
255
- }
256
-
257
- release(){
258
- if [ "$4" == "true" ];
259
- then
260
- releaseProd $1 $2 $3 $5
261
- else
262
- releaseDev $1 $2 $3
263
- fi
264
-
265
- }
266
-
267
- ARLAS_PROD="false"
268
-
269
- for i in "$@"
270
- do
271
- case $i in
272
- -core=*|--arlas-web-core=*)
273
- ARLAS_CORE="${i#*=}"
274
- shift # past argument=value
275
- ;;
276
- -cont=*|--arlas-web-contributors=*)
277
- ARLAS_CONT="${i#*=}"
278
- shift # past argument=value
279
- ;;
280
- -comp=*|--arlas-web-components=*)
281
- ARLAS_COMP="${i#*=}"
282
- shift # past argument=value
283
- ;;
284
- -d3=*|--arlas-d3=*)
285
- ARLAS_D3="${i#*=}"
286
- shift # past argument=value
287
- ;;
288
- -tool=*|--arlas-wui-toolkit=*)
289
- ARLAS_TOOL="${i#*=}"
290
- shift # past argument=value
291
- ;;
292
- -all=*|--global=*)
293
- ARLAS_ALL="${i#*=}"
294
- shift # past argument=value
295
- ;;
296
- -h|--help)
297
- ARLAS_HELP="true"
298
- shift # past argument=value
299
- ;;
300
- -prod|--production)
301
- ARLAS_PROD="true"
302
- shift # past argument=value
303
- ;;
304
- -ref_branch=*|--reference_branch=*)
305
- REF_BRANCH="${i#*=}"
306
- shift # past argument=value
307
- ;;
308
- *)
309
- # unknown option
310
- ;;
311
- esac
312
- done
313
-
314
- if [ -z ${REF_BRANCH+x} ];
315
- then
316
- echo ""
317
- echo "###########"
318
- echo "-ref_branch is missing."
319
- echo " Add -ref_branch=develop for a new official release"
320
- echo " Add -ref_branch=x.x.x for a maintenance release"
321
- echo "###########"
322
- echo ""
323
- usage;
324
- fi
325
-
326
- if [ ! -z ${ARLAS_HELP+x} ];
327
- then
328
- usage;
329
- fi
330
-
331
- if [ ! -z ${ARLAS_CORE+x} ];
332
- then
333
- checkInput ${ARLAS_CORE} ${ARLAS_PROD}
334
- IFS=';' read -ra TABCORE <<< "$ARLAS_CORE"
335
- ARLAS_CORE_VERS="${TABCORE[0]}";
336
- ARLAS_CORE_LEVEL="${TABCORE[1]}";
337
- elif [ ! -z ${ARLAS_ALL+x} ];
338
- then
339
- checkInput ${ARLAS_ALL} ${ARLAS_PROD}
340
- IFS=';' read -ra TABCORE <<< "$ARLAS_ALL"
341
- ARLAS_CORE_VERS="${TABCORE[0]}";
342
- ARLAS_CORE_LEVEL="${TABCORE[1]}";
343
- fi
344
-
345
- if [ ! -z ${ARLAS_CONT+x} ];
346
- then
347
- checkInput ${ARLAS_CONT} ${ARLAS_PROD}
348
- IFS=';' read -ra TABCONT <<< "$ARLAS_CONT"
349
- ARLAS_CONT_VERS="${TABCONT[0]}";
350
- ARLAS_CONT_LEVEL="${TABCONT[1]}";
351
- elif [ ! -z ${ARLAS_ALL+x} ];
352
- then
353
- checkInput ${ARLAS_ALL} ${ARLAS_PROD}
354
- IFS=';' read -ra TABCONT <<< "$ARLAS_ALL"
355
- ARLAS_CONT_VERS="${TABCONT[0]}";
356
- ARLAS_CONT_LEVEL="${TABCONT[1]}";
357
- fi
358
-
359
- if [ ! -z ${ARLAS_COMP+x} ];
360
- then
361
- checkInput ${ARLAS_COMP} ${ARLAS_PROD}
362
- IFS=';' read -ra TABCOMP <<< "$ARLAS_COMP"
363
- ARLAS_COMP_VERS="${TABCOMP[0]}";
364
- ARLAS_COMP_LEVEL="${TABCOMP[1]}";
365
- elif [ ! -z ${ARLAS_ALL+x} ];
366
- then
367
- checkInput ${ARLAS_ALL} ${ARLAS_PROD}
368
- IFS=';' read -ra TABCOMP <<< "$ARLAS_ALL"
369
- ARLAS_COMP_VERS="${TABCOMP[0]}";
370
- ARLAS_COMP_LEVEL="${TABCOMP[1]}";
371
- fi
372
-
373
- if [ ! -z ${ARLAS_D3+x} ];
374
- then
375
- checkInput ${ARLAS_D3} ${ARLAS_PROD}
376
- IFS=';' read -ra TABD3 <<< "$ARLAS_D3"
377
- ARLAS_D3_VERS="${TABD3[0]}";
378
- ARLAS_D3_LEVEL="${TABD3[1]}";
379
- elif [ ! -z ${ARLAS_ALL+x} ];
380
- then
381
- checkInput ${ARLAS_ALL} ${ARLAS_PROD}
382
- IFS=';' read -ra TABD3 <<< "$ARLAS_ALL"
383
- ARLAS_D3_VERS="${TABD3[0]}";
384
- ARLAS_D3_LEVEL="${TABD3[1]}";
385
- fi
386
-
387
- if [ ! -z ${ARLAS_TOOL+x} ];
388
- then
389
- checkInput ${ARLAS_TOOL} ${ARLAS_PROD}
390
- IFS=';' read -ra TABCOMP <<< "$ARLAS_TOOL"
391
- ARLAS_TOOL_VERS="${TABCOMP[0]}";
392
- ARLAS_TOOL_LEVEL="${TABCOMP[1]}";
393
- elif [ ! -z ${ARLAS_ALL+x} ];
394
- then
395
- checkInput ${ARLAS_ALL} ${ARLAS_PROD}
396
- IFS=';' read -ra TABCOMP <<< "$ARLAS_ALL"
397
- ARLAS_TOOL_VERS="${TABCOMP[0]}";
398
- ARLAS_TOOL_LEVEL="${TABCOMP[1]}";
399
- fi
400
-
401
- if [ ! -z ${ARLAS_CORE_VERS+x} ] && [ ! -z ${ARLAS_CORE_LEVEL+x} ];
402
- then
403
- echo "Release ARLAS-web-core ${ARLAS_CORE_LEVEL} version : ${ARLAS_CORE_VERS}";
404
- release ${ARLAS_CORE_VERS} ${ARLAS_CORE_LEVEL} "core" ${ARLAS_PROD} ${REF_BRANCH}
405
- fi
406
-
407
- if [ ! -z ${ARLAS_CONT_VERS+x} ] && [ ! -z ${ARLAS_CONT_LEVEL+x} ];
408
- then
409
- echo "Release ARLAS-web-contributors ${ARLAS_CONT_VERS} version : ${ARLAS_CONT_LEVEL}";
410
- release ${ARLAS_CONT_VERS} ${ARLAS_CONT_LEVEL} "contributors" ${ARLAS_PROD} ${REF_BRANCH}
411
- fi
412
-
413
- if [ ! -z ${ARLAS_COMP_VERS+x} ] && [ ! -z ${ARLAS_COMP_LEVEL+x} ];
414
- then
415
- echo "Release ARLAS-web-components ${ARLAS_COMP_VERS} version : ${ARLAS_COMP_LEVEL}";
416
- release ${ARLAS_COMP_VERS} ${ARLAS_COMP_LEVEL} "components" ${ARLAS_PROD} ${REF_BRANCH}
417
- fi
418
-
419
- if [ ! -z ${ARLAS_D3_VERS+x} ] && [ ! -z ${ARLAS_D3_LEVEL+x} ];
420
- then
421
- echo "Release ARLAS-d3 ${ARLAS_D3_VERS} version : ${ARLAS_D3_LEVEL}";
422
- release ${ARLAS_D3_VERS} ${ARLAS_D3_LEVEL} "d3" ${ARLAS_PROD} ${REF_BRANCH}
423
- fi
424
-
425
- if [ ! -z ${ARLAS_TOOL_VERS+x} ] && [ ! -z ${ARLAS_TOOL_LEVEL+x} ];
426
- then
427
- echo "Release ARLAS-wui-toolkit ${ARLAS_TOOL_VERS} version : ${ARLAS_TOOL_LEVEL}";
428
- release ${ARLAS_TOOL_VERS} ${ARLAS_TOOL_LEVEL} "toolkit" ${ARLAS_PROD} ${REF_BRANCH}
429
- fi
@@ -1,161 +0,0 @@
1
- /*
2
- * Licensed to Gisaïa under one or more contributor
3
- * license agreements. See the NOTICE.txt file distributed with
4
- * this work for additional information regarding copyright
5
- * ownership. Gisaïa licenses this file to you under
6
- * the Apache License, Version 2.0 (the "License"); you may
7
- * not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- import { ConfigService } from '../services/config.service';
21
- import { CollaborativesearchService } from '../services/collaborativesearch.service';
22
- import { CollaborationEvent, Collaboration } from './collaboration';
23
- import { Observable, Subject } from 'rxjs';
24
- import { map, finalize, filter, debounceTime } from 'rxjs/operators';
25
- import { CollectionAggField, hasAtLeastOneCommon as hasAtLeastOneCommon } from '../utils/utils';
26
-
27
- export abstract class Contributor {
28
-
29
- private name: string;
30
- private fetchedData: any;
31
- private _updateData = true;
32
- public isDataUpdating = false;
33
- public collection: string;
34
- public collections: CollectionAggField[];
35
- public endCollaborationEvent = new Subject();
36
- protected cacheDuration: number;
37
-
38
-
39
- /**
40
- * @param identifier string identifier of the contributor.
41
- * @param configService configService of the contributor.
42
- */
43
- constructor(public identifier: string,
44
- public configService: ConfigService,
45
- public collaborativeSearcheService: CollaborativesearchService, collection?: string) {
46
- if (!!collection) {
47
- this.collection = collection;
48
- } else {
49
- this.collection = this.collaborativeSearcheService.defaultCollection;
50
- }
51
- const configDebounceTime = this.configService.getValue('arlas.server.debounceCollaborationTime');
52
- const debounceDuration = configDebounceTime !== undefined ? configDebounceTime : 750;
53
- const configName = this.getConfigValue('name');
54
- const configCacheDuration = this.getConfigValue('cache_duration');
55
- this.cacheDuration = configCacheDuration ? configCacheDuration : this.collaborativeSearcheService.max_age;
56
- this.name = configName ? configName : this.identifier;
57
- // Register the contributor in collaborativeSearcheService registry
58
- this.collaborativeSearcheService.register(this.identifier, this);
59
- // Subscribe a bus to update data and selection
60
- this.collaborativeSearcheService.collaborationBus.pipe(debounceTime(debounceDuration))
61
- .subscribe(collaborationEvent => {
62
- // Update only contributor of same collection that the current collaboration or on the init whit the url
63
- let collaborationCollections;
64
- if (!!this.collaborativeSearcheService.registry.get(collaborationEvent.id)) {
65
- collaborationCollections = this.collaborativeSearcheService.registry.get(collaborationEvent.id).collections;
66
- }
67
- const cs1 = !!this.collections ? this.collections.map(c => c.collectionName) : [];
68
- const cs2 = !!collaborationCollections ? collaborationCollections.map(c => c.collectionName) : [];
69
- const update = collaborationEvent.id === 'url' || collaborationEvent.id === 'all' || hasAtLeastOneCommon(cs1, cs2) ;
70
- if (this._updateData && update) {
71
- this.updateFromCollaboration(<CollaborationEvent>collaborationEvent);
72
- }
73
- },
74
- error => this.collaborativeSearcheService.collaborationErrorBus.next(error)
75
- );
76
- }
77
- /**
78
- * @returns package name of contributor used in configuration.
79
- */
80
- public abstract getPackageName(): string;
81
-
82
- /**
83
- * @param key a `key` defined in configuration.
84
- * @returns value of the `key` in configuration.
85
- */
86
- public getConfigValue(key: string): any {
87
- let configValue = null;
88
- const contributor = this.configService.getValue('arlas.web.contributors').find(
89
- contrib => contrib.identifier === this.identifier
90
- );
91
- if (contributor) {
92
- configValue = contributor[key];
93
- }
94
- return configValue;
95
- }
96
-
97
- /**
98
- * @returns name of contributor set in configuration.
99
- */
100
- public getName(): string {
101
- return this.name;
102
- }
103
-
104
- /**
105
- * @returns set the name of the contributor
106
- */
107
- public setName(name: string): void {
108
- this.name = name;
109
- }
110
-
111
- /**
112
- * @returns whether the data of contributor should be updated.
113
- */
114
- public get updateData(): boolean {
115
- return this._updateData;
116
- }
117
-
118
- /**
119
- * @param value set if the data of contributor should be updated or not.
120
- */
121
- public set updateData(value) {
122
- this._updateData = value;
123
- }
124
-
125
-
126
- /**
127
- * @returns name and live informations about filter contributor.
128
- */
129
- public abstract getFilterDisplayName(): string;
130
-
131
- public abstract fetchData(collaborationEvent: CollaborationEvent): Observable<any>;
132
-
133
- public abstract computeData(data: any): any;
134
-
135
- public abstract setData(data: any): any;
136
-
137
- public abstract setSelection(data: any, c: Collaboration): any;
138
-
139
- public updateFromCollaboration(collaborationEvent: CollaborationEvent) {
140
- this.collaborativeSearcheService.ongoingSubscribe.next(1);
141
- this.isDataUpdating = true;
142
- this.fetchData(collaborationEvent)
143
- .pipe(
144
- map(f => this.computeData(f)),
145
- map(f => { this.fetchedData = f; this.setData(f); }),
146
- finalize(() => {
147
- this.setSelection(this.fetchedData, this.collaborativeSearcheService.getCollaboration(this.identifier));
148
- this.collaborativeSearcheService.contribFilterBus
149
- .next(this.collaborativeSearcheService.registry.get(this.identifier));
150
- this.collaborativeSearcheService.ongoingSubscribe.
151
- next(-1);
152
- this.isDataUpdating = false;
153
- this.endCollaborationEvent.next({});
154
- })
155
- )
156
- .subscribe(
157
- data => data,
158
- error => this.collaborativeSearcheService.collaborationErrorBus.next(error)
159
- );
160
- }
161
- }
@@ -1,58 +0,0 @@
1
- /*
2
- * Licensed to Gisaïa under one or more contributor
3
- * license agreements. See the NOTICE.txt file distributed with
4
- * this work for additional information regarding copyright
5
- * ownership. Gisaïa licenses this file to you under
6
- * the Apache License, Version 2.0 (the "License"); you may
7
- * not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- import { Search, Aggregation } from 'arlas-api';
21
-
22
- /**
23
- * Enum ARLAS SERVER type of request.
24
- */
25
- export enum projType {
26
- aggregate,
27
- geoaggregate,
28
- geohashgeoaggregate,
29
- geotilegeoaggregate,
30
- count,
31
- search,
32
- geosearch,
33
- tiledgeosearch,
34
- /**range is deprecated and will be removed in v13.0.0 */
35
- range,
36
- compute,
37
- shapesearch,
38
- shapeaggregate
39
- }
40
-
41
- export interface TiledSearch {
42
- search: Search;
43
- x: number;
44
- y: number;
45
- z: number;
46
- }
47
-
48
- export interface GeohashAggregation {
49
- geohash: string;
50
- aggregations: Array<Aggregation>;
51
- }
52
-
53
- export interface GeoTileAggregation {
54
- x: number;
55
- y: number;
56
- z: number;
57
- aggregations: Array<Aggregation>;
58
- }