Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 5db9ac4

Browse files
DarpanLalaniSheethalJRYashPShah-swag
authored
2.1.1 release (#100)
* Non-working- upgraded with 1013 * initial commit * initial commit 2 * updated version and image fix * optimized AppService calls * updated with 1015 * updated with plugin support in widget catalog * Added validation for simulators * widget catalog upgraded to support plugins * reverted code in simulator manager service * ngx-echart added as part of app builder core build * Added plugin specific code changes in widget details component * plugin verfication feature implemented * Added progress indicator while installing,updating and deleting plugins * updated plugin verification logic * Hide progress modal after uninstall * upgraded timeout * updated delaytimeout * removed echart widget module * CSS Changes in widget catalog * Added pluginType entry in grid and list view, fixed simulator issue * Dashboard Catalog Changes to Support Plugins * Code changes w.r.t Plugin Install/Uninstall/Update * Lock Dashboard, Search Dashboard and Branding Issue related code changes * updated for seamless upgrade from 1.3.x to 1.4.x * updated package.json * updated with dev branch and verify widget update for seamless upgrade from 1.3.2 * Search Dashboard With Reordering Issue Fixed * Branding issue fixed * Lock Dashboard code issue fix * Lock Unlock icon css, branding issue fix when primary color is white * Drag and drop issue fixed * Drag and Drop issue fix on search * plugin installation * search dashboard issue fix and simulator code change to add required interval for new device * Branding issue w.r.t pagination * added overall progress bar and changed widget catalog to plugin catalog * updated with upgrade changes * updated with plugin message * added context-path condition to restict app builder upgrade notification * dashboard catalog changes * initial commit with version upgrade * 1.3.2 dev (#76) * updated with global role - poc * updated with global role implementation * updated dashboard catalog for role based access * updated with role base access for tab group and navigation dashboard * updated: removed console log * added role based access * updated simulator error message * added tree view for dashboard * added file for dahsboard hierarchy * Tree Structure Code Changes * CSS Changes w.r.t tree structure * Tree Structure css changes * Added CSS to show hide collapse button * bug fixed in group template * Tree Structure Code Changes * Tree Structure Code Changes * context-path app issue resolved * drag n drop issue solution * Code changes w.r.t Dashboard Structure * css changes w.r.t tree structure * updated with isDashboard flag * Code changes w.r.t tree structure * css changes in tree structure * update styling * update styling * Widget Details page issue fixed for Smart Map Widget * added expand all feature, fixed title and branding issue * fixed issue related to tree structure * installed new version of external assets binary * removed console log * Removed inline styles in dashboard config component Co-authored-by: Darpankumar Lalani <[email protected]> * updated with new plugin service api integration * updated readme for 1.3.2 release * updated readme * 1.3.2 dev (#77) * updated with global role - poc * updated with global role implementation * updated dashboard catalog for role based access * updated with role base access for tab group and navigation dashboard * updated: removed console log * added role based access * updated simulator error message * added tree view for dashboard * added file for dahsboard hierarchy * Tree Structure Code Changes * CSS Changes w.r.t tree structure * Tree Structure css changes * Added CSS to show hide collapse button * bug fixed in group template * Tree Structure Code Changes * Tree Structure Code Changes * context-path app issue resolved * drag n drop issue solution * Code changes w.r.t Dashboard Structure * css changes w.r.t tree structure * updated with isDashboard flag * Code changes w.r.t tree structure * css changes in tree structure * update styling * update styling * Widget Details page issue fixed for Smart Map Widget * added expand all feature, fixed title and branding issue * fixed issue related to tree structure * installed new version of external assets binary * removed console log * Removed inline styles in dashboard config component * Lock and unlock dashboard title change Co-authored-by: Darpankumar Lalani <[email protected]> * updated readme * 1.3.2 dev (#78) * updated with global role - poc * updated with global role implementation * updated dashboard catalog for role based access * updated with role base access for tab group and navigation dashboard * updated: removed console log * added role based access * updated simulator error message * added tree view for dashboard * added file for dahsboard hierarchy * Tree Structure Code Changes * CSS Changes w.r.t tree structure * Tree Structure css changes * Added CSS to show hide collapse button * bug fixed in group template * Tree Structure Code Changes * Tree Structure Code Changes * context-path app issue resolved * drag n drop issue solution * Code changes w.r.t Dashboard Structure * css changes w.r.t tree structure * updated with isDashboard flag * Code changes w.r.t tree structure * css changes in tree structure * update styling * update styling * Widget Details page issue fixed for Smart Map Widget * added expand all feature, fixed title and branding issue * fixed issue related to tree structure * installed new version of external assets binary * removed console log * Removed inline styles in dashboard config component * Lock and unlock dashboard title change * change in create dashboard Co-authored-by: Darpankumar Lalani <[email protected]> * updated version * updated for dev testing * update with remove unused binary and upgrade service merge fixed * Fixed issues * added code for c8y1015 compatibility * Reverted catalog name to widget catalog * external asset service updated simulator max restrctions added widget catalog no widgets message updated * updated error handling in template catalog json * code updated for preprod branch * Dynamic select of dev/preprod branch, css fix in widget catalog and edit dashboard issue fix * Upgraded c8y to 1016.0.93 * updated by removing basic auth in simulator * Fixed undefined error in Applications page * updated with subscribe tenant fix. error handling incase of widget is assigned to different tenant * updated message for subscribed app builder bug fix for app with context path icon * updated to 1016.0.109 * updated with selectable dashboard path * url modified for template details * added support for assets in dashboard catalog * updated error handling in verify plugin * Added Under Maintenance Code * Updated under maintenance check * 1.3.3 dev (#81) * 1.3.3 code changes * Updated check in under maintenance * Updated warning message w.r.t sub-tenant * reset config remotes while updating application * Updated c8y version to 1011.0.38 * Updated package version * Removed console logs * reverted console logs and removed commented code * change label * demo catalog multiple version support added * added support for multiple demo catalog version * added iscompatible check * Custom Branding and Branding Issue Code Changes * Changes in app list component * Fixed issue in verify widget compatibility method * Custom Branding issue fixed * Fixed Custom Branding Issue * Updated condition in findInstalledWidget method * RC flag removed * updated readme * Updated readme for 1.3.3 release * update implementation to get list of packages * Custom Branding Code Changes and fixed other issues * Code Changes w.r.t direct install of app builder from administration * Bug fix for app with context path (#83) * bug fix for app with context path * Changes while uninstalling widgets * Branding Issue fixed * App Builder Home page changes * Added await and changes while installing plugins * Changes in direct install of app builder * Changes in direct install method * added exception handling * added changes for clone app logic * Changes in app builder direct install * Default view changed to list view for dashboards * css issue fixed in list view * Improved simulator locking behaviour. Avoided lock check logic if there is no simulator created * White line branding issue and App builder direct install code fix * updated messaging text * Changes w.r.t app builder external assets * removed duplicate code * Branding Issue and Dashboard Config issue fixed * Dashboard General Code Changes * fix dashboard config issue * RC tag removed * updated based on latest changes in 2.0 * updated with label changed * 2.0.0 dev 1 (#87) * Compatible check added while installing widgets in direct install method * Fixed issues for lock/unlock tab navigator data explorer * Copy Clipboard Feature and Dark Theme Issue Fixed * added logic for indirect install for demo catalog widget * dark theme issue fixed * Updated Readme * updated readme * updated readme * Updated readme with how to sections * Updated document * branding issue of icons fixed, smart rules, alarms, data explorer fixed * Update README.md * updated readme * Updated readme --------- Co-authored-by: Darpankumar Lalani <[email protected]> * 2.0.0 dev 1 (#88) * Compatible check added while installing widgets in direct install method * Fixed issues for lock/unlock tab navigator data explorer * Copy Clipboard Feature and Dark Theme Issue Fixed * added logic for indirect install for demo catalog widget * dark theme issue fixed * Updated Readme * updated readme * updated readme * Updated readme with how to sections * Updated document * branding issue of icons fixed, smart rules, alarms, data explorer fixed * Update README.md * updated readme * Updated readme * search dashboard code changes --------- Co-authored-by: Darpankumar Lalani <[email protected]> * update packages * 2.0.0 dev 1 (#89) * Compatible check added while installing widgets in direct install method * Fixed issues for lock/unlock tab navigator data explorer * Copy Clipboard Feature and Dark Theme Issue Fixed * added logic for indirect install for demo catalog widget * dark theme issue fixed * Updated Readme * updated readme * updated readme * Updated readme with how to sections * Updated document * branding issue of icons fixed, smart rules, alarms, data explorer fixed * Update README.md * updated readme * Updated readme * search dashboard code changes * updated with condition --------- Co-authored-by: Sheethal JR <[email protected]> * Updated Readme * Updated readme * Updated with video link * 2.1.0 dev merge (#98) * Initial commit * updated simulators for styling * branding updates for 2.1.0 * #92,warning icon-mywidgests,default theme branding * issue #75- validating if simulator name exists * issue#74- forced min not to be greater than max * group template - Type support added * updated power by logo * fixed control by operation issue for browser based simulator * updated 1018.0.151 * default brand for custom styling is updated * added with Type option in dashboard catalog * code refactor * reverted to 1018.0.125 * widget catalog deprecation warning added * updated home screen * updated message * added ids for automation * device type added in simulator along with css and id changes for automation * globalpresales logo added for branding --------- Co-authored-by: YashPShah-swag <[email protected]> * updated image and css * updated version * Device availability issue fixed for browser based simulator * updated headers for simulator * updated endpoint urls * updated readme --------- Co-authored-by: Sheethal JR (SJR) <[email protected]> Co-authored-by: SheethalJR <[email protected]> Co-authored-by: Sheethal JR <[email protected]> Co-authored-by: YashPShah-swag <[email protected]>
1 parent 033e9ac commit 5db9ac4

14 files changed

+1582
-570
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Application Builder is an open-source tool for you to create web applications 
1111
* **Enhanced dashboard catalog:** Now you can create dashboard based on device group and asset/device type using pre-design dashboard templates.
1212
* **Dashboard catalog reloaded:** Experience the next level with our latest dashboard templates for Predictive Maintenance, Smart Field Services, and Smart Billing—Now with one-click Microservice installation!
1313
* **Enhanced Branding:** Various improvement in overall branding.
14-
* **Cumulocity upgrade:** Application Builder is now based on Cumulocity 1018.0.125
14+
* **Cumulocity upgrade:** Application Builder is now based on Cumulocity 1018.0.x
1515
* **Various bug fixes**
1616

1717
## Features
-21.6 KB
Binary file not shown.
21.5 KB
Binary file not shown.

builder/app-builder-upgrade/app-builder-upgrade.service.ts

Lines changed: 56 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { AppBuilderConfig, VersionInfo } from "./app-builder-upgrade.model";
3333
import { AppIdService } from "../app-id.service";
3434
import { catchError, delay, first } from "rxjs/operators";
3535
import * as semver from "semver";
36-
import { IApplication } from "@c8y/client";
36+
import { FetchClient, IApplication } from "@c8y/client";
3737
import * as _ from 'lodash';
3838
import { WidgetCatalogService } from "./../widget-catalog/widget-catalog.service";
3939
import { WidgetCatalog, WidgetModel } from "./../widget-catalog/widget-catalog.model";
@@ -62,25 +62,44 @@ export class AppBuilderUpgradeService {
6262
public appVersion: string = appVersion;
6363
public newVersion: boolean = false;
6464
public errorReported = false;
65+
private readonly CUMULOCITY_COMMUNITY_MS_HEALTH_URL = '/service/c8y-community-utils/health';
6566

6667
constructor(private http: HttpClient, public rendererFactory: RendererFactory2, @Inject(DOCUMENT) private _document: Document,
67-
private modalService: BsModalService, private progressIndicatorService: ProgressIndicatorService,
68+
private modalService: BsModalService, private progressIndicatorService: ProgressIndicatorService, private client: FetchClient,
6869
private appService: ApplicationService, private externalService: AppBuilderExternalAssetsService,
6970
private settingService: SettingsService, private userService: UserService, private appStateService: AppStateService,
70-
appIdService: AppIdService, private alertService: AlertService, private widgetCatalogService: WidgetCatalogService) {
71-
this.GATEWAY_URL_GitHubAsset = this.externalService.getURL('GITHUB', 'gatewayURL_GitHubAsset');
71+
private appIdService: AppIdService, private alertService: AlertService, private widgetCatalogService: WidgetCatalogService) {
72+
73+
this.GATEWAY_URL_GitHubAsset = 'service/c8y-community-utils/githubAsset?path=';
74+
this.GATEWAY_URL_GitHubAPI_FallBack = this.externalService.getURL('GITHUB', 'gatewayURL_Github_Fallback');
7275
this.GATEWAY_URL_GitHubAPI = this.externalService.getURL('GITHUB', 'gatewayURL_Github');
73-
this.GATEWAY_URL_Labcase = this.externalService.getURL('DBCATALOG', 'gatewayURL');
76+
this.GATEWAY_URL_Labcase = 'service/c8y-community-utils/labcaseAsset?id=';
7477
this.GATEWAY_URL_GitHubAPI_FallBack = this.externalService.getURL('GITHUB', 'gatewayURL_Github_Fallback');
75-
this.GATEWAY_URL_GitHubAsset_FallBack = this.externalService.getURL('GITHUB', 'gatewayURL_GitHubAsset_Fallback');
76-
this.GATEWAY_URL_Labcase_FallBack = this.externalService.getURL('DBCATALOG', 'gatewayURL_Fallback');
78+
this.GATEWAY_URL_GitHubAsset_FallBack = 'service/c8y-community-utils/githubAsset?path=';
79+
this.GATEWAY_URL_Labcase_FallBack = 'service/c8y-community-utils/labcaseAsset?id=';
80+
7781

78-
appIdService.appIdDelayedUntilAfterLogin$.pipe(first()).subscribe(() => {
82+
// this.GATEWAY_URL_GitHubAsset = this.externalService.getURL('GITHUB', 'gatewayURL_GitHubAsset');
83+
// this.GATEWAY_URL_Labcase = this.externalService.getURL('DBCATALOG', 'gatewayURL');
84+
// this.GATEWAY_URL_GitHubAsset_FallBack = this.externalService.getURL('GITHUB', 'gatewayURL_GitHubAsset_Fallback');
85+
// this.GATEWAY_URL_Labcase_FallBack = this.externalService.getURL('DBCATALOG', 'gatewayURL_Fallback');
86+
87+
this.appIdService.appIdDelayedUntilAfterLogin$.pipe(first()).subscribe(() => {
7988
this.userHasAdminRights = userService.hasRole(appStateService.currentUser.value, "ROLE_APPLICATION_MANAGEMENT_ADMIN")
8089
this.appStateService.currentApplication.subscribe(app => {
8190
this.currentApp = app;
8291
this.verifyPlugins();
8392
});
93+
94+
this.getCumulocityCommunityMSHealth().then(response => {
95+
if(response && response.status === "UP") {
96+
this.appIdService.isCommunityMSExist = true;
97+
} else {
98+
this.appIdService.isCommunityMSExist = false;
99+
}
100+
}).catch(err => {
101+
this.appIdService.isCommunityMSExist = false;
102+
})
84103
});
85104
}
86105

@@ -235,14 +254,16 @@ export class AppBuilderUpgradeService {
235254
this.errorReported = true;
236255
return;
237256
}
257+
if(!this.appIdService.isCommunityMSExist) {
258+
this.widgetCatalogService.loadErrorMessageDialog();
259+
this.errorReported = true;
260+
return;
261+
}
238262
this.progressIndicatorService.setProgress(40);
239263
let appC8yJson;
240264
let binaryFile;
241265
try {
242-
const data: ArrayBuffer = await this.downloadBinary(binaryLocation, isGithub);
243-
const blob = new Blob([data], {
244-
type: 'application/zip'
245-
});
266+
const blob = await this.downloadBinary(binaryLocation, isGithub);
246267
binaryFile = new File([blob], fileName, { type: "'application/zip'" })
247268
this.progressIndicatorService.setProgress(50);
248269
this.progressIndicatorService.setProgress(60);
@@ -335,25 +356,24 @@ export class AppBuilderUpgradeService {
335356
});
336357
}
337358
}
338-
private downloadBinary(binaryId: string, isGithub: boolean): Promise<ArrayBuffer> {
339-
let url = `${this.GATEWAY_URL_GitHubAsset}${binaryId}`;
340-
if (!isGithub) {
341-
url = `${this.GATEWAY_URL_Labcase}${binaryId}`
359+
private async downloadBinary(binaryId: string, isGithub: boolean): Promise<any> {
360+
if(this.appIdService.isCommunityMSExist) {
361+
let url = `${this.GATEWAY_URL_GitHubAsset}${binaryId}`;
362+
if (!isGithub) {
363+
url = `${this.GATEWAY_URL_Labcase}${binaryId}`
364+
}
365+
const response = await this.client.fetch(`${url}`);
366+
if(response && response.ok) {
367+
return (await response.blob());
368+
} else {
369+
this.alertService.danger("Unable to download binary! Please try after sometime. If problem persists, please contact the administrator.");
370+
}
371+
372+
} else {
373+
this.hideProgressModalDialog();
374+
this.widgetCatalogService.loadErrorMessageDialog();
375+
342376
}
343-
return this.http.get(url, {
344-
responseType: 'arraybuffer'
345-
})
346-
.pipe(catchError(err => {
347-
console.log('App Builder Upgrade Binary: Error in primary endpoint! using fallback...');
348-
let url = `${this.GATEWAY_URL_GitHubAsset_FallBack}${binaryId}`;
349-
if (!isGithub) {
350-
url = `${this.GATEWAY_URL_Labcase_FallBack}${binaryId}`
351-
}
352-
return this.http.get(url, {
353-
responseType: 'arraybuffer'
354-
})
355-
}))
356-
.toPromise();
357377
}
358378

359379
fetchAppBuilderConfig(): Observable<AppBuilderConfig> {
@@ -443,22 +463,14 @@ export class AppBuilderUpgradeService {
443463
this.progressIndicatorService.setProgress(10);
444464
let binary = null;
445465
let fileName = '';
466+
let blob = null;
446467
if (pluginBinary.binaryLink && pluginBinary.binaryLink !== '') {
447-
binary = await new Promise(resolve => this.widgetCatalogService.downloadBinary(pluginBinary.binaryLink)
448-
.subscribe(binaryData => resolve(binaryData), error => {
449-
this.logError();
450-
})) as any;
468+
blob = await this.widgetCatalogService.downloadBinary(pluginBinary.binaryLink);
451469
fileName = pluginBinary.binaryLink.replace(/^.*[\\\/]/, '');
452470
} else {
453-
binary = await new Promise(resolve => this.widgetCatalogService.downloadBinaryFromLabcase(pluginBinary.link)
454-
.subscribe(binaryData => resolve(binaryData), error => {
455-
this.logError();
456-
})) as any;
471+
blob = await this.widgetCatalogService.downloadBinaryFromLabcase(pluginBinary.link)
457472
fileName = pluginBinary.fileName;
458473
}
459-
const blob = new Blob([binary], {
460-
type: 'application/zip'
461-
});
462474
const fileOfBlob = new File([blob], fileName);
463475
await this.widgetCatalogService.installPackage(fileOfBlob);
464476
appConfigUpdated = true;
@@ -617,4 +629,7 @@ export class AppBuilderUpgradeService {
617629
const major = '>=' + semver.major(widget.installedVersion) + '.0.0';
618630
return semver.satisfies(widget.version, major);
619631
}
632+
async getCumulocityCommunityMSHealth() {
633+
return (await (await this.client.fetch(`${this.CUMULOCITY_COMMUNITY_MS_HEALTH_URL}`)).json());
634+
}
620635
}

builder/app-id.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export class AppIdService {
3030
/** same as the appId$ but the value is pended until after the user logs in */
3131
readonly appIdDelayedUntilAfterLogin$: Observable<string|undefined>;
3232

33+
isCommunityMSExist = false;
34+
3335
constructor(router: Router, appStateService: AppStateService) {
3436
router.events.pipe(
3537
filter(event => event instanceof ActivationEnd),

builder/branding/standard-theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export function standardTheme(branding: any) {
9797
--c8y-component-spinner-color:${_lighter_text_Hex};
9898
--c8y-component-color-text-muted: ${_text_Hex};
9999
--c8y-component-background-hover: ${_lighter_primary_Hex_1_1};
100+
--c8y-dropdown-background-default: ${_lighter_primary_Hex};
100101
101102
--c8y-level-0: ${_lighter_primary_Hex};
102103
--c8y-level-1-custom: ${_lighter_primary_Hex_1_1};

builder/template-catalog/template-catalog.component.ts

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { DeviceSelectorModalComponent } from "../utils/device-selector-modal/dev
2222
import { BsModalRef, BsModalService } from "ngx-bootstrap/modal";
2323
import { DependencyDescription, TemplateCatalogEntry, TemplateDetails } from "./template-catalog.model";
2424
import { TemplateCatalogService } from "./template-catalog.service";
25-
import { AlertService, DynamicComponentDefinition, DynamicComponentService } from "@c8y/ngx-components";
25+
import { AlertService, DynamicComponentDefinition, DynamicComponentService, PluginsService } from "@c8y/ngx-components";
2626
import { Subject, Subscription, interval } from "rxjs";
2727
import { ProgressIndicatorModalComponent } from "../utils/progress-indicator-modal/progress-indicator-modal.component";
2828

@@ -31,6 +31,7 @@ import { catchError } from "rxjs/operators";
3131
import { AccessRightsService } from "../../builder/access-rights.service";
3232
import { ProgressIndicatorService } from "../../builder/utils/progress-indicator-modal/progress-indicator.service";
3333
import { ApplicationBinaryService } from "../../builder/application-binary.service";
34+
import { AlertMessageModalComponent } from "../../builder/utils/alert-message-modal/alert-message-modal.component";
3435

3536

3637
enum TemplateCatalogStep {
@@ -101,7 +102,7 @@ export class TemplateCatalogModalComponent implements OnInit {
101102
constructor(private modalService: BsModalService, private modalRef: BsModalRef, private appService: ApplicationService,
102103
private catalogService: TemplateCatalogService, private componentService: DynamicComponentService,
103104
private alertService: AlertService, private widgetCatalogService: WidgetCatalogService,
104-
private applicationBinaryService: ApplicationBinaryService,
105+
private applicationBinaryService: ApplicationBinaryService, private pluginsService: PluginsService,
105106
private accessRightsService: AccessRightsService, private progressIndicatorService: ProgressIndicatorService) {
106107
this.onSave = new Subject();
107108
this.onCancel = new Subject();
@@ -325,15 +326,13 @@ export class TemplateCatalogModalComponent implements OnInit {
325326
}
326327
});
327328
this.catalogService.downloadBinary(dependency.link)
328-
.subscribe(async data => {
329+
.then(async blob => {
329330
let createdApp = null;
330331
this.microserviceDownloadProgress$.unsubscribe();
331332
try {
332333
this.progressIndicatorService.setProgress(40);
333334
this.progressIndicatorService.setMessage(`Installing ${dependency.title}`);
334-
const blob = new Blob([data], {
335-
type: 'application/zip'
336-
});
335+
337336
const fileName = dependency.link.replace(/^.*[\\\/]/, '');
338337
const fileOfBlob = new File([blob], fileName);
339338

@@ -358,10 +357,15 @@ export class TemplateCatalogModalComponent implements OnInit {
358357
this.alertService.danger("There is some technical error! Please try after sometime.");
359358
console.error(ex.message);
360359
}
360+
}).catch(err => {
361+
this.hideProgressModalDialog();
362+
this.loadErrorMessageDialog();
361363
});
362364

363365
} else { // installing plugin
364-
const widgetBinaryFound = this.appList.find(app => app.manifest?.isPackage && (app.name.toLowerCase() === dependency.title?.toLowerCase() ||
366+
367+
const packageList = await this.pluginsService.listPackages();
368+
const widgetBinaryFound = packageList.find(app => (app.name.toLowerCase() === dependency.title?.toLowerCase() ||
365369
(app.contextPath && app.contextPath?.toLowerCase() === dependency?.contextPath?.toLowerCase())));
366370
this.showProgressModalDialog(`Installing ${dependency.title}`);
367371
this.progressIndicatorService.setProgress(10);
@@ -380,11 +384,8 @@ export class TemplateCatalogModalComponent implements OnInit {
380384
} else {
381385
this.progressIndicatorService.setProgress(10);
382386
this.catalogService.downloadBinary(dependency.link)
383-
.subscribe(data => {
387+
.then(blob => {
384388
this.progressIndicatorService.setProgress(20);
385-
const blob = new Blob([data], {
386-
type: 'application/zip'
387-
});
388389
const fileName = dependency.link.replace(/^.*[\\\/]/, '');
389390
const fileOfBlob = new File([blob], fileName);
390391
this.widgetCatalogService.installPackage(fileOfBlob).then(async () => {
@@ -396,6 +397,9 @@ export class TemplateCatalogModalComponent implements OnInit {
396397
this.alertService.danger("There is some technical error! Please try after sometime.");
397398
console.error(error);
398399
});
400+
}).catch(err => {
401+
this.hideProgressModalDialog();
402+
this.loadErrorMessageDialog();
399403
});
400404
}
401405
}
@@ -460,4 +464,19 @@ export class TemplateCatalogModalComponent implements OnInit {
460464
}
461465

462466
}
467+
private loadErrorMessageDialog() {
468+
const alertMessage = {
469+
title: 'Microservice needed!',
470+
description: `'Cumulocity Community Utils' microservice is not installed or subscribed. Please download the microservice, then install and subscribe to it by navigating to Administration -> Ecosystems -> Microservices. `,
471+
type: 'danger',
472+
externalLink: "https://labcase.softwareag.com/storage/d/a02221e54739758ccb1ab839ce09e2cc",
473+
externalLinkLabel: "Download the microservice now.",
474+
alertType: 'info' //info|confirm
475+
}
476+
this.alertModalDialog(alertMessage);
477+
}
478+
479+
alertModalDialog(message: any): BsModalRef {
480+
return this.modalService.show(AlertMessageModalComponent, { class: 'c8y-wizard', initialState: { message } });
481+
}
463482
}

0 commit comments

Comments
 (0)