@ngageoint/mage.web-core-lib 6.2.8 → 6.2.10-beta.1

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 (45) hide show
  1. package/bundles/ngageoint-mage.web-core-lib-common.umd.js +3 -3
  2. package/bundles/ngageoint-mage.web-core-lib-common.umd.js.map +1 -1
  3. package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js +1 -1
  4. package/bundles/ngageoint-mage.web-core-lib-common.umd.min.js.map +1 -1
  5. package/bundles/ngageoint-mage.web-core-lib-feed.umd.js +19 -19
  6. package/bundles/ngageoint-mage.web-core-lib-feed.umd.js.map +1 -1
  7. package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js +1 -1
  8. package/bundles/ngageoint-mage.web-core-lib-feed.umd.min.js.map +1 -1
  9. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js +4 -4
  10. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.js.map +1 -1
  11. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js +1 -1
  12. package/bundles/ngageoint-mage.web-core-lib-static-icon.umd.min.js.map +1 -1
  13. package/bundles/ngageoint-mage.web-core-lib-user.umd.js +3 -9
  14. package/bundles/ngageoint-mage.web-core-lib-user.umd.js.map +1 -1
  15. package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js +2 -2
  16. package/bundles/ngageoint-mage.web-core-lib-user.umd.min.js.map +1 -1
  17. package/common/xhr-img.component.d.ts +2 -2
  18. package/esm2015/common/xhr-img.component.js +4 -4
  19. package/esm2015/feed/feed.service.js +20 -20
  20. package/esm2015/static-icon/static-icon.service.js +5 -5
  21. package/esm2015/user/user-read.service.js +4 -10
  22. package/esm5/common/xhr-img.component.js +4 -4
  23. package/esm5/feed/feed.service.js +20 -20
  24. package/esm5/static-icon/static-icon.service.js +5 -5
  25. package/esm5/user/user-read.service.js +4 -10
  26. package/feed/feed.service.d.ts +2 -2
  27. package/fesm2015/ngageoint-mage.web-core-lib-common.js +3 -3
  28. package/fesm2015/ngageoint-mage.web-core-lib-common.js.map +1 -1
  29. package/fesm2015/ngageoint-mage.web-core-lib-feed.js +19 -19
  30. package/fesm2015/ngageoint-mage.web-core-lib-feed.js.map +1 -1
  31. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js +4 -4
  32. package/fesm2015/ngageoint-mage.web-core-lib-static-icon.js.map +1 -1
  33. package/fesm2015/ngageoint-mage.web-core-lib-user.js +3 -9
  34. package/fesm2015/ngageoint-mage.web-core-lib-user.js.map +1 -1
  35. package/fesm5/ngageoint-mage.web-core-lib-common.js +3 -3
  36. package/fesm5/ngageoint-mage.web-core-lib-common.js.map +1 -1
  37. package/fesm5/ngageoint-mage.web-core-lib-feed.js +19 -19
  38. package/fesm5/ngageoint-mage.web-core-lib-feed.js.map +1 -1
  39. package/fesm5/ngageoint-mage.web-core-lib-static-icon.js +4 -4
  40. package/fesm5/ngageoint-mage.web-core-lib-static-icon.js.map +1 -1
  41. package/fesm5/ngageoint-mage.web-core-lib-user.js +3 -9
  42. package/fesm5/ngageoint-mage.web-core-lib-user.js.map +1 -1
  43. package/package.json +1 -1
  44. package/static-icon/static-icon.service.d.ts +2 -2
  45. package/user/user-read.service.d.ts +2 -2
@@ -32,9 +32,9 @@ const OBJECT_URL_SERVICE = new InjectionToken(`${selector}.objectUrlService`);
32
32
  * URLs for the image data, preventing memory leaks.
33
33
  */
34
34
  class XhrImgComponent {
35
- constructor(objectUrlService, http, sanitizer) {
35
+ constructor(objectUrlService, webClient, sanitizer) {
36
36
  this.objectUrlService = objectUrlService;
37
- this.http = http;
37
+ this.webClient = webClient;
38
38
  this.sanitizer = sanitizer;
39
39
  this.sourceUrl = null;
40
40
  this.safeBlobUrl = null;
@@ -50,7 +50,7 @@ class XhrImgComponent {
50
50
  if (!this.sourceUrl) {
51
51
  return;
52
52
  }
53
- this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })
53
+ this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })
54
54
  .subscribe(x => {
55
55
  this.objectUrlService.revokeObjectURL(this.blobUrl);
56
56
  this.blobUrl = this.objectUrlService.createObjectURL(x);
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-common.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts","ng://@ngageoint/mage.web-core-lib/common/ngageoint-mage.web-core-lib-common.ts"],"sourcesContent":["import { Component, ElementRef, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private http: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy() {\n this.disposeCurrent()\n }\n\n onImgLoad() {\n this.disposeCurrent()\n }\n\n private disposeCurrent() {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute"],"mappings":";;;;AAKA,MAAM,QAAQ,GAAG,cAAc,CAAA;MAYlB,kBAAkB,GAAG,IAAI,cAAc,CAAmB,GAAG,QAAQ,mBAAmB,EAAC;AAEtG;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsCa,eAAe;IAS1B,YAAgD,gBAAkC,EAAU,IAAgB,EAAU,SAAuB;QAA7F,qBAAgB,GAAhB,gBAAgB,CAAkB;QAAU,SAAI,GAAJ,IAAI,CAAY;QAAU,cAAS,GAAT,SAAS,CAAc;QAN7I,cAAS,GAAkB,IAAI,CAAA;QAC/B,gBAAW,GAAmB,IAAI,CAAA;KAK+G;IAEjJ,WAAW,CAAC,OAAsB;QAChC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,OAAM;SACP;QACD,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACxD,OAAM;SACP;QACD,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,OAAM;SACP;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;aACxE,SAAS,CAAC,CAAC;YACV,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACnD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;YACvD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,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;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-common.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts","ng://@ngageoint/mage.web-core-lib/common/ngageoint-mage.web-core-lib-common.ts"],"sourcesContent":["import { Component, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private webClient: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy(): void {\n this.disposeCurrent()\n }\n\n onImgLoad(): void {\n this.disposeCurrent()\n }\n\n private disposeCurrent(): void {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\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KACtB;IAED,SAAS;QACP,IAAI,CAAC,cAAc,EAAE,CAAA;KACtB;IAEO,cAAc;QACpB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACpD;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;SAChC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB;;8EA9CU,eAAe,oBASN,kBAAkB;iDAT3B,eAAe,4GAPf;YACT;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,QAAQ,EAAE,GAAG;aACd;SACF;QAPUA,2BAAoD;QAAtBC,oFAAQ,eAAW,IAAC;QAAlDC,cAAoD;;QAA/CC,kDAAwB;;+CAS7B,eAAe;cAX3B,SAAS;eAAC;gBACT,QAAQ,EAAE,GAAG,QAAQ,EAAE;gBACvB,QAAQ,EAAE,sDAAsD;gBAChE,MAAM,EAAE,CAAE,mCAAmC,CAAE;gBAC/C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,kBAAkB;wBAC3B,QAAQ,EAAE,GAAG;qBACd;iBACF;aACF;;sBAUc,MAAM;uBAAC,kBAAkB;;kBAPrC,KAAK;mBAAC,KAAK;;;MC5CD,gBAAgB;;iDAAhB,gBAAgB;4GAAhB,gBAAgB,kBAVlB;YACP,aAAa;SACd;qFAQU,gBAAgB,mBANzB,eAAe,aAHf,aAAa,aAMb,eAAe;+CAGN,gBAAgB;cAX5B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,aAAa;iBACd;gBACD,YAAY,EAAE;oBACZ,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,eAAe;iBAChB;aACF;;;ACdD;;;;;;"}
@@ -4,8 +4,8 @@ import { map } from 'rxjs/operators';
4
4
  import { HttpClient } from '@angular/common/http';
5
5
 
6
6
  class FeedService {
7
- constructor(http) {
8
- this.http = http;
7
+ constructor(webClient) {
8
+ this.webClient = webClient;
9
9
  // TODO: there is probably a better solution than maintaining this map here
10
10
  this._feeds = new BehaviorSubject([]);
11
11
  this.feeds = this._feeds.asObservable();
@@ -15,56 +15,56 @@ class FeedService {
15
15
  return this._feedItems.get(feedId).asObservable();
16
16
  }
17
17
  fetchAllFeeds() {
18
- return this.http.get('/api/feeds/');
18
+ return this.webClient.get('/api/feeds/');
19
19
  }
20
20
  fetchFeed(feedId) {
21
- return this.http.get(`/api/feeds/${feedId}`);
21
+ return this.webClient.get(`/api/feeds/${feedId}`);
22
22
  }
23
23
  fetchService(serviceId) {
24
- return this.http.get(`/api/feeds/services/${serviceId}`);
24
+ return this.webClient.get(`/api/feeds/services/${serviceId}`);
25
25
  }
26
26
  createService(service) {
27
- return this.http.post(`/api/feeds/services`, service);
27
+ return this.webClient.post(`/api/feeds/services`, service);
28
28
  }
29
29
  fetchServices() {
30
- return this.http.get(`/api/feeds/services`);
30
+ return this.webClient.get(`/api/feeds/services`);
31
31
  }
32
32
  fetchServiceFeeds(serviceId) {
33
- return this.http.get(`/api/feeds/services/${serviceId}/feeds`);
33
+ return this.webClient.get(`/api/feeds/services/${serviceId}/feeds`);
34
34
  }
35
35
  fetchServiceType(serviceTypeId) {
36
- return this.http.get(`/api/feeds/service_types/${serviceTypeId}`);
36
+ return this.webClient.get(`/api/feeds/service_types/${serviceTypeId}`);
37
37
  }
38
38
  fetchTopics(serviceId) {
39
- return this.http.get(`/api/feeds/services/${serviceId}/topics`);
39
+ return this.webClient.get(`/api/feeds/services/${serviceId}/topics`);
40
40
  }
41
41
  previewFeed(serviceId, topicId, feedSpec, opts) {
42
42
  opts = opts || {};
43
43
  const skipContentFetch = opts.skipContentFetch === true;
44
- return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`, { feed: feedSpec });
44
+ return this.webClient.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`, { feed: feedSpec });
45
45
  }
46
46
  fetchTopic(serviceId, topicId) {
47
- return this.http.get(`/api/feeds/services/${serviceId}/topics/${topicId}`);
47
+ return this.webClient.get(`/api/feeds/services/${serviceId}/topics/${topicId}`);
48
48
  }
49
49
  fetchServiceTypes() {
50
- return this.http.get(`/api/feeds/service_types`);
50
+ return this.webClient.get(`/api/feeds/service_types`);
51
51
  }
52
52
  createFeed(serviceId, topicId, feedConfiguration) {
53
- return this.http.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);
53
+ return this.webClient.post(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);
54
54
  }
55
55
  updateFeed(feed) {
56
- return this.http.put(`/api/feeds/${feed.id}`, feed);
56
+ return this.webClient.put(`/api/feeds/${feed.id}`, feed);
57
57
  }
58
58
  deleteFeed(feed) {
59
- return this.http.delete(`/api/feeds/${feed.id}`, { responseType: 'text' });
59
+ return this.webClient.delete(`/api/feeds/${feed.id}`, { responseType: 'text' });
60
60
  }
61
61
  deleteService(service) {
62
62
  console.log('delete');
63
- return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });
63
+ return this.webClient.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });
64
64
  }
65
65
  fetchFeeds(eventId) {
66
66
  const subject = new Subject();
67
- this.http.get(`/api/events/${eventId}/feeds`).subscribe(feeds => {
67
+ this.webClient.get(`/api/events/${eventId}/feeds`).subscribe(feeds => {
68
68
  feeds.map(feed => {
69
69
  feed.id = feed.id.toString();
70
70
  return feed;
@@ -83,7 +83,7 @@ class FeedService {
83
83
  }
84
84
  fetchFeedItems(event, feed) {
85
85
  const feedItems = this._feedItems.get(feed.id);
86
- return this.http.post(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(map(content => {
86
+ return this.webClient.post(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(map(content => {
87
87
  const features = content.items.features;
88
88
  features.forEach((feature) => {
89
89
  feature.id = String(feature.id);
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-feed.js","sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts","ng://@ngageoint/mage.web-core-lib/feed/ngageoint-mage.web-core-lib-feed.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private http: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.http.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.http.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.http.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.http.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.http.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.http.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.http.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.http.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.http.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.http.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.http.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.http.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.http.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.http.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.http.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.http.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAea,WAAW;IAEtB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;;QAG5B,WAAM,GAAG,IAAI,eAAe,CAAc,EAAE,CAAC,CAAC;QAC7C,UAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAEpC,eAAU,GAAG,IAAI,GAAG,EAA2C,CAAC;KAN/B;IAOzC,SAAS,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAC;KACnD;IAED,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,aAAa,CAAC,CAAC;KAClD;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,cAAc,MAAM,EAAE,CAAC,CAAC;KAC5D;IAED,YAAY,CAAC,SAAiB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAU,uBAAuB,SAAS,EAAE,CAAC,CAAC;KACnE;IAED,aAAa,CAAC,OAA6E;QACzF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAU,qBAAqB,EAAE,OAAO,CAAC,CAAC;KAChE;IAED,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,qBAAqB,CAAC,CAAC;KAC7D;IAED,iBAAiB,CAAC,SAAiB;QAC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AAI,CAAC,IAAI,CAAC,IAAI,CAAc,eAAe,KAAK,CAAC,EAAE,UAAU,IAAI,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAC7F,GAAG,CAAC,OAAO;YACT,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAA;YACvC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAsB;gBACtC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;gBAC/B,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAA;aAC9C,CAAC,CAAA;YACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACxB,OAAO,OAAO,CAAA;SACf,CAAC,CACH,CAAA;KACF;;sEAlHU,WAAW;gDAAX,WAAW,WAAX,WAAW,mBAFV,MAAM;+CAEP,WAAW;cAHvB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;ACdD;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-feed.js","sources":["ng://@ngageoint/mage.web-core-lib/feed/feed.service.ts","ng://@ngageoint/mage.web-core-lib/feed/ngageoint-mage.web-core-lib-feed.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Feature } from 'geojson'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { Feed, FeedContent, FeedExpanded, FeedPost, FeedPreview, FeedTopic, Service, ServiceType, StyledFeature } from './feed.model'\n\n\nexport interface FeedPreviewOptions {\n skipContentFetch?: boolean\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FeedService {\n\n constructor(private webClient: HttpClient) { }\n\n // TODO: there is probably a better solution than maintaining this map here\n private _feeds = new BehaviorSubject<Array<Feed>>([]);\n readonly feeds = this._feeds.asObservable();\n\n private _feedItems = new Map<string, BehaviorSubject<Array<Feature>>>();\n feedItems(feedId: string): Observable<Array<Feature>> {\n return this._feedItems.get(feedId).asObservable();\n }\n\n fetchAllFeeds(): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>('/api/feeds/');\n }\n\n fetchFeed(feedId: string): Observable<FeedExpanded> {\n return this.webClient.get<FeedExpanded>(`/api/feeds/${feedId}`);\n }\n\n fetchService(serviceId: string): Observable<Service> {\n return this.webClient.get<Service>(`/api/feeds/services/${serviceId}`);\n }\n\n createService(service: { title: string, summary?: string, serviceType: string, config: any}): Observable<Service> {\n return this.webClient.post<Service>(`/api/feeds/services`, service);\n }\n\n fetchServices(): Observable<Array<Service>> {\n return this.webClient.get<Array<Service>>(`/api/feeds/services`);\n }\n\n fetchServiceFeeds(serviceId: string): Observable<Array<Feed>> {\n return this.webClient.get<Array<Feed>>(`/api/feeds/services/${serviceId}/feeds`);\n }\n\n fetchServiceType(serviceTypeId: string): Observable<ServiceType> {\n return this.webClient.get<ServiceType>(`/api/feeds/service_types/${serviceTypeId}`);\n }\n\n fetchTopics(serviceId: string): Observable<Array<FeedTopic>> {\n return this.webClient.get<Array<FeedTopic>>(`/api/feeds/services/${serviceId}/topics`);\n }\n\n previewFeed(serviceId: string, topicId: string, feedSpec: Partial<Omit<FeedPost, 'service' | 'topic'>>, opts?: FeedPreviewOptions): Observable<FeedPreview> {\n opts = opts || {}\n const skipContentFetch: boolean = opts.skipContentFetch === true\n return this.webClient.post<FeedPreview>(\n `/api/feeds/services/${serviceId}/topics/${topicId}/feed_preview?skip_content_fetch=${skipContentFetch}`,\n { feed: feedSpec });\n }\n\n fetchTopic(serviceId: string, topicId: string): Observable<FeedTopic> {\n return this.webClient.get<FeedTopic>(`/api/feeds/services/${serviceId}/topics/${topicId}`);\n }\n\n fetchServiceTypes(): Observable<Array<ServiceType>> {\n return this.webClient.get<Array<ServiceType>>(`/api/feeds/service_types`);\n }\n\n createFeed(serviceId: string, topicId: string, feedConfiguration: any): Observable<FeedExpanded> {\n return this.webClient.post<FeedExpanded>(`/api/feeds/services/${serviceId}/topics/${topicId}/feeds`, feedConfiguration);\n }\n\n updateFeed(feed: Partial<Omit<FeedPost, 'id'>> & Pick<Feed, 'id'>): Observable<FeedExpanded> {\n return this.webClient.put<FeedExpanded>(`/api/feeds/${feed.id}`, feed);\n }\n\n deleteFeed(feed: Feed | FeedExpanded): Observable<{}> {\n return this.webClient.delete(`/api/feeds/${feed.id}`, {responseType: 'text'});\n }\n\n deleteService(service: Service): Observable<{}> {\n console.log('delete')\n return this.webClient.delete(`/api/feeds/services/${service.id}`, { responseType: 'text' });\n }\n\n fetchFeeds(eventId: number): Observable<Array<Feed>> {\n const subject = new Subject<Array<Feed>>();\n this.webClient.get<Array<Feed>>(`/api/events/${eventId}/feeds`).subscribe(feeds => {\n feeds.map(feed => {\n feed.id = feed.id.toString();\n return feed;\n });\n\n feeds.forEach(feed => {\n let feedItems = this._feedItems.get(feed.id);\n if (!feedItems) {\n feedItems = new BehaviorSubject<Array<Feature>>([]);\n this._feedItems.set(feed.id, feedItems);\n }\n })\n\n subject.next(feeds);\n this._feeds.next(feeds);\n });\n\n return subject;\n }\n\n fetchFeedItems(event: any, feed: Feed): Observable<FeedContent> {\n const feedItems = this._feedItems.get(feed.id)\n return this.webClient.post<FeedContent>(`/api/events/${event.id}/feeds/${feed.id}/content`, {}).pipe(\n map(content => {\n const features = content.items.features\n features.forEach((feature: StyledFeature) => {\n feature.id = String(feature.id)\n feature.properties = feature.properties || {}\n })\n feedItems.next(features)\n return content\n })\n )\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAea,WAAW;IAEtB,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;;QAGjC,WAAM,GAAG,IAAI,eAAe,CAAc,EAAE,CAAC,CAAC;QAC7C,UAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAEpC,eAAU,GAAG,IAAI,GAAG,EAA2C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AW;cAHvB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;ACdD;;;;;;"}
@@ -21,8 +21,8 @@ const contentPathOfIcon = (icon) => {
21
21
  };
22
22
 
23
23
  class StaticIconService {
24
- constructor(http) {
25
- this.http = http;
24
+ constructor(webClient) {
25
+ this.webClient = webClient;
26
26
  }
27
27
  fetchIcons(fetch) {
28
28
  const now = Date.now();
@@ -55,7 +55,7 @@ class StaticIconService {
55
55
  return results;
56
56
  }
57
57
  fetchIconById(id) {
58
- return this.http.get(`/api/icons/${id}`).pipe(catchError((err, caught) => {
58
+ return this.webClient.get(`/api/icons/${id}`).pipe(catchError((err, caught) => {
59
59
  // TODO: this is probably better practice to insulate app layer from
60
60
  // http errors
61
61
  // if (err instanceof HttpErrorResponse) {
@@ -67,7 +67,7 @@ class StaticIconService {
67
67
  }));
68
68
  }
69
69
  fetchIconBySourceUrl(url) {
70
- return this.http.get(`/api/icons`, {
70
+ return this.webClient.get(`/api/icons`, {
71
71
  params: new HttpParams().set('source_url', url)
72
72
  });
73
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-static-icon.js","sources":["ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.model.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.service.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-img/static-icon-img.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.module.ts","ng://@ngageoint/mage.web-core-lib/static-icon/ngageoint-mage.web-core-lib-static-icon.ts"],"sourcesContent":["\nexport interface StaticIcon {\n id: string\n sourceUrl: string\n contentPath: string\n title?: string\n summary?: string\n fileName?: string\n tags?: string[]\n}\n\nexport interface RegisteredStaticIconReference {\n id: string\n sourceUrl?: never\n}\n\nexport interface SourceUrlStaticIconReference {\n sourceUrl: string\n id?: never\n}\n\nexport const contentPathOfIcon = (icon?: StaticIcon | RegisteredStaticIconReference | string | null | undefined): string | undefined => {\n if (!icon) {\n return\n }\n if (typeof icon !== 'string') {\n icon = icon.id\n }\n return `/api/icons/${icon}/content`\n}\n\nexport type StaticIconReference = RegisteredStaticIconReference | SourceUrlStaticIconReference\n","import { HttpClient, HttpParams } from '@angular/common/http'\nimport { Injectable } from '@angular/core';\nimport { Observable, throwError } from 'rxjs'\nimport { catchError } from 'rxjs/operators'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon, StaticIconReference } from './static-icon.model'\n\n\nexport interface IconFetch extends PagingParameters {\n searchText?: string\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class StaticIconService {\n\n constructor(private http: HttpClient) { }\n\n fetchIcons(fetch?: IconFetch): Observable<PageOf<StaticIcon>> {\n const now = Date.now()\n const results = new Observable<PageOf<StaticIcon>>(observer => {\n const icons: StaticIcon[] = []\n let remaining = 100\n while (remaining--) {\n const id = now - remaining\n icons.unshift({\n id: String(id),\n title: `Icon ${id}`,\n fileName: `icon-${id}.png`,\n sourceUrl: `https://test.mage/${id}.png`,\n contentPath: `/icons/${id}/content`\n })\n }\n setTimeout(() => {\n observer.next({\n pageSize: 100,\n pageIndex: 0,\n totalCount: 100,\n items: icons\n })\n observer.complete()\n }, 0)\n return {\n unsubscribe() { }\n }\n })\n return results\n }\n\n fetchIconById(id: string): Observable<StaticIcon | null> {\n return this.http.get<StaticIcon>(`/api/icons/${id}`).pipe(\n catchError((err, caught) => {\n // TODO: this is probably better practice to insulate app layer from\n // http errors\n // if (err instanceof HttpErrorResponse) {\n // if (err.status === 404) {\n // return null\n // }\n // }\n return throwError(err)\n })\n )\n }\n\n fetchIconBySourceUrl(url: string): Observable<StaticIcon> {\n return this.http.get<StaticIcon | null>(`/api/icons`, {\n params: new HttpParams().set('source_url', url)\n })\n }\n\n fetchIconByReference(ref: StaticIconReference): Observable<StaticIcon | null> {\n if (ref.id) {\n return this.fetchIconById(ref.id)\n }\n else if (ref.sourceUrl) {\n return this.fetchIconBySourceUrl(ref.sourceUrl)\n }\n throw new Error('no icon id or source url')\n }\n\n registerIconUrl(url: string): Observable<StaticIcon> {\n throw new Error('unimplemented')\n }\n\n uploadIcon(): void {\n throw new Error('unimplemented')\n }\n}\n","import { HttpClient } from '@angular/common/http'\nimport { Component, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator, Validators } from '@angular/forms'\nimport { DomSanitizer } from '@angular/platform-browser'\nimport { StaticIcon, StaticIconReference } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\n\n@Component({\n selector: 'mage-static-icon-form-field',\n templateUrl: './static-icon-form-field.component.html',\n styleUrls: ['./static-icon-form-field.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n ]\n})\nexport class StaticIconFormFieldComponent implements OnChanges, OnDestroy, ControlValueAccessor, Validator {\n\n iconRef: StaticIconReference = null\n\n form: FormGroup = new FormGroup({\n iconRefToken: new FormControl(null),\n iconRefType: new FormControl(null, Validators.required)\n })\n icon: StaticIcon | null\n\n private onChange: (iconRef: StaticIconReference) => void = (iconRef: StaticIconReference) => {}\n private onValidatorChange: () => void = () => {}\n private onTouched: () => void = () => {}\n\n constructor(private iconService: StaticIconService, private httpClient: HttpClient, private sanitizer: DomSanitizer) {\n this.form.valueChanges.subscribe((x: IconRefFormValue) => {\n this.iconRef = iconRefForFormValue(x)\n this.onChange(this.iconRef)\n })\n }\n\n registerOnValidatorChange?(fn: () => void): void {\n this.onValidatorChange = fn\n }\n\n ngOnChanges(changes: SimpleChanges) { }\n\n ngOnDestroy() { }\n\n onSelectIcon() { }\n\n writeValue(iconRef: StaticIconReference): void {\n this.iconRef = iconRef\n const formValue = formValueForIconRef(iconRef)\n this.form.setValue(formValue, { emitEvent: false })\n this.resolveIconRef()\n }\n\n registerOnChange(fn: (x: StaticIconReference | null) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n if (isDisabled) {\n this.form.disable()\n }\n else {\n this.form.enable()\n }\n }\n\n validate(control: AbstractControl): ValidationErrors {\n return this.form.errors\n }\n\n private resolveIconRef() {\n if (!this.iconRef) {\n this.icon = null\n return\n }\n this.iconService.fetchIconByReference(this.iconRef).subscribe(x => {\n this.icon = x\n if (!this.icon) {\n return\n }\n })\n }\n}\n\nenum IconRefType {\n Registered = 'id',\n SourceUrl = 'sourceUrl'\n}\n\ntype IconRefFormValue = {\n iconRefToken: string | null\n iconRefType: IconRefType | null\n}\n\nfunction iconRefForFormValue(x: IconRefFormValue): StaticIconReference | null {\n if (!x.iconRefType) {\n return null\n }\n switch (x.iconRefType) {\n case IconRefType.Registered:\n return { [IconRefType.Registered]: x.iconRefToken }\n case IconRefType.SourceUrl:\n return { [IconRefType.SourceUrl]: x.iconRefToken }\n default:\n throw new Error('invalid icon ref type: ' + x.iconRefToken)\n }\n}\n\nfunction formValueForIconRef(x: StaticIconReference | null): IconRefFormValue {\n if (!x) {\n return {\n iconRefType: null,\n iconRefToken: null\n }\n }\n let iconRefType: IconRefType | null = null\n let iconRefToken: string | null = null\n if (x.hasOwnProperty(IconRefType.Registered)) {\n iconRefType = IconRefType.Registered || null\n iconRefToken = x[IconRefType.Registered] || null\n }\n else if (x.hasOwnProperty(IconRefType.SourceUrl)) {\n iconRefType = IconRefType.SourceUrl || null\n iconRefToken = x[IconRefType.SourceUrl] || null\n }\n return {\n iconRefType,\n iconRefToken\n }\n}\n","<div [formGroup]=\"form\">\n <mage-xhr-img class=\"icon-image\" [src]=\"icon?.contentPath\"></mage-xhr-img>\n <input type=\"hidden\" formControlName=\"iconRefType\"/>\n <input type=\"hidden\" formControlName=\"iconRefToken\"/>\n</div>","import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { RegisteredStaticIconReference, contentPathOfIcon } from '../static-icon.model'\n\n@Component({\n selector: 'mage-static-icon-img',\n template: `<mage-xhr-img [src]=\"iconPath\"></mage-xhr-img>`,\n})\nexport class StaticIconImgComponent implements OnInit, OnChanges {\n\n @Input()\n iconRef: RegisteredStaticIconReference | string | null\n iconPath: string | null\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.iconRef) {\n if (this.iconRef) {\n this.iconPath = contentPathOfIcon(this.iconRef)\n }\n else {\n this.iconPath = null\n }\n }\n }\n}\n","<div class=\"icon-select\">\n <cdk-virtual-scroll-viewport [itemSize]=\"40\">\n <mat-card *cdkVirtualFor=\"let icon of icons\" class=icon-select-item>\n <mat-card-header>\n <mat-card-title>{{icon.title}}</mat-card-title>\n </mat-card-header>\n <img mat-card-img [src]=\"icon.path\" />\n </mat-card>\n </cdk-virtual-scroll-viewport>\n</div>\n<!--\n <button mat-button class=\"add__button\" type=\"button\" color=\"primary\" (click)=\"file.click()\">\n Upload Icon\n </button>\n <input [hidden]=\"true\" type=\"file\" #file multiple (change)=\"onAttachmentFile($event)\">\n-->","import { Component, OnInit } from '@angular/core'\nimport { PagingParameters, PagingDataSource } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\nexport interface StaticIconSelectItem {\n id: string\n path: string\n title: string\n fileName: string\n}\n\n@Component({\n selector: 'static-icon-select',\n templateUrl: './static-icon-select.component.html',\n styleUrls: ['./static-icon-select.component.scss']\n})\nexport class StaticIconSelectComponent implements OnInit {\n\n icons: StaticIcon[] | null = null\n dataSource: PagingDataSource<StaticIcon>\n\n constructor(\n private iconService: StaticIconService\n ) {\n this.dataSource = new PagingDataSource<StaticIcon>(250, (paging: PagingParameters) => {\n return this.iconService.fetchIcons(paging)\n })\n }\n\n ngOnInit() {\n this.iconService.fetchIcons().subscribe(x => {\n this.icons = x.items\n })\n }\n\n onBrowseForUploadIcon() {\n throw new Error('unimplemented')\n }\n}\n\n","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatCardModule } from '@angular/material/card'\nimport { MageCommonModule } from '@ngageoint/mage.web-core-lib/common'\nimport { StaticIconFormFieldComponent } from './static-icon-form-field/static-icon-form-field.component'\nimport { StaticIconImgComponent } from './static-icon-img/static-icon-img.component'\nimport { StaticIconSelectComponent } from './static-icon-select/static-icon-select.component'\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatCardModule,\n MageCommonModule,\n ScrollingModule\n ],\n declarations: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ],\n exports: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ]\n})\nexport class StaticIconModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵelement","i0.ɵɵelementEnd","i0.ɵɵproperty","i0.ɵɵadvance","i0.ɵɵtext","i0.ɵɵtextInterpolate","i0.ɵɵtemplate"],"mappings":";;;;;;;;;;;;MAqBa,iBAAiB,GAAG,CAAC,IAA6E;IAC7G,IAAI,CAAC,IAAI,EAAE;QACT,OAAM;KACP;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAA;KACf;IACD,OAAO,c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,mBAAmB;QACnB,aAAa;QACb,gBAAgB;QAChB,eAAe,aAQf,4BAA4B;QAC5B,sBAAsB;QACtB,yBAAyB;+CAGhB,gBAAgB;cApB5B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,aAAa;oBACb,gBAAgB;oBAChB,eAAe;iBAChB;gBACD,YAAY,EAAE;oBACZ,4BAA4B;oBAC5B,sBAAsB;oBACtB,yBAAyB;iBAC1B;gBACD,OAAO,EAAE;oBACP,4BAA4B;oBAC5B,sBAAsB;oBACtB,yBAAyB;iBAC1B;aACF;;;AC9BD;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-static-icon.js","sources":["ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.model.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.service.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-form-field/static-icon-form-field.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-img/static-icon-img.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.html","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon-select/static-icon-select.component.ts","ng://@ngageoint/mage.web-core-lib/static-icon/static-icon.module.ts","ng://@ngageoint/mage.web-core-lib/static-icon/ngageoint-mage.web-core-lib-static-icon.ts"],"sourcesContent":["\nexport interface StaticIcon {\n id: string\n sourceUrl: string\n contentPath: string\n title?: string\n summary?: string\n fileName?: string\n tags?: string[]\n}\n\nexport interface RegisteredStaticIconReference {\n id: string\n sourceUrl?: never\n}\n\nexport interface SourceUrlStaticIconReference {\n sourceUrl: string\n id?: never\n}\n\nexport const contentPathOfIcon = (icon?: StaticIcon | RegisteredStaticIconReference | string | null | undefined): string | undefined => {\n if (!icon) {\n return\n }\n if (typeof icon !== 'string') {\n icon = icon.id\n }\n return `/api/icons/${icon}/content`\n}\n\nexport type StaticIconReference = RegisteredStaticIconReference | SourceUrlStaticIconReference\n","import { HttpClient, HttpParams } from '@angular/common/http'\nimport { Injectable } from '@angular/core';\nimport { Observable, throwError } from 'rxjs'\nimport { catchError } from 'rxjs/operators'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon, StaticIconReference } from './static-icon.model'\n\n\nexport interface IconFetch extends PagingParameters {\n searchText?: string\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class StaticIconService {\n\n constructor(private webClient: HttpClient) { }\n\n fetchIcons(fetch?: IconFetch): Observable<PageOf<StaticIcon>> {\n const now = Date.now()\n const results = new Observable<PageOf<StaticIcon>>(observer => {\n const icons: StaticIcon[] = []\n let remaining = 100\n while (remaining--) {\n const id = now - remaining\n icons.unshift({\n id: String(id),\n title: `Icon ${id}`,\n fileName: `icon-${id}.png`,\n sourceUrl: `https://test.mage/${id}.png`,\n contentPath: `/icons/${id}/content`\n })\n }\n setTimeout(() => {\n observer.next({\n pageSize: 100,\n pageIndex: 0,\n totalCount: 100,\n items: icons\n })\n observer.complete()\n }, 0)\n return {\n unsubscribe() { }\n }\n })\n return results\n }\n\n fetchIconById(id: string): Observable<StaticIcon | null> {\n return this.webClient.get<StaticIcon>(`/api/icons/${id}`).pipe(\n catchError((err, caught) => {\n // TODO: this is probably better practice to insulate app layer from\n // http errors\n // if (err instanceof HttpErrorResponse) {\n // if (err.status === 404) {\n // return null\n // }\n // }\n return throwError(err)\n })\n )\n }\n\n fetchIconBySourceUrl(url: string): Observable<StaticIcon> {\n return this.webClient.get<StaticIcon | null>(`/api/icons`, {\n params: new HttpParams().set('source_url', url)\n })\n }\n\n fetchIconByReference(ref: StaticIconReference): Observable<StaticIcon | null> {\n if (ref.id) {\n return this.fetchIconById(ref.id)\n }\n else if (ref.sourceUrl) {\n return this.fetchIconBySourceUrl(ref.sourceUrl)\n }\n throw new Error('no icon id or source url')\n }\n\n registerIconUrl(url: string): Observable<StaticIcon> {\n throw new Error('unimplemented')\n }\n\n uploadIcon(): void {\n throw new Error('unimplemented')\n }\n}\n","import { HttpClient } from '@angular/common/http'\nimport { Component, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator, Validators } from '@angular/forms'\nimport { DomSanitizer } from '@angular/platform-browser'\nimport { StaticIcon, StaticIconReference } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\n\n@Component({\n selector: 'mage-static-icon-form-field',\n templateUrl: './static-icon-form-field.component.html',\n styleUrls: ['./static-icon-form-field.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: StaticIconFormFieldComponent\n },\n ]\n})\nexport class StaticIconFormFieldComponent implements OnChanges, OnDestroy, ControlValueAccessor, Validator {\n\n iconRef: StaticIconReference = null\n\n form: FormGroup = new FormGroup({\n iconRefToken: new FormControl(null),\n iconRefType: new FormControl(null, Validators.required)\n })\n icon: StaticIcon | null\n\n private onChange: (iconRef: StaticIconReference) => void = (iconRef: StaticIconReference) => {}\n private onValidatorChange: () => void = () => {}\n private onTouched: () => void = () => {}\n\n constructor(private iconService: StaticIconService, private httpClient: HttpClient, private sanitizer: DomSanitizer) {\n this.form.valueChanges.subscribe((x: IconRefFormValue) => {\n this.iconRef = iconRefForFormValue(x)\n this.onChange(this.iconRef)\n })\n }\n\n registerOnValidatorChange?(fn: () => void): void {\n this.onValidatorChange = fn\n }\n\n ngOnChanges(changes: SimpleChanges) { }\n\n ngOnDestroy() { }\n\n onSelectIcon() { }\n\n writeValue(iconRef: StaticIconReference): void {\n this.iconRef = iconRef\n const formValue = formValueForIconRef(iconRef)\n this.form.setValue(formValue, { emitEvent: false })\n this.resolveIconRef()\n }\n\n registerOnChange(fn: (x: StaticIconReference | null) => void): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n if (isDisabled) {\n this.form.disable()\n }\n else {\n this.form.enable()\n }\n }\n\n validate(control: AbstractControl): ValidationErrors {\n return this.form.errors\n }\n\n private resolveIconRef() {\n if (!this.iconRef) {\n this.icon = null\n return\n }\n this.iconService.fetchIconByReference(this.iconRef).subscribe(x => {\n this.icon = x\n if (!this.icon) {\n return\n }\n })\n }\n}\n\nenum IconRefType {\n Registered = 'id',\n SourceUrl = 'sourceUrl'\n}\n\ntype IconRefFormValue = {\n iconRefToken: string | null\n iconRefType: IconRefType | null\n}\n\nfunction iconRefForFormValue(x: IconRefFormValue): StaticIconReference | null {\n if (!x.iconRefType) {\n return null\n }\n switch (x.iconRefType) {\n case IconRefType.Registered:\n return { [IconRefType.Registered]: x.iconRefToken }\n case IconRefType.SourceUrl:\n return { [IconRefType.SourceUrl]: x.iconRefToken }\n default:\n throw new Error('invalid icon ref type: ' + x.iconRefToken)\n }\n}\n\nfunction formValueForIconRef(x: StaticIconReference | null): IconRefFormValue {\n if (!x) {\n return {\n iconRefType: null,\n iconRefToken: null\n }\n }\n let iconRefType: IconRefType | null = null\n let iconRefToken: string | null = null\n if (x.hasOwnProperty(IconRefType.Registered)) {\n iconRefType = IconRefType.Registered || null\n iconRefToken = x[IconRefType.Registered] || null\n }\n else if (x.hasOwnProperty(IconRefType.SourceUrl)) {\n iconRefType = IconRefType.SourceUrl || null\n iconRefToken = x[IconRefType.SourceUrl] || null\n }\n return {\n iconRefType,\n iconRefToken\n }\n}\n","<div [formGroup]=\"form\">\n <mage-xhr-img class=\"icon-image\" [src]=\"icon?.contentPath\"></mage-xhr-img>\n <input type=\"hidden\" formControlName=\"iconRefType\"/>\n <input type=\"hidden\" formControlName=\"iconRefToken\"/>\n</div>","import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { RegisteredStaticIconReference, contentPathOfIcon } from '../static-icon.model'\n\n@Component({\n selector: 'mage-static-icon-img',\n template: `<mage-xhr-img [src]=\"iconPath\"></mage-xhr-img>`,\n})\nexport class StaticIconImgComponent implements OnInit, OnChanges {\n\n @Input()\n iconRef: RegisteredStaticIconReference | string | null\n iconPath: string | null\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.iconRef) {\n if (this.iconRef) {\n this.iconPath = contentPathOfIcon(this.iconRef)\n }\n else {\n this.iconPath = null\n }\n }\n }\n}\n","<div class=\"icon-select\">\n <cdk-virtual-scroll-viewport [itemSize]=\"40\">\n <mat-card *cdkVirtualFor=\"let icon of icons\" class=icon-select-item>\n <mat-card-header>\n <mat-card-title>{{icon.title}}</mat-card-title>\n </mat-card-header>\n <img mat-card-img [src]=\"icon.path\" />\n </mat-card>\n </cdk-virtual-scroll-viewport>\n</div>\n<!--\n <button mat-button class=\"add__button\" type=\"button\" color=\"primary\" (click)=\"file.click()\">\n Upload Icon\n </button>\n <input [hidden]=\"true\" type=\"file\" #file multiple (change)=\"onAttachmentFile($event)\">\n-->","import { Component, OnInit } from '@angular/core'\nimport { PagingParameters, PagingDataSource } from '@ngageoint/mage.web-core-lib/paging'\nimport { StaticIcon } from '../static-icon.model'\nimport { StaticIconService } from '../static-icon.service'\n\nexport interface StaticIconSelectItem {\n id: string\n path: string\n title: string\n fileName: string\n}\n\n@Component({\n selector: 'static-icon-select',\n templateUrl: './static-icon-select.component.html',\n styleUrls: ['./static-icon-select.component.scss']\n})\nexport class StaticIconSelectComponent implements OnInit {\n\n icons: StaticIcon[] | null = null\n dataSource: PagingDataSource<StaticIcon>\n\n constructor(\n private iconService: StaticIconService\n ) {\n this.dataSource = new PagingDataSource<StaticIcon>(250, (paging: PagingParameters) => {\n return this.iconService.fetchIcons(paging)\n })\n }\n\n ngOnInit() {\n this.iconService.fetchIcons().subscribe(x => {\n this.icons = x.items\n })\n }\n\n onBrowseForUploadIcon() {\n throw new Error('unimplemented')\n }\n}\n\n","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatCardModule } from '@angular/material/card'\nimport { MageCommonModule } from '@ngageoint/mage.web-core-lib/common'\nimport { StaticIconFormFieldComponent } from './static-icon-form-field/static-icon-form-field.component'\nimport { StaticIconImgComponent } from './static-icon-img/static-icon-img.component'\nimport { StaticIconSelectComponent } from './static-icon-select/static-icon-select.component'\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatCardModule,\n MageCommonModule,\n ScrollingModule\n ],\n declarations: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ],\n exports: [\n StaticIconFormFieldComponent,\n StaticIconImgComponent,\n StaticIconSelectComponent,\n ]\n})\nexport class StaticIconModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵelement","i0.ɵɵelementEnd","i0.ɵɵproperty","i0.ɵɵadvance","i0.ɵɵtext","i0.ɵɵtextInterpolate","i0.ɵɵtemplate"],"mappings":";;;;;;;;;;;;MAqBa,iBAAiB,GAAG,CAAC,IAA6E;IAC7G,IAAI,CAAC,IAAI,EAAE;QACT,OAAM;KACP;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAA;KACf;IACD,OAAO,cAAc,IAAI,UAAU,CAAA;AACrC;;MCda,iBAAiB;IAE5B,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;KAAK;IAE9C,UAAU,CAAC,KAAiB;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAqB,QAAQ;YACzD,MAAM,KAAK,GAAiB,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4BAA4B;oBAC5B,sBAAsB;oBACtB,yBAAyB;iBAC1B;gBACD,OAAO,EAAE;oBACP,4BAA4B;oBAC5B,sBAAsB;oBACtB,yBAAyB;iBAC1B;aACF;;;AC9BD;;;;;;"}
@@ -15,15 +15,9 @@ import { Subject } from 'rxjs';
15
15
  import { distinctUntilChanged, debounceTime } from 'rxjs/operators';
16
16
 
17
17
  const USER_READ_BASE_URL = '/api/next-users';
18
- const reqKeys = {
19
- term: 'term',
20
- pageSize: 'page_size',
21
- pageIndex: 'page',
22
- includeTotalCount: 'total',
23
- };
24
18
  class UserReadService {
25
- constructor(http) {
26
- this.http = http;
19
+ constructor(webClient) {
20
+ this.webClient = webClient;
27
21
  }
28
22
  search(which) {
29
23
  const queryParams = {
@@ -36,7 +30,7 @@ class UserReadService {
36
30
  if (typeof which.includeTotalCount === 'boolean') {
37
31
  queryParams.total = which.includeTotalCount ? 'true' : 'false';
38
32
  }
39
- return this.http.get(`${USER_READ_BASE_URL}/search`, {
33
+ return this.webClient.get(`${USER_READ_BASE_URL}/search`, {
40
34
  params: queryParams
41
35
  });
42
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-user.js","sources":["ng://@ngageoint/mage.web-core-lib/user/user-read.service.ts","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.html","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.ts","ng://@ngageoint/mage.web-core-lib/user/user.module.ts","ng://@ngageoint/mage.web-core-lib/user/ngageoint-mage.web-core-lib-user.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http'\nimport { InjectionToken, Injectable } from '@angular/core'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { Observable } from 'rxjs'\nimport { User } from './user.model'\n\nexport const USER_READ_BASE_URL = '/api/next-users'\n\ntype SearchQueryParams = {\n page_size: string,\n page: string,\n term?: string,\n total?: 'true' | 'false'\n}\n\nconst reqKeys: { [SearchParamKey in keyof UserSearchParams]: string } = {\n term: 'term',\n pageSize: 'page_size',\n pageIndex: 'page',\n includeTotalCount: 'total',\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UserReadService {\n\n constructor(private http: HttpClient) { }\n\n search(which: UserSearchParams): Observable<PageOf<UserSearchResult>> {\n const queryParams: SearchQueryParams = {\n page_size: String(which.pageSize),\n page: String(which.pageIndex),\n }\n if (typeof which.term === 'string') {\n queryParams.term = which.term\n }\n if (typeof which.includeTotalCount === 'boolean') {\n queryParams.total = which.includeTotalCount ? 'true' : 'false'\n }\n return this.http.get<PageOf<UserSearchResult>>(`${USER_READ_BASE_URL}/search`, {\n params: queryParams\n })\n }\n}\n\nexport interface UserSearchParams extends PagingParameters {\n term?: string | null | undefined\n}\n\nexport type UserSearchResult = Pick<User, 'id' | 'username' | 'displayName' | 'email' | 'active' | 'enabled'> & {\n /**\n * A reduction of all the phone numbers to a single string\n */\n allPhones?: string | null | undefined\n}\n\nexport const USER_READ_SERVICE = new InjectionToken<UserReadService>('UserReadService')","<ng-select [items]=\"users\"\n [typeahead]=\"searchTerm$\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n [trackByFn]=\"trackByUserId\"\n appendTo=\"body\"\n placeholder=\"Choose a user\"\n bindLabel=\"displayName\"\n (open)=\"onOpen()\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\">{{totalCount}} matching users</small>\n </ng-template>\n <ng-template class=\"user-option\" ng-option-tmp let-user=\"item\" let-index=\"index\">\n <div class=\"user-option\">\n <p class=\"user-option__line primary\">{{user.displayName}} ({{user.username}})</p>\n <p class=\"user-option__line detail\">{{user.email || '[no email]'}}</p>\n <p class=\"user-option__line detail\">{{user.allPhones || '[no phone]'}}</p>\n </div>\n </ng-template>\n</ng-select>\n","import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, ViewChild, forwardRef, OnInit } from '@angular/core'\nimport { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { NgSelectComponent } from '@ng-select/ng-select'\nimport { User } from '../user.model'\nimport { UserReadService, UserSearchParams, UserSearchResult } from '../user-read.service'\nimport { pageForItemIndex, itemRangeOfPage } from '@ngageoint/mage.web-core-lib/paging'\nimport { Subject, BehaviorSubject, SubscriptionLike, Unsubscribable } from 'rxjs'\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators'\nimport { X } from '@angular/cdk/keycodes'\n\n@Component({\n selector: 'mage-user-select',\n templateUrl: './user-select.component.html',\n styleUrls: [\n './user-select.component.scss'\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: forwardRef(() => UserSelectComponent)\n }\n ]\n})\nexport class UserSelectComponent implements OnInit, OnChanges, AfterViewInit, ControlValueAccessor {\n\n readonly baseFindParams: Readonly<UserSearchParams> = Object.freeze({\n pageSize: 100,\n pageIndex: 0,\n term: null\n })\n readonly nextPageScrollThreshold = 15\n readonly searchTermDebounceTime = 500\n readonly trackByUserId: (x: User) => User['id'] = x => x.id\n get loading(): boolean {\n return !!this.currentFetch && !this.currentFetch.closed\n }\n\n users: UserSearchResult[] = []\n totalCount = 0\n searchTerm$ = new Subject<string | null>()\n currentSearchTerm: string | null = null\n @ViewChild(NgSelectComponent, { static: true })\n userSelect: NgSelectComponent\n\n private currentFetch: SubscriptionLike | null = null\n\n constructor(private userService: UserReadService) { }\n\n ngOnInit() {\n this.searchTerm$.pipe(\n distinctUntilChanged(),\n debounceTime(this.searchTermDebounceTime),\n )\n .subscribe(x => {\n this.currentSearchTerm = x\n this.users = []\n this.totalCount = 0\n if (this.currentFetch) {\n this.currentFetch.unsubscribe()\n this.currentFetch = null\n }\n this.fetchNextPage()\n })\n }\n\n ngOnChanges(changes: SimpleChanges) {\n }\n\n ngAfterViewInit() {\n }\n\n writeValue(x: User | null): void {\n this.userSelect.writeValue(x)\n }\n\n registerOnChange(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnChange(fn)\n }\n\n registerOnTouched(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnTouched(fn)\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.userSelect.setDisabledState(isDisabled)\n }\n\n onOpen() {\n if (this.users.length === 0) {\n this.fetchNextPage()\n }\n }\n\n onScroll({ end }: { start: number, end: number }) {\n if (end < this.users.length - this.nextPageScrollThreshold || this.users.length === this.totalCount) {\n return\n }\n this.fetchNextPage()\n }\n\n onScrollToEnd() {\n\n }\n\n fetchNextPage() {\n if (this.currentFetch) {\n if (this.currentFetch.closed) {\n this.currentFetch = null\n }\n else {\n return\n }\n }\n const nextPage = pageForItemIndex(this.users.length, this.baseFindParams.pageSize)\n const findParams: UserSearchParams = {\n ...this.baseFindParams,\n pageIndex: nextPage\n }\n if (this.currentSearchTerm) {\n findParams.term = this.currentSearchTerm\n }\n this.currentFetch = this.userService.search(findParams).subscribe(page => {\n this.users = this.users.concat(page.items)\n if (typeof page.totalCount === 'number') {\n this.totalCount = page.totalCount\n }\n })\n }\n}","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatAutocompleteModule } from '@angular/material/autocomplete'\nimport { MatDialogModule } from '@angular/material/dialog'\nimport { MatFormFieldModule } from '@angular/material/form-field'\nimport { MatInputModule } from '@angular/material/input'\nimport { MatListModule } from '@angular/material/list'\nimport { MatSelectModule } from '@angular/material/select'\nimport { UserSelectComponent } from './user-select/user-select.component'\nimport { NgSelectModule } from '@ng-select/ng-select'\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n ScrollingModule,\n MatAutocompleteModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule,\n MatListModule,\n MatSelectModule,\n NgSelectModule,\n ],\n declarations: [\n UserSelectComponent\n ],\n exports: [\n UserSelectComponent\n ]\n})\nexport class MageUserModule {\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵtext","i0.ɵɵelementEnd","i0.ɵɵadvance","i0.ɵɵtextInterpolate1","i0.ɵɵtextInterpolate2","i0.ɵɵtextInterpolate","i0.ɵɵlistener","i0.ɵɵtemplate","i0.ɵɵproperty"],"mappings":";;;;;;;;;;;;;;;;MAMa,kBAAkB,GAAG,kBAAiB;AASnD,MAAM,OAAO,GAA2D;IACtE,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,MAAM;IACjB,iBAAiB,EAAE,OAAO;CAC3B,CAAA;MAKY,eAAe;IAE1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;KAAK;IAEzC,MAAM,CAAC,KAAuB;QAC5B,MAAM,WAAW,GAAsB;YACrC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;SAC9B,CAAA;QACD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YAClC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;SAC9B;QACD,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,SAAS,EAAE;YAChD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAA;SAC/D;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA2B,GAAG,kBAAkB,SAAS,EAAE;YAC7E,MAAM,EAAE,WAAW;SACpB,CAAC,CAAA;KACH;;8EAlBU,eAAe;oDAAf,eAAe,WAAf,eAAe,mBAFd,MAAM;+CAEP,eAAe;cAH3B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;MAiCY,iBAAiB,GAAG,IAAI,cAAc,CAAkB,iBAAiB;;;IC5ClFA,6BAAo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iB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;MCRnC,cAAc;;+CAAd,cAAc;wGAAd,cAAc,kBApBhB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,eAAe;YACf,qBAAqB;YACrB,eAAe;YACf,kBAAkB;YAClB,cAAc;YACd,aAAa;YACb,eAAe;YACf,cAAc;SACf;qFAQU,cAAc,mBANvB,mBAAmB,aAbnB,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,aAAa;QACb,eAAe;QACf,cAAc,aAMd,mBAAmB;+CAGV,cAAc;cArB1B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,eAAe;oBACf,qBAAqB;oBACrB,eAAe;oBACf,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,mBAAmB;iBACpB;aACF;;;ACjCD;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-user.js","sources":["ng://@ngageoint/mage.web-core-lib/user/user-read.service.ts","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.html","ng://@ngageoint/mage.web-core-lib/user/user-select/user-select.component.ts","ng://@ngageoint/mage.web-core-lib/user/user.module.ts","ng://@ngageoint/mage.web-core-lib/user/ngageoint-mage.web-core-lib-user.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http'\nimport { InjectionToken, Injectable } from '@angular/core'\nimport { PageOf, PagingParameters } from '@ngageoint/mage.web-core-lib/paging'\nimport { Observable } from 'rxjs'\nimport { User } from './user.model'\n\nexport const USER_READ_BASE_URL = '/api/next-users'\n\ntype SearchQueryParams = {\n page_size: string,\n page: string,\n term?: string,\n total?: 'true' | 'false'\n}\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UserReadService {\n\n constructor(private webClient: HttpClient) { }\n\n search(which: UserSearchParams): Observable<PageOf<UserSearchResult>> {\n const queryParams: SearchQueryParams = {\n page_size: String(which.pageSize),\n page: String(which.pageIndex),\n }\n if (typeof which.term === 'string') {\n queryParams.term = which.term\n }\n if (typeof which.includeTotalCount === 'boolean') {\n queryParams.total = which.includeTotalCount ? 'true' : 'false'\n }\n return this.webClient.get<PageOf<UserSearchResult>>(`${USER_READ_BASE_URL}/search`, {\n params: queryParams\n })\n }\n}\n\nexport interface UserSearchParams extends PagingParameters {\n term?: string | null | undefined\n}\n\nexport type UserSearchResult = Pick<User, 'id' | 'username' | 'displayName' | 'email' | 'active' | 'enabled'> & {\n /**\n * A reduction of all the phone numbers to a single string\n */\n allPhones?: string | null | undefined\n}\n\nexport const USER_READ_SERVICE = new InjectionToken<UserReadService>('UserReadService')","<ng-select [items]=\"users\"\n [typeahead]=\"searchTerm$\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n [trackByFn]=\"trackByUserId\"\n appendTo=\"body\"\n placeholder=\"Choose a user\"\n bindLabel=\"displayName\"\n (open)=\"onOpen()\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\">{{totalCount}} matching users</small>\n </ng-template>\n <ng-template class=\"user-option\" ng-option-tmp let-user=\"item\" let-index=\"index\">\n <div class=\"user-option\">\n <p class=\"user-option__line primary\">{{user.displayName}} ({{user.username}})</p>\n <p class=\"user-option__line detail\">{{user.email || '[no email]'}}</p>\n <p class=\"user-option__line detail\">{{user.allPhones || '[no phone]'}}</p>\n </div>\n </ng-template>\n</ng-select>\n","import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, ViewChild, forwardRef, OnInit } from '@angular/core'\nimport { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { NgSelectComponent } from '@ng-select/ng-select'\nimport { User } from '../user.model'\nimport { UserReadService, UserSearchParams, UserSearchResult } from '../user-read.service'\nimport { pageForItemIndex, itemRangeOfPage } from '@ngageoint/mage.web-core-lib/paging'\nimport { Subject, BehaviorSubject, SubscriptionLike, Unsubscribable } from 'rxjs'\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators'\nimport { X } from '@angular/cdk/keycodes'\n\n@Component({\n selector: 'mage-user-select',\n templateUrl: './user-select.component.html',\n styleUrls: [\n './user-select.component.scss'\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: forwardRef(() => UserSelectComponent)\n }\n ]\n})\nexport class UserSelectComponent implements OnInit, OnChanges, AfterViewInit, ControlValueAccessor {\n\n readonly baseFindParams: Readonly<UserSearchParams> = Object.freeze({\n pageSize: 100,\n pageIndex: 0,\n term: null\n })\n readonly nextPageScrollThreshold = 15\n readonly searchTermDebounceTime = 500\n readonly trackByUserId: (x: User) => User['id'] = x => x.id\n get loading(): boolean {\n return !!this.currentFetch && !this.currentFetch.closed\n }\n\n users: UserSearchResult[] = []\n totalCount = 0\n searchTerm$ = new Subject<string | null>()\n currentSearchTerm: string | null = null\n @ViewChild(NgSelectComponent, { static: true })\n userSelect: NgSelectComponent\n\n private currentFetch: SubscriptionLike | null = null\n\n constructor(private userService: UserReadService) { }\n\n ngOnInit() {\n this.searchTerm$.pipe(\n distinctUntilChanged(),\n debounceTime(this.searchTermDebounceTime),\n )\n .subscribe(x => {\n this.currentSearchTerm = x\n this.users = []\n this.totalCount = 0\n if (this.currentFetch) {\n this.currentFetch.unsubscribe()\n this.currentFetch = null\n }\n this.fetchNextPage()\n })\n }\n\n ngOnChanges(changes: SimpleChanges) {\n }\n\n ngAfterViewInit() {\n }\n\n writeValue(x: User | null): void {\n this.userSelect.writeValue(x)\n }\n\n registerOnChange(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnChange(fn)\n }\n\n registerOnTouched(fn: (...args: any[]) => any): void {\n this.userSelect.registerOnTouched(fn)\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.userSelect.setDisabledState(isDisabled)\n }\n\n onOpen() {\n if (this.users.length === 0) {\n this.fetchNextPage()\n }\n }\n\n onScroll({ end }: { start: number, end: number }) {\n if (end < this.users.length - this.nextPageScrollThreshold || this.users.length === this.totalCount) {\n return\n }\n this.fetchNextPage()\n }\n\n onScrollToEnd() {\n\n }\n\n fetchNextPage() {\n if (this.currentFetch) {\n if (this.currentFetch.closed) {\n this.currentFetch = null\n }\n else {\n return\n }\n }\n const nextPage = pageForItemIndex(this.users.length, this.baseFindParams.pageSize)\n const findParams: UserSearchParams = {\n ...this.baseFindParams,\n pageIndex: nextPage\n }\n if (this.currentSearchTerm) {\n findParams.term = this.currentSearchTerm\n }\n this.currentFetch = this.userService.search(findParams).subscribe(page => {\n this.users = this.users.concat(page.items)\n if (typeof page.totalCount === 'number') {\n this.totalCount = page.totalCount\n }\n })\n }\n}","import { ScrollingModule } from '@angular/cdk/scrolling'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { MatAutocompleteModule } from '@angular/material/autocomplete'\nimport { MatDialogModule } from '@angular/material/dialog'\nimport { MatFormFieldModule } from '@angular/material/form-field'\nimport { MatInputModule } from '@angular/material/input'\nimport { MatListModule } from '@angular/material/list'\nimport { MatSelectModule } from '@angular/material/select'\nimport { UserSelectComponent } from './user-select/user-select.component'\nimport { NgSelectModule } from '@ng-select/ng-select'\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n ScrollingModule,\n MatAutocompleteModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule,\n MatListModule,\n MatSelectModule,\n NgSelectModule,\n ],\n declarations: [\n UserSelectComponent\n ],\n exports: [\n UserSelectComponent\n ]\n})\nexport class MageUserModule {\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵtext","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QU,cAAc,mBANvB,mBAAmB,aAbnB,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,aAAa;QACb,eAAe;QACf,cAAc,aAMd,mBAAmB;+CAGV,cAAc;cArB1B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,eAAe;oBACf,qBAAqB;oBACrB,eAAe;oBACf,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,mBAAmB;iBACpB;aACF;;;ACjCD;;;;;;"}
@@ -32,9 +32,9 @@ var OBJECT_URL_SERVICE = new InjectionToken(selector + ".objectUrlService");
32
32
  * URLs for the image data, preventing memory leaks.
33
33
  */
34
34
  var XhrImgComponent = /** @class */ (function () {
35
- function XhrImgComponent(objectUrlService, http, sanitizer) {
35
+ function XhrImgComponent(objectUrlService, webClient, sanitizer) {
36
36
  this.objectUrlService = objectUrlService;
37
- this.http = http;
37
+ this.webClient = webClient;
38
38
  this.sanitizer = sanitizer;
39
39
  this.sourceUrl = null;
40
40
  this.safeBlobUrl = null;
@@ -51,7 +51,7 @@ var XhrImgComponent = /** @class */ (function () {
51
51
  if (!this.sourceUrl) {
52
52
  return;
53
53
  }
54
- this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })
54
+ this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })
55
55
  .subscribe(function (x) {
56
56
  _this.objectUrlService.revokeObjectURL(_this.blobUrl);
57
57
  _this.blobUrl = _this.objectUrlService.createObjectURL(x);
@@ -1 +1 @@
1
- {"version":3,"file":"ngageoint-mage.web-core-lib-common.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts","ng://@ngageoint/mage.web-core-lib/common/ngageoint-mage.web-core-lib-common.ts"],"sourcesContent":["import { Component, ElementRef, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private http: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.http.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy() {\n this.disposeCurrent()\n }\n\n onImgLoad() {\n this.disposeCurrent()\n }\n\n private disposeCurrent() {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute"],"mappings":";;;;AAKA,IAAM,QAAQ,GAAG,cAAc,CAAA;IAYlB,kB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AChB,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACpD;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;SAChC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB;kFA9CU,eAAe,oBASN,kBAAkB;qDAT3B,eAAe,4GAPf;gBACT;oBACE,OAAO,EAAE,kBAAkB;oBAC3B,QAAQ,EAAE,GAAG;iBACd;aACF;YAPUA,2BAAoD;YAAtBC,oFAAQ,eAAW,IAAC;YAAlDC,cAAoD;;YAA/CC,kDAAwB;;0BAhD1C;CA8CA,IA0DC;+CA/CY,eAAe;cAX3B,SAAS;eAAC;gBACT,QAAQ,EAAE,KAAG,QAAU;gBACvB,QAAQ,EAAE,0DAAsD;gBAChE,MAAM,EAAE,CAAE,mCAAmC,CAAE;gBAC/C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,kBAAkB;wBAC3B,QAAQ,EAAE,GAAG;qBACd;iBACF;aACF;;sBAUc,MAAM;uBAAC,kBAAkB;;kBAPrC,KAAK;mBAAC,KAAK;;;;ICvDd;KAWgC;qDAAnB,gBAAgB;gHAAhB,gBAAgB,kBAVlB;gBACP,aAAa;aACd;2BAPH;CAIA,IAWgC;qFAAnB,gBAAgB,mBANzB,eAAe,aAHf,aAAa,aAMb,eAAe;+CAGN,gBAAgB;cAX5B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,aAAa;iBACd;gBACD,YAAY,EAAE;oBACZ,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,eAAe;iBAChB;aACF;;;ACdD;;;;;;"}
1
+ {"version":3,"file":"ngageoint-mage.web-core-lib-common.js","sources":["ng://@ngageoint/mage.web-core-lib/common/xhr-img.component.ts","ng://@ngageoint/mage.web-core-lib/common/mage-common.module.ts","ng://@ngageoint/mage.web-core-lib/common/ngageoint-mage.web-core-lib-common.ts"],"sourcesContent":["import { Component, Inject, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser'\nimport { Subscription } from 'rxjs'\n\nconst selector = 'mage-xhr-img'\n\n/**\n * This is a simple interface that includes the [methods](https://www.w3.org/TR/FileAPI/#creating-revoking)\n * from the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) for\n * managing blob URLs. This allows a service to be injected into\n * `XhrImgComponent` and overridden for testing.\n */\nexport interface ObjectUrlService {\n createObjectURL: (typeof URL)['createObjectURL']\n revokeObjectURL: (typeof URL)['revokeObjectURL']\n}\nexport const OBJECT_URL_SERVICE = new InjectionToken<ObjectUrlService>(`${selector}.objectUrlService`)\n\n/**\n * This component allows fetching images by `XMLHttpRequest` rather than the\n * browser's native mechanism. These image requests are subject to HTTP\n * interceptors that can add authorization headers to the request instead of\n * using cache-defeating URL query parameters to set an auth token. Applying\n * headers to the browser's native `img` requests is impossible, so a query\n * parameter is necessary for authorization, but adding the parameter to the\n * URL effectively bypasses the browser's caching mechanism when the auth token\n * changes for images that\n * should otherwise be subject to caching.\n *\n * The catch to fetching images by XHR is the response must be fetched as a\n * `Blob`. The user then gets a browser-specific URL for the blob by\n * `URL.createObjectURL(blob)`, which can then be assigned to the `src`\n * attribute of an `img` tag. These blob URLs must then be \"revoked\" by\n * `URL.revokeObjectURL(url)` in order to reclaim object URL's associated\n * resources. See [Mozilla's docs](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#example_using_object_urls_to_display_images)\n * on the subject.\n *\n * To use the component, simply add the tag to a template and bind the `src`\n * attribute to the source URL of the desired image.\n * ```\n * <mage-xhr-img [src]=\"someComponent.imageUrlRequiresAuth\"></mage-xhr-img>\n * ```\n * The component encapsulates the logic of creating and releasing the object\n * URLs for the image data, preventing memory leaks.\n */\n@Component({\n selector: `${selector}`,\n template: `<img [attr.src]=\"safeBlobUrl\" (load)=\"onImgLoad()\"/>`,\n styles: [ `img { height: 100%; width: 100% }` ],\n providers: [\n {\n provide: OBJECT_URL_SERVICE,\n useValue: URL\n }\n ]\n})\nexport class XhrImgComponent implements OnChanges, OnDestroy {\n\n @Input('src')\n sourceUrl: string | null = null\n safeBlobUrl: SafeUrl | null = null\n\n private blobUrl: string\n private subscription: Subscription\n\n constructor(@Inject(OBJECT_URL_SERVICE) private objectUrlService: ObjectUrlService, private webClient: HttpClient, private sanitizer: DomSanitizer) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!changes.sourceUrl) {\n return\n }\n if (changes.sourceUrl.isFirstChange() && !this.sourceUrl) {\n return\n }\n this.disposeCurrent()\n if (!this.sourceUrl) {\n return\n }\n this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })\n .subscribe(x => {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n this.blobUrl = this.objectUrlService.createObjectURL(x)\n this.safeBlobUrl = this.sanitizer.bypassSecurityTrustUrl(this.blobUrl)\n })\n }\n\n ngOnDestroy(): void {\n this.disposeCurrent()\n }\n\n onImgLoad(): void {\n this.disposeCurrent()\n }\n\n private disposeCurrent(): void {\n if (this.blobUrl) {\n this.objectUrlService.revokeObjectURL(this.blobUrl)\n }\n if (this.subscription) {\n this.subscription.unsubscribe()\n }\n this.blobUrl = null\n }\n}","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { XhrImgComponent } from './xhr-img.component'\n\n@NgModule({\n imports: [\n BrowserModule\n ],\n declarations: [\n XhrImgComponent\n ],\n exports: [\n XhrImgComponent\n ]\n})\nexport class MageCommonModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵattribute"],"mappings":";;;;AAKA,IAAM,QAAQ,GAAG,cAAc,CAAA;IAYlB,kBAAkB,GAAG,IAAI,cAAc,CAAsB,QAAQ,sBAAm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AAI,CAAC,OAAO,CAAC,CAAA;SACpD;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;SAChC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB;kFA9CU,eAAe,oBASN,kBAAkB;qDAT3B,eAAe,4GAPf;gBACT;oBACE,OAAO,EAAE,kBAAkB;oBAC3B,QAAQ,EAAE,GAAG;iBACd;aACF;YAPUA,2BAAoD;YAAtBC,oFAAQ,eAAW,IAAC;YAAlDC,cAAoD;;YAA/CC,kDAAwB;;0BAhD1C;CA8CA,IA0DC;+CA/CY,eAAe;cAX3B,SAAS;eAAC;gBACT,QAAQ,EAAE,KAAG,QAAU;gBACvB,QAAQ,EAAE,0DAAsD;gBAChE,MAAM,EAAE,CAAE,mCAAmC,CAAE;gBAC/C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,kBAAkB;wBAC3B,QAAQ,EAAE,GAAG;qBACd;iBACF;aACF;;sBAUc,MAAM;uBAAC,kBAAkB;;kBAPrC,KAAK;mBAAC,KAAK;;;;ICvDd;KAWgC;qDAAnB,gBAAgB;gHAAhB,gBAAgB,kBAVlB;gBACP,aAAa;aACd;2BAPH;CAIA,IAWgC;qFAAnB,gBAAgB,mBANzB,eAAe,aAHf,aAAa,aAMb,eAAe;+CAGN,gBAAgB;cAX5B,QAAQ;eAAC;gBACR,OAAO,EAAE;oBACP,aAAa;iBACd;gBACD,YAAY,EAAE;oBACZ,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,eAAe;iBAChB;aACF;;;ACdD;;;;;;"}
@@ -4,8 +4,8 @@ import { map } from 'rxjs/operators';
4
4
  import { HttpClient } from '@angular/common/http';
5
5
 
6
6
  var FeedService = /** @class */ (function () {
7
- function FeedService(http) {
8
- this.http = http;
7
+ function FeedService(webClient) {
8
+ this.webClient = webClient;
9
9
  // TODO: there is probably a better solution than maintaining this map here
10
10
  this._feeds = new BehaviorSubject([]);
11
11
  this.feeds = this._feeds.asObservable();
@@ -15,57 +15,57 @@ var FeedService = /** @class */ (function () {
15
15
  return this._feedItems.get(feedId).asObservable();
16
16
  };
17
17
  FeedService.prototype.fetchAllFeeds = function () {
18
- return this.http.get('/api/feeds/');
18
+ return this.webClient.get('/api/feeds/');
19
19
  };
20
20
  FeedService.prototype.fetchFeed = function (feedId) {
21
- return this.http.get("/api/feeds/" + feedId);
21
+ return this.webClient.get("/api/feeds/" + feedId);
22
22
  };
23
23
  FeedService.prototype.fetchService = function (serviceId) {
24
- return this.http.get("/api/feeds/services/" + serviceId);
24
+ return this.webClient.get("/api/feeds/services/" + serviceId);
25
25
  };
26
26
  FeedService.prototype.createService = function (service) {
27
- return this.http.post("/api/feeds/services", service);
27
+ return this.webClient.post("/api/feeds/services", service);
28
28
  };
29
29
  FeedService.prototype.fetchServices = function () {
30
- return this.http.get("/api/feeds/services");
30
+ return this.webClient.get("/api/feeds/services");
31
31
  };
32
32
  FeedService.prototype.fetchServiceFeeds = function (serviceId) {
33
- return this.http.get("/api/feeds/services/" + serviceId + "/feeds");
33
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/feeds");
34
34
  };
35
35
  FeedService.prototype.fetchServiceType = function (serviceTypeId) {
36
- return this.http.get("/api/feeds/service_types/" + serviceTypeId);
36
+ return this.webClient.get("/api/feeds/service_types/" + serviceTypeId);
37
37
  };
38
38
  FeedService.prototype.fetchTopics = function (serviceId) {
39
- return this.http.get("/api/feeds/services/" + serviceId + "/topics");
39
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/topics");
40
40
  };
41
41
  FeedService.prototype.previewFeed = function (serviceId, topicId, feedSpec, opts) {
42
42
  opts = opts || {};
43
43
  var skipContentFetch = opts.skipContentFetch === true;
44
- return this.http.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feed_preview?skip_content_fetch=" + skipContentFetch, { feed: feedSpec });
44
+ return this.webClient.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feed_preview?skip_content_fetch=" + skipContentFetch, { feed: feedSpec });
45
45
  };
46
46
  FeedService.prototype.fetchTopic = function (serviceId, topicId) {
47
- return this.http.get("/api/feeds/services/" + serviceId + "/topics/" + topicId);
47
+ return this.webClient.get("/api/feeds/services/" + serviceId + "/topics/" + topicId);
48
48
  };
49
49
  FeedService.prototype.fetchServiceTypes = function () {
50
- return this.http.get("/api/feeds/service_types");
50
+ return this.webClient.get("/api/feeds/service_types");
51
51
  };
52
52
  FeedService.prototype.createFeed = function (serviceId, topicId, feedConfiguration) {
53
- return this.http.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feeds", feedConfiguration);
53
+ return this.webClient.post("/api/feeds/services/" + serviceId + "/topics/" + topicId + "/feeds", feedConfiguration);
54
54
  };
55
55
  FeedService.prototype.updateFeed = function (feed) {
56
- return this.http.put("/api/feeds/" + feed.id, feed);
56
+ return this.webClient.put("/api/feeds/" + feed.id, feed);
57
57
  };
58
58
  FeedService.prototype.deleteFeed = function (feed) {
59
- return this.http.delete("/api/feeds/" + feed.id, { responseType: 'text' });
59
+ return this.webClient.delete("/api/feeds/" + feed.id, { responseType: 'text' });
60
60
  };
61
61
  FeedService.prototype.deleteService = function (service) {
62
62
  console.log('delete');
63
- return this.http.delete("/api/feeds/services/" + service.id, { responseType: 'text' });
63
+ return this.webClient.delete("/api/feeds/services/" + service.id, { responseType: 'text' });
64
64
  };
65
65
  FeedService.prototype.fetchFeeds = function (eventId) {
66
66
  var _this = this;
67
67
  var subject = new Subject();
68
- this.http.get("/api/events/" + eventId + "/feeds").subscribe(function (feeds) {
68
+ this.webClient.get("/api/events/" + eventId + "/feeds").subscribe(function (feeds) {
69
69
  feeds.map(function (feed) {
70
70
  feed.id = feed.id.toString();
71
71
  return feed;
@@ -84,7 +84,7 @@ var FeedService = /** @class */ (function () {
84
84
  };
85
85
  FeedService.prototype.fetchFeedItems = function (event, feed) {
86
86
  var feedItems = this._feedItems.get(feed.id);
87
- return this.http.post("/api/events/" + event.id + "/feeds/" + feed.id + "/content", {}).pipe(map(function (content) {
87
+ return this.webClient.post("/api/events/" + event.id + "/feeds/" + feed.id + "/content", {}).pipe(map(function (content) {
88
88
  var features = content.items.features;
89
89
  features.forEach(function (feature) {
90
90
  feature.id = String(feature.id);