@c8y/ngx-components 1021.22.116 → 1021.22.118

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.
@@ -2362,25 +2362,8 @@ class ApplicationPluginsComponent {
2362
2362
  this.allAvailablePlugins$
2363
2363
  ]).pipe(map(([remotePlugins, allPlugins]) => this.getInstalledPlugins(allPlugins, remotePlugins)), shareReplay(1));
2364
2364
  this.orphanedPlugins$ = this.installedPlugins$.pipe(map(plugins => plugins.filter(p => p.status === ApplicationPluginStatus.ORPHANED)));
2365
- this.isStandard$ = combineLatest([this.installedPlugins$, this.selfPlugins$]).pipe(map(([installedPlugins, selfPlugins]) => {
2366
- const manifestRemotes = this.app?.manifest?.remotes || {};
2367
- // ensure that every installed plugin is a self plugin or a plugin from the manifest
2368
- const allInstalledPluginsAreSelf = installedPlugins.every(p => selfPlugins.some(selfPlugin => selfPlugin.id === p.id) ||
2369
- (Array.isArray(manifestRemotes[p.contextPath]) &&
2370
- manifestRemotes[p.contextPath].includes(p.module)));
2371
- // ensure that every self plugin is installed
2372
- const allSelfPluginsAreInstalled = selfPlugins.every(selfPlugin => installedPlugins.some(p => p.id === selfPlugin.id));
2373
- const configRemotes = this.app?.config?.remotes || {};
2374
- // ensure that every remote from the manifest is in the config
2375
- // if no config exists we are also all good
2376
- const everyRemoteFromManifestIsInConfig = !this.app?.config?.remotes ||
2377
- Object.keys(manifestRemotes).every(contextPath => Array.isArray(configRemotes[contextPath]) &&
2378
- Array.isArray(manifestRemotes[contextPath]) &&
2379
- manifestRemotes[contextPath].every(module => configRemotes[contextPath].includes(module)));
2380
- return (allInstalledPluginsAreSelf &&
2381
- allSelfPluginsAreInstalled &&
2382
- everyRemoteFromManifestIsInConfig);
2383
- }));
2365
+ // only use the installedPlugins$ and selfPlugins$ as triggers
2366
+ this.isStandard$ = combineLatest([this.installedPlugins$, this.selfPlugins$]).pipe(map(() => this.isStandard(this.app)));
2384
2367
  this.title = gettext('Installed plugins');
2385
2368
  this.loadMoreItemsLabel = gettext('Load more packages');
2386
2369
  this.loadingItemsLabel = gettext('Loading packages…');
@@ -2608,6 +2591,43 @@ class ApplicationPluginsComponent {
2608
2591
  this.destroy$.next();
2609
2592
  this.destroy$.complete();
2610
2593
  }
2594
+ isStandard(app) {
2595
+ return (
2596
+ // ensure that every remote from the manifest is in the config
2597
+ this.everyRemoteFromManifestIsInConfig(app) &&
2598
+ // should not have any excluded remotes
2599
+ Object.keys(app?.config?.excludedRemotes || {}).length === 0 &&
2600
+ // ensure that every remote from the config is in the manifest
2601
+ this.everyRemoteFromConfigIsInManifest(app));
2602
+ }
2603
+ everyRemoteFromManifestIsInConfig(app) {
2604
+ const manifestRemotes = app?.manifest?.remotes;
2605
+ const configRemotes = app?.config?.remotes;
2606
+ if (!manifestRemotes || !configRemotes) {
2607
+ return true;
2608
+ }
2609
+ return Object.keys(manifestRemotes).every(contextPath => {
2610
+ return (Array.isArray(configRemotes[contextPath]) &&
2611
+ Array.isArray(manifestRemotes[contextPath]) &&
2612
+ manifestRemotes[contextPath].every(module => {
2613
+ return configRemotes[contextPath].includes(module);
2614
+ }));
2615
+ });
2616
+ }
2617
+ everyRemoteFromConfigIsInManifest(app) {
2618
+ const manifestRemotes = app?.manifest?.remotes || {};
2619
+ const configRemotes = app?.config?.remotes;
2620
+ if (!configRemotes) {
2621
+ return true;
2622
+ }
2623
+ return Object.keys(configRemotes).every(contextPath => {
2624
+ return (Array.isArray(configRemotes[contextPath]) &&
2625
+ Array.isArray(manifestRemotes[contextPath]) &&
2626
+ configRemotes[contextPath].every(module => {
2627
+ return manifestRemotes[contextPath].includes(module);
2628
+ }));
2629
+ });
2630
+ }
2611
2631
  addInstallButtonToHeaderActionControls() {
2612
2632
  if (this.appId) {
2613
2633
  this.headerActionControls = [
@@ -2655,8 +2675,8 @@ class ApplicationPluginsComponent {
2655
2675
  return this.app;
2656
2676
  }
2657
2677
  async getApplicationMFExports(app) {
2658
- const exports = this.pluginsService.getMFExports(app, [], true);
2659
- return exports;
2678
+ const applicationExports = this.pluginsService.getMFExports(app, [], true);
2679
+ return applicationExports;
2660
2680
  }
2661
2681
  async getApplicationMFRemotes(app) {
2662
2682
  const appConfigRemotes = this.pluginsService.getMFRemotes(app);