@c8y/ngx-components 1022.4.3 → 1022.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/action/action.service.d.ts +1 -1
- package/core/action-bar/action-bar.service.d.ts +1 -1
- package/core/beta-feature/beta-preview.service.d.ts +1 -1
- package/core/breadcrumb/breadcrumb.service.d.ts +1 -1
- package/core/common/extension-hooks.d.ts +1 -1
- package/core/common/extension-hooks.d.ts.map +1 -1
- package/core/common/options.service.d.ts +1 -1
- package/core/common/service-registry.service.d.ts +2 -2
- package/core/common/service-registry.service.d.ts.map +1 -1
- package/core/common/ui-state.service.d.ts +3 -3
- package/core/data-grid/action-controls-extension.service.d.ts +1 -1
- package/core/data-grid/filter-chip/filter-mapper.factory.d.ts +1 -1
- package/core/docs/docs.models.d.ts +1 -1
- package/core/docs/docs.module.d.ts +1 -1
- package/core/docs/docs.service.d.ts +1 -1
- package/core/docs/docs.service.d.ts.map +1 -1
- package/core/docs/help-and-support-outlet/help-and-support-outlet.module.d.ts +1 -1
- package/core/docs/legal-notices-outlet/legal-notices-outlet.module.d.ts +1 -1
- package/core/docs/support-outlet/support-outlet.module.d.ts +1 -1
- package/core/drawer/drawer.service.d.ts +2 -2
- package/core/drawer/drawer.service.d.ts.map +1 -1
- package/core/dynamic-component/dynamic-component.model.d.ts +2 -2
- package/core/dynamic-component/dynamic-component.service.d.ts +1 -1
- package/core/dynamic-component/dynamic-component.service.d.ts.map +1 -1
- package/core/i18n/patterns-message.hook.d.ts +1 -1
- package/core/i18n/translation-loader.service.d.ts +1 -1
- package/core/i18n/translation-loader.service.d.ts.map +1 -1
- package/core/navigator/navigator-bottom/navigator-bottom.module.d.ts +1 -1
- package/core/navigator/navigator-top/navigator-top.module.d.ts +1 -1
- package/core/navigator/navigator.module.d.ts +1 -1
- package/core/navigator/navigator.service.d.ts +1 -1
- package/core/provider-configuration/provider-configuration-hook.d.ts +1 -1
- package/core/router/router.service.d.ts +2 -2
- package/core/router/router.service.d.ts.map +1 -1
- package/core/search/search.service.d.ts +2 -2
- package/core/search/search.service.d.ts.map +1 -1
- package/core/stepper/stepper.service.d.ts +2 -2
- package/core/stepper/stepper.service.d.ts.map +1 -1
- package/core/tabs/tabs.service.d.ts +1 -1
- package/core/ui-settings/ui-settings.module.d.ts +1 -1
- package/core/user/user-details-drawer/user-details-drawer.module.d.ts +1 -1
- package/core/user/user-menu.service.d.ts +2 -2
- package/core/user/user-menu.service.d.ts.map +1 -1
- package/core/user/user.module.d.ts +1 -1
- package/core/version/version.model.d.ts +1 -1
- package/core/version/version.module.d.ts +1 -1
- package/core/version/version.service.d.ts +1 -1
- package/core/version/version.service.d.ts.map +1 -1
- package/core/version/websdk-plugin-version.factory.d.ts +1 -1
- package/core/version/websdk-plugin-version.factory.d.ts.map +1 -1
- package/core/wizard/wizard.model.d.ts +1 -1
- package/core/wizard/wizard.service.d.ts +1 -1
- package/core/wizard/wizard.service.d.ts.map +1 -1
- package/device-parameters/index.d.ts +1 -1
- package/exports/index.d.ts +1 -1
- package/fesm2022/c8y-ngx-components.mjs +697 -697
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/remote-access/passthrough/index.d.ts +1 -1
- package/widgets/definitions/alarms/alarm-list/index.d.ts +1 -1
- package/widgets/definitions/alarms/all-critical-alarms/index.d.ts +1 -1
- package/widgets/definitions/alarms/recent-alarms/index.d.ts +1 -1
- package/widgets/definitions/applications/index.d.ts +1 -1
- package/widgets/definitions/asset-notes/index.d.ts +1 -1
- package/widgets/definitions/cockpit-legacy-welcome/index.d.ts +1 -1
- package/widgets/definitions/cockpit-welcome/index.d.ts +1 -1
- package/widgets/definitions/datapoints-graph/index.d.ts +1 -1
- package/widgets/definitions/datapoints-table/index.d.ts +1 -1
- package/widgets/definitions/device-control-message/index.d.ts +1 -1
- package/widgets/definitions/help-and-service/index.d.ts +1 -1
- package/widgets/definitions/html-widget/index.d.ts +1 -1
- package/widgets/definitions/image/index.d.ts +1 -1
- package/widgets/definitions/info-gauge/index.d.ts +1 -1
- package/widgets/definitions/kpi/index.d.ts +1 -1
- package/widgets/definitions/linear-gauge/index.d.ts +1 -1
- package/widgets/definitions/map/index.d.ts +1 -1
- package/widgets/definitions/markdown/index.d.ts +1 -1
- package/widgets/definitions/quick-links/index.d.ts +1 -1
- package/widgets/definitions/radial-gauge/index.d.ts +1 -1
- package/widgets/definitions/silo/index.d.ts +1 -1
- package/widgets/definitions/three-d-rotation/index.d.ts +1 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Input, Directive, Injectable,
|
|
2
|
+
import { Input, Directive, Injectable, Injector, InjectionToken, NgModuleRef, createNgModule, Optional, Inject, isDevMode, inject, Pipe, EventEmitter, NgModule, LOCALE_ID, EnvironmentInjector, createEnvironmentInjector, HostListener, Component, HostBinding, Output, forwardRef, DestroyRef, ViewChild, SecurityContext, TemplateRef, provideAppInitializer, Self, SkipSelf, Attribute, ContentChild, ViewContainerRef, ElementRef, ContentChildren, ViewChildren, createComponent, runInInjectionContext, importProvidersFrom, ChangeDetectionStrategy, SimpleChange, reflectComponentType, signal, effect, Type, computed, input, output } from '@angular/core';
|
|
3
3
|
import * as i1$3 from 'ngx-bootstrap/dropdown';
|
|
4
4
|
import { BsDropdownModule, BsDropdownDirective } from 'ngx-bootstrap/dropdown';
|
|
5
5
|
import { CdkTrapFocus, A11yModule } from '@angular/cdk/a11y';
|
|
6
|
-
import {
|
|
7
|
-
import { Subject, BehaviorSubject, ReplaySubject,
|
|
8
|
-
import { shareReplay, map
|
|
6
|
+
import { castArray, flatten, uniq, sortBy, groupBy, camelCase, isEqual, isUndefined, throttle as throttle$1, keys, get, isNaN as isNaN$1, isFinite, each, mapValues, mapKeys, forEach, assign, min, every, first, map as map$1, find, negate, upperFirst, memoize as memoize$1, property, some, entries, omitBy, isDate, pick, flatMap, orderBy, isEmpty, filter as filter$2, snakeCase, matches, escape, escapeRegExp, assignWith, set, toNumber, isEqualWith, clone, omit, cloneDeep, uniqBy, has, transform, identity, flow, findIndex as findIndex$1, isNil, chunk, values, union, without, indexOf, parseInt as parseInt$1, kebabCase, forOwn } from 'lodash-es';
|
|
7
|
+
import { Subject, BehaviorSubject, ReplaySubject, merge, of, defer, combineLatest, race, isObservable, from, NEVER, Observable, firstValueFrom, fromEvent, pipe, throwError, concat, map as map$2, filter as filter$1, tap as tap$1, fromEventPattern, startWith as startWith$1, switchMap as switchMap$1, distinctUntilChanged as distinctUntilChanged$1, takeUntil as takeUntil$1, empty, timer, forkJoin, interval, shareReplay as shareReplay$1, mergeMap as mergeMap$1 } from 'rxjs';
|
|
8
|
+
import { shareReplay, map, distinctUntilChanged, filter, startWith, switchMap, take, scan, debounceTime, share, takeUntil, tap, catchError, first as first$1, retryWhen, delay, concatMap, debounce, sample, withLatestFrom, mergeMap, every as every$1, toArray, merge as merge$1, expand, mapTo, skip, reduce, finalize, combineLatestWith } from 'rxjs/operators';
|
|
9
9
|
import * as i1 from '@c8y/client';
|
|
10
|
-
import {
|
|
10
|
+
import { OperationStatus, TenantLoginOptionType, UserManagementSource, GrantType, ApplicationType, BasicAuth, CookieAuth, Realtime, FetchClient, QueriesUtil, Client, PasswordStrength, ApplicationAvailability, InventoryService, AlarmService, TenantService, ApplicationService, UserService, aggregationType, Service, Paging, FeatureService } from '@c8y/client';
|
|
11
11
|
import { __decorate, __metadata } from 'tslib';
|
|
12
12
|
import * as i1$4 from '@angular/router';
|
|
13
13
|
import { NavigationEnd, RouterModule as RouterModule$1, NavigationStart, RouterLink, RouterLinkActive, RouterOutlet, ActivationEnd, PRIMARY_OUTLET, ActivatedRoute, ActivationStart, ChildActivationEnd, ROUTES, Router, NavigationCancel, NavigationError } from '@angular/router';
|
|
14
|
-
import { compare, coerce } from 'semver';
|
|
15
|
-
import { mergeRemotes, removeRemotes, TOKEN_KEY, TFATOKEN_KEY, getThemePreference, setThemePreference, applyTheme } from '@c8y/bootstrap';
|
|
16
14
|
import * as i4 from '@c8y/ngx-components/api';
|
|
17
15
|
import { DataModule } from '@c8y/ngx-components/api';
|
|
18
16
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
@@ -43,10 +41,12 @@ import * as i1$7 from 'ngx-bootstrap/modal';
|
|
|
43
41
|
import { ModalModule as ModalModule$1, BsModalRef } from 'ngx-bootstrap/modal';
|
|
44
42
|
import * as i1$8 from '@angular/forms';
|
|
45
43
|
import { FormsModule as FormsModule$1, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, CheckboxControlValueAccessor, FormControl, NgModel, FormControlName, ReactiveFormsModule, NgForm, ControlContainer, FormArray, NgControl, FormGroup, FormBuilder } from '@angular/forms';
|
|
44
|
+
import { TOKEN_KEY, TFATOKEN_KEY, getThemePreference, setThemePreference, applyTheme, mergeRemotes, removeRemotes } from '@c8y/bootstrap';
|
|
46
45
|
import * as i1$9 from 'ngx-bootstrap/popover';
|
|
47
46
|
import { PopoverModule, PopoverDirective } from 'ngx-bootstrap/popover';
|
|
48
47
|
import { parsePhoneNumberFromString } from 'libphonenumber-js/max';
|
|
49
48
|
import { QRCodeComponent } from 'angularx-qrcode';
|
|
49
|
+
import { compare, coerce } from 'semver';
|
|
50
50
|
import * as mimeDB from 'mime-db';
|
|
51
51
|
import * as i2$3 from '@ngx-formly/core';
|
|
52
52
|
import { FormlyModule, FieldWrapper, FieldArrayType, FieldType, FORMLY_CONFIG, ɵdefineHiddenProp as _defineHiddenProp } from '@ngx-formly/core';
|
|
@@ -193,477 +193,6 @@ var GroupFragment;
|
|
|
193
193
|
GroupFragment["dynamicGroupQueryString"] = "c8y_DeviceQueryString";
|
|
194
194
|
})(GroupFragment || (GroupFragment = {}));
|
|
195
195
|
|
|
196
|
-
var ApplicationPluginStatus;
|
|
197
|
-
(function (ApplicationPluginStatus) {
|
|
198
|
-
ApplicationPluginStatus["ORPHANED"] = "ORPHANED";
|
|
199
|
-
ApplicationPluginStatus["LATEST"] = "LATEST";
|
|
200
|
-
ApplicationPluginStatus["OUTDATED"] = "OUTDATED";
|
|
201
|
-
ApplicationPluginStatus["REVOKED"] = "REVOKED";
|
|
202
|
-
ApplicationPluginStatus["AUTO"] = "AUTO";
|
|
203
|
-
})(ApplicationPluginStatus || (ApplicationPluginStatus = {}));
|
|
204
|
-
var PackageType;
|
|
205
|
-
(function (PackageType) {
|
|
206
|
-
/**
|
|
207
|
-
* A package coming from the official Cumulocity github enterprise.
|
|
208
|
-
*/
|
|
209
|
-
PackageType["OFFICIAL"] = "OFFICIAL";
|
|
210
|
-
/**
|
|
211
|
-
* A package coming from any connected partner repository.
|
|
212
|
-
*/
|
|
213
|
-
PackageType["COMMUNITY"] = "COMMUNITY";
|
|
214
|
-
/**
|
|
215
|
-
* A package where the origin is unknown (e.g. uploaded to management with an unknown label)
|
|
216
|
-
*/
|
|
217
|
-
PackageType["UNKNOWN"] = "UNKNOWN";
|
|
218
|
-
/**
|
|
219
|
-
* A custom package e.g. uploaded to the tenant by a user
|
|
220
|
-
*/
|
|
221
|
-
PackageType["CUSTOM"] = "CUSTOM";
|
|
222
|
-
/**
|
|
223
|
-
* A package that was archived by the user
|
|
224
|
-
*/
|
|
225
|
-
PackageType["ARCHIVED"] = "ARCHIVED";
|
|
226
|
-
})(PackageType || (PackageType = {}));
|
|
227
|
-
|
|
228
|
-
class PluginsService {
|
|
229
|
-
static convertInstalledRemotesToIds(remotes) {
|
|
230
|
-
if (!remotes) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const importContextPaths = Object.keys(remotes);
|
|
234
|
-
const plugins = [];
|
|
235
|
-
importContextPaths.forEach(contextPath => {
|
|
236
|
-
const moduleNames = remotes[contextPath] || [];
|
|
237
|
-
plugins.push(...moduleNames.map(module => PluginsService.createPluginId(contextPath, module, '', true)));
|
|
238
|
-
});
|
|
239
|
-
return plugins;
|
|
240
|
-
}
|
|
241
|
-
static createPluginId(contextPath, plugin, version, useLatest = false) {
|
|
242
|
-
const moduleName = typeof plugin === 'string' ? plugin : plugin.module;
|
|
243
|
-
if (useLatest) {
|
|
244
|
-
return `${contextPath}/${moduleName}`;
|
|
245
|
-
}
|
|
246
|
-
return `${contextPath}@${version}/${moduleName}`;
|
|
247
|
-
}
|
|
248
|
-
constructor(applicationService, appStateService, client) {
|
|
249
|
-
this.applicationService = applicationService;
|
|
250
|
-
this.appStateService = appStateService;
|
|
251
|
-
this.client = client;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Fetches a list of available packages.
|
|
255
|
-
* @param params Additional query parameters.
|
|
256
|
-
* @returns Returns a list of packages.
|
|
257
|
-
*/
|
|
258
|
-
async listPackages(params = {}) {
|
|
259
|
-
const apps = await this.listApplicationsByCurrentTenant(params);
|
|
260
|
-
const webApps = apps.filter(app => this.isPackage(app));
|
|
261
|
-
const uniqueWebApps = this.removeDuplicates(webApps, 'contextPath');
|
|
262
|
-
return uniqueWebApps.sort((a, b) => a.name.localeCompare(b.name));
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Checks if an application is a package.
|
|
266
|
-
* @param application Application managed object.
|
|
267
|
-
* @returns Returns true if the application is a package.
|
|
268
|
-
*/
|
|
269
|
-
isPackage(application) {
|
|
270
|
-
return application.manifest?.isPackage === true;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Updates the remotes field in the application configuration by adding new plugins.
|
|
274
|
-
* Important: if the remotes object is not set on the configuration object,
|
|
275
|
-
* remotes will not be added. Make sure that this object exists in the application configuration.
|
|
276
|
-
* @param application Application managed object.
|
|
277
|
-
* @param plugins List of remotes to be added.
|
|
278
|
-
* @returns Returns updated application remotes.
|
|
279
|
-
*/
|
|
280
|
-
async addRemotes(application, plugins) {
|
|
281
|
-
const pluginsArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
282
|
-
const manifestRemotes = application.manifest?.remotes || {};
|
|
283
|
-
const appConfig = application?.config;
|
|
284
|
-
const appConfigRemotes = appConfig?.remotes || manifestRemotes;
|
|
285
|
-
const appConfigExcludedRemotes = appConfig?.excludedRemotes || {};
|
|
286
|
-
// only normal and self optional scoped plugins should be added to remotes
|
|
287
|
-
// self scoped plugins will be automatically added
|
|
288
|
-
const allPluginsExceptSelfScoped = this.getAllPluginsExceptSelfScoped(pluginsArray, application.contextPath);
|
|
289
|
-
const newRemotes = this.addPluginToRemotesConfig(appConfigRemotes, allPluginsExceptSelfScoped);
|
|
290
|
-
// should be unproblematic to remove all categories of plugins from excluded remotes
|
|
291
|
-
const newExcludedRemotes = this.removePluginsFromRemotesConfig(appConfigExcludedRemotes, plugins);
|
|
292
|
-
return await this.updateRemotesInAppConfig(application, newRemotes, newExcludedRemotes);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Updates the remotes field in the application configuration by removing plugins.
|
|
296
|
-
* @param application Application managed object.
|
|
297
|
-
* @param plugins List of remotes to be removed.
|
|
298
|
-
* @returns Returns updated application remotes.
|
|
299
|
-
*/
|
|
300
|
-
async removeRemotes(application, plugins) {
|
|
301
|
-
const pluginsArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
302
|
-
const manifestRemotes = application.manifest?.remotes || {};
|
|
303
|
-
const appConfig = application?.config;
|
|
304
|
-
const appConfigRemotes = appConfig?.remotes || manifestRemotes;
|
|
305
|
-
const appConfigExcludedRemotes = appConfig?.excludedRemotes || {};
|
|
306
|
-
// app plugins need to be removed from remotes
|
|
307
|
-
const newRemotes = this.removePluginsFromRemotesConfig(appConfigRemotes, plugins);
|
|
308
|
-
// self scoped plugins need to be added to excluded remotes
|
|
309
|
-
// as they would be otherwise automatically added to remotes
|
|
310
|
-
const selfScopedPlugins = this.getSelfScopedPlugins(pluginsArray, application.contextPath);
|
|
311
|
-
const newExcludedRemotes = this.addPluginToRemotesConfig(appConfigExcludedRemotes, selfScopedPlugins);
|
|
312
|
-
return await this.updateRemotesInAppConfig(application, newRemotes, newExcludedRemotes);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Updates the remotes field in the application configuration.
|
|
316
|
-
* @param application Application managed object.
|
|
317
|
-
* @param plugins List of remotes to be added.
|
|
318
|
-
* @returns Returns updated application remotes.
|
|
319
|
-
*/
|
|
320
|
-
async updateRemotesInAppConfig(application, plugins, excludedRemotes) {
|
|
321
|
-
const updatedAppWithConfig = await this.applicationService.updateApplicationConfig(application, {
|
|
322
|
-
remotes: plugins,
|
|
323
|
-
excludedRemotes: excludedRemotes || {}
|
|
324
|
-
});
|
|
325
|
-
return updatedAppWithConfig?.config || { remotes: {} };
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Fetches the application manifest.
|
|
329
|
-
* @param application Application managed object.
|
|
330
|
-
* @returns Returns the application manifest.
|
|
331
|
-
*/
|
|
332
|
-
async getCumulocityJsonFile(application) {
|
|
333
|
-
const c8yJson = await this.applicationService.getAppManifest(application);
|
|
334
|
-
if (!c8yJson.remotes) {
|
|
335
|
-
c8yJson.remotes = {};
|
|
336
|
-
}
|
|
337
|
-
return c8yJson;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Sets the initial state of remotes in the configuration (when it's missing), based on the list of remotes being in the application manifest.
|
|
341
|
-
* @param application Application managed object.
|
|
342
|
-
* @returns Returns a list of remotes that has been assigned to the configuration object.
|
|
343
|
-
*/
|
|
344
|
-
async setInitialRemotes(application) {
|
|
345
|
-
try {
|
|
346
|
-
const manifest = await this.getCumulocityJsonFile(application);
|
|
347
|
-
const manifestRemotes = manifest.remotes;
|
|
348
|
-
return await this.updateRemotesInAppConfig(application, manifestRemotes || {}, {});
|
|
349
|
-
}
|
|
350
|
-
catch (er) {
|
|
351
|
-
return undefined;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
async resetRemotes(application) {
|
|
355
|
-
return await this.applicationService.updateApplicationConfig(application, {
|
|
356
|
-
remotes: undefined,
|
|
357
|
-
excludedRemotes: undefined
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
sortVersions(source, order) {
|
|
361
|
-
const sourceCopy = cloneDeep(source);
|
|
362
|
-
if (source.list && source.path) {
|
|
363
|
-
const path = sourceCopy.path.join('.');
|
|
364
|
-
return sourceCopy.list.sort((a, b) => compare(coerce(get(a, path)), coerce(get(b, path))) * (order === 'asc' ? 1 : -1));
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
return sourceCopy.sort((a, b) => compare(coerce(a), coerce(b)) * (order === 'asc' ? 1 : -1));
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Extracts a list of exported plugins from the application object.
|
|
372
|
-
* @param application Application managed object.
|
|
373
|
-
* @param useLatest Set this to true, to not bind the plugin to any version.
|
|
374
|
-
* @returns Returns a list of exported plugins.
|
|
375
|
-
*/
|
|
376
|
-
getMFExports(application, excludedScopes = [
|
|
377
|
-
PluginsExportScopes.SELF,
|
|
378
|
-
PluginsExportScopes.SELF_OPTIONAL,
|
|
379
|
-
PluginsExportScopes.GLOBAL
|
|
380
|
-
], useLatest = false) {
|
|
381
|
-
const manifest = application.manifest;
|
|
382
|
-
if (!manifest || !manifest.exports) {
|
|
383
|
-
return [];
|
|
384
|
-
}
|
|
385
|
-
return this.extendPluginsDetails(application, {
|
|
386
|
-
version: manifest.version,
|
|
387
|
-
binaryId: undefined
|
|
388
|
-
}, useLatest).filter(plugin => !excludedScopes.includes(plugin.scope));
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Extracts a list of exports from each available package.
|
|
392
|
-
* @param allVersions If set to true, all and not only latest versions are included.
|
|
393
|
-
* @param excludedScopes Defines which scopes should not be loaded.
|
|
394
|
-
* @returns Returns a list of all exported plugins.
|
|
395
|
-
*/
|
|
396
|
-
async getAllMFExports(allVersions = false, excludedScopes = [
|
|
397
|
-
PluginsExportScopes.SELF,
|
|
398
|
-
PluginsExportScopes.SELF_OPTIONAL,
|
|
399
|
-
PluginsExportScopes.GLOBAL
|
|
400
|
-
]) {
|
|
401
|
-
const plugins = new Array();
|
|
402
|
-
const packages = await this.listPackages();
|
|
403
|
-
for (const pkg of packages) {
|
|
404
|
-
if (!pkg?.manifest?.exports) {
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
if (allVersions && Array.isArray(pkg.applicationVersions)) {
|
|
408
|
-
pkg.applicationVersions.forEach(version => {
|
|
409
|
-
plugins.push(...this.extendPluginsDetails(pkg, version));
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
plugins.push(...this.extendPluginsDetails(pkg, {
|
|
414
|
-
version: pkg.manifest.version,
|
|
415
|
-
binaryId: undefined
|
|
416
|
-
}));
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return plugins.filter(plugin => !excludedScopes.includes(plugin.scope));
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Extracts a list of remotes from the application object.
|
|
423
|
-
* @param application Application managed object.
|
|
424
|
-
* @returns Returns list of remotes.
|
|
425
|
-
*/
|
|
426
|
-
getMFRemotes(application) {
|
|
427
|
-
const manifest = application.manifest || {};
|
|
428
|
-
const config = application?.config;
|
|
429
|
-
let remotes = config?.remotes || manifest.remotes || {};
|
|
430
|
-
const manifestExports = manifest.exports || manifest.manifest?.exports || [];
|
|
431
|
-
const selfRemotes = manifestExports
|
|
432
|
-
.filter(plugin => plugin.scope === PluginsExportScopes.SELF)
|
|
433
|
-
.map(plugin => plugin.module || plugin.name);
|
|
434
|
-
if (selfRemotes.length) {
|
|
435
|
-
remotes = mergeRemotes([{ [application.contextPath]: selfRemotes }, remotes]);
|
|
436
|
-
}
|
|
437
|
-
remotes = removeRemotes(remotes, config?.excludedRemotes);
|
|
438
|
-
return remotes;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Determines the type of a package.
|
|
442
|
-
* A package is OFFICIAL if it comes from management tenant and has a label attached called OFFICIAL.
|
|
443
|
-
* A package is COMMUNITY if it has a label called COMMUNITY.
|
|
444
|
-
* A package is CUSTOM if it does not have any label attached.
|
|
445
|
-
* A package is UNKNOWN if it has a label attached but it does not match COMMUNITY or OFFICIAL.
|
|
446
|
-
*
|
|
447
|
-
* Labels can be used to identify the status of a package. Community packages always need
|
|
448
|
-
* a license validation. The label will be shown on the application card to tell a user
|
|
449
|
-
* whether they are looking into an official or community package.
|
|
450
|
-
*
|
|
451
|
-
* @param packageApplication The package application object to check.
|
|
452
|
-
* @returns The package type.
|
|
453
|
-
*/
|
|
454
|
-
getPackageType(packageApplication) {
|
|
455
|
-
const label = packageApplication.label || packageApplication.manifest?.label;
|
|
456
|
-
if (label === PackageType.ARCHIVED) {
|
|
457
|
-
return PackageType.ARCHIVED;
|
|
458
|
-
}
|
|
459
|
-
if (!label) {
|
|
460
|
-
return PackageType.CUSTOM;
|
|
461
|
-
}
|
|
462
|
-
if (label === PackageType.OFFICIAL && this.isOwnedByManagement(packageApplication)) {
|
|
463
|
-
return PackageType.OFFICIAL;
|
|
464
|
-
}
|
|
465
|
-
if (label === PackageType.COMMUNITY) {
|
|
466
|
-
return PackageType.COMMUNITY;
|
|
467
|
-
}
|
|
468
|
-
return PackageType.UNKNOWN;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Verifies if an application is owned by management tenant.
|
|
472
|
-
*
|
|
473
|
-
* @param app The application to verify.
|
|
474
|
-
* @returns True if owned by management tenant.
|
|
475
|
-
*/
|
|
476
|
-
isOwnedByManagement(app) {
|
|
477
|
-
const appOwner = get(app, 'owner.tenant.id');
|
|
478
|
-
return appOwner === 'management';
|
|
479
|
-
}
|
|
480
|
-
pluginsFromManifest(manifest) {
|
|
481
|
-
const plugins = manifest.exports;
|
|
482
|
-
const extendedPlugins = plugins
|
|
483
|
-
.filter(p => p.scope === PluginsExportScopes.SELF)
|
|
484
|
-
.map(p => ({
|
|
485
|
-
...p,
|
|
486
|
-
id: PluginsService.createPluginId(manifest.contextPath, p, manifest.version),
|
|
487
|
-
contextPath: manifest.contextPath,
|
|
488
|
-
version: manifest.version,
|
|
489
|
-
versioningMatrix: manifest.versioningMatrix,
|
|
490
|
-
license: manifest.license,
|
|
491
|
-
type: PackageType.CUSTOM
|
|
492
|
-
}));
|
|
493
|
-
return extendedPlugins;
|
|
494
|
-
}
|
|
495
|
-
async getReadmeFileContent(baseUrl) {
|
|
496
|
-
return this.getFileContent(baseUrl, 'readme');
|
|
497
|
-
}
|
|
498
|
-
async getChangelogFileContent(baseUrl) {
|
|
499
|
-
return this.getFileContent(baseUrl, 'changelog');
|
|
500
|
-
}
|
|
501
|
-
async getFileContent(baseUrl, fileType) {
|
|
502
|
-
const file = await this.getFile(baseUrl, fileType);
|
|
503
|
-
if (file.status === 200) {
|
|
504
|
-
return await file.text();
|
|
505
|
-
}
|
|
506
|
-
return '';
|
|
507
|
-
}
|
|
508
|
-
async getFile(baseUrl, fileType) {
|
|
509
|
-
const options = {
|
|
510
|
-
method: 'GET',
|
|
511
|
-
headers: { 'Content-Type': 'text/markdown' }
|
|
512
|
-
};
|
|
513
|
-
const uppercaseFilename = fileType === 'readme' ? 'README.md' : 'CHANGELOG.md';
|
|
514
|
-
let result = await this.client.fetch(`${baseUrl}${uppercaseFilename}`, options);
|
|
515
|
-
if (result && result.status === 404) {
|
|
516
|
-
result = await this.client.fetch(`${baseUrl}${uppercaseFilename.toLowerCase()}`, options);
|
|
517
|
-
}
|
|
518
|
-
return result;
|
|
519
|
-
}
|
|
520
|
-
isSelfScopedPlugin(plugin, contextPath) {
|
|
521
|
-
return (plugin.scope === PluginsExportScopes.SELF &&
|
|
522
|
-
(!contextPath || plugin.contextPath === contextPath));
|
|
523
|
-
}
|
|
524
|
-
getSelfScopedPlugins(plugins, contextPath) {
|
|
525
|
-
return plugins.filter(plugin => this.isSelfScopedPlugin(plugin, contextPath));
|
|
526
|
-
}
|
|
527
|
-
getAllPluginsExceptSelfScoped(plugins, contextPath) {
|
|
528
|
-
return plugins.filter(plugin => !this.isSelfScopedPlugin(plugin, contextPath));
|
|
529
|
-
}
|
|
530
|
-
removeDuplicates(apps, key) {
|
|
531
|
-
const uniqueList = [];
|
|
532
|
-
const groupedAppsByKey = groupBy(apps, key);
|
|
533
|
-
const groupedApps = Object.keys(groupedAppsByKey).map(key => groupedAppsByKey[key]);
|
|
534
|
-
for (const appsGroup of groupedApps) {
|
|
535
|
-
if (appsGroup.length < 2) {
|
|
536
|
-
uniqueList.push(...appsGroup);
|
|
537
|
-
}
|
|
538
|
-
else {
|
|
539
|
-
const appFromCurrentTenant = appsGroup.find(app => this.isFromCurrentTenant(app));
|
|
540
|
-
if (appFromCurrentTenant) {
|
|
541
|
-
uniqueList.push(appFromCurrentTenant);
|
|
542
|
-
continue;
|
|
543
|
-
}
|
|
544
|
-
const appNotOwnedByManagement = appsGroup.find(app => !this.isOwnedByManagement(app));
|
|
545
|
-
uniqueList.push(appNotOwnedByManagement);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
return uniqueList;
|
|
549
|
-
}
|
|
550
|
-
isFromCurrentTenant(app) {
|
|
551
|
-
return app.owner.tenant.id === this.appStateService.currentTenant.value.name;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Modifies the list of plugins to have additional information such as id.
|
|
555
|
-
* @ignore
|
|
556
|
-
*/
|
|
557
|
-
extendPluginsDetails(application, version, useLatest = false) {
|
|
558
|
-
const plugins = application.manifest.exports;
|
|
559
|
-
const extendedPlugins = plugins.map(p => ({
|
|
560
|
-
...p,
|
|
561
|
-
id: PluginsService.createPluginId(application.contextPath, p, version.version, useLatest),
|
|
562
|
-
idLatest: PluginsService.createPluginId(application.contextPath, p, version.version, true),
|
|
563
|
-
contextPath: application.contextPath,
|
|
564
|
-
version: version.version,
|
|
565
|
-
versioningMatrix: application.manifest.versioningMatrix,
|
|
566
|
-
tags: useLatest ? ['latest'] : version.tags || [],
|
|
567
|
-
license: application.manifest.license,
|
|
568
|
-
type: this.getPackageType(application),
|
|
569
|
-
originApp: application
|
|
570
|
-
}));
|
|
571
|
-
return extendedPlugins;
|
|
572
|
-
}
|
|
573
|
-
async listApplicationsByCurrentTenant(params = {}) {
|
|
574
|
-
const filter = Object.assign({
|
|
575
|
-
type: 'HOSTED',
|
|
576
|
-
pageSize: 2000,
|
|
577
|
-
withTotalPages: true
|
|
578
|
-
}, params);
|
|
579
|
-
const sharedFilter = Object.assign({
|
|
580
|
-
availability: ApplicationAvailability.SHARED,
|
|
581
|
-
type: 'HOSTED',
|
|
582
|
-
pageSize: 2000,
|
|
583
|
-
withTotalPages: true
|
|
584
|
-
}, params);
|
|
585
|
-
const tenantName = this.appStateService.currentTenant.value.name;
|
|
586
|
-
const [resultAppsOwnedByTenant, resultSharedApps] = await Promise.all([
|
|
587
|
-
this.applicationService.listByTenant(tenantName, filter),
|
|
588
|
-
this.applicationService.list(sharedFilter)
|
|
589
|
-
]);
|
|
590
|
-
const { data: appsOwnedByTenant } = resultAppsOwnedByTenant;
|
|
591
|
-
const { data: sharedApps } = resultSharedApps;
|
|
592
|
-
const webApps = [...appsOwnedByTenant, ...sharedApps];
|
|
593
|
-
return uniqBy(webApps, (app) => app.id);
|
|
594
|
-
}
|
|
595
|
-
addPluginToRemotesConfig(remotesConfig, plugins) {
|
|
596
|
-
if (!plugins) {
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
const remotesCopy = cloneDeep(remotesConfig);
|
|
600
|
-
const temp = Array.isArray(plugins) ? plugins : [plugins];
|
|
601
|
-
temp.forEach(plugin => {
|
|
602
|
-
const { contextPath, moduleName } = this.parsePluginId(plugin.id);
|
|
603
|
-
if (!contextPath || !moduleName) {
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
remotesCopy[contextPath]?.length >= 0
|
|
607
|
-
? remotesCopy[contextPath].push(moduleName)
|
|
608
|
-
: (remotesCopy[contextPath] = []).push(moduleName);
|
|
609
|
-
remotesCopy[contextPath] = [...new Set(remotesCopy[contextPath])];
|
|
610
|
-
});
|
|
611
|
-
return remotesCopy;
|
|
612
|
-
}
|
|
613
|
-
removePluginsFromRemotesConfig(remotesConfig, plugins) {
|
|
614
|
-
const remotesCopy = cloneDeep(remotesConfig);
|
|
615
|
-
const temp = Array.isArray(plugins) ? plugins : [plugins];
|
|
616
|
-
temp.forEach(plugin => {
|
|
617
|
-
const { rawContextPath, moduleName } = this.parsePluginId(plugin.id);
|
|
618
|
-
if (!rawContextPath || !moduleName) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
// Find all keys in remotesConfig that match the plugin context (regardless of version)
|
|
622
|
-
Object.keys(remotesCopy).forEach(key => {
|
|
623
|
-
if (key === rawContextPath || key.startsWith(`${rawContextPath}@`)) {
|
|
624
|
-
remotesCopy[key] = remotesCopy[key].filter(p => p !== moduleName);
|
|
625
|
-
remotesCopy[key] = [...new Set(remotesCopy[key])];
|
|
626
|
-
if (remotesCopy[key].length === 0) {
|
|
627
|
-
delete remotesCopy[key];
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
});
|
|
632
|
-
return remotesCopy;
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Parses id of the plugin and returns object with context path, raw context path (without version) and module name.
|
|
636
|
-
* For example:
|
|
637
|
-
* ```ts
|
|
638
|
-
* const id = 'widget-plugin@1021.0.1/WidgetPluginModule'
|
|
639
|
-
* const parsed = parsePluginId(id); // { contextPath: 'widget-plugin@1021.0.1', moduleName: 'WidgetPluginModule', rawContextPath: 'widget-plugin' }
|
|
640
|
-
* @param id Plugin id in the format of `<contextPath>@<version>/<moduleName>`
|
|
641
|
-
* @returns Object with context path, module name and raw context path (without version).
|
|
642
|
-
*/
|
|
643
|
-
parsePluginId(id) {
|
|
644
|
-
const [contextPath, moduleName] = id.split('/');
|
|
645
|
-
const [rawContextPath] = contextPath.split('@');
|
|
646
|
-
return { rawContextPath, contextPath, moduleName };
|
|
647
|
-
}
|
|
648
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService, deps: [{ token: i1.ApplicationService }, { token: AppStateService }, { token: i1.FetchClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
649
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService }); }
|
|
650
|
-
}
|
|
651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService, decorators: [{
|
|
652
|
-
type: Injectable
|
|
653
|
-
}], ctorParameters: () => [{ type: i1.ApplicationService }, { type: AppStateService }, { type: i1.FetchClient }] });
|
|
654
|
-
|
|
655
|
-
class PluginsModule {
|
|
656
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
657
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule }); }
|
|
658
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, providers: [PluginsService] }); }
|
|
659
|
-
}
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, decorators: [{
|
|
661
|
-
type: NgModule,
|
|
662
|
-
args: [{
|
|
663
|
-
providers: [PluginsService]
|
|
664
|
-
}]
|
|
665
|
-
}] });
|
|
666
|
-
|
|
667
196
|
class PluginsResolveService {
|
|
668
197
|
constructor() {
|
|
669
198
|
this._refresh$ = new Subject();
|
|
@@ -699,27 +228,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
699
228
|
}]
|
|
700
229
|
}], ctorParameters: () => [] });
|
|
701
230
|
|
|
702
|
-
class PluginLoadedPipe {
|
|
703
|
-
constructor(pluginsResolve) {
|
|
704
|
-
this.pluginsResolve = pluginsResolve;
|
|
705
|
-
}
|
|
706
|
-
transform(pluginName) {
|
|
707
|
-
if (!pluginName) {
|
|
708
|
-
return of(false);
|
|
709
|
-
}
|
|
710
|
-
return this.pluginsResolve.loadedPluginNames$.pipe(map(pluginNames => pluginNames.includes(pluginName)), distinctUntilChanged());
|
|
711
|
-
}
|
|
712
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, deps: [{ token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
713
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, isStandalone: true, name: "c8yPluginLoaded" }); }
|
|
714
|
-
}
|
|
715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, decorators: [{
|
|
716
|
-
type: Pipe,
|
|
717
|
-
args: [{
|
|
718
|
-
name: 'c8yPluginLoaded',
|
|
719
|
-
standalone: true
|
|
720
|
-
}]
|
|
721
|
-
}], ctorParameters: () => [{ type: PluginsResolveService }] });
|
|
722
|
-
|
|
723
231
|
class StandalonePluginInjector extends Injector {
|
|
724
232
|
/**
|
|
725
233
|
* @deprecated Use `constructor` instead.
|
|
@@ -857,7 +365,7 @@ class StateService {
|
|
|
857
365
|
* @param mappedProperty The property to map to.
|
|
858
366
|
*/
|
|
859
367
|
map(mappedProperty) {
|
|
860
|
-
return this.state$.pipe(map
|
|
368
|
+
return this.state$.pipe(map(mappedProperty), distinctUntilChanged());
|
|
861
369
|
}
|
|
862
370
|
/**
|
|
863
371
|
* Emits a new state.
|
|
@@ -918,7 +426,7 @@ function fromFactories(factories, router, withFirstEmpty = true) {
|
|
|
918
426
|
return toObservableOfArrays([f], withFirstEmpty);
|
|
919
427
|
});
|
|
920
428
|
return combineLatest(factoryObservables);
|
|
921
|
-
}).pipe(map
|
|
429
|
+
}).pipe(map(results => sortByPriority([].concat(...results))), map(value => uniq(value)));
|
|
922
430
|
}
|
|
923
431
|
function resolveInjectedFactories(factories) {
|
|
924
432
|
return flatten(factories.map(f => {
|
|
@@ -930,7 +438,7 @@ function resolveInjectedFactories(factories) {
|
|
|
930
438
|
}));
|
|
931
439
|
}
|
|
932
440
|
function stateToFactory(componentsState) {
|
|
933
|
-
const components$ = componentsState.pipe(map
|
|
441
|
+
const components$ = componentsState.pipe(map((componentSet) => [...componentSet]));
|
|
934
442
|
return { get: () => components$ };
|
|
935
443
|
}
|
|
936
444
|
function sortByPriority(items) {
|
|
@@ -962,7 +470,7 @@ function toObservableOfArrays(factoryResult, withFirstEmpty) {
|
|
|
962
470
|
observable = race(observable, withEmptyFirst);
|
|
963
471
|
}
|
|
964
472
|
}
|
|
965
|
-
return observable.pipe(map
|
|
473
|
+
return observable.pipe(map(result => (Array.isArray(result) ? result : [result]).filter(item => !!item)));
|
|
966
474
|
}
|
|
967
475
|
function isPromise(obj) {
|
|
968
476
|
return !!obj && typeof obj.then === 'function';
|
|
@@ -1154,7 +662,7 @@ class OptionsService extends ApplicationOptions {
|
|
|
1154
662
|
*/
|
|
1155
663
|
get$(optionKey, defaultValue, attemptParse) {
|
|
1156
664
|
const fn = () => this.get(optionKey, defaultValue, attemptParse);
|
|
1157
|
-
return this.optionsUpdated$.pipe(map
|
|
665
|
+
return this.optionsUpdated$.pipe(map(fn), startWith(fn()), distinctUntilChanged());
|
|
1158
666
|
}
|
|
1159
667
|
/**
|
|
1160
668
|
* Sets an application option.
|
|
@@ -1395,7 +903,7 @@ class AppStateService extends StateService {
|
|
|
1395
903
|
this.currentUser = new BehaviorSubject(null);
|
|
1396
904
|
this.currentTenant = new BehaviorSubject(null);
|
|
1397
905
|
this.currentApplication = new BehaviorSubject(null);
|
|
1398
|
-
this.currentApplicationConfig = this.currentApplication.pipe(filter(app => !!app), map
|
|
906
|
+
this.currentApplicationConfig = this.currentApplication.pipe(filter(app => !!app), map(app => app?.config || null));
|
|
1399
907
|
if (application) {
|
|
1400
908
|
this.currentApplication.next(application);
|
|
1401
909
|
this.state.app = application;
|
|
@@ -1499,7 +1007,7 @@ class AppStateService extends StateService {
|
|
|
1499
1007
|
*/
|
|
1500
1008
|
isOwnerOfApplication$(app) {
|
|
1501
1009
|
const app$ = app ? of(app) : this.currentApplication;
|
|
1502
|
-
return combineLatest([app$, this.currentTenant]).pipe(map
|
|
1010
|
+
return combineLatest([app$, this.currentTenant]).pipe(map(([app, tenant]) => {
|
|
1503
1011
|
if (!app || !tenant) {
|
|
1504
1012
|
return false;
|
|
1505
1013
|
}
|
|
@@ -1514,18 +1022,18 @@ class AppStateService extends StateService {
|
|
|
1514
1022
|
}
|
|
1515
1023
|
currentAppsOfUser$() {
|
|
1516
1024
|
const appChanges$ = this.onAppChangesCompletion$().pipe(startWith(undefined));
|
|
1517
|
-
const userChanges$ = this.currentUser.pipe(map
|
|
1025
|
+
const userChanges$ = this.currentUser.pipe(map(user => user?.id), distinctUntilChanged());
|
|
1518
1026
|
return combineLatest([userChanges$, appChanges$]).pipe(filter(([userId]) => !!userId), switchMap(([userId]) => this.applicationService.listByUser(userId, {
|
|
1519
1027
|
dropOverwrittenApps: true,
|
|
1520
1028
|
noPaging: true
|
|
1521
|
-
})), map
|
|
1029
|
+
})), map(({ data }) => data), shareReplay({ bufferSize: 1, refCount: true }));
|
|
1522
1030
|
}
|
|
1523
1031
|
/**
|
|
1524
1032
|
* An Observable emitting once all POST, PUT, DELETE requests to the application API finished
|
|
1525
1033
|
*/
|
|
1526
1034
|
onAppChangesCompletion$() {
|
|
1527
1035
|
const methods = ['POST', 'PUT', 'DELETE'];
|
|
1528
|
-
return this.apiService.calls.pipe(filter(({ method, url }) => methods.includes(method) && url?.includes('application/applications')), map
|
|
1036
|
+
return this.apiService.calls.pipe(filter(({ method, url }) => methods.includes(method) && url?.includes('application/applications')), map(({ phase }) => (phase === 'start' ? 1 : -1)), scan((count, item) => count + item, 0), map(count => count === 0), distinctUntilChanged(), debounceTime(500), filter(completed => !!completed), map(() => {
|
|
1529
1037
|
return;
|
|
1530
1038
|
}));
|
|
1531
1039
|
}
|
|
@@ -1621,7 +1129,7 @@ class RealtimeService {
|
|
|
1621
1129
|
* @returns An [[Observable]] of newly created entity objects.
|
|
1622
1130
|
*/
|
|
1623
1131
|
onCreate$(entityOrId) {
|
|
1624
|
-
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'CREATE'), map
|
|
1132
|
+
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'CREATE'), map(msg => msg.data));
|
|
1625
1133
|
}
|
|
1626
1134
|
/**
|
|
1627
1135
|
* Get an Observable of all UPDATE realtime notifications.
|
|
@@ -1631,7 +1139,7 @@ class RealtimeService {
|
|
|
1631
1139
|
* @returns An [[Observable]] of updated entity objects.
|
|
1632
1140
|
*/
|
|
1633
1141
|
onUpdate$(entityOrId) {
|
|
1634
|
-
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'UPDATE'), map
|
|
1142
|
+
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'UPDATE'), map(msg => msg.data));
|
|
1635
1143
|
}
|
|
1636
1144
|
/**
|
|
1637
1145
|
* Get an Observable of all DELETE realtime notifications.
|
|
@@ -1641,7 +1149,7 @@ class RealtimeService {
|
|
|
1641
1149
|
* @returns An [[Observable]] of deleted entity objects.
|
|
1642
1150
|
*/
|
|
1643
1151
|
onDelete$(entityOrId) {
|
|
1644
|
-
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'DELETE'), map
|
|
1152
|
+
return this.onAll$(entityOrId).pipe(filter(msg => msg.realtimeAction === 'DELETE'), map(msg => coerceNumberProperty(msg.data)));
|
|
1645
1153
|
}
|
|
1646
1154
|
getIdString(reference) {
|
|
1647
1155
|
let id;
|
|
@@ -1666,7 +1174,7 @@ class RealtimeSubjectService {
|
|
|
1666
1174
|
this.realtime = realtime;
|
|
1667
1175
|
this.subjects$ = new Map();
|
|
1668
1176
|
this.reconnect$ = this.createObservableForReconnect().pipe(share());
|
|
1669
|
-
this.connectionStatus$ = this.createObservableForConnectionStatus().pipe(distinctUntilChanged
|
|
1177
|
+
this.connectionStatus$ = this.createObservableForConnectionStatus().pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
1670
1178
|
}
|
|
1671
1179
|
getObservableForChannel(channel) {
|
|
1672
1180
|
if (this.subjects$.has(channel)) {
|
|
@@ -1788,7 +1296,7 @@ class AssetTypesRealtimeService {
|
|
|
1788
1296
|
* @returns IManagedObject which represents the asset type.
|
|
1789
1297
|
*/
|
|
1790
1298
|
getAssetTypeByName$(name) {
|
|
1791
|
-
return this.assetTypes$.pipe(map
|
|
1299
|
+
return this.assetTypes$.pipe(map(assetTypes => assetTypes[name]));
|
|
1792
1300
|
}
|
|
1793
1301
|
/**
|
|
1794
1302
|
* Returns an asset type from the cache based on the id.
|
|
@@ -1796,7 +1304,7 @@ class AssetTypesRealtimeService {
|
|
|
1796
1304
|
* @returns IManagedObject which represents the asset type.
|
|
1797
1305
|
*/
|
|
1798
1306
|
getAssetTypeById$(assetTypeId) {
|
|
1799
|
-
return this.assetTypes$.pipe(map
|
|
1307
|
+
return this.assetTypes$.pipe(map(assetTypes => Object.values(assetTypes).find((assetType) => assetType.id === assetTypeId)));
|
|
1800
1308
|
}
|
|
1801
1309
|
/**
|
|
1802
1310
|
* Returns all the available asset types from the cache.
|
|
@@ -1812,7 +1320,7 @@ class AssetTypesRealtimeService {
|
|
|
1812
1320
|
*/
|
|
1813
1321
|
getIcon$(type) {
|
|
1814
1322
|
const assetType = this.getAssetTypeByName$(type);
|
|
1815
|
-
return assetType.pipe(map
|
|
1323
|
+
return assetType.pipe(map(assetType => assetType?.c8y_IsAssetType?.icon?.name || this.DEFAULT_ASSET_ICON));
|
|
1816
1324
|
}
|
|
1817
1325
|
/**
|
|
1818
1326
|
* Refreshes the asset types cache
|
|
@@ -1821,7 +1329,7 @@ class AssetTypesRealtimeService {
|
|
|
1821
1329
|
this.refreshTrigger.next();
|
|
1822
1330
|
}
|
|
1823
1331
|
initAssetTypes$() {
|
|
1824
|
-
const triggerRefresh = merge(this.appStateService.currentUser.pipe(map
|
|
1332
|
+
const triggerRefresh = merge(this.appStateService.currentUser.pipe(map(user => user?.id), distinctUntilChanged(), filter(userId => !!userId)), this.refreshTrigger);
|
|
1825
1333
|
return triggerRefresh.pipe(switchMap(() => this.getAssetTypes$()), shareReplay(1));
|
|
1826
1334
|
}
|
|
1827
1335
|
/**
|
|
@@ -5311,10 +4819,10 @@ class TranslationLoaderService {
|
|
|
5311
4819
|
this.cache = new Map();
|
|
5312
4820
|
this.reloadTrigger$ = new BehaviorSubject(null);
|
|
5313
4821
|
this.translateService.onLangChange
|
|
5314
|
-
.pipe(map
|
|
4822
|
+
.pipe(map(event => event.lang),
|
|
5315
4823
|
// ensure we are starting with the current language
|
|
5316
4824
|
// as the event might be triggered before the current language is set
|
|
5317
|
-
startWith(this.translateService.currentLang), filter(lang => !!lang), distinctUntilChanged
|
|
4825
|
+
startWith(this.translateService.currentLang), filter(lang => !!lang), distinctUntilChanged(), switchMap(lang => this.getTranslation(lang).pipe(map(translations => ({ lang, translations })))))
|
|
5318
4826
|
.subscribe(({ lang, translations }) => {
|
|
5319
4827
|
this.translateService.setTranslation(lang, translations, true);
|
|
5320
4828
|
});
|
|
@@ -5325,7 +4833,7 @@ class TranslationLoaderService {
|
|
|
5325
4833
|
defer(() => this.getUserDefinedTranslations(lang)),
|
|
5326
4834
|
defer(() => this.optionsService.get$('langsDetails', {})),
|
|
5327
4835
|
defer(() => this.getTranslationsForPugins(lang))
|
|
5328
|
-
]).pipe(map
|
|
4836
|
+
]).pipe(map(([appTranslations, userDefinedTranslations, langsDetails, pluginTranslations]) => {
|
|
5329
4837
|
const translationsFromBranding = (langsDetails && langsDetails[lang]) || {};
|
|
5330
4838
|
return {
|
|
5331
4839
|
...appTranslations,
|
|
@@ -5335,7 +4843,7 @@ class TranslationLoaderService {
|
|
|
5335
4843
|
};
|
|
5336
4844
|
}), tap(dictionary => {
|
|
5337
4845
|
this.cachedLocaleDictionaryService.cachedDictionary[lang] = dictionary;
|
|
5338
|
-
}), map
|
|
4846
|
+
}), map(dictionary => getDictionaryWithTrimmedKeys(dictionary)), catchError(() => of({})));
|
|
5339
4847
|
return this.reloadTrigger$.pipe(switchMap(() => translations$));
|
|
5340
4848
|
}
|
|
5341
4849
|
triggerReload() {
|
|
@@ -5352,7 +4860,7 @@ class TranslationLoaderService {
|
|
|
5352
4860
|
if (!plugins.length) {
|
|
5353
4861
|
return of({});
|
|
5354
4862
|
}
|
|
5355
|
-
return combineLatest(plugins.map(plugin => this.getTranslationsForPlugin(lang, plugin))).pipe(map
|
|
4863
|
+
return combineLatest(plugins.map(plugin => this.getTranslationsForPlugin(lang, plugin))).pipe(map(translations => {
|
|
5356
4864
|
return translations.reduce((acc, translation) => ({ ...acc, ...translation }), {});
|
|
5357
4865
|
}));
|
|
5358
4866
|
}));
|
|
@@ -5592,7 +5100,7 @@ class VirtualScrollWindowStrategy {
|
|
|
5592
5100
|
this._offsetSizePx = offsetSizePx;
|
|
5593
5101
|
this._minBufferPx = minBufferPx;
|
|
5594
5102
|
this._maxBufferPx = maxBufferPx;
|
|
5595
|
-
this.scrolledIndexChange = this._scrolledIndexChange.pipe(distinctUntilChanged
|
|
5103
|
+
this.scrolledIndexChange = this._scrolledIndexChange.pipe(distinctUntilChanged());
|
|
5596
5104
|
this.destroy$ = this.destroy.asObservable();
|
|
5597
5105
|
}
|
|
5598
5106
|
/**
|
|
@@ -5832,7 +5340,7 @@ class VirtualScrollerWrapperComponent {
|
|
|
5832
5340
|
}
|
|
5833
5341
|
}
|
|
5834
5342
|
apply() {
|
|
5835
|
-
this.items$ = of(this.items).pipe(src => this.filterPipe(src), map
|
|
5343
|
+
this.items$ = of(this.items).pipe(src => this.filterPipe(src), map(item => item));
|
|
5836
5344
|
}
|
|
5837
5345
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: VirtualScrollerWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5838
5346
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: VirtualScrollerWrapperComponent, isStandalone: true, selector: "c8y-virtual-scroller-wrapper", inputs: { items: "items", itemHeight: "itemHeight", containerHeight: "containerHeight", template: "template", filterPipe: "filterPipe", strategy: "strategy", trackByFn: "trackByFn" }, viewQueries: [{ propertyName: "virtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], ngImport: i0, template: "<ng-container\n *ngIf=\"items$ | async as items\"\n [ngSwitch]=\"strategy\"\n>\n <ng-container *ngSwitchCase=\"'window'\">\n <cdk-virtual-scroll-viewport\n class=\"inner-scroll\"\n windowVirtualScrollStrategy\n [itemSizePx]=\"itemHeight\"\n data-cy=\"c8y-virtual-scroll-wrapper--window\"\n >\n <div *cdkVirtualFor=\"let item of items; index as i; trackBy: trackByFn\">\n <ng-container\n *ngTemplateOutlet=\"template; context: { $implicit: item, index: i }\"\n ></ng-container>\n </div>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'fixed'\">\n <cdk-virtual-scroll-viewport\n class=\"inner-scroll\"\n [style.height]=\"containerHeight + 'px'\"\n [itemSize]=\"itemHeight\"\n data-cy=\"c8y-virtual-scroll-wrapper--fixed\"\n >\n <div *cdkVirtualFor=\"let item of items; index as i; trackBy: trackByFn\">\n <ng-container\n *ngTemplateOutlet=\"template; context: { $implicit: item, index: i }\"\n ></ng-container>\n </div>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n</ng-container>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: VirtualScrollWindowDirective, selector: "cdk-virtual-scroll-viewport[windowVirtualScrollStrategy]", inputs: ["itemSizePx", "minBufferPx", "maxBufferPx", "offsetSizePx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
@@ -5980,7 +5488,7 @@ class ForOfDirective {
|
|
|
5980
5488
|
*/
|
|
5981
5489
|
set c8yForOf(fetchData) {
|
|
5982
5490
|
if (fetchData) {
|
|
5983
|
-
this.obs$ = (isObservable(fetchData) ? fetchData : of(fetchData)).pipe(map
|
|
5491
|
+
this.obs$ = (isObservable(fetchData) ? fetchData : of(fetchData)).pipe(map(result => {
|
|
5984
5492
|
if (result === null) {
|
|
5985
5493
|
this.paging = null;
|
|
5986
5494
|
return [];
|
|
@@ -6069,7 +5577,7 @@ class ForOfDirective {
|
|
|
6069
5577
|
this.cachedData = [];
|
|
6070
5578
|
this.loadMoreMode = 'auto';
|
|
6071
5579
|
this.dataPipe = pipe(tap());
|
|
6072
|
-
this.itemDataPipe = pipe(map
|
|
5580
|
+
this.itemDataPipe = pipe(map(item => [item]), src => this.dataPipe(src), map(([item]) => item));
|
|
6073
5581
|
this.maxIterations = 10;
|
|
6074
5582
|
this.realtimeOptions = {};
|
|
6075
5583
|
this.unsubscribe$ = new Subject();
|
|
@@ -6189,7 +5697,7 @@ class ForOfDirective {
|
|
|
6189
5697
|
.onUpdate$(entityOrId)
|
|
6190
5698
|
.pipe(item$ => combineLatest([
|
|
6191
5699
|
item$,
|
|
6192
|
-
item$.pipe(src => this.itemDataPipe(src), map
|
|
5700
|
+
item$.pipe(src => this.itemDataPipe(src), map(item => item !== undefined))
|
|
6193
5701
|
]), takeUntil(this.unsubscribe$))
|
|
6194
5702
|
.subscribe(([item, passesDataPipe]) => {
|
|
6195
5703
|
const { insertOnUpdate, removeOnUpdate } = this.realtimeOptions;
|
|
@@ -6283,7 +5791,7 @@ class ForOfDirective {
|
|
|
6283
5791
|
instance.loadingLabel = this.loadingLabel;
|
|
6284
5792
|
this.c8yForLoadMoreComponent.emit(instance);
|
|
6285
5793
|
this.pagingSub = instance.onLoad
|
|
6286
|
-
.pipe(map
|
|
5794
|
+
.pipe(map((data) => this.checkForDuplicates(data)), tap((data) => {
|
|
6287
5795
|
this.cachedData = this.cachedData.concat(data);
|
|
6288
5796
|
}))
|
|
6289
5797
|
.pipe(src => this.dataPipe(src))
|
|
@@ -6628,7 +6136,7 @@ class FilesService {
|
|
|
6628
6136
|
* @returns Returns list of file extensions.
|
|
6629
6137
|
*/
|
|
6630
6138
|
getFileExtensions() {
|
|
6631
|
-
return uniq(flatten(map$
|
|
6139
|
+
return uniq(flatten(map$1(this.fileTypeExtensionsMap, ({ exts }) => exts)));
|
|
6632
6140
|
}
|
|
6633
6141
|
/**
|
|
6634
6142
|
* The list of generic file types.
|
|
@@ -7444,7 +6952,7 @@ class MarkdownToHtmlPipe {
|
|
|
7444
6952
|
}
|
|
7445
6953
|
transform(markdown, args) {
|
|
7446
6954
|
return markdown
|
|
7447
|
-
? from(import('marked')).pipe(map
|
|
6955
|
+
? from(import('marked')).pipe(map(marked => {
|
|
7448
6956
|
const renderer = new marked.Renderer();
|
|
7449
6957
|
const baseUrl = args?.baseUrl || '';
|
|
7450
6958
|
if (baseUrl) {
|
|
@@ -7472,7 +6980,7 @@ class MarkdownToHtmlPipe {
|
|
|
7472
6980
|
return originalRendererHtml.call(renderer, html);
|
|
7473
6981
|
};
|
|
7474
6982
|
return marked.parse(markdown, { renderer });
|
|
7475
|
-
}), map
|
|
6983
|
+
}), map(html => this.sanitizer.sanitize(SecurityContext.HTML, html)), catchError(e => {
|
|
7476
6984
|
console.warn(e);
|
|
7477
6985
|
return of('<p>Failed to process markdown file.</p>');
|
|
7478
6986
|
}))
|
|
@@ -7889,7 +7397,7 @@ class ShowIfFilterPipe {
|
|
|
7889
7397
|
return of(true);
|
|
7890
7398
|
}
|
|
7891
7399
|
});
|
|
7892
|
-
return combineLatest(entries(observableShowIfMap).map(([key, val]) => val.pipe(map
|
|
7400
|
+
return combineLatest(entries(observableShowIfMap).map(([key, val]) => val.pipe(map(showIf => ({ key, showIf }))))).pipe(map((allShowIfs) => {
|
|
7893
7401
|
allShowIfs.forEach(showIf => (value[showIf.key].showIf = showIf.showIf));
|
|
7894
7402
|
return omitBy(value, (v) => !v.showIf);
|
|
7895
7403
|
}));
|
|
@@ -8388,7 +7896,7 @@ class UserPreferencesService {
|
|
|
8388
7896
|
* @returns An Observable of a user preference.
|
|
8389
7897
|
*/
|
|
8390
7898
|
observe(key) {
|
|
8391
|
-
return concat(this.get(key), this.preferenceChanges$.pipe(filter(change => change.key === key), map
|
|
7899
|
+
return concat(this.get(key), this.preferenceChanges$.pipe(filter(change => change.key === key), map(change => change.value)));
|
|
8392
7900
|
}
|
|
8393
7901
|
/**
|
|
8394
7902
|
* Get an Observable value for searched key for current user.
|
|
@@ -8566,7 +8074,7 @@ function initializeServices(translateService, state, userPreferences) {
|
|
|
8566
8074
|
}
|
|
8567
8075
|
else {
|
|
8568
8076
|
state.currentUser
|
|
8569
|
-
.pipe(map
|
|
8077
|
+
.pipe(map(user => user && user.userName), filter(u => !!u), distinctUntilChanged(), switchMap(() => userPreferences.get('language')), startWith(firstLanguage), filter(lang => !!lang), distinctUntilChanged())
|
|
8570
8078
|
.subscribe(lang => {
|
|
8571
8079
|
translateService.switchToLanguage(lang);
|
|
8572
8080
|
});
|
|
@@ -9515,13 +9023,13 @@ class ZipService {
|
|
|
9515
9023
|
});
|
|
9516
9024
|
}
|
|
9517
9025
|
getJsonData(zipFile, fileEntryFilter) {
|
|
9518
|
-
return this.getEntries(zipFile).pipe(map
|
|
9026
|
+
return this.getEntries(zipFile).pipe(map(entries => {
|
|
9519
9027
|
const entryFile = entries.find(entry => entry.filename === fileEntryFilter.filename);
|
|
9520
9028
|
if (!entryFile) {
|
|
9521
9029
|
throwError(() => new Error(`File not found ${JSON.stringify(fileEntryFilter)}`));
|
|
9522
9030
|
}
|
|
9523
9031
|
return entryFile;
|
|
9524
|
-
}), concatMap(entry => this.getData(entry)), switchMap(async (blob) => await blob.text()), map
|
|
9032
|
+
}), concatMap(entry => this.getData(entry)), switchMap(async (blob) => await blob.text()), map(text => JSON.parse(text)));
|
|
9525
9033
|
}
|
|
9526
9034
|
async createZip(files) {
|
|
9527
9035
|
const zipFileStream = new TransformStream();
|
|
@@ -9565,7 +9073,7 @@ class InterAppService {
|
|
|
9565
9073
|
* @returns Observable of Application
|
|
9566
9074
|
*/
|
|
9567
9075
|
getApp$(key) {
|
|
9568
|
-
return this.stateService.currentAppsOfUser.pipe(map(apps => apps.find(app => app.key === key)));
|
|
9076
|
+
return this.stateService.currentAppsOfUser.pipe(map$2(apps => apps.find(app => app.key === key)));
|
|
9569
9077
|
}
|
|
9570
9078
|
/**
|
|
9571
9079
|
* Checks if current application is the same as the one that key is provided
|
|
@@ -9573,7 +9081,7 @@ class InterAppService {
|
|
|
9573
9081
|
* @returns Observable of boolean; true if current app matches provided key.
|
|
9574
9082
|
*/
|
|
9575
9083
|
isCurrentApp$(key) {
|
|
9576
|
-
return this.stateService.currentApplication.pipe(map(app => app?.key === key));
|
|
9084
|
+
return this.stateService.currentApplication.pipe(map$2(app => app?.key === key));
|
|
9577
9085
|
}
|
|
9578
9086
|
/**
|
|
9579
9087
|
* Checks if other (other than current) application link should be displayed. It consists of two conditions:
|
|
@@ -9584,9 +9092,9 @@ class InterAppService {
|
|
|
9584
9092
|
*/
|
|
9585
9093
|
shouldShowAppLink$(appKey) {
|
|
9586
9094
|
return combineLatest([
|
|
9587
|
-
this.getApp$(appKey).pipe(map(Boolean)),
|
|
9588
|
-
this.isCurrentApp$(appKey).pipe(map(val => !val))
|
|
9589
|
-
]).pipe(map(([linkedAppIsAvailable, linkLeadsToOtherAppThanCurrent]) => linkedAppIsAvailable && linkLeadsToOtherAppThanCurrent));
|
|
9095
|
+
this.getApp$(appKey).pipe(map$2(Boolean)),
|
|
9096
|
+
this.isCurrentApp$(appKey).pipe(map$2(val => !val))
|
|
9097
|
+
]).pipe(map$2(([linkedAppIsAvailable, linkLeadsToOtherAppThanCurrent]) => linkedAppIsAvailable && linkLeadsToOtherAppThanCurrent));
|
|
9590
9098
|
}
|
|
9591
9099
|
/**
|
|
9592
9100
|
* Navigates to app by provided app key
|
|
@@ -9594,7 +9102,7 @@ class InterAppService {
|
|
|
9594
9102
|
* @param path {string} - Additional path in target application.
|
|
9595
9103
|
*/
|
|
9596
9104
|
async navigateToApp(appKey, path) {
|
|
9597
|
-
const contextPath = await firstValueFrom(this.getApp$(appKey).pipe(map(app => app?.contextPath)));
|
|
9105
|
+
const contextPath = await firstValueFrom(this.getApp$(appKey).pipe(map$2(app => app?.contextPath)));
|
|
9598
9106
|
if (!contextPath) {
|
|
9599
9107
|
const msg = this.translateService.instant(gettext$1('Application with key "{{appKey}}" not found.'), { appKey });
|
|
9600
9108
|
this.alertService.danger(msg);
|
|
@@ -9846,7 +9354,7 @@ class GainsightService {
|
|
|
9846
9354
|
this.loadScriptTag(scriptTag, key);
|
|
9847
9355
|
const currentUserStream = this.appState.currentUser;
|
|
9848
9356
|
const scriptLoadStream = fromEvent(scriptTag, 'load');
|
|
9849
|
-
const versionStream = this.appState.state$.pipe(filter(({ versions }) => versions.backend), map
|
|
9357
|
+
const versionStream = this.appState.state$.pipe(filter(({ versions }) => versions.backend), map(({ versions }) => versions), take(1));
|
|
9850
9358
|
const sourceStreams = sendPiiData
|
|
9851
9359
|
? [currentUserStream, scriptLoadStream, versionStream]
|
|
9852
9360
|
: [currentUserStream, scriptLoadStream];
|
|
@@ -10634,11 +10142,11 @@ class AppSwitcherService {
|
|
|
10634
10142
|
this.ui = ui;
|
|
10635
10143
|
this.visibleApplicationTypes = ['HOSTED', 'EXTERNAL'];
|
|
10636
10144
|
const { currentTenant } = this.ui;
|
|
10637
|
-
this.appsOfCurrentUser$ = this.ui.currentAppsOfUser.pipe(map
|
|
10638
|
-
this.oneCloudApps$ = this.appsOfCurrentUser$.pipe(map
|
|
10639
|
-
const nonCloudApps$ = this.appsOfCurrentUser$.pipe(map
|
|
10640
|
-
this.apps$ = combineLatest([nonCloudApps$, currentTenant]).pipe(map
|
|
10641
|
-
this.finishedLoading$ = combineLatest([this.apps$, this.oneCloudApps$]).pipe(map
|
|
10145
|
+
this.appsOfCurrentUser$ = this.ui.currentAppsOfUser.pipe(map(apps => this.filterVisible(apps)), shareReplay(1));
|
|
10146
|
+
this.oneCloudApps$ = this.appsOfCurrentUser$.pipe(map(apps => apps.filter(app => this.isCloudApp(app))), map(cloudApps => this.orderApps(cloudApps)), shareReplay(1));
|
|
10147
|
+
const nonCloudApps$ = this.appsOfCurrentUser$.pipe(map(apps => apps.filter(app => !this.isCloudApp(app))));
|
|
10148
|
+
this.apps$ = combineLatest([nonCloudApps$, currentTenant]).pipe(map(([apps, tenant]) => this.filterDuplicates(apps, tenant)), map(apps => this.orderApps(apps)), shareReplay(1));
|
|
10149
|
+
this.finishedLoading$ = combineLatest([this.apps$, this.oneCloudApps$]).pipe(map(() => true), take(1), shareReplay(1));
|
|
10642
10150
|
}
|
|
10643
10151
|
filterVisible(apps) {
|
|
10644
10152
|
return apps.filter(app => this.visibleApplicationTypes.includes(app.type) &&
|
|
@@ -10832,7 +10340,7 @@ class IsActiveAppPipe {
|
|
|
10832
10340
|
}
|
|
10833
10341
|
transform(app) {
|
|
10834
10342
|
const { contextPath } = app;
|
|
10835
|
-
return this.ui.state$.pipe(map
|
|
10343
|
+
return this.ui.state$.pipe(map(state => get(state, 'app.contextPath')), distinctUntilChanged(), map(currentContextPath => contextPath === currentContextPath));
|
|
10836
10344
|
}
|
|
10837
10345
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: IsActiveAppPipe, deps: [{ token: AppStateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
10838
10346
|
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: IsActiveAppPipe, isStandalone: true, name: "isActiveApp" }); }
|
|
@@ -11015,7 +10523,7 @@ class ActionBarService extends ExtensionPointForPlugins {
|
|
|
11015
10523
|
getInjectedHooks(HOOK_ACTION_BAR, this.injectors),
|
|
11016
10524
|
() => this.factories,
|
|
11017
10525
|
stateToFactory(this.state$)
|
|
11018
|
-
]).pipe(map
|
|
10526
|
+
]).pipe(map((items) => {
|
|
11019
10527
|
const grouped = groupBy(items, 'groupId');
|
|
11020
10528
|
// groupBy stores undefined as a string key -> all undefined a ungrouped
|
|
11021
10529
|
const ungroupedItems = grouped.undefined || [];
|
|
@@ -11023,7 +10531,7 @@ class ActionBarService extends ExtensionPointForPlugins {
|
|
|
11023
10531
|
.filter(key => key !== 'undefined')
|
|
11024
10532
|
.map(key => this.pickItemFromGroup(grouped[key]));
|
|
11025
10533
|
return [...ungroupedItems, ...groupedItems];
|
|
11026
|
-
}), map
|
|
10534
|
+
}), map(items => sortByPriority(items)), shareReplay(1), distinctUntilChanged());
|
|
11027
10535
|
}
|
|
11028
10536
|
pickItemFromGroup(groupedItems) {
|
|
11029
10537
|
const groupIsPrioritized = groupedItems.some(item => item.hasOwnProperty('inGroupPriority'));
|
|
@@ -11212,10 +10720,10 @@ class ActionBarComponent {
|
|
|
11212
10720
|
});
|
|
11213
10721
|
}
|
|
11214
10722
|
ngOnInit() {
|
|
11215
|
-
this.right$ = this.items$.pipe(map
|
|
11216
|
-
this.left$ = this.items$.pipe(map
|
|
11217
|
-
this.more$ = this.items$.pipe(map
|
|
11218
|
-
this.hidden$ = this.items$.pipe(map
|
|
10723
|
+
this.right$ = this.items$.pipe(map(items => filter$2(items, { placement: 'right' })), map(items => sortBy(items, this.byPriority)));
|
|
10724
|
+
this.left$ = this.items$.pipe(map(items => filter$2(items, { placement: 'left' })), map(items => sortBy(items, this.byPriority)));
|
|
10725
|
+
this.more$ = this.items$.pipe(map(items => filter$2(items, { placement: 'more' })), map(items => sortBy(items, this.byPriority)));
|
|
10726
|
+
this.hidden$ = this.items$.pipe(map(items => {
|
|
11219
10727
|
return !(items && items.length);
|
|
11220
10728
|
}));
|
|
11221
10729
|
this.hidden$.pipe(takeUntil(this.destroy$)).subscribe(hidden => {
|
|
@@ -11387,7 +10895,7 @@ class ActionService extends ExtensionPointForPlugins {
|
|
|
11387
10895
|
getInjectedHooks(HOOK_ACTION, this.injectors),
|
|
11388
10896
|
() => this.factories,
|
|
11389
10897
|
stateToFactory(this.state$)
|
|
11390
|
-
]).pipe(distinctUntilChanged
|
|
10898
|
+
]).pipe(distinctUntilChanged(), shareReplay(1));
|
|
11391
10899
|
}
|
|
11392
10900
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ActionService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
11393
10901
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ActionService, providedIn: 'root' }); }
|
|
@@ -11413,11 +10921,11 @@ class ActionOutletComponent {
|
|
|
11413
10921
|
/**
|
|
11414
10922
|
* Returns the items that are displayed in the "add"-dropdown ordered by priority.
|
|
11415
10923
|
*/
|
|
11416
|
-
this.templatesAndLabels$ = this.items$.pipe(map
|
|
10924
|
+
this.templatesAndLabels$ = this.items$.pipe(map(items => sortBy(items.filter(action => !action.component), this.byPriority)));
|
|
11417
10925
|
/**
|
|
11418
10926
|
* Returns the items that are displayed at the top navigation.
|
|
11419
10927
|
*/
|
|
11420
|
-
this.components$ = this.items$.pipe(map
|
|
10928
|
+
this.components$ = this.items$.pipe(map(items => sortBy(items.filter(action => action.component), this.byPriority)));
|
|
11421
10929
|
}
|
|
11422
10930
|
/**
|
|
11423
10931
|
* The current items to display in the action dropdown.
|
|
@@ -11842,7 +11350,7 @@ class DrawerService extends ExtensionPointForPlugins {
|
|
|
11842
11350
|
return this.state$.value;
|
|
11843
11351
|
}
|
|
11844
11352
|
getDrawersForPosition$(position) {
|
|
11845
|
-
return this.items$.pipe(map
|
|
11353
|
+
return this.items$.pipe(map(items => items.filter(drawer => drawer.position === position)));
|
|
11846
11354
|
}
|
|
11847
11355
|
/**
|
|
11848
11356
|
* Adds a new node to the navigator.
|
|
@@ -11865,7 +11373,7 @@ class DrawerService extends ExtensionPointForPlugins {
|
|
|
11865
11373
|
getInjectedHooks(HOOK_DRAWER, this.injectors),
|
|
11866
11374
|
() => this.factories,
|
|
11867
11375
|
stateToFactory(this.state$)
|
|
11868
|
-
]).pipe(distinctUntilChanged
|
|
11376
|
+
]).pipe(distinctUntilChanged(allEntriesAreEqual), map((drawerItems) => removeDuplicatesIds(drawerItems)), shareReplay(1));
|
|
11869
11377
|
}
|
|
11870
11378
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DrawerService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
11871
11379
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DrawerService, providedIn: 'root' }); }
|
|
@@ -11898,11 +11406,11 @@ class HeaderService extends StateService {
|
|
|
11898
11406
|
});
|
|
11899
11407
|
this.DELAY_TO_AVOID_FLICKERING_ON_ASYNC_NODES = 1000;
|
|
11900
11408
|
this.header$ = this.map((header) => header);
|
|
11901
|
-
this.canToggleNavigator$ = this.drawerService.items$.pipe(map
|
|
11409
|
+
this.canToggleNavigator$ = this.drawerService.items$.pipe(map(items => !!items.filter(tmp => tmp.position === 'left' && !tmp.noneRequired)?.length), distinctUntilChanged(), delay(this.DELAY_TO_AVOID_FLICKERING_ON_ASYNC_NODES));
|
|
11902
11410
|
this.navigatorOpen$ = combineLatest([
|
|
11903
11411
|
this.map(({ nav }) => nav.open),
|
|
11904
11412
|
this.canToggleNavigator$
|
|
11905
|
-
]).pipe(map
|
|
11413
|
+
]).pipe(map(([open, hasItems]) => open && hasItems));
|
|
11906
11414
|
this.rightDrawerOpen$ = this.map(({ rightDrawer }) => rightDrawer.open).pipe();
|
|
11907
11415
|
const titleReference = document.querySelector('title');
|
|
11908
11416
|
const notificationServices = this.serviceRegistry.get('notificationService');
|
|
@@ -12501,7 +12009,7 @@ class NavigatorService extends ExtensionPointForPlugins {
|
|
|
12501
12009
|
*/
|
|
12502
12010
|
this.firstUrl = true;
|
|
12503
12011
|
this.items$ = this.setupItemsObservable();
|
|
12504
|
-
this.hasItemsInNavigator$ = this.items$.pipe(map
|
|
12012
|
+
this.hasItemsInNavigator$ = this.items$.pipe(map(({ length }) => !!length), distinctUntilChanged());
|
|
12505
12013
|
this.redirectToFirstNode();
|
|
12506
12014
|
}
|
|
12507
12015
|
/**
|
|
@@ -12534,7 +12042,7 @@ class NavigatorService extends ExtensionPointForPlugins {
|
|
|
12534
12042
|
getInjectedHooks(HOOK_NAVIGATOR_NODES, this.injectors),
|
|
12535
12043
|
() => this.factories,
|
|
12536
12044
|
stateToFactory(this.state$)
|
|
12537
|
-
]).pipe(distinctUntilChanged
|
|
12045
|
+
]).pipe(distinctUntilChanged(), map((nodes) => {
|
|
12538
12046
|
const noParent = nodes.filter(node => !node.parent);
|
|
12539
12047
|
const withParent = nodes.filter(node => node.parent);
|
|
12540
12048
|
// Based on the sortedNodes array, the nodes are sequentially created.
|
|
@@ -12556,7 +12064,7 @@ class NavigatorService extends ExtensionPointForPlugins {
|
|
|
12556
12064
|
return hasBaseRoute;
|
|
12557
12065
|
}
|
|
12558
12066
|
this.router.events
|
|
12559
|
-
.pipe(filter(event => event instanceof NavigationStart && event.url === '/'), switchMap(() => this.items$.pipe(map
|
|
12067
|
+
.pipe(filter(event => event instanceof NavigationStart && event.url === '/'), switchMap(() => this.items$.pipe(map(nodes => this.getFirstNodeWithPath(sortByPriority(nodes))), filter(firstNodeWithPath => firstNodeWithPath && firstNodeWithPath.path !== '/'), first$1())))
|
|
12560
12068
|
.subscribe((node) => {
|
|
12561
12069
|
this.router.navigate([node.path]);
|
|
12562
12070
|
});
|
|
@@ -12690,14 +12198,14 @@ class StepperService extends ExtensionPointForPlugins {
|
|
|
12690
12198
|
* @param id The id of the stepper to hook into.
|
|
12691
12199
|
*/
|
|
12692
12200
|
getById$(id) {
|
|
12693
|
-
return this.items$.pipe(filter(steps => steps.length > 0), map
|
|
12201
|
+
return this.items$.pipe(filter(steps => steps.length > 0), map(steps => steps.filter(cmp => cmp.stepperId === id)), take(1));
|
|
12694
12202
|
}
|
|
12695
12203
|
setupItemsObservable() {
|
|
12696
12204
|
return fromTrigger(this.router, this.refresh$, [
|
|
12697
12205
|
getInjectedHooks(HOOK_STEPPER, this.injectors),
|
|
12698
12206
|
() => this.factories,
|
|
12699
12207
|
stateToFactory(this.state$)
|
|
12700
|
-
]).pipe(distinctUntilChanged
|
|
12208
|
+
]).pipe(distinctUntilChanged(), shareReplay(1));
|
|
12701
12209
|
}
|
|
12702
12210
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepperService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: i1$1.TranslateService }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
12703
12211
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepperService, providedIn: 'root' }); }
|
|
@@ -12747,7 +12255,7 @@ class SetupService {
|
|
|
12747
12255
|
return of([]);
|
|
12748
12256
|
}
|
|
12749
12257
|
return this.stepperService.getById$(Steppers.SETUP);
|
|
12750
|
-
}), map
|
|
12258
|
+
}), map((steps) => this.getNotCompletedSetupSteps(steps)), map(notCompletedSetupSteps => this.options.forceSetup ||
|
|
12751
12259
|
(this.options.isSetup && this.needsSetup(notCompletedSetupSteps))), switchMap(required => this.setupRequired(required)));
|
|
12752
12260
|
}
|
|
12753
12261
|
}
|
|
@@ -12758,7 +12266,7 @@ class SetupService {
|
|
|
12758
12266
|
if (!required) {
|
|
12759
12267
|
return of(required);
|
|
12760
12268
|
}
|
|
12761
|
-
return this.skipSetup$.pipe(map
|
|
12269
|
+
return this.skipSetup$.pipe(map(skipped => !skipped));
|
|
12762
12270
|
}
|
|
12763
12271
|
needsSetup(notCompletedSetupSteps) {
|
|
12764
12272
|
notCompletedSetupSteps = this.excludeSetupFinishStep(notCompletedSetupSteps);
|
|
@@ -12835,13 +12343,13 @@ class TabsService extends ExtensionPointForPlugins {
|
|
|
12835
12343
|
this.translateService = translateService;
|
|
12836
12344
|
this.options = options;
|
|
12837
12345
|
this.items$ = this.setupItemsObservable();
|
|
12838
|
-
this.orientation$ = this.items$.pipe(map
|
|
12346
|
+
this.orientation$ = this.items$.pipe(map((tabs) => {
|
|
12839
12347
|
const firstTabWithDefinedOrientation = tabs.find(tab => tab.orientation);
|
|
12840
12348
|
if (firstTabWithDefinedOrientation) {
|
|
12841
12349
|
return firstTabWithDefinedOrientation.orientation;
|
|
12842
12350
|
}
|
|
12843
12351
|
return this.options.tabsHorizontal ? 'horizontal' : 'vertical';
|
|
12844
|
-
}), distinctUntilChanged
|
|
12352
|
+
}), distinctUntilChanged());
|
|
12845
12353
|
}
|
|
12846
12354
|
prepareTabs(tabs) {
|
|
12847
12355
|
return this.sortTabs(tabs
|
|
@@ -12882,7 +12390,7 @@ class TabsService extends ExtensionPointForPlugins {
|
|
|
12882
12390
|
this.emitNewState();
|
|
12883
12391
|
}
|
|
12884
12392
|
get firstTab$() {
|
|
12885
|
-
return this.items$.pipe(map
|
|
12393
|
+
return this.items$.pipe(map(tabs => tabs[0]), filter(Boolean), first$1());
|
|
12886
12394
|
}
|
|
12887
12395
|
/**
|
|
12888
12396
|
* Checks if at least one of the tabs is available.
|
|
@@ -12898,7 +12406,7 @@ class TabsService extends ExtensionPointForPlugins {
|
|
|
12898
12406
|
getInjectedHooks(HOOK_TABS, this.injectors),
|
|
12899
12407
|
() => this.factories,
|
|
12900
12408
|
stateToFactory(this.state$)
|
|
12901
|
-
]).pipe(distinctUntilChanged
|
|
12409
|
+
]).pipe(distinctUntilChanged(), map(tabs => this.prepareTabs(tabs)), shareReplay(1));
|
|
12902
12410
|
}
|
|
12903
12411
|
sort(tabs) {
|
|
12904
12412
|
return tabs.sort((a, b) => {
|
|
@@ -13047,7 +12555,7 @@ class BreadcrumbService extends ExtensionPointForPlugins {
|
|
|
13047
12555
|
getInjectedHooks(HOOK_BREADCRUMB, this.injectors),
|
|
13048
12556
|
() => this.factories,
|
|
13049
12557
|
stateToFactory(this.state$)
|
|
13050
|
-
]).pipe(distinctUntilChanged
|
|
12558
|
+
]).pipe(distinctUntilChanged(), map(breadcrumbs => this.sortByPreferredPath(breadcrumbs)), shareReplay(1));
|
|
13051
12559
|
}
|
|
13052
12560
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BreadcrumbService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13053
12561
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BreadcrumbService, providedIn: 'root' }); }
|
|
@@ -13217,7 +12725,7 @@ class DocsService extends ExtensionPointWithoutStateForPlugins {
|
|
|
13217
12725
|
}
|
|
13218
12726
|
setupItemsObservable() {
|
|
13219
12727
|
const supportUrlRefreshTrigger = this.app.map(({ supportUrl }) => supportUrl);
|
|
13220
|
-
return fromTriggerOnce(this.router, [supportUrlRefreshTrigger, this.refresh$], [getInjectedHooks(HOOK_DOCS, this.injectors), () => this.factories, this]).pipe(shareReplay(1), distinctUntilChanged
|
|
12728
|
+
return fromTriggerOnce(this.router, [supportUrlRefreshTrigger, this.refresh$], [getInjectedHooks(HOOK_DOCS, this.injectors), () => this.factories, this]).pipe(shareReplay(1), distinctUntilChanged());
|
|
13221
12729
|
}
|
|
13222
12730
|
getLink(templateStr, partialLink) {
|
|
13223
12731
|
if (!templateStr) {
|
|
@@ -13333,7 +12841,7 @@ class SearchService extends ExtensionPointForPlugins {
|
|
|
13333
12841
|
getInjectedHooks(HOOK_SEARCH, this.injectors),
|
|
13334
12842
|
() => this.factories,
|
|
13335
12843
|
stateToFactory(this.state$)
|
|
13336
|
-
]).pipe(shareReplay(1), distinctUntilChanged
|
|
12844
|
+
]).pipe(shareReplay(1), distinctUntilChanged());
|
|
13337
12845
|
}
|
|
13338
12846
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SearchService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13339
12847
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SearchService, providedIn: 'root' }); }
|
|
@@ -13413,7 +12921,7 @@ class UserMenuService extends ExtensionPointForPlugins {
|
|
|
13413
12921
|
getInjectedHooks(HOOK_USER_MENU, this.injectors),
|
|
13414
12922
|
() => this.factories,
|
|
13415
12923
|
stateToFactory(this.state$)
|
|
13416
|
-
]).pipe(map
|
|
12924
|
+
]).pipe(map(items => Array.from(items.values())), map(items => sortByPriority(items)), distinctUntilChanged(), shareReplay(1));
|
|
13417
12925
|
}
|
|
13418
12926
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserMenuService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13419
12927
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserMenuService, providedIn: 'root' }); }
|
|
@@ -13440,7 +12948,7 @@ class TitleOutletComponent {
|
|
|
13440
12948
|
pageTitleUpdate$.subscribe(pageTitleUpdate => (this.pageTitleUpdate = pageTitleUpdate));
|
|
13441
12949
|
this.zone.runOutsideAngular(() => {
|
|
13442
12950
|
this.headerService.state$
|
|
13443
|
-
.pipe(debounceTime(100), filter(state => state.pageTitleUpdate), debounceTime(100), map
|
|
12951
|
+
.pipe(debounceTime(100), filter(state => state.pageTitleUpdate), debounceTime(100), map(() => this.element.nativeElement.querySelector('h1')), filter(el => el !== null), map(el => el.innerText), filter(Boolean))
|
|
13444
12952
|
.subscribe((title) => headerService.changePageTitle(title));
|
|
13445
12953
|
});
|
|
13446
12954
|
}
|
|
@@ -13507,9 +13015,9 @@ class DrawerOutletComponent {
|
|
|
13507
13015
|
constructor(drawerService) {
|
|
13508
13016
|
this.drawerService = drawerService;
|
|
13509
13017
|
this.drawerPosition$ = new BehaviorSubject(null);
|
|
13510
|
-
const cleanedPosition$ = this.drawerPosition$.pipe(filter(p => !!p), distinctUntilChanged
|
|
13511
|
-
this.isLeft$ = cleanedPosition$.pipe(map
|
|
13512
|
-
this.drawerItems$ = cleanedPosition$.pipe(filter(p => !!p), distinctUntilChanged
|
|
13018
|
+
const cleanedPosition$ = this.drawerPosition$.pipe(filter(p => !!p), distinctUntilChanged());
|
|
13019
|
+
this.isLeft$ = cleanedPosition$.pipe(map(position => position === 'left'));
|
|
13020
|
+
this.drawerItems$ = cleanedPosition$.pipe(filter(p => !!p), distinctUntilChanged(), switchMap(position => this.drawerService.getDrawersForPosition$(position)));
|
|
13513
13021
|
}
|
|
13514
13022
|
ngOnChanges(changes) {
|
|
13515
13023
|
if (changes.position) {
|
|
@@ -13558,7 +13066,7 @@ class HeaderBarComponent {
|
|
|
13558
13066
|
*/
|
|
13559
13067
|
this.simple = false;
|
|
13560
13068
|
this.app$ = this.appState.currentApplication.pipe(filter(app => !!app));
|
|
13561
|
-
this.loadingClass$ = this.apiService.isLoading$.pipe(map
|
|
13069
|
+
this.loadingClass$ = this.apiService.isLoading$.pipe(map(loading => ({ active: loading })));
|
|
13562
13070
|
}
|
|
13563
13071
|
ngAfterViewInit() {
|
|
13564
13072
|
this.headerService.verifyIfNavOpen();
|
|
@@ -13637,7 +13145,7 @@ class TabsOutletComponent {
|
|
|
13637
13145
|
}
|
|
13638
13146
|
ngOnInit() {
|
|
13639
13147
|
if (this.outletName && this.tabs.length === 0) {
|
|
13640
|
-
const tabsSubscription$ = this.tabsService.items$.pipe(map
|
|
13148
|
+
const tabsSubscription$ = this.tabsService.items$.pipe(map(tabs => tabs.filter(tab => tab.tabsOutlet === this.outletName)), takeUntil(this.destroy$));
|
|
13641
13149
|
tabsSubscription$.subscribe(tabs => {
|
|
13642
13150
|
this.tabs = tabs;
|
|
13643
13151
|
});
|
|
@@ -14923,12 +14431,12 @@ class BootstrapComponent {
|
|
|
14923
14431
|
this.tabsOrientation = this.options.tabsHorizontal ? 'horizontal' : 'vertical';
|
|
14924
14432
|
this.ui
|
|
14925
14433
|
.map(({ lang }) => lang)
|
|
14926
|
-
.pipe(takeUntil(this.destroy$), distinctUntilChanged
|
|
14434
|
+
.pipe(takeUntil(this.destroy$), distinctUntilChanged())
|
|
14927
14435
|
.subscribe(() => {
|
|
14928
14436
|
this.actionBar.refresh();
|
|
14929
14437
|
});
|
|
14930
14438
|
this.showPoweredBy = !this.options.get('hidePowered');
|
|
14931
|
-
this.showMainView$ = this.setupService.isSetupNeeded$.pipe(map
|
|
14439
|
+
this.showMainView$ = this.setupService.isSetupNeeded$.pipe(map(setupNeeded => !setupNeeded));
|
|
14932
14440
|
}
|
|
14933
14441
|
ngOnDestroy() {
|
|
14934
14442
|
this.destroy$.next();
|
|
@@ -15181,7 +14689,7 @@ class NavigatorNodeComponent {
|
|
|
15181
14689
|
/**
|
|
15182
14690
|
* A observable which emits, as soon as the active state of the node changes.
|
|
15183
14691
|
*/
|
|
15184
|
-
this.isActive$ = merge(this.nodeInit$, this.router.events.pipe(filter(e => e instanceof ActivationEnd))).pipe(map
|
|
14692
|
+
this.isActive$ = merge(this.nodeInit$, this.router.events.pipe(filter(e => e instanceof ActivationEnd))).pipe(map(() => {
|
|
15185
14693
|
if (isUndefined(this.node.path)) {
|
|
15186
14694
|
return false;
|
|
15187
14695
|
}
|
|
@@ -15200,7 +14708,7 @@ class NavigatorNodeComponent {
|
|
|
15200
14708
|
fragment: 'ignored',
|
|
15201
14709
|
matrixParams: 'ignored'
|
|
15202
14710
|
});
|
|
15203
|
-
}), distinctUntilChanged
|
|
14711
|
+
}), distinctUntilChanged(), tap(isActive => {
|
|
15204
14712
|
if (isActive) {
|
|
15205
14713
|
this.expandCollapse(true);
|
|
15206
14714
|
this.expandRecursiveParent(this.node.parents);
|
|
@@ -15705,7 +15213,7 @@ class NavigatorDrawerFactory {
|
|
|
15705
15213
|
};
|
|
15706
15214
|
}
|
|
15707
15215
|
get() {
|
|
15708
|
-
return this.navigatorService.hasItemsInNavigator$.pipe(map
|
|
15216
|
+
return this.navigatorService.hasItemsInNavigator$.pipe(map(tmp => (tmp ? this.drawerItem : [])));
|
|
15709
15217
|
}
|
|
15710
15218
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NavigatorDrawerFactory, deps: [{ token: NavigatorService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
15711
15219
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NavigatorDrawerFactory }); }
|
|
@@ -16254,7 +15762,7 @@ class SelectKeyboardService {
|
|
|
16254
15762
|
return list.changes.pipe(startWith$1(list), switchMap$1((items) => combineLatest([
|
|
16255
15763
|
merge(fromEvent(input, 'keyup'), fromEvent(input, 'keydown')),
|
|
16256
15764
|
of(items.toArray())
|
|
16257
|
-
])), map(([e, items]) => this.handleKeyboard(e, input, items, dropdown)), distinctUntilChanged(), takeUntil$1(this.destroyed$));
|
|
15765
|
+
])), map$2(([e, items]) => this.handleKeyboard(e, input, items, dropdown)), distinctUntilChanged$1(), takeUntil$1(this.destroyed$));
|
|
16258
15766
|
}
|
|
16259
15767
|
ngOnDestroy() {
|
|
16260
15768
|
this.unregister();
|
|
@@ -16600,7 +16108,7 @@ class TypeaheadComponent {
|
|
|
16600
16108
|
}
|
|
16601
16109
|
ngAfterViewInit() {
|
|
16602
16110
|
fromEvent(this.searchControl.nativeElement, 'keydown')
|
|
16603
|
-
.pipe(debounceTime(200), distinctUntilChanged
|
|
16111
|
+
.pipe(debounceTime(200), distinctUntilChanged(), takeUntil(this.destroyed$))
|
|
16604
16112
|
.subscribe((event) => {
|
|
16605
16113
|
if (this.selectKeyboardService.isSelectionEvent(event)) {
|
|
16606
16114
|
return;
|
|
@@ -17991,7 +17499,7 @@ class FilterInputComponent {
|
|
|
17991
17499
|
return timer(0);
|
|
17992
17500
|
}
|
|
17993
17501
|
return timer(this.AUTO_SEARCH_DEBOUNCE);
|
|
17994
|
-
}), map
|
|
17502
|
+
}), map((e) => e.target.value), distinctUntilChanged())
|
|
17995
17503
|
.subscribe(filterTerm => {
|
|
17996
17504
|
this.filterTerm = filterTerm;
|
|
17997
17505
|
this.onSearch.emit(filterTerm);
|
|
@@ -18376,7 +17884,7 @@ class JsonValidationPrettifierDirective {
|
|
|
18376
17884
|
}
|
|
18377
17885
|
ngOnInit() {
|
|
18378
17886
|
this.subscription = this.abstractCtrl.valueChanges
|
|
18379
|
-
.pipe(tap(() => this.clearValidationMessage()), debounceTime(this.debounceTimeInMs), distinctUntilChanged
|
|
17887
|
+
.pipe(tap(() => this.clearValidationMessage()), debounceTime(this.debounceTimeInMs), distinctUntilChanged())
|
|
18380
17888
|
.subscribe(value => {
|
|
18381
17889
|
this.validateInputAndPrettify(value);
|
|
18382
17890
|
});
|
|
@@ -19674,14 +19182,14 @@ class ThemeSwitcherService {
|
|
|
19674
19182
|
}
|
|
19675
19183
|
return of(preference);
|
|
19676
19184
|
}));
|
|
19677
|
-
this.disableThemeSelection$ = this._temporaryThemePreference$.pipe(map
|
|
19185
|
+
this.disableThemeSelection$ = this._temporaryThemePreference$.pipe(map(preference => preference !== 'none'));
|
|
19678
19186
|
this.currentlyAppliedTheme$ = this._temporaryThemePreference$.pipe(switchMap(temporaryPreference => {
|
|
19679
19187
|
if (temporaryPreference !== 'none') {
|
|
19680
19188
|
return of(temporaryPreference);
|
|
19681
19189
|
}
|
|
19682
19190
|
return userSelectedTheme$;
|
|
19683
19191
|
}));
|
|
19684
|
-
this.darkThemeAvailable$ = this.options.get$('darkThemeAvailable').pipe(map
|
|
19192
|
+
this.darkThemeAvailable$ = this.options.get$('darkThemeAvailable').pipe(map(value => !!value));
|
|
19685
19193
|
}
|
|
19686
19194
|
getCurrentThemePreference() {
|
|
19687
19195
|
const value = getThemePreference();
|
|
@@ -19691,7 +19199,7 @@ class ThemeSwitcherService {
|
|
|
19691
19199
|
return 'light';
|
|
19692
19200
|
}
|
|
19693
19201
|
getUsersSystemPreferenceForTheme$() {
|
|
19694
|
-
return fromEvent(window.matchMedia('(prefers-color-scheme: dark)'), 'change').pipe(startWith(window.matchMedia('(prefers-color-scheme: dark)')), map
|
|
19202
|
+
return fromEvent(window.matchMedia('(prefers-color-scheme: dark)'), 'change').pipe(startWith(window.matchMedia('(prefers-color-scheme: dark)')), map((e) => (e.matches ? 'dark' : 'light')));
|
|
19695
19203
|
}
|
|
19696
19204
|
changeUserPreference(preference) {
|
|
19697
19205
|
setThemePreference(preference);
|
|
@@ -21268,6 +20776,477 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
21268
20776
|
}]
|
|
21269
20777
|
}] });
|
|
21270
20778
|
|
|
20779
|
+
var ApplicationPluginStatus;
|
|
20780
|
+
(function (ApplicationPluginStatus) {
|
|
20781
|
+
ApplicationPluginStatus["ORPHANED"] = "ORPHANED";
|
|
20782
|
+
ApplicationPluginStatus["LATEST"] = "LATEST";
|
|
20783
|
+
ApplicationPluginStatus["OUTDATED"] = "OUTDATED";
|
|
20784
|
+
ApplicationPluginStatus["REVOKED"] = "REVOKED";
|
|
20785
|
+
ApplicationPluginStatus["AUTO"] = "AUTO";
|
|
20786
|
+
})(ApplicationPluginStatus || (ApplicationPluginStatus = {}));
|
|
20787
|
+
var PackageType;
|
|
20788
|
+
(function (PackageType) {
|
|
20789
|
+
/**
|
|
20790
|
+
* A package coming from the official Cumulocity github enterprise.
|
|
20791
|
+
*/
|
|
20792
|
+
PackageType["OFFICIAL"] = "OFFICIAL";
|
|
20793
|
+
/**
|
|
20794
|
+
* A package coming from any connected partner repository.
|
|
20795
|
+
*/
|
|
20796
|
+
PackageType["COMMUNITY"] = "COMMUNITY";
|
|
20797
|
+
/**
|
|
20798
|
+
* A package where the origin is unknown (e.g. uploaded to management with an unknown label)
|
|
20799
|
+
*/
|
|
20800
|
+
PackageType["UNKNOWN"] = "UNKNOWN";
|
|
20801
|
+
/**
|
|
20802
|
+
* A custom package e.g. uploaded to the tenant by a user
|
|
20803
|
+
*/
|
|
20804
|
+
PackageType["CUSTOM"] = "CUSTOM";
|
|
20805
|
+
/**
|
|
20806
|
+
* A package that was archived by the user
|
|
20807
|
+
*/
|
|
20808
|
+
PackageType["ARCHIVED"] = "ARCHIVED";
|
|
20809
|
+
})(PackageType || (PackageType = {}));
|
|
20810
|
+
|
|
20811
|
+
class PluginsService {
|
|
20812
|
+
static convertInstalledRemotesToIds(remotes) {
|
|
20813
|
+
if (!remotes) {
|
|
20814
|
+
return;
|
|
20815
|
+
}
|
|
20816
|
+
const importContextPaths = Object.keys(remotes);
|
|
20817
|
+
const plugins = [];
|
|
20818
|
+
importContextPaths.forEach(contextPath => {
|
|
20819
|
+
const moduleNames = remotes[contextPath] || [];
|
|
20820
|
+
plugins.push(...moduleNames.map(module => PluginsService.createPluginId(contextPath, module, '', true)));
|
|
20821
|
+
});
|
|
20822
|
+
return plugins;
|
|
20823
|
+
}
|
|
20824
|
+
static createPluginId(contextPath, plugin, version, useLatest = false) {
|
|
20825
|
+
const moduleName = typeof plugin === 'string' ? plugin : plugin.module;
|
|
20826
|
+
if (useLatest) {
|
|
20827
|
+
return `${contextPath}/${moduleName}`;
|
|
20828
|
+
}
|
|
20829
|
+
return `${contextPath}@${version}/${moduleName}`;
|
|
20830
|
+
}
|
|
20831
|
+
constructor(applicationService, appStateService, client) {
|
|
20832
|
+
this.applicationService = applicationService;
|
|
20833
|
+
this.appStateService = appStateService;
|
|
20834
|
+
this.client = client;
|
|
20835
|
+
}
|
|
20836
|
+
/**
|
|
20837
|
+
* Fetches a list of available packages.
|
|
20838
|
+
* @param params Additional query parameters.
|
|
20839
|
+
* @returns Returns a list of packages.
|
|
20840
|
+
*/
|
|
20841
|
+
async listPackages(params = {}) {
|
|
20842
|
+
const apps = await this.listApplicationsByCurrentTenant(params);
|
|
20843
|
+
const webApps = apps.filter(app => this.isPackage(app));
|
|
20844
|
+
const uniqueWebApps = this.removeDuplicates(webApps, 'contextPath');
|
|
20845
|
+
return uniqueWebApps.sort((a, b) => a.name.localeCompare(b.name));
|
|
20846
|
+
}
|
|
20847
|
+
/**
|
|
20848
|
+
* Checks if an application is a package.
|
|
20849
|
+
* @param application Application managed object.
|
|
20850
|
+
* @returns Returns true if the application is a package.
|
|
20851
|
+
*/
|
|
20852
|
+
isPackage(application) {
|
|
20853
|
+
return application.manifest?.isPackage === true;
|
|
20854
|
+
}
|
|
20855
|
+
/**
|
|
20856
|
+
* Updates the remotes field in the application configuration by adding new plugins.
|
|
20857
|
+
* Important: if the remotes object is not set on the configuration object,
|
|
20858
|
+
* remotes will not be added. Make sure that this object exists in the application configuration.
|
|
20859
|
+
* @param application Application managed object.
|
|
20860
|
+
* @param plugins List of remotes to be added.
|
|
20861
|
+
* @returns Returns updated application remotes.
|
|
20862
|
+
*/
|
|
20863
|
+
async addRemotes(application, plugins) {
|
|
20864
|
+
const pluginsArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
20865
|
+
const manifestRemotes = application.manifest?.remotes || {};
|
|
20866
|
+
const appConfig = application?.config;
|
|
20867
|
+
const appConfigRemotes = appConfig?.remotes || manifestRemotes;
|
|
20868
|
+
const appConfigExcludedRemotes = appConfig?.excludedRemotes || {};
|
|
20869
|
+
// only normal and self optional scoped plugins should be added to remotes
|
|
20870
|
+
// self scoped plugins will be automatically added
|
|
20871
|
+
const allPluginsExceptSelfScoped = this.getAllPluginsExceptSelfScoped(pluginsArray, application.contextPath);
|
|
20872
|
+
const newRemotes = this.addPluginToRemotesConfig(appConfigRemotes, allPluginsExceptSelfScoped);
|
|
20873
|
+
// should be unproblematic to remove all categories of plugins from excluded remotes
|
|
20874
|
+
const newExcludedRemotes = this.removePluginsFromRemotesConfig(appConfigExcludedRemotes, plugins);
|
|
20875
|
+
return await this.updateRemotesInAppConfig(application, newRemotes, newExcludedRemotes);
|
|
20876
|
+
}
|
|
20877
|
+
/**
|
|
20878
|
+
* Updates the remotes field in the application configuration by removing plugins.
|
|
20879
|
+
* @param application Application managed object.
|
|
20880
|
+
* @param plugins List of remotes to be removed.
|
|
20881
|
+
* @returns Returns updated application remotes.
|
|
20882
|
+
*/
|
|
20883
|
+
async removeRemotes(application, plugins) {
|
|
20884
|
+
const pluginsArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
20885
|
+
const manifestRemotes = application.manifest?.remotes || {};
|
|
20886
|
+
const appConfig = application?.config;
|
|
20887
|
+
const appConfigRemotes = appConfig?.remotes || manifestRemotes;
|
|
20888
|
+
const appConfigExcludedRemotes = appConfig?.excludedRemotes || {};
|
|
20889
|
+
// app plugins need to be removed from remotes
|
|
20890
|
+
const newRemotes = this.removePluginsFromRemotesConfig(appConfigRemotes, plugins);
|
|
20891
|
+
// self scoped plugins need to be added to excluded remotes
|
|
20892
|
+
// as they would be otherwise automatically added to remotes
|
|
20893
|
+
const selfScopedPlugins = this.getSelfScopedPlugins(pluginsArray, application.contextPath);
|
|
20894
|
+
const newExcludedRemotes = this.addPluginToRemotesConfig(appConfigExcludedRemotes, selfScopedPlugins);
|
|
20895
|
+
return await this.updateRemotesInAppConfig(application, newRemotes, newExcludedRemotes);
|
|
20896
|
+
}
|
|
20897
|
+
/**
|
|
20898
|
+
* Updates the remotes field in the application configuration.
|
|
20899
|
+
* @param application Application managed object.
|
|
20900
|
+
* @param plugins List of remotes to be added.
|
|
20901
|
+
* @returns Returns updated application remotes.
|
|
20902
|
+
*/
|
|
20903
|
+
async updateRemotesInAppConfig(application, plugins, excludedRemotes) {
|
|
20904
|
+
const updatedAppWithConfig = await this.applicationService.updateApplicationConfig(application, {
|
|
20905
|
+
remotes: plugins,
|
|
20906
|
+
excludedRemotes: excludedRemotes || {}
|
|
20907
|
+
});
|
|
20908
|
+
return updatedAppWithConfig?.config || { remotes: {} };
|
|
20909
|
+
}
|
|
20910
|
+
/**
|
|
20911
|
+
* Fetches the application manifest.
|
|
20912
|
+
* @param application Application managed object.
|
|
20913
|
+
* @returns Returns the application manifest.
|
|
20914
|
+
*/
|
|
20915
|
+
async getCumulocityJsonFile(application) {
|
|
20916
|
+
const c8yJson = await this.applicationService.getAppManifest(application);
|
|
20917
|
+
if (!c8yJson.remotes) {
|
|
20918
|
+
c8yJson.remotes = {};
|
|
20919
|
+
}
|
|
20920
|
+
return c8yJson;
|
|
20921
|
+
}
|
|
20922
|
+
/**
|
|
20923
|
+
* Sets the initial state of remotes in the configuration (when it's missing), based on the list of remotes being in the application manifest.
|
|
20924
|
+
* @param application Application managed object.
|
|
20925
|
+
* @returns Returns a list of remotes that has been assigned to the configuration object.
|
|
20926
|
+
*/
|
|
20927
|
+
async setInitialRemotes(application) {
|
|
20928
|
+
try {
|
|
20929
|
+
const manifest = await this.getCumulocityJsonFile(application);
|
|
20930
|
+
const manifestRemotes = manifest.remotes;
|
|
20931
|
+
return await this.updateRemotesInAppConfig(application, manifestRemotes || {}, {});
|
|
20932
|
+
}
|
|
20933
|
+
catch (er) {
|
|
20934
|
+
return undefined;
|
|
20935
|
+
}
|
|
20936
|
+
}
|
|
20937
|
+
async resetRemotes(application) {
|
|
20938
|
+
return await this.applicationService.updateApplicationConfig(application, {
|
|
20939
|
+
remotes: undefined,
|
|
20940
|
+
excludedRemotes: undefined
|
|
20941
|
+
});
|
|
20942
|
+
}
|
|
20943
|
+
sortVersions(source, order) {
|
|
20944
|
+
const sourceCopy = cloneDeep(source);
|
|
20945
|
+
if (source.list && source.path) {
|
|
20946
|
+
const path = sourceCopy.path.join('.');
|
|
20947
|
+
return sourceCopy.list.sort((a, b) => compare(coerce(get(a, path)), coerce(get(b, path))) * (order === 'asc' ? 1 : -1));
|
|
20948
|
+
}
|
|
20949
|
+
else {
|
|
20950
|
+
return sourceCopy.sort((a, b) => compare(coerce(a), coerce(b)) * (order === 'asc' ? 1 : -1));
|
|
20951
|
+
}
|
|
20952
|
+
}
|
|
20953
|
+
/**
|
|
20954
|
+
* Extracts a list of exported plugins from the application object.
|
|
20955
|
+
* @param application Application managed object.
|
|
20956
|
+
* @param useLatest Set this to true, to not bind the plugin to any version.
|
|
20957
|
+
* @returns Returns a list of exported plugins.
|
|
20958
|
+
*/
|
|
20959
|
+
getMFExports(application, excludedScopes = [
|
|
20960
|
+
PluginsExportScopes.SELF,
|
|
20961
|
+
PluginsExportScopes.SELF_OPTIONAL,
|
|
20962
|
+
PluginsExportScopes.GLOBAL
|
|
20963
|
+
], useLatest = false) {
|
|
20964
|
+
const manifest = application.manifest;
|
|
20965
|
+
if (!manifest || !manifest.exports) {
|
|
20966
|
+
return [];
|
|
20967
|
+
}
|
|
20968
|
+
return this.extendPluginsDetails(application, {
|
|
20969
|
+
version: manifest.version,
|
|
20970
|
+
binaryId: undefined
|
|
20971
|
+
}, useLatest).filter(plugin => !excludedScopes.includes(plugin.scope));
|
|
20972
|
+
}
|
|
20973
|
+
/**
|
|
20974
|
+
* Extracts a list of exports from each available package.
|
|
20975
|
+
* @param allVersions If set to true, all and not only latest versions are included.
|
|
20976
|
+
* @param excludedScopes Defines which scopes should not be loaded.
|
|
20977
|
+
* @returns Returns a list of all exported plugins.
|
|
20978
|
+
*/
|
|
20979
|
+
async getAllMFExports(allVersions = false, excludedScopes = [
|
|
20980
|
+
PluginsExportScopes.SELF,
|
|
20981
|
+
PluginsExportScopes.SELF_OPTIONAL,
|
|
20982
|
+
PluginsExportScopes.GLOBAL
|
|
20983
|
+
]) {
|
|
20984
|
+
const plugins = new Array();
|
|
20985
|
+
const packages = await this.listPackages();
|
|
20986
|
+
for (const pkg of packages) {
|
|
20987
|
+
if (!pkg?.manifest?.exports) {
|
|
20988
|
+
continue;
|
|
20989
|
+
}
|
|
20990
|
+
if (allVersions && Array.isArray(pkg.applicationVersions)) {
|
|
20991
|
+
pkg.applicationVersions.forEach(version => {
|
|
20992
|
+
plugins.push(...this.extendPluginsDetails(pkg, version));
|
|
20993
|
+
});
|
|
20994
|
+
}
|
|
20995
|
+
else {
|
|
20996
|
+
plugins.push(...this.extendPluginsDetails(pkg, {
|
|
20997
|
+
version: pkg.manifest.version,
|
|
20998
|
+
binaryId: undefined
|
|
20999
|
+
}));
|
|
21000
|
+
}
|
|
21001
|
+
}
|
|
21002
|
+
return plugins.filter(plugin => !excludedScopes.includes(plugin.scope));
|
|
21003
|
+
}
|
|
21004
|
+
/**
|
|
21005
|
+
* Extracts a list of remotes from the application object.
|
|
21006
|
+
* @param application Application managed object.
|
|
21007
|
+
* @returns Returns list of remotes.
|
|
21008
|
+
*/
|
|
21009
|
+
getMFRemotes(application) {
|
|
21010
|
+
const manifest = application.manifest || {};
|
|
21011
|
+
const config = application?.config;
|
|
21012
|
+
let remotes = config?.remotes || manifest.remotes || {};
|
|
21013
|
+
const manifestExports = manifest.exports || manifest.manifest?.exports || [];
|
|
21014
|
+
const selfRemotes = manifestExports
|
|
21015
|
+
.filter(plugin => plugin.scope === PluginsExportScopes.SELF)
|
|
21016
|
+
.map(plugin => plugin.module || plugin.name);
|
|
21017
|
+
if (selfRemotes.length) {
|
|
21018
|
+
remotes = mergeRemotes([{ [application.contextPath]: selfRemotes }, remotes]);
|
|
21019
|
+
}
|
|
21020
|
+
remotes = removeRemotes(remotes, config?.excludedRemotes);
|
|
21021
|
+
return remotes;
|
|
21022
|
+
}
|
|
21023
|
+
/**
|
|
21024
|
+
* Determines the type of a package.
|
|
21025
|
+
* A package is OFFICIAL if it comes from management tenant and has a label attached called OFFICIAL.
|
|
21026
|
+
* A package is COMMUNITY if it has a label called COMMUNITY.
|
|
21027
|
+
* A package is CUSTOM if it does not have any label attached.
|
|
21028
|
+
* A package is UNKNOWN if it has a label attached but it does not match COMMUNITY or OFFICIAL.
|
|
21029
|
+
*
|
|
21030
|
+
* Labels can be used to identify the status of a package. Community packages always need
|
|
21031
|
+
* a license validation. The label will be shown on the application card to tell a user
|
|
21032
|
+
* whether they are looking into an official or community package.
|
|
21033
|
+
*
|
|
21034
|
+
* @param packageApplication The package application object to check.
|
|
21035
|
+
* @returns The package type.
|
|
21036
|
+
*/
|
|
21037
|
+
getPackageType(packageApplication) {
|
|
21038
|
+
const label = packageApplication.label || packageApplication.manifest?.label;
|
|
21039
|
+
if (label === PackageType.ARCHIVED) {
|
|
21040
|
+
return PackageType.ARCHIVED;
|
|
21041
|
+
}
|
|
21042
|
+
if (!label) {
|
|
21043
|
+
return PackageType.CUSTOM;
|
|
21044
|
+
}
|
|
21045
|
+
if (label === PackageType.OFFICIAL && this.isOwnedByManagement(packageApplication)) {
|
|
21046
|
+
return PackageType.OFFICIAL;
|
|
21047
|
+
}
|
|
21048
|
+
if (label === PackageType.COMMUNITY) {
|
|
21049
|
+
return PackageType.COMMUNITY;
|
|
21050
|
+
}
|
|
21051
|
+
return PackageType.UNKNOWN;
|
|
21052
|
+
}
|
|
21053
|
+
/**
|
|
21054
|
+
* Verifies if an application is owned by management tenant.
|
|
21055
|
+
*
|
|
21056
|
+
* @param app The application to verify.
|
|
21057
|
+
* @returns True if owned by management tenant.
|
|
21058
|
+
*/
|
|
21059
|
+
isOwnedByManagement(app) {
|
|
21060
|
+
const appOwner = get(app, 'owner.tenant.id');
|
|
21061
|
+
return appOwner === 'management';
|
|
21062
|
+
}
|
|
21063
|
+
pluginsFromManifest(manifest) {
|
|
21064
|
+
const plugins = manifest.exports;
|
|
21065
|
+
const extendedPlugins = plugins
|
|
21066
|
+
.filter(p => p.scope === PluginsExportScopes.SELF)
|
|
21067
|
+
.map(p => ({
|
|
21068
|
+
...p,
|
|
21069
|
+
id: PluginsService.createPluginId(manifest.contextPath, p, manifest.version),
|
|
21070
|
+
contextPath: manifest.contextPath,
|
|
21071
|
+
version: manifest.version,
|
|
21072
|
+
versioningMatrix: manifest.versioningMatrix,
|
|
21073
|
+
license: manifest.license,
|
|
21074
|
+
type: PackageType.CUSTOM
|
|
21075
|
+
}));
|
|
21076
|
+
return extendedPlugins;
|
|
21077
|
+
}
|
|
21078
|
+
async getReadmeFileContent(baseUrl) {
|
|
21079
|
+
return this.getFileContent(baseUrl, 'readme');
|
|
21080
|
+
}
|
|
21081
|
+
async getChangelogFileContent(baseUrl) {
|
|
21082
|
+
return this.getFileContent(baseUrl, 'changelog');
|
|
21083
|
+
}
|
|
21084
|
+
async getFileContent(baseUrl, fileType) {
|
|
21085
|
+
const file = await this.getFile(baseUrl, fileType);
|
|
21086
|
+
if (file.status === 200) {
|
|
21087
|
+
return await file.text();
|
|
21088
|
+
}
|
|
21089
|
+
return '';
|
|
21090
|
+
}
|
|
21091
|
+
async getFile(baseUrl, fileType) {
|
|
21092
|
+
const options = {
|
|
21093
|
+
method: 'GET',
|
|
21094
|
+
headers: { 'Content-Type': 'text/markdown' }
|
|
21095
|
+
};
|
|
21096
|
+
const uppercaseFilename = fileType === 'readme' ? 'README.md' : 'CHANGELOG.md';
|
|
21097
|
+
let result = await this.client.fetch(`${baseUrl}${uppercaseFilename}`, options);
|
|
21098
|
+
if (result && result.status === 404) {
|
|
21099
|
+
result = await this.client.fetch(`${baseUrl}${uppercaseFilename.toLowerCase()}`, options);
|
|
21100
|
+
}
|
|
21101
|
+
return result;
|
|
21102
|
+
}
|
|
21103
|
+
isSelfScopedPlugin(plugin, contextPath) {
|
|
21104
|
+
return (plugin.scope === PluginsExportScopes.SELF &&
|
|
21105
|
+
(!contextPath || plugin.contextPath === contextPath));
|
|
21106
|
+
}
|
|
21107
|
+
getSelfScopedPlugins(plugins, contextPath) {
|
|
21108
|
+
return plugins.filter(plugin => this.isSelfScopedPlugin(plugin, contextPath));
|
|
21109
|
+
}
|
|
21110
|
+
getAllPluginsExceptSelfScoped(plugins, contextPath) {
|
|
21111
|
+
return plugins.filter(plugin => !this.isSelfScopedPlugin(plugin, contextPath));
|
|
21112
|
+
}
|
|
21113
|
+
removeDuplicates(apps, key) {
|
|
21114
|
+
const uniqueList = [];
|
|
21115
|
+
const groupedAppsByKey = groupBy(apps, key);
|
|
21116
|
+
const groupedApps = Object.keys(groupedAppsByKey).map(key => groupedAppsByKey[key]);
|
|
21117
|
+
for (const appsGroup of groupedApps) {
|
|
21118
|
+
if (appsGroup.length < 2) {
|
|
21119
|
+
uniqueList.push(...appsGroup);
|
|
21120
|
+
}
|
|
21121
|
+
else {
|
|
21122
|
+
const appFromCurrentTenant = appsGroup.find(app => this.isFromCurrentTenant(app));
|
|
21123
|
+
if (appFromCurrentTenant) {
|
|
21124
|
+
uniqueList.push(appFromCurrentTenant);
|
|
21125
|
+
continue;
|
|
21126
|
+
}
|
|
21127
|
+
const appNotOwnedByManagement = appsGroup.find(app => !this.isOwnedByManagement(app));
|
|
21128
|
+
uniqueList.push(appNotOwnedByManagement);
|
|
21129
|
+
}
|
|
21130
|
+
}
|
|
21131
|
+
return uniqueList;
|
|
21132
|
+
}
|
|
21133
|
+
isFromCurrentTenant(app) {
|
|
21134
|
+
return app.owner.tenant.id === this.appStateService.currentTenant.value.name;
|
|
21135
|
+
}
|
|
21136
|
+
/**
|
|
21137
|
+
* Modifies the list of plugins to have additional information such as id.
|
|
21138
|
+
* @ignore
|
|
21139
|
+
*/
|
|
21140
|
+
extendPluginsDetails(application, version, useLatest = false) {
|
|
21141
|
+
const plugins = application.manifest.exports;
|
|
21142
|
+
const extendedPlugins = plugins.map(p => ({
|
|
21143
|
+
...p,
|
|
21144
|
+
id: PluginsService.createPluginId(application.contextPath, p, version.version, useLatest),
|
|
21145
|
+
idLatest: PluginsService.createPluginId(application.contextPath, p, version.version, true),
|
|
21146
|
+
contextPath: application.contextPath,
|
|
21147
|
+
version: version.version,
|
|
21148
|
+
versioningMatrix: application.manifest.versioningMatrix,
|
|
21149
|
+
tags: useLatest ? ['latest'] : version.tags || [],
|
|
21150
|
+
license: application.manifest.license,
|
|
21151
|
+
type: this.getPackageType(application),
|
|
21152
|
+
originApp: application
|
|
21153
|
+
}));
|
|
21154
|
+
return extendedPlugins;
|
|
21155
|
+
}
|
|
21156
|
+
async listApplicationsByCurrentTenant(params = {}) {
|
|
21157
|
+
const filter = Object.assign({
|
|
21158
|
+
type: 'HOSTED',
|
|
21159
|
+
pageSize: 2000,
|
|
21160
|
+
withTotalPages: true
|
|
21161
|
+
}, params);
|
|
21162
|
+
const sharedFilter = Object.assign({
|
|
21163
|
+
availability: ApplicationAvailability.SHARED,
|
|
21164
|
+
type: 'HOSTED',
|
|
21165
|
+
pageSize: 2000,
|
|
21166
|
+
withTotalPages: true
|
|
21167
|
+
}, params);
|
|
21168
|
+
const tenantName = this.appStateService.currentTenant.value.name;
|
|
21169
|
+
const [resultAppsOwnedByTenant, resultSharedApps] = await Promise.all([
|
|
21170
|
+
this.applicationService.listByTenant(tenantName, filter),
|
|
21171
|
+
this.applicationService.list(sharedFilter)
|
|
21172
|
+
]);
|
|
21173
|
+
const { data: appsOwnedByTenant } = resultAppsOwnedByTenant;
|
|
21174
|
+
const { data: sharedApps } = resultSharedApps;
|
|
21175
|
+
const webApps = [...appsOwnedByTenant, ...sharedApps];
|
|
21176
|
+
return uniqBy(webApps, (app) => app.id);
|
|
21177
|
+
}
|
|
21178
|
+
addPluginToRemotesConfig(remotesConfig, plugins) {
|
|
21179
|
+
if (!plugins) {
|
|
21180
|
+
return;
|
|
21181
|
+
}
|
|
21182
|
+
const remotesCopy = cloneDeep(remotesConfig);
|
|
21183
|
+
const temp = Array.isArray(plugins) ? plugins : [plugins];
|
|
21184
|
+
temp.forEach(plugin => {
|
|
21185
|
+
const { contextPath, moduleName } = this.parsePluginId(plugin.id);
|
|
21186
|
+
if (!contextPath || !moduleName) {
|
|
21187
|
+
return;
|
|
21188
|
+
}
|
|
21189
|
+
remotesCopy[contextPath]?.length >= 0
|
|
21190
|
+
? remotesCopy[contextPath].push(moduleName)
|
|
21191
|
+
: (remotesCopy[contextPath] = []).push(moduleName);
|
|
21192
|
+
remotesCopy[contextPath] = [...new Set(remotesCopy[contextPath])];
|
|
21193
|
+
});
|
|
21194
|
+
return remotesCopy;
|
|
21195
|
+
}
|
|
21196
|
+
removePluginsFromRemotesConfig(remotesConfig, plugins) {
|
|
21197
|
+
const remotesCopy = cloneDeep(remotesConfig);
|
|
21198
|
+
const temp = Array.isArray(plugins) ? plugins : [plugins];
|
|
21199
|
+
temp.forEach(plugin => {
|
|
21200
|
+
const { rawContextPath, moduleName } = this.parsePluginId(plugin.id);
|
|
21201
|
+
if (!rawContextPath || !moduleName) {
|
|
21202
|
+
return;
|
|
21203
|
+
}
|
|
21204
|
+
// Find all keys in remotesConfig that match the plugin context (regardless of version)
|
|
21205
|
+
Object.keys(remotesCopy).forEach(key => {
|
|
21206
|
+
if (key === rawContextPath || key.startsWith(`${rawContextPath}@`)) {
|
|
21207
|
+
remotesCopy[key] = remotesCopy[key].filter(p => p !== moduleName);
|
|
21208
|
+
remotesCopy[key] = [...new Set(remotesCopy[key])];
|
|
21209
|
+
if (remotesCopy[key].length === 0) {
|
|
21210
|
+
delete remotesCopy[key];
|
|
21211
|
+
}
|
|
21212
|
+
}
|
|
21213
|
+
});
|
|
21214
|
+
});
|
|
21215
|
+
return remotesCopy;
|
|
21216
|
+
}
|
|
21217
|
+
/**
|
|
21218
|
+
* Parses id of the plugin and returns object with context path, raw context path (without version) and module name.
|
|
21219
|
+
* For example:
|
|
21220
|
+
* ```ts
|
|
21221
|
+
* const id = 'widget-plugin@1021.0.1/WidgetPluginModule'
|
|
21222
|
+
* const parsed = parsePluginId(id); // { contextPath: 'widget-plugin@1021.0.1', moduleName: 'WidgetPluginModule', rawContextPath: 'widget-plugin' }
|
|
21223
|
+
* @param id Plugin id in the format of `<contextPath>@<version>/<moduleName>`
|
|
21224
|
+
* @returns Object with context path, module name and raw context path (without version).
|
|
21225
|
+
*/
|
|
21226
|
+
parsePluginId(id) {
|
|
21227
|
+
const [contextPath, moduleName] = id.split('/');
|
|
21228
|
+
const [rawContextPath] = contextPath.split('@');
|
|
21229
|
+
return { rawContextPath, contextPath, moduleName };
|
|
21230
|
+
}
|
|
21231
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService, deps: [{ token: i1.ApplicationService }, { token: AppStateService }, { token: i1.FetchClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
21232
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService }); }
|
|
21233
|
+
}
|
|
21234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsService, decorators: [{
|
|
21235
|
+
type: Injectable
|
|
21236
|
+
}], ctorParameters: () => [{ type: i1.ApplicationService }, { type: AppStateService }, { type: i1.FetchClient }] });
|
|
21237
|
+
|
|
21238
|
+
class PluginsModule {
|
|
21239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
21240
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule }); }
|
|
21241
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, providers: [PluginsService] }); }
|
|
21242
|
+
}
|
|
21243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginsModule, decorators: [{
|
|
21244
|
+
type: NgModule,
|
|
21245
|
+
args: [{
|
|
21246
|
+
providers: [PluginsService]
|
|
21247
|
+
}]
|
|
21248
|
+
}] });
|
|
21249
|
+
|
|
21271
21250
|
/**
|
|
21272
21251
|
* An extension HOOK can use either a pure value:
|
|
21273
21252
|
* ```typescript
|
|
@@ -21326,7 +21305,7 @@ class BackendVersionFactory {
|
|
|
21326
21305
|
if (this.config?.disableBackendVersionFactory) {
|
|
21327
21306
|
return;
|
|
21328
21307
|
}
|
|
21329
|
-
this.backendVersion$ = this.appState.state$.pipe(map
|
|
21308
|
+
this.backendVersion$ = this.appState.state$.pipe(map(state => state?.versions?.backend), filter(backendVersion => !!backendVersion), distinctUntilChanged(), map(backendVersion => this.buildBackendVersion(backendVersion)), shareReplay(1));
|
|
21330
21309
|
}
|
|
21331
21310
|
get() {
|
|
21332
21311
|
return this.backendVersion$;
|
|
@@ -21359,7 +21338,7 @@ class VersionService extends ExtensionPointForPlugins {
|
|
|
21359
21338
|
constructor(rootInjector, pluginService) {
|
|
21360
21339
|
super(rootInjector, pluginService);
|
|
21361
21340
|
this.items$ = this.setupItemsObservable();
|
|
21362
|
-
this.nonHiddenItems$ = this.items$.pipe(map
|
|
21341
|
+
this.nonHiddenItems$ = this.items$.pipe(map(versions => versions.filter(version => !version.hidden)));
|
|
21363
21342
|
}
|
|
21364
21343
|
get state() {
|
|
21365
21344
|
return this.state$.value;
|
|
@@ -21380,7 +21359,7 @@ class VersionService extends ExtensionPointForPlugins {
|
|
|
21380
21359
|
getInjectedHooks(HOOK_VERSION, this.injectors),
|
|
21381
21360
|
() => this.factories,
|
|
21382
21361
|
stateToFactory(this.state$)
|
|
21383
|
-
]).pipe(distinctUntilChanged
|
|
21362
|
+
]).pipe(distinctUntilChanged(), map(versions => sortByPriority(versions)), shareReplay(1));
|
|
21384
21363
|
}
|
|
21385
21364
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: VersionService, deps: [{ token: i0.Injector }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
21386
21365
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: VersionService, providedIn: 'root' }); }
|
|
@@ -21433,7 +21412,7 @@ class PlatformDetailsService {
|
|
|
21433
21412
|
}
|
|
21434
21413
|
async getVersions() {
|
|
21435
21414
|
const versions = await this.version.items$
|
|
21436
|
-
.pipe(take(1), map
|
|
21415
|
+
.pipe(take(1), map(versions => this.version.cleanUpVersions(versions)))
|
|
21437
21416
|
.toPromise();
|
|
21438
21417
|
return versions;
|
|
21439
21418
|
}
|
|
@@ -21505,7 +21484,7 @@ class VersionListComponent {
|
|
|
21505
21484
|
this.platformDetails = platformDetails;
|
|
21506
21485
|
this.headerService = headerService;
|
|
21507
21486
|
this.versionsToDirectlyDisplay$ = this.version.nonHiddenItems$;
|
|
21508
|
-
this.currentTenantId$ = this.appState.currentTenant.pipe(map
|
|
21487
|
+
this.currentTenantId$ = this.appState.currentTenant.pipe(map(tenant => tenant?.name), filter(tenantId => !!tenantId), distinctUntilChanged());
|
|
21509
21488
|
this.open$ = this.headerService.rightDrawerOpen$;
|
|
21510
21489
|
}
|
|
21511
21490
|
async downloadPlatformDetails() {
|
|
@@ -21536,7 +21515,7 @@ class VersionDrawerFactory {
|
|
|
21536
21515
|
};
|
|
21537
21516
|
}
|
|
21538
21517
|
get() {
|
|
21539
|
-
return this.shouldShowPlatformInformation$().pipe(distinctUntilChanged
|
|
21518
|
+
return this.shouldShowPlatformInformation$().pipe(distinctUntilChanged(), map(shouldShowPlatformInformation => {
|
|
21540
21519
|
if (shouldShowPlatformInformation) {
|
|
21541
21520
|
return this.drawerItem;
|
|
21542
21521
|
}
|
|
@@ -21547,7 +21526,7 @@ class VersionDrawerFactory {
|
|
|
21547
21526
|
return combineLatest([
|
|
21548
21527
|
this.options.get$('hidePowered'),
|
|
21549
21528
|
this.options.get$('hidePlatformInformation')
|
|
21550
|
-
]).pipe(map
|
|
21529
|
+
]).pipe(map(([hidePowered, hidePlatformInformation]) => {
|
|
21551
21530
|
if (hidePlatformInformation === undefined) {
|
|
21552
21531
|
return !hidePowered;
|
|
21553
21532
|
}
|
|
@@ -21573,7 +21552,7 @@ class WebSDKPluginVersionFactory {
|
|
|
21573
21552
|
if (this.config?.disableWebSDKPluginVersionFactory) {
|
|
21574
21553
|
return;
|
|
21575
21554
|
}
|
|
21576
|
-
this.webSDKPluginVersions$ = this.appState.currentApplication.pipe(map
|
|
21555
|
+
this.webSDKPluginVersions$ = this.appState.currentApplication.pipe(map(app => this.plugins.getMFRemotes(app)), filter(remotes => !!remotes), distinctUntilChanged(), map(remotes => this.getVersionsFromRemotes(remotes)));
|
|
21577
21556
|
}
|
|
21578
21557
|
get() {
|
|
21579
21558
|
return this.webSDKPluginVersions$;
|
|
@@ -21687,7 +21666,7 @@ class ApplicationVersionFactory {
|
|
|
21687
21666
|
if (this.config?.disableWebSDKVersionFactory) {
|
|
21688
21667
|
return;
|
|
21689
21668
|
}
|
|
21690
|
-
this.applicationVersions$ = this.appState.currentApplication.pipe(map
|
|
21669
|
+
this.applicationVersions$ = this.appState.currentApplication.pipe(map(app => this.getInformationFromApp(app)));
|
|
21691
21670
|
}
|
|
21692
21671
|
get() {
|
|
21693
21672
|
return this.applicationVersions$;
|
|
@@ -22436,13 +22415,13 @@ class NavigatorBottomService {
|
|
|
22436
22415
|
this.navigatorLogoHeightVariable = 'navigator-platform-logo-height';
|
|
22437
22416
|
}
|
|
22438
22417
|
hasHidePoweredSet() {
|
|
22439
|
-
return this.options.get$('hidePowered').pipe(map
|
|
22418
|
+
return this.options.get$('hidePowered').pipe(map(hidePowered => !!hidePowered));
|
|
22440
22419
|
}
|
|
22441
22420
|
hasCustomNavigatorLogoSet() {
|
|
22442
22421
|
return combineLatest([
|
|
22443
22422
|
this.options.get$('brandingCSSVars'),
|
|
22444
22423
|
this.themeService.currentlyAppliedTheme$
|
|
22445
|
-
]).pipe(map
|
|
22424
|
+
]).pipe(map(([vars, theme]) => {
|
|
22446
22425
|
if (!vars || typeof vars !== 'object') {
|
|
22447
22426
|
return false;
|
|
22448
22427
|
}
|
|
@@ -22457,7 +22436,7 @@ class NavigatorBottomService {
|
|
|
22457
22436
|
return of(true);
|
|
22458
22437
|
}
|
|
22459
22438
|
shouldShowDefaultPoweredBy() {
|
|
22460
|
-
return combineLatest([this.hasHidePoweredSet(), this.hasCustomNavigatorLogoSet()]).pipe(map
|
|
22439
|
+
return combineLatest([this.hasHidePoweredSet(), this.hasCustomNavigatorLogoSet()]).pipe(map(([hidePowered, hasCustomLogo]) => !hidePowered && !hasCustomLogo));
|
|
22461
22440
|
}
|
|
22462
22441
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NavigatorBottomService, deps: [{ token: OptionsService }, { token: ThemeSwitcherService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
22463
22442
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NavigatorBottomService, providedIn: 'root' }); }
|
|
@@ -22497,7 +22476,7 @@ class NavigatorBottomDrawerFactory {
|
|
|
22497
22476
|
};
|
|
22498
22477
|
}
|
|
22499
22478
|
get() {
|
|
22500
|
-
return this.bottomService.shouldShowBottomDrawer().pipe(map
|
|
22479
|
+
return this.bottomService.shouldShowBottomDrawer().pipe(map(showBottomDrawer => {
|
|
22501
22480
|
if (!showBottomDrawer) {
|
|
22502
22481
|
return [];
|
|
22503
22482
|
}
|
|
@@ -22731,7 +22710,7 @@ class DropAreaComponent {
|
|
|
22731
22710
|
return maxFileSizeInMegaBytes * 1_048_576;
|
|
22732
22711
|
}
|
|
22733
22712
|
getFilesNamesAsString(files) {
|
|
22734
|
-
return map$
|
|
22713
|
+
return map$1(files, ({ name }) => name).join(', ');
|
|
22735
22714
|
}
|
|
22736
22715
|
isFilesArrayEmpty() {
|
|
22737
22716
|
return get(this, 'files.length', 0) === 0;
|
|
@@ -23361,7 +23340,7 @@ function asyncValidateArrayElements(validator) {
|
|
|
23361
23340
|
return of({ valueNotArray: true });
|
|
23362
23341
|
}
|
|
23363
23342
|
const observables = values.map(value => validator(new FormControl(value)));
|
|
23364
|
-
return forkJoin(observables).pipe(map
|
|
23343
|
+
return forkJoin(observables).pipe(map(errors => generateArrayRelatedErrors(errors)));
|
|
23365
23344
|
};
|
|
23366
23345
|
}
|
|
23367
23346
|
function generateArrayRelatedErrors(errors) {
|
|
@@ -23464,7 +23443,7 @@ class FilePickerFormControlComponent {
|
|
|
23464
23443
|
/**
|
|
23465
23444
|
* Emits boolean value when file is dragged inside or outside of viewport, or file is not dragged anymore.
|
|
23466
23445
|
*/
|
|
23467
|
-
this.isDraggingFiles$ = merge(draggingFilesGlobally$.pipe(map
|
|
23446
|
+
this.isDraggingFiles$ = merge(draggingFilesGlobally$.pipe(map(ev => ev.type === 'dragenter')), fromEvent(document, 'mouseenter').pipe(map(() => false)), fromEvent(document, 'drop').pipe(map(() => false))).pipe(distinctUntilChanged());
|
|
23468
23447
|
/**
|
|
23469
23448
|
* Emits boolean value after checking if dragged files match configured extensions list,
|
|
23470
23449
|
* When dragging of file starts, get mimetypes of each file, convert them to possible extensions list
|
|
@@ -23475,7 +23454,7 @@ class FilePickerFormControlComponent {
|
|
|
23475
23454
|
if (!this.accept) {
|
|
23476
23455
|
return of(true);
|
|
23477
23456
|
}
|
|
23478
|
-
return of(ev).pipe(map
|
|
23457
|
+
return of(ev).pipe(map(ev => [...ev.dataTransfer.items]), map(files => files.map(file => mimeDB[file.type].extensions || ['unknown'])), map(extensionsForFiles => extensionsForFiles.every(extensionsForFile => extensionsForFile.some(ext => this.filesService.extractFileExtensions(this.accept).includes(ext)))));
|
|
23479
23458
|
}), tap(allowed => {
|
|
23480
23459
|
this.isExtensionAllowed = allowed;
|
|
23481
23460
|
}));
|
|
@@ -23483,12 +23462,12 @@ class FilePickerFormControlComponent {
|
|
|
23483
23462
|
* If File is being dragged and extensions meets requirements, then drop-area can be enlarged.
|
|
23484
23463
|
*/
|
|
23485
23464
|
this.isDropAreaEnlarged$ = this.isDraggingFiles$;
|
|
23486
|
-
this.isDraggedFileUnsupported$ = this.isDraggingFiles$.pipe(withLatestFrom(this.isExtensionAllowed$), map
|
|
23465
|
+
this.isDraggedFileUnsupported$ = this.isDraggingFiles$.pipe(withLatestFrom(this.isExtensionAllowed$), map(([fileDragged, extAllowed]) => fileDragged && !extAllowed));
|
|
23487
23466
|
/**
|
|
23488
23467
|
* Emits true when file is hovering above drop-area. Only works when isDropAreaEnlarged$ also emits true.
|
|
23489
23468
|
* This is workaround for CSS :hover pseudo-class not triggering when dragging file.
|
|
23490
23469
|
*/
|
|
23491
|
-
this.isDraggingOverFilePlaceholder$ = merge(fromEvent(this.filePlaceholder.nativeElement, 'dragenter'), fromEvent(this.filePlaceholder.nativeElement, 'dragleave'), fromEvent(this.filePlaceholder.nativeElement, 'drop')).pipe(filter((ev) => ev.dataTransfer?.types.toString() === 'Files'), map
|
|
23470
|
+
this.isDraggingOverFilePlaceholder$ = merge(fromEvent(this.filePlaceholder.nativeElement, 'dragenter'), fromEvent(this.filePlaceholder.nativeElement, 'dragleave'), fromEvent(this.filePlaceholder.nativeElement, 'drop')).pipe(filter((ev) => ev.dataTransfer?.types.toString() === 'Files'), map(ev => ev.type === 'dragenter'), withLatestFrom(this.isDropAreaEnlarged$), map(([draggingOver, dropAreaEnlarged]) => draggingOver && dropAreaEnlarged));
|
|
23492
23471
|
}
|
|
23493
23472
|
afterValueChanged() {
|
|
23494
23473
|
this.onChange([...this.droppedFiles]);
|
|
@@ -23814,7 +23793,7 @@ class RouterTabsResolver {
|
|
|
23814
23793
|
resolve(currentRoute) {
|
|
23815
23794
|
const routeConfig = currentRoute.routeConfig;
|
|
23816
23795
|
const latestChildren = this.getLatestChildRoutes(routeConfig.rootContext);
|
|
23817
|
-
return from(latestChildren || []).pipe(mergeMap((child) => from(this.getGuards(child)).pipe(map
|
|
23796
|
+
return from(latestChildren || []).pipe(mergeMap((child) => from(this.getGuards(child)).pipe(map(canActivate => canActivate(currentRoute, this.routerStateSnapshot)), mergeMap((result) => {
|
|
23818
23797
|
if (isObservable(result)) {
|
|
23819
23798
|
return result;
|
|
23820
23799
|
}
|
|
@@ -23827,7 +23806,7 @@ class RouterTabsResolver {
|
|
|
23827
23806
|
if (Array.isArray(result)) {
|
|
23828
23807
|
child.tabs = result;
|
|
23829
23808
|
}
|
|
23830
|
-
}), every$1(result => !!result), filter(result => result), mergeMap(() => (Array.isArray(child.tabs) ? from(child.tabs) : of(child))), map
|
|
23809
|
+
}), every$1(result => !!result), filter(result => result), mergeMap(() => (Array.isArray(child.tabs) ? from(child.tabs) : of(child))), map(result => {
|
|
23831
23810
|
const url = this.getBaselUrl(currentRoute).join('/');
|
|
23832
23811
|
return result.label || result.path
|
|
23833
23812
|
? {
|
|
@@ -24187,7 +24166,7 @@ class ScopedContextRouteService {
|
|
|
24187
24166
|
*/
|
|
24188
24167
|
isLoading$() {
|
|
24189
24168
|
return this.router.events.pipe(filter(e => (e instanceof ActivationStart || e instanceof ChildActivationEnd) &&
|
|
24190
|
-
e.snapshot.routeConfig?.rootContext === this.currentContext), map
|
|
24169
|
+
e.snapshot.routeConfig?.rootContext === this.currentContext), map(e => e instanceof ActivationStart), takeUntilDestroyed(this.destroyRef));
|
|
24191
24170
|
}
|
|
24192
24171
|
/**
|
|
24193
24172
|
* Initializes the context route.
|
|
@@ -24348,7 +24327,7 @@ class ContextRouteGuard {
|
|
|
24348
24327
|
return this.detailCached(service, id).pipe(tap(contextData => {
|
|
24349
24328
|
Object.keys(route.data.contextData).forEach(key => delete route.data.contextData[key]);
|
|
24350
24329
|
Object.assign(route.data.contextData, contextData);
|
|
24351
|
-
}), map
|
|
24330
|
+
}), map(() => true), catchError(() => of(false)));
|
|
24352
24331
|
}
|
|
24353
24332
|
service(route) {
|
|
24354
24333
|
const serviceInstance = ViewContextServices.contextToService(route.data.context);
|
|
@@ -24362,7 +24341,7 @@ class ContextRouteGuard {
|
|
|
24362
24341
|
let cached = cache[id];
|
|
24363
24342
|
if (!cached) {
|
|
24364
24343
|
const params = service instanceof InventoryService ? { withChildren: false } : undefined;
|
|
24365
|
-
cached = from(service.detail(id, params)).pipe(map
|
|
24344
|
+
cached = from(service.detail(id, params)).pipe(map(({ data }) => data), shareReplay(1));
|
|
24366
24345
|
cache[id] = cached;
|
|
24367
24346
|
}
|
|
24368
24347
|
return cached;
|
|
@@ -24498,7 +24477,7 @@ class RouterService extends ExtensionPointWithoutStateForPlugins {
|
|
|
24498
24477
|
return fromTriggerOnce(this.router, this.refresh$, [
|
|
24499
24478
|
getInjectedHooks(HOOK_ROUTE, this.injectors, InjectionType.ROUTE),
|
|
24500
24479
|
() => this.factories
|
|
24501
|
-
]).pipe(distinctUntilChanged
|
|
24480
|
+
]).pipe(distinctUntilChanged(), shareReplay(1));
|
|
24502
24481
|
}
|
|
24503
24482
|
addRoutes(routes) {
|
|
24504
24483
|
if (this.router.routerState?.snapshot?.url) {
|
|
@@ -24758,7 +24737,7 @@ class HelpAndSupportOutletComponent {
|
|
|
24758
24737
|
this.headerService = headerService;
|
|
24759
24738
|
this.PRODUCT_EXPERIENCE = PRODUCT_EXPERIENCE_CORE_SHARED;
|
|
24760
24739
|
this.documentationOpen = false;
|
|
24761
|
-
this.helpAndSupport$ = this.docsService.items$.pipe(map
|
|
24740
|
+
this.helpAndSupport$ = this.docsService.items$.pipe(map(items => items.filter(item => item.type === 'doc' && item.label !== legalNoticesItem.label)));
|
|
24762
24741
|
this.appState$ = this.appState.state$;
|
|
24763
24742
|
this.drawerOpen$ = this.headerService.rightDrawerOpen$;
|
|
24764
24743
|
}
|
|
@@ -24857,11 +24836,11 @@ class SupportOutletComponent {
|
|
|
24857
24836
|
this.isCollapsed = state.activateSupportUserAvailable && state.supportUrl;
|
|
24858
24837
|
this.userSupportAvailable = this.ui.state$.getValue().activateSupportUserAvailable;
|
|
24859
24838
|
this.supportUrl = this.ui.state$.getValue().supportUrl;
|
|
24860
|
-
this.supportUserEnabled$ = this.ui.currentUser.pipe(map
|
|
24839
|
+
this.supportUserEnabled$ = this.ui.currentUser.pipe(map(user => !!user?.supportUserEnabled));
|
|
24861
24840
|
this.isCollapsible = this.userSupportAvailable && !!this.supportUrl;
|
|
24862
24841
|
this.textClass = this.isCollapsible ? 'text-truncate text-12' : 'text-medium';
|
|
24863
24842
|
this.drawerOpen$ = this.headerService.rightDrawerOpen$;
|
|
24864
|
-
this.tabIndex$ = this.drawerOpen$.pipe(map
|
|
24843
|
+
this.tabIndex$ = this.drawerOpen$.pipe(map(drawerOpen => (drawerOpen ? '0' : '-1')));
|
|
24865
24844
|
}
|
|
24866
24845
|
async refreshCurrentUser() {
|
|
24867
24846
|
const currentUserResult = await this.userService.current();
|
|
@@ -24962,7 +24941,7 @@ class LegalNoticesOutletComponent {
|
|
|
24962
24941
|
this.docsService = docsService;
|
|
24963
24942
|
this.headerService = headerService;
|
|
24964
24943
|
this.PRODUCT_EXPERIENCE = PRODUCT_EXPERIENCE_CORE_SHARED;
|
|
24965
|
-
this.legalNotices$ = this.docsService.items$.pipe(map
|
|
24944
|
+
this.legalNotices$ = this.docsService.items$.pipe(map(items => items.find(item => item.type === 'doc' && item.label === legalNoticesItem.label)));
|
|
24966
24945
|
this.drawerOpen$ = this.headerService.rightDrawerOpen$;
|
|
24967
24946
|
}
|
|
24968
24947
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LegalNoticesOutletComponent, deps: [{ token: DocsService }, { token: HeaderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -25034,7 +25013,7 @@ class CloseDatePickerDirective {
|
|
|
25034
25013
|
? merge(fromEvent(element, 'click'), fromEvent(document, 'click'))
|
|
25035
25014
|
: fromEvent(document, 'click');
|
|
25036
25015
|
clickEvent$
|
|
25037
|
-
.pipe(map
|
|
25016
|
+
.pipe(map((event) => event.target), filter(target => !this.el.nativeElement.contains(target)), // i.e. anything which is not inside this `c8y-date-time-picker`
|
|
25038
25017
|
takeUntil(this.destroy$))
|
|
25039
25018
|
.subscribe(() => this.closeDatepicker.hide());
|
|
25040
25019
|
}
|
|
@@ -25981,7 +25960,7 @@ class SelectTypeComponent extends FieldType {
|
|
|
25981
25960
|
this.placeholder$ = defer(() => of(this.properties?.placeholder)).pipe(switchMap(placeholder => placeholder
|
|
25982
25961
|
? of(placeholder)
|
|
25983
25962
|
: this.defaultPlaceholder$.pipe(startWith(this.translateService.instant(gettext$1('Select your option'))))));
|
|
25984
|
-
this.defaultPlaceholder$ = defer(() => isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options)).pipe(map
|
|
25963
|
+
this.defaultPlaceholder$ = defer(() => isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options)).pipe(map(data => get(data[0], this.labelProp)), map(example => this.translateService.instant(!example ? gettext$1('No items') : gettext$1('Select your option, for example, {{ example }}'), { example })));
|
|
25985
25964
|
this.options$ = defer(() => isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options));
|
|
25986
25965
|
}
|
|
25987
25966
|
ngOnInit() {
|
|
@@ -26075,7 +26054,7 @@ class TypeaheadTypeComponent extends FieldType {
|
|
|
26075
26054
|
this.placeholder$ = defer(() => of(this.to?.placeholder)).pipe(switchMap(placeholder => placeholder
|
|
26076
26055
|
? of(placeholder)
|
|
26077
26056
|
: this.defaultPlaceholder$.pipe(startWith(this.translateService.instant(gettext$1('Start typing to search'))))));
|
|
26078
|
-
this.defaultPlaceholder$ = defer(() => isObservable(this.to?.c8yForOptions) ? this.to?.c8yForOptions : of(this.to?.c8yForOptions)).pipe(map
|
|
26057
|
+
this.defaultPlaceholder$ = defer(() => isObservable(this.to?.c8yForOptions) ? this.to?.c8yForOptions : of(this.to?.c8yForOptions)).pipe(map(({ data }) => get(data[0], this.labelProp || 'name')), map(example => {
|
|
26079
26058
|
return !!example
|
|
26080
26059
|
? this.translateService.instant(gettext$1('Start typing to search, for example, {{ example }}'), { example })
|
|
26081
26060
|
: this.translateService.instant(gettext$1('No items'));
|
|
@@ -26110,7 +26089,7 @@ class TypeaheadTypeComponent extends FieldType {
|
|
|
26110
26089
|
}
|
|
26111
26090
|
setPipe(filterStr) {
|
|
26112
26091
|
this.pattern = filterStr;
|
|
26113
|
-
this.filterPipe = pipe(map
|
|
26092
|
+
this.filterPipe = pipe(map(data => {
|
|
26114
26093
|
return data.filter(el => el[this.labelProp] &&
|
|
26115
26094
|
el[this.labelProp].toLowerCase().indexOf(filterStr.toLowerCase()) > -1);
|
|
26116
26095
|
}), tap(data => {
|
|
@@ -26293,11 +26272,11 @@ class TranslateExtension {
|
|
|
26293
26272
|
this.translate.stream(to.placeholder),
|
|
26294
26273
|
this.translate.stream(gettext$1('e.g. {{ example }}')),
|
|
26295
26274
|
of(Boolean(to.removeExempliGratia))
|
|
26296
|
-
]).pipe(map
|
|
26275
|
+
]).pipe(map(([placeholder, expression, exempliGratia]) => !exempliGratia
|
|
26297
26276
|
? this.parser.interpolate(expression, { example: placeholder })
|
|
26298
26277
|
: placeholder))
|
|
26299
26278
|
: to.placeholder,
|
|
26300
|
-
'props.options': (isObservable(to.options) ? to.options : of(to.options)).pipe(map
|
|
26279
|
+
'props.options': (isObservable(to.options) ? to.options : of(to.options)).pipe(map((options) => (options || []).map(option => ({
|
|
26301
26280
|
...option,
|
|
26302
26281
|
label: this.translate.instant(option.label)
|
|
26303
26282
|
}))))
|
|
@@ -26858,7 +26837,7 @@ class DynamicComponentService extends ExtensionPointForPlugins {
|
|
|
26858
26837
|
getInjectedHooks(HOOK_COMPONENTS, this.injectors),
|
|
26859
26838
|
() => this.factories,
|
|
26860
26839
|
stateToFactory(this.state$)
|
|
26861
|
-
]).pipe(distinctUntilChanged
|
|
26840
|
+
]).pipe(distinctUntilChanged(), takeUntil(combineLatest([timer(this.waitTimeout || this.DEFAULT_WAIT_TIMEOUT), remotesLoaded$])), shareReplay(1));
|
|
26862
26841
|
}
|
|
26863
26842
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicComponentService, deps: [{ token: i0.Injector }, { token: i1$4.Router }, { token: RESOLVING_COMPONENT_WAIT_TIME, optional: true }, { token: DynamicResolverService }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
26864
26843
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicComponentService, providedIn: 'root' }); }
|
|
@@ -27316,7 +27295,7 @@ class DynamicBulkDetailsResolver {
|
|
|
27316
27295
|
* Map containing the ids to be retrieved per bulk request.
|
|
27317
27296
|
*/
|
|
27318
27297
|
this.idsGroupedByBulkId = new Map();
|
|
27319
|
-
this.resultsOfBulkLoad = this.dynamicResolver.bulkResolvingTrigger$.pipe(map
|
|
27298
|
+
this.resultsOfBulkLoad = this.dynamicResolver.bulkResolvingTrigger$.pipe(map(bulkRequestId => ({
|
|
27320
27299
|
uniqIds: uniq(this.idsGroupedByBulkId.get(bulkRequestId) || []),
|
|
27321
27300
|
bulkRequestId
|
|
27322
27301
|
})), tap(({ bulkRequestId }) => this.idsGroupedByBulkId.delete(bulkRequestId)), mergeMap(({ uniqIds, bulkRequestId }) => this.performBulkRequest(uniqIds, bulkRequestId)), share());
|
|
@@ -27332,7 +27311,7 @@ class DynamicBulkDetailsResolver {
|
|
|
27332
27311
|
}
|
|
27333
27312
|
const idsArray = Array.isArray(idOrIds) ? idOrIds : [idOrIds];
|
|
27334
27313
|
this.addIdsToBeLoaded(bulkRequestId, ...idsArray);
|
|
27335
|
-
return this.getResult$(bulkRequestId).pipe(map
|
|
27314
|
+
return this.getResult$(bulkRequestId).pipe(map(({ result: retrievedEntities, errors }) => {
|
|
27336
27315
|
if (Array.isArray(idOrIds)) {
|
|
27337
27316
|
return idOrIds.map((id, index) => retrievedEntities.find(tmp => this.isEntityOfId(tmp, id)) ||
|
|
27338
27317
|
this.buildRetrievalAlert(valueBehindAttribute[index], errors));
|
|
@@ -27345,7 +27324,7 @@ class DynamicBulkDetailsResolver {
|
|
|
27345
27324
|
* Provides an Observable of the results of the given bulkRequestId.
|
|
27346
27325
|
*/
|
|
27347
27326
|
getResult$(bulkRequestId) {
|
|
27348
|
-
return this.resultsOfBulkLoad.pipe(filter(({ bulkRequestId: bId }) => bulkRequestId === bId), map
|
|
27327
|
+
return this.resultsOfBulkLoad.pipe(filter(({ bulkRequestId: bId }) => bulkRequestId === bId), map(({ result, errors }) => ({ result, errors })), take(1), map(result => cloneDeep(result)));
|
|
27349
27328
|
}
|
|
27350
27329
|
/**
|
|
27351
27330
|
* Adds a single id or an array of ids to the idsGroupedByBulkId Map for the provided bulkRequestId.
|
|
@@ -27537,7 +27516,7 @@ class DynamicDatapointsResolver {
|
|
|
27537
27516
|
this.moResolver.addIdsToBeLoaded(bulkRequestId, ...moIds);
|
|
27538
27517
|
return this.moResolver
|
|
27539
27518
|
.getResult$(bulkRequestId)
|
|
27540
|
-
.pipe(map
|
|
27519
|
+
.pipe(map(({ result: updatedMos, errors }) => this.assignUpdatedValues(datapoints, updatedMos, errors)));
|
|
27541
27520
|
}
|
|
27542
27521
|
serialize(config, attribute) {
|
|
27543
27522
|
const valueBehindAttribute = config[attribute];
|
|
@@ -27645,12 +27624,12 @@ class DashboardChildChange {
|
|
|
27645
27624
|
this.child = childToChange;
|
|
27646
27625
|
}
|
|
27647
27626
|
get resize$() {
|
|
27648
|
-
return this.child.dragSource.moved.pipe(map
|
|
27627
|
+
return this.child.dragSource.moved.pipe(map(move => this.getPixelSize(move)), tap(resizeDimension => this.setPixelSize(resizeDimension)), map(resizeDimension => this.getDimensionSize(resizeDimension)), distinctUntilChanged((prev, next) => prev.width === next.width && prev.height === next.height), map(dimension => this.setDimension(dimension)), tap(() => console.log('Resize dimension:', this.child)), this.arrangePipe());
|
|
27649
27628
|
}
|
|
27650
27629
|
get drag$() {
|
|
27651
|
-
return this.child.dragSource.moved.pipe(map
|
|
27630
|
+
return this.child.dragSource.moved.pipe(map(move => this.getDimensionPosition(move)), filter(dimension => dimension.x >= 0 &&
|
|
27652
27631
|
dimension.x <= this.dashboard.columns - this.child.width &&
|
|
27653
|
-
dimension.y >= 0), distinctUntilChanged
|
|
27632
|
+
dimension.y >= 0), distinctUntilChanged((prev, next) => prev.x === next.x && prev.y === next.y), this.arrangePipe());
|
|
27654
27633
|
}
|
|
27655
27634
|
findFreeDimension() {
|
|
27656
27635
|
let y = -1;
|
|
@@ -27695,12 +27674,12 @@ class DashboardChildChange {
|
|
|
27695
27674
|
});
|
|
27696
27675
|
}
|
|
27697
27676
|
arrangePipe() {
|
|
27698
|
-
return pipe(map
|
|
27677
|
+
return pipe(map((dimension) => ({
|
|
27699
27678
|
current: dimension,
|
|
27700
27679
|
scan: this.children,
|
|
27701
27680
|
spacing: dimension.y + dimension.height,
|
|
27702
27681
|
origin: { ...dimension }
|
|
27703
|
-
})), expand((dimensions) => this.arrangeAll(dimensions)), map
|
|
27682
|
+
})), expand((dimensions) => this.arrangeAll(dimensions)), map(({ origin }) => origin), map(dimension => this.setDimension(dimension, true)), tap(() => this.collapseUpAll()));
|
|
27704
27683
|
}
|
|
27705
27684
|
collapseUp(dimension) {
|
|
27706
27685
|
let { y } = dimension;
|
|
@@ -28202,7 +28181,7 @@ class DashboardChildComponent {
|
|
|
28202
28181
|
/**
|
|
28203
28182
|
* Triggers on every resize and returns true if in one column view (mobile view)
|
|
28204
28183
|
*/
|
|
28205
|
-
this.isOneColumnView$ = fromEvent(window, 'resize').pipe(map
|
|
28184
|
+
this.isOneColumnView$ = fromEvent(window, 'resize').pipe(map(_ => {
|
|
28206
28185
|
return (document.documentElement.clientWidth <= this.MD_BOOTSTRAP_BREAKPOINT_READONLY_CLASS_PROPERTY);
|
|
28207
28186
|
}), debounceTime(200), startWith(document.documentElement.clientWidth <= this.MD_BOOTSTRAP_BREAKPOINT_READONLY_CLASS_PROPERTY));
|
|
28208
28187
|
/**
|
|
@@ -28464,7 +28443,7 @@ class WidgetsDashboardEventService {
|
|
|
28464
28443
|
* @returns An observable of event.
|
|
28465
28444
|
*/
|
|
28466
28445
|
getObservable(eventType) {
|
|
28467
|
-
return this.events$.pipe(filter(({ type }) => (eventType ? type === eventType : true)), map
|
|
28446
|
+
return this.events$.pipe(filter(({ type }) => (eventType ? type === eventType : true)), map(({ data }) => data));
|
|
28468
28447
|
}
|
|
28469
28448
|
/**
|
|
28470
28449
|
* Returns the last value of the event.
|
|
@@ -28617,7 +28596,7 @@ class WidgetTimeContextQueryService {
|
|
|
28617
28596
|
* @returns Observable of date context query params.
|
|
28618
28597
|
*/
|
|
28619
28598
|
queryParamsChange$() {
|
|
28620
|
-
return this.activatedRoute.queryParams.pipe(map
|
|
28599
|
+
return this.activatedRoute.queryParams.pipe(map((params) => this.processQueryParams(params)), filter((params) => this.queryParamsContainsTimeRange(params)));
|
|
28621
28600
|
}
|
|
28622
28601
|
/**
|
|
28623
28602
|
* Creates widget time context from query parameters.
|
|
@@ -28979,7 +28958,7 @@ class WidgetTimeContextComponent {
|
|
|
28979
28958
|
this.dashboardChild.addActions([this.action]);
|
|
28980
28959
|
}
|
|
28981
28960
|
this.route.queryParams
|
|
28982
|
-
.pipe(distinctUntilChanged
|
|
28961
|
+
.pipe(distinctUntilChanged(), map(params => params['globalContextAutoRefresh'] === 'true'), takeUntil(this.destroy$))
|
|
28983
28962
|
.subscribe(this.handleAutoRefreshChange.bind(this));
|
|
28984
28963
|
}
|
|
28985
28964
|
/**
|
|
@@ -29517,7 +29496,7 @@ class WidgetGlobalAutoRefreshService {
|
|
|
29517
29496
|
* The value is true if the loading count is non-zero, and false if the loading count is zero.
|
|
29518
29497
|
* Uses distinctUntilChanged() to emit only when the boolean value changes.
|
|
29519
29498
|
*/
|
|
29520
|
-
this.isLoadingWidgets$ = this.loadingCount$.pipe(distinctUntilChanged
|
|
29499
|
+
this.isLoadingWidgets$ = this.loadingCount$.pipe(distinctUntilChanged(), map(count => count !== 0));
|
|
29521
29500
|
/**
|
|
29522
29501
|
* Object containing behavior subjects for managing auto-refresh settings.
|
|
29523
29502
|
*/
|
|
@@ -29593,7 +29572,7 @@ class WidgetGlobalAutoRefreshService {
|
|
|
29593
29572
|
* @returns An observable that emits the parsed value of the `GLOBAL_CONTEXT_AUTO_REFRESH` query parameter.
|
|
29594
29573
|
*/
|
|
29595
29574
|
getQueryParamChangeValue$() {
|
|
29596
|
-
return this.activatedRoute.queryParams.pipe(map
|
|
29575
|
+
return this.activatedRoute.queryParams.pipe(map(params => params[GLOBAL_CONTEXT_AUTO_REFRESH]), map(this.parseGlobalAutoRefreshParam));
|
|
29597
29576
|
}
|
|
29598
29577
|
/**
|
|
29599
29578
|
* Monitors router navigation events and updates the navigation progress state.
|
|
@@ -29994,7 +29973,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
29994
29973
|
}] } });
|
|
29995
29974
|
|
|
29996
29975
|
function globalAutoRefreshLoading(globalRefreshService) {
|
|
29997
|
-
return (source) => source.pipe(distinctUntilChanged
|
|
29976
|
+
return (source) => source.pipe(distinctUntilChanged(), tap(isLoading => isLoading
|
|
29998
29977
|
? globalRefreshService.incrementLoading()
|
|
29999
29978
|
: globalRefreshService.decrementLoading()));
|
|
30000
29979
|
}
|
|
@@ -30052,7 +30031,7 @@ class WidgetsDashboardComponent {
|
|
|
30052
30031
|
this.onCancelDashboard = new EventEmitter();
|
|
30053
30032
|
this.revertChange = new EventEmitter();
|
|
30054
30033
|
this.widgetInFullscreenMode = false;
|
|
30055
|
-
this.inFullScreen$ = fromEvent(document, 'fullscreenchange').pipe(map
|
|
30034
|
+
this.inFullScreen$ = fromEvent(document, 'fullscreenchange').pipe(map(() => this.fullScreen()), startWith(this.fullScreen()));
|
|
30056
30035
|
this.editMode$ = new BehaviorSubject(false);
|
|
30057
30036
|
this.copyDashboardLabel = gettext$1('Copy dashboard');
|
|
30058
30037
|
this.undoMessage = gettext$1('Undo: "{{ changeToUndo }}"');
|
|
@@ -30065,8 +30044,8 @@ class WidgetsDashboardComponent {
|
|
|
30065
30044
|
this.enableEditMode();
|
|
30066
30045
|
}
|
|
30067
30046
|
this.resolvedWidgets$ = this._widgets.pipe(switchMap(widgets => this.executeResolversOfWidgets(widgets)), shareReplay(1));
|
|
30068
|
-
this.isExecutingResolvers$ = merge(this._widgets.pipe(map
|
|
30069
|
-
this.isLoadingWidgets$ = combineLatest([this.isLoading$, this.isExecutingResolvers$]).pipe(map
|
|
30047
|
+
this.isExecutingResolvers$ = merge(this._widgets.pipe(map(() => true)), this.resolvedWidgets$.pipe(map(() => false)));
|
|
30048
|
+
this.isLoadingWidgets$ = combineLatest([this.isLoading$, this.isExecutingResolvers$]).pipe(map(loadings => loadings.some(loading => loading)), shareReplay(1));
|
|
30070
30049
|
}
|
|
30071
30050
|
ngOnChanges(changes) {
|
|
30072
30051
|
if (changes.isCopyDisabled) {
|
|
@@ -31486,7 +31465,7 @@ class DataGridService {
|
|
|
31486
31465
|
localStorage.removeItem(key);
|
|
31487
31466
|
}
|
|
31488
31467
|
getConfig$(key) {
|
|
31489
|
-
return this.userPreferencesService.get(key).pipe(map
|
|
31468
|
+
return this.userPreferencesService.get(key).pipe(map(config => config || {
|
|
31490
31469
|
columns: [],
|
|
31491
31470
|
pagination: { pageSize: this.DEFAULT_PAGE_SIZE, currentPage: 1 }
|
|
31492
31471
|
}));
|
|
@@ -31495,7 +31474,7 @@ class DataGridService {
|
|
|
31495
31474
|
return from(this.userPreferencesService.set(key, config));
|
|
31496
31475
|
}
|
|
31497
31476
|
getUserConfiguredColumns$(columns, storageKey) {
|
|
31498
|
-
return this.getConfig$(storageKey).pipe(withLatestFrom(isObservable(columns) ? columns : of(columns)), map
|
|
31477
|
+
return this.getConfig$(storageKey).pipe(withLatestFrom(isObservable(columns) ? columns : of(columns)), map(([config, cols]) => this.applyConfigToColumns(config, cols, storageKey)), take(1), share());
|
|
31499
31478
|
}
|
|
31500
31479
|
getQueryObj(columns, defaultFilter = {}) {
|
|
31501
31480
|
return transform(columns, (query, column) => this.extendQueryByColumn(query, column), {
|
|
@@ -31701,7 +31680,7 @@ class FilterMapperService {
|
|
|
31701
31680
|
filterChip.path = currentPath;
|
|
31702
31681
|
return this.mapFieldsToFilter(filterChip, [field.fieldArray], [...currentPath, index]);
|
|
31703
31682
|
});
|
|
31704
|
-
return combineLatest(filters).pipe(map
|
|
31683
|
+
return combineLatest(filters).pipe(map(result => flatten(result)));
|
|
31705
31684
|
}
|
|
31706
31685
|
filterChip.path = currentPath;
|
|
31707
31686
|
if (get(filterChip.externalFilterQuery, currentPath)) {
|
|
@@ -31714,7 +31693,7 @@ class FilterMapperService {
|
|
|
31714
31693
|
const filterMapper = this.filterMapperFactory.get(field.type);
|
|
31715
31694
|
return filterMapper
|
|
31716
31695
|
.map(field, filterChip)
|
|
31717
|
-
.pipe(map
|
|
31696
|
+
.pipe(map(mappedChip => (mappedChip.displayValue ? [...resultChips, mappedChip] : resultChips)));
|
|
31718
31697
|
}
|
|
31719
31698
|
catch (error) {
|
|
31720
31699
|
this.alert.danger(error);
|
|
@@ -31851,12 +31830,12 @@ class GridDataSource {
|
|
|
31851
31830
|
this.resultListSubject.complete();
|
|
31852
31831
|
}
|
|
31853
31832
|
loadData({ rows, columns, pagination, searchText, serverSideDataCallback, selectable, selectionPrimaryKey, infiniteScroll, reload = false, parentRow = null }) {
|
|
31854
|
-
const clientSideData$ = toObservable(rows).pipe(map
|
|
31833
|
+
const clientSideData$ = toObservable(rows).pipe(map(initialData => {
|
|
31855
31834
|
if (!!parentRow) {
|
|
31856
31835
|
return parentRow[this.childNodesPropertyName] || [];
|
|
31857
31836
|
}
|
|
31858
31837
|
return initialData;
|
|
31859
|
-
}), map
|
|
31838
|
+
}), map(initialData => {
|
|
31860
31839
|
let filteredSize = 0;
|
|
31861
31840
|
let filteredDataIds = [];
|
|
31862
31841
|
const transformedData = flow(data => this.doClientSideSearch({ data, columns, searchText }), data => this.doClientSideFiltering({ data, columns }), data => this.doClientSideSorting({ data, columns }), data => {
|
|
@@ -31884,7 +31863,7 @@ class GridDataSource {
|
|
|
31884
31863
|
pagination,
|
|
31885
31864
|
selection: { enabled: selectable, primaryKey: selectionPrimaryKey },
|
|
31886
31865
|
parentRow
|
|
31887
|
-
}))).pipe(map
|
|
31866
|
+
}))).pipe(map((result) => {
|
|
31888
31867
|
const { data, paging, size, filteredSize, filteredDataIds } = result;
|
|
31889
31868
|
if (!parentRow) {
|
|
31890
31869
|
this.dataStatsSubject.next({
|
|
@@ -32068,7 +32047,7 @@ const PX_ACTIONS = {
|
|
|
32068
32047
|
|
|
32069
32048
|
class VisibleControlsPipe {
|
|
32070
32049
|
transform(actionControls, arg) {
|
|
32071
|
-
return defer(() => of(actionControls ?? [])).pipe(mergeMap$1(controls => forkJoin(controls.map(control => toObservable(!control.showIf || control.showIf(arg)).pipe(map(visible => ({ control, visible }))))).pipe(map(evaluatedControls => evaluatedControls.filter(ec => ec.visible).map(ec => ec.control)))), map(visible => values(groupBy(visible, 'type'))
|
|
32050
|
+
return defer(() => of(actionControls ?? [])).pipe(mergeMap$1(controls => forkJoin(controls.map(control => toObservable(!control.showIf || control.showIf(arg)).pipe(map$2(visible => ({ control, visible }))))).pipe(map$2(evaluatedControls => evaluatedControls.filter(ec => ec.visible).map(ec => ec.control)))), map$2(visible => values(groupBy(visible, 'type'))
|
|
32072
32051
|
.map((actionControls) => {
|
|
32073
32052
|
if (actionControls?.length === 1) {
|
|
32074
32053
|
return actionControls[0];
|
|
@@ -32263,7 +32242,7 @@ class DataGridComponent {
|
|
|
32263
32242
|
this.filteringApplied = false;
|
|
32264
32243
|
this.columnsWithFiltersApplied = [];
|
|
32265
32244
|
this.totalPagesCount$ = new BehaviorSubject(Infinity);
|
|
32266
|
-
this.hidePagination$ = this.totalPagesCount$.pipe(map
|
|
32245
|
+
this.hidePagination$ = this.totalPagesCount$.pipe(map(totalPagesCount => totalPagesCount <= 1), delay(0) // prevents ExpressionChangedAfterItHasBeenCheckedError
|
|
32267
32246
|
);
|
|
32268
32247
|
this.selectedItemIds = [];
|
|
32269
32248
|
this.currentPageSelectionState = {
|
|
@@ -32358,7 +32337,7 @@ class DataGridComponent {
|
|
|
32358
32337
|
this.actionControlsService.items$
|
|
32359
32338
|
.pipe(startWith([]), switchMap((hooks) => forkJoin(hooks.map(hook => toObservable(hook?.matchesGrid
|
|
32360
32339
|
? this.safelyInvokeMatcher(hook.matchesGrid, this.route, this.configurationStrategy?.getContext())
|
|
32361
|
-
: false).pipe(map
|
|
32340
|
+
: false).pipe(map(matches => ({ hook, matches }))))).pipe(startWith([]))), map((hooks) => hooks.filter(hook => hook.matches).map(hook => hook.hook)), map((hooks) => hooks.reduce((actionControls, currentHook) => {
|
|
32362
32341
|
return [...actionControls, ...castArray(currentHook.actionControls)];
|
|
32363
32342
|
}, [])), combineLatestWith(this.actionControlsInput$), tap(([hookControls, inputControls]) => (this.actionControls = [...inputControls, ...hookControls])), takeUntil(this.unsubscribe$))
|
|
32364
32343
|
.subscribe();
|
|
@@ -32372,7 +32351,7 @@ class DataGridComponent {
|
|
|
32372
32351
|
this.updateColumns();
|
|
32373
32352
|
// Resetting the stats size to 0 when managed objects are deleted but sizing not yet updated
|
|
32374
32353
|
// TODO remove after MTM-60226 is resolved
|
|
32375
|
-
this.emptyStateContext$ = combineLatest([this.dataSource.stats$, this.dataSource.data$]).pipe(map
|
|
32354
|
+
this.emptyStateContext$ = combineLatest([this.dataSource.stats$, this.dataSource.data$]).pipe(map(([stats, data]) => {
|
|
32376
32355
|
if (stats.filteredSize === 1 && data.length === 0) {
|
|
32377
32356
|
return { ...stats, size: 0, filteredSize: 0 };
|
|
32378
32357
|
}
|
|
@@ -32785,7 +32764,7 @@ class DataGridComponent {
|
|
|
32785
32764
|
this.manualSearch$.next(searchText);
|
|
32786
32765
|
}
|
|
32787
32766
|
setupSearchObservables() {
|
|
32788
|
-
const autoSearch$ = this.searchText$.pipe(debounceTime(this.SEARCH_DEBOUNCE_TIME), distinctUntilChanged
|
|
32767
|
+
const autoSearch$ = this.searchText$.pipe(debounceTime(this.SEARCH_DEBOUNCE_TIME), distinctUntilChanged(), filter(value => value !== this.lastManualSearchValue), tap(value => {
|
|
32789
32768
|
this.lastManualSearchValue = value;
|
|
32790
32769
|
}));
|
|
32791
32770
|
const manualSearch$ = this.manualSearch$.pipe(filter(value => value.trim() !== ''), tap(value => {
|
|
@@ -33098,7 +33077,7 @@ class DataGridComponent {
|
|
|
33098
33077
|
}
|
|
33099
33078
|
}
|
|
33100
33079
|
processAndPersistConfigChange() {
|
|
33101
|
-
merge(merge(this.onSort, this.onPageSizeChange, this.onColumnReordered, this.onColumnVisibilityChange).pipe(map
|
|
33080
|
+
merge(merge(this.onSort, this.onPageSizeChange, this.onColumnReordered, this.onColumnVisibilityChange).pipe(map(config => config.columns)), merge(this.onAddCustomColumn, this.onRemoveCustomColumn).pipe(map(() => (this.columns || []).map(this.mapColumnToConfig.bind(this)))), this.onFilter.pipe(map(({ columnName, filteringModifier }) => this.columns.map(this.mapColumnToConfig.bind(this)).map((column) => {
|
|
33102
33081
|
if (isNil(columnName)) {
|
|
33103
33082
|
delete column.filter;
|
|
33104
33083
|
}
|
|
@@ -33112,7 +33091,7 @@ class DataGridComponent {
|
|
|
33112
33091
|
}
|
|
33113
33092
|
return column;
|
|
33114
33093
|
}))))
|
|
33115
|
-
.pipe(map
|
|
33094
|
+
.pipe(map((columns) => ({
|
|
33116
33095
|
columns,
|
|
33117
33096
|
pagination: { pageSize: this.pagination.pageSize }
|
|
33118
33097
|
})), filter(() => !!this.configurationStrategy), this.trimFilterConfigPipe(), this.trimSortConfigPipe(), this.trimCustomColumnConfigPipe(), this.ignoreColumnOrderPipe(), this.ignoreColumnVisibilityPipe(), concatMap((config) => this.configurationStrategy.saveConfig$(config)), takeUntil(this.unsubscribe$))
|
|
@@ -33144,7 +33123,7 @@ class DataGridComponent {
|
|
|
33144
33123
|
}
|
|
33145
33124
|
ignoreColumnOrderPipe() {
|
|
33146
33125
|
return pipe(this.checkEventPipe('order', config => {
|
|
33147
|
-
return this.configurationStrategy.getConfig$().pipe(map
|
|
33126
|
+
return this.configurationStrategy.getConfig$().pipe(map(oldConfig => {
|
|
33148
33127
|
const oldColumns = oldConfig?.columns || this.defaultColumns;
|
|
33149
33128
|
// check if custom columns have been added
|
|
33150
33129
|
const columnsAdded = (config.columns || []).filter(col => !oldColumns.find(old => old.name === col.name));
|
|
@@ -33158,7 +33137,7 @@ class DataGridComponent {
|
|
|
33158
33137
|
}
|
|
33159
33138
|
ignoreColumnVisibilityPipe() {
|
|
33160
33139
|
return pipe(this.checkEventPipe('visibility', config => {
|
|
33161
|
-
return this.configurationStrategy.getConfig$().pipe(map
|
|
33140
|
+
return this.configurationStrategy.getConfig$().pipe(map(oldConfig => {
|
|
33162
33141
|
config.columns = (config.columns || []).map(newCol => {
|
|
33163
33142
|
const columns = oldConfig?.columns || this.defaultColumns;
|
|
33164
33143
|
const oldCol = columns.find((col) => newCol.name === col.name);
|
|
@@ -33173,8 +33152,8 @@ class DataGridComponent {
|
|
|
33173
33152
|
return pipe(concatMap((config) => {
|
|
33174
33153
|
return this.resolveConfigFilter
|
|
33175
33154
|
.call(this, configPart)
|
|
33176
|
-
.pipe(map
|
|
33177
|
-
}), map
|
|
33155
|
+
.pipe(map(keepEventData => ({ config, keepEventData })));
|
|
33156
|
+
}), map(({ config, keepEventData }) => keepEventData ? config : trimEventDataFn.call(this, config)), concatMap(config => (isObservable(config) ? config : of(config))));
|
|
33178
33157
|
}
|
|
33179
33158
|
resolveConfigFilter(configPart) {
|
|
33180
33159
|
let result;
|
|
@@ -33415,7 +33394,7 @@ class RadioFilterMapper {
|
|
|
33415
33394
|
map(field, filter) {
|
|
33416
33395
|
if (this.fieldType.includes(field.type.toString())) {
|
|
33417
33396
|
const fieldOptions = field.props?.options || field.props?.enum;
|
|
33418
|
-
return toObservable(fieldOptions).pipe(map
|
|
33397
|
+
return toObservable(fieldOptions).pipe(map(options => {
|
|
33419
33398
|
const object = options.find(option => option.value === get(filter.externalFilterQuery, filter.path)) ??
|
|
33420
33399
|
options.find(option => option === get(filter.externalFilterQuery, filter.path));
|
|
33421
33400
|
return {
|
|
@@ -33493,7 +33472,7 @@ class SelectFilterMapper {
|
|
|
33493
33472
|
}
|
|
33494
33473
|
map(field, filter) {
|
|
33495
33474
|
if (this.fieldType === field.type) {
|
|
33496
|
-
return toObservable(field.props?.options).pipe(map
|
|
33475
|
+
return toObservable(field.props?.options).pipe(map(options => {
|
|
33497
33476
|
const selectedOption = options.find(option => option.value === get(filter.externalFilterQuery, filter.path));
|
|
33498
33477
|
return {
|
|
33499
33478
|
...filter,
|
|
@@ -33854,7 +33833,7 @@ class RangeDisplayComponent {
|
|
|
33854
33833
|
});
|
|
33855
33834
|
this.currentRangeWidthObserver.observe(this.currentRangeElement.nativeElement);
|
|
33856
33835
|
this.currentRangeWidthChanged
|
|
33857
|
-
.pipe(debounceTime(this.CURRENT_RANGE_WIDTH_TRANSITION_TIME), map
|
|
33836
|
+
.pipe(debounceTime(this.CURRENT_RANGE_WIDTH_TRANSITION_TIME), map((rangeElement) => parseInt(getComputedStyle(rangeElement, null).width)), distinctUntilChanged(), takeUntil(this.destroyed$))
|
|
33858
33837
|
.subscribe(rangeElementWidth => {
|
|
33859
33838
|
this.setTooltipShiftValue(rangeElementWidth);
|
|
33860
33839
|
});
|
|
@@ -34419,14 +34398,14 @@ class WizardService extends ExtensionPointForPlugins {
|
|
|
34419
34398
|
* @returns observable with list of wizard entries.
|
|
34420
34399
|
*/
|
|
34421
34400
|
getEntriesListById(id) {
|
|
34422
|
-
return this.items$.pipe(map
|
|
34401
|
+
return this.items$.pipe(map(entries => entries.filter(entry => entry.wizardId === id)));
|
|
34423
34402
|
}
|
|
34424
34403
|
setupItemsObservable() {
|
|
34425
34404
|
return fromTrigger(this.router, this.refresh$, [
|
|
34426
34405
|
getInjectedHooks(HOOK_WIZARD, this.injectors),
|
|
34427
34406
|
() => this.factories,
|
|
34428
34407
|
stateToFactory(this.state$)
|
|
34429
|
-
]).pipe(distinctUntilChanged
|
|
34408
|
+
]).pipe(distinctUntilChanged(allEntriesAreEqual), map(entries => this.getUniqueListBy(entries, 'name', 'wizardId')), shareReplay(1));
|
|
34430
34409
|
}
|
|
34431
34410
|
getUniqueListBy(entries, ...keys) {
|
|
34432
34411
|
return [
|
|
@@ -34958,10 +34937,10 @@ class FeatureCacheService {
|
|
|
34958
34937
|
* @returns true if the feature key exists in the list of features.
|
|
34959
34938
|
*/
|
|
34960
34939
|
featureExists(key) {
|
|
34961
|
-
return this.features$.pipe(map
|
|
34940
|
+
return this.features$.pipe(map(features => features.some(feature => feature.key === key)));
|
|
34962
34941
|
}
|
|
34963
34942
|
getFeatureState(key) {
|
|
34964
|
-
return this.features$.pipe(map
|
|
34943
|
+
return this.features$.pipe(map(features => {
|
|
34965
34944
|
const feature = features.find(f => f.key === key);
|
|
34966
34945
|
return feature?.active || false;
|
|
34967
34946
|
}));
|
|
@@ -34998,7 +34977,7 @@ class PreviewService extends ExtensionPointForPlugins {
|
|
|
34998
34977
|
this.reload$ = new BehaviorSubject(false);
|
|
34999
34978
|
this.LOCAL_STORAGE_KEY = 'c8y_beta_features_seen';
|
|
35000
34979
|
this.seenFeatures$ = new BehaviorSubject(this.getSeenFeatures());
|
|
35001
|
-
this.hasUnseenFeatures$ = combineLatest([this.getAvailableFeatures$(), this.seenFeatures$]).pipe(map
|
|
34980
|
+
this.hasUnseenFeatures$ = combineLatest([this.getAvailableFeatures$(), this.seenFeatures$]).pipe(map(([features, seen]) => features.some(feature => !seen.includes(feature.label))), distinctUntilChanged());
|
|
35002
34981
|
this.featureService = inject(FeatureService);
|
|
35003
34982
|
this.featureCacheService = inject(FeatureCacheService);
|
|
35004
34983
|
this.optionsService = inject(OptionsService);
|
|
@@ -35024,8 +35003,8 @@ class PreviewService extends ExtensionPointForPlugins {
|
|
|
35024
35003
|
if (feature.active$) {
|
|
35025
35004
|
return feature.active$;
|
|
35026
35005
|
}
|
|
35027
|
-
return this.featureCacheService.getFeatureState(key).pipe(distinctUntilChanged
|
|
35028
|
-
}))), distinctUntilChanged
|
|
35006
|
+
return this.featureCacheService.getFeatureState(key).pipe(distinctUntilChanged());
|
|
35007
|
+
}))), distinctUntilChanged());
|
|
35029
35008
|
}
|
|
35030
35009
|
/**
|
|
35031
35010
|
* Toggle the state of a specific feature.
|
|
@@ -35080,8 +35059,8 @@ class PreviewService extends ExtensionPointForPlugins {
|
|
|
35080
35059
|
return combineLatest(features.map(feat => feat.key
|
|
35081
35060
|
? this.featureCacheService
|
|
35082
35061
|
.featureExists(feat.key)
|
|
35083
|
-
.pipe(map
|
|
35084
|
-
: of(feat))).pipe(map
|
|
35062
|
+
.pipe(map(exists => (exists ? feat : false)))
|
|
35063
|
+
: of(feat))).pipe(map(features => features.filter(Boolean)));
|
|
35085
35064
|
}));
|
|
35086
35065
|
}
|
|
35087
35066
|
/**
|
|
@@ -35097,7 +35076,7 @@ class PreviewService extends ExtensionPointForPlugins {
|
|
|
35097
35076
|
getInjectedHooks(HOOK_PREVIEW, this.injectors),
|
|
35098
35077
|
() => this.factories,
|
|
35099
35078
|
stateToFactory(this.state$)
|
|
35100
|
-
]).pipe(distinctUntilChanged
|
|
35079
|
+
]).pipe(distinctUntilChanged(), map(features => sortByPriority(features)), shareReplay(1));
|
|
35101
35080
|
}
|
|
35102
35081
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PreviewService, deps: [{ token: i0.Injector }, { token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
35103
35082
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PreviewService, providedIn: 'root' }); }
|
|
@@ -35231,7 +35210,7 @@ class BetaPreviewDrawerFactory {
|
|
|
35231
35210
|
};
|
|
35232
35211
|
}
|
|
35233
35212
|
get() {
|
|
35234
|
-
return this.shouldShowBetaPreview$().pipe(distinctUntilChanged
|
|
35213
|
+
return this.shouldShowBetaPreview$().pipe(distinctUntilChanged(), map(shouldShowBetaPreview => {
|
|
35235
35214
|
if (shouldShowBetaPreview) {
|
|
35236
35215
|
return this.drawerItem;
|
|
35237
35216
|
}
|
|
@@ -35242,7 +35221,7 @@ class BetaPreviewDrawerFactory {
|
|
|
35242
35221
|
return combineLatest([
|
|
35243
35222
|
this.options.get$('hideBetaPreview'),
|
|
35244
35223
|
this.previewService.getAvailableFeatures$()
|
|
35245
|
-
]).pipe(map
|
|
35224
|
+
]).pipe(map(([hideBetaPreview, items]) => {
|
|
35246
35225
|
const hasItems = items.length > 0;
|
|
35247
35226
|
if (!hasItems) {
|
|
35248
35227
|
return false;
|
|
@@ -35593,7 +35572,7 @@ class ProviderConfigurationNodeFactory {
|
|
|
35593
35572
|
const canActivate = this.config
|
|
35594
35573
|
.map(this.getGuards.bind(this))
|
|
35595
35574
|
.map(this.checkCanActivate.bind(this));
|
|
35596
|
-
return forkJoin(canActivate).pipe(map
|
|
35575
|
+
return forkJoin(canActivate).pipe(map((canActivateResult) => this.config
|
|
35597
35576
|
.map((c, index) => canActivateResult[index] ? new NavigatorNode(c.navigation) : undefined)
|
|
35598
35577
|
.filter(el => !!el)), tap(nodes => (this.nodes = nodes)));
|
|
35599
35578
|
}
|
|
@@ -35604,7 +35583,7 @@ class ProviderConfigurationNodeFactory {
|
|
|
35604
35583
|
const canActivateResult = ca
|
|
35605
35584
|
.map((canActivate) => canActivate.canActivate(undefined, undefined))
|
|
35606
35585
|
.map(toObservable);
|
|
35607
|
-
return forkJoin(canActivateResult).pipe(map
|
|
35586
|
+
return forkJoin(canActivateResult).pipe(map((caResult) => caResult.reduce((acc, curr) => acc && curr)));
|
|
35608
35587
|
}
|
|
35609
35588
|
return of(true);
|
|
35610
35589
|
}
|
|
@@ -35683,11 +35662,11 @@ class ProviderConfigurationComponent {
|
|
|
35683
35662
|
this.providerDefinitionsService = providerDefinitionsService;
|
|
35684
35663
|
this.providerConfigurationService = providerConfigurationService;
|
|
35685
35664
|
this.jsonschema = jsonschema;
|
|
35686
|
-
this.layout$ = this.activatedRoute.data.pipe(map
|
|
35665
|
+
this.layout$ = this.activatedRoute.data.pipe(map((config) => config.layout), tap((layout) => (this.layout = layout)), tap((layout) => {
|
|
35687
35666
|
this.options.formState.disabled = !this.permissions.hasAllRoles(layout.saveRoles || []);
|
|
35688
35667
|
this.beforeSaveHook = layout.beforeSaveHook;
|
|
35689
35668
|
}));
|
|
35690
|
-
this.allRoles$ = this.layout$.pipe(map
|
|
35669
|
+
this.allRoles$ = this.layout$.pipe(map((layout) => [
|
|
35691
35670
|
...(layout.deleteRoles || []),
|
|
35692
35671
|
...(layout.saveRoles || [])
|
|
35693
35672
|
]));
|
|
@@ -35704,14 +35683,14 @@ class ProviderConfigurationComponent {
|
|
|
35704
35683
|
this.updatedConfiguration$ = new Subject();
|
|
35705
35684
|
}
|
|
35706
35685
|
ngOnInit() {
|
|
35707
|
-
const allProviders$ = from(this.providerDefinitionsService.list()).pipe(map
|
|
35708
|
-
this.providers$ = combineLatest(allProviders$, this.providerInput$).pipe(map
|
|
35686
|
+
const allProviders$ = from(this.providerDefinitionsService.list()).pipe(map(result => result.data), shareReplay(1));
|
|
35687
|
+
this.providers$ = combineLatest(allProviders$, this.providerInput$).pipe(map(([providers, input]) => input
|
|
35709
35688
|
? providers.filter(el => el.displayName.toLowerCase().indexOf(input.toLowerCase()) >= 0)
|
|
35710
35689
|
: providers), shareReplay(1));
|
|
35711
|
-
this.configuration$ = merge(this.updatedConfiguration$, this.reload$.pipe(switchMap(() => from(this.providerConfigurationService.detail()).pipe(catchError(() => of({})))), map
|
|
35690
|
+
this.configuration$ = merge(this.updatedConfiguration$, this.reload$.pipe(switchMap(() => from(this.providerConfigurationService.detail()).pipe(catchError(() => of({})))), map(result => result.data))).pipe(map(this.removeEncryptedValues), shareReplay(1));
|
|
35712
35691
|
this.selectedProvider$ = combineLatest(allProviders$, this.configuration$, this.changeProvider$).pipe(tap(([_, configuration, newProvider]) => (this.model = newProvider
|
|
35713
35692
|
? pick(this.model, 'sms.senderName', 'sms.senderAddress')
|
|
35714
|
-
: configuration)), map
|
|
35693
|
+
: configuration)), map(([providers, configuration, newProvider]) => newProvider ||
|
|
35715
35694
|
find(providers, (provider) => get(configuration, 'provider') === provider.id)), tap((provider) => {
|
|
35716
35695
|
if (provider) {
|
|
35717
35696
|
const config = this.jsonschema.toFieldConfig(get(provider, 'schema'));
|
|
@@ -35864,7 +35843,7 @@ class ProviderConfigurationTabFactory {
|
|
|
35864
35843
|
: undefined)
|
|
35865
35844
|
.map(this.checkCanActivate.bind(this));
|
|
35866
35845
|
return canActivate.length > 0
|
|
35867
|
-
? forkJoin(canActivate).pipe(map
|
|
35846
|
+
? forkJoin(canActivate).pipe(map((canActivateResult) => filteredRoutes
|
|
35868
35847
|
.map((c, index) => {
|
|
35869
35848
|
const tab = {
|
|
35870
35849
|
...c.tab,
|
|
@@ -35880,7 +35859,7 @@ class ProviderConfigurationTabFactory {
|
|
|
35880
35859
|
const canActivateResult = ca
|
|
35881
35860
|
.map((canActivate) => canActivate.canActivate(undefined, undefined))
|
|
35882
35861
|
.map(toObservable);
|
|
35883
|
-
return forkJoin(canActivateResult).pipe(map
|
|
35862
|
+
return forkJoin(canActivateResult).pipe(map((caResult) => caResult.reduce((acc, curr) => acc && curr)));
|
|
35884
35863
|
}
|
|
35885
35864
|
return of(true);
|
|
35886
35865
|
}
|
|
@@ -35969,7 +35948,7 @@ class LegacyGridConfigMapperService {
|
|
|
35969
35948
|
return combineLatest([
|
|
35970
35949
|
this.userPreferencesService.get(legacyAllDevicesGridKey),
|
|
35971
35950
|
this.userPreferencesService.get(legacyAllDevicesGridFilterKey)
|
|
35972
|
-
]).pipe(map
|
|
35951
|
+
]).pipe(map(([legacyConfig, legacyFilterConfig]) => this.mapLegacyToDeviceGridConfig(legacyConfig, legacyFilterConfig, context.defaultColumns)), concatMap(mappedLegacyConfig => {
|
|
35973
35952
|
if (mappedLegacyConfig) {
|
|
35974
35953
|
return Promise.all([
|
|
35975
35954
|
this.userPreferencesService.set(legacyAllDevicesGridKey, null),
|
|
@@ -35983,7 +35962,7 @@ class LegacyGridConfigMapperService {
|
|
|
35983
35962
|
? this.userPreferencesService
|
|
35984
35963
|
.set(context?.key, mappedLegacyConfig)
|
|
35985
35964
|
.then(() => mappedLegacyConfig)
|
|
35986
|
-
: this.userPreferencesService.get(context?.key)), map
|
|
35965
|
+
: this.userPreferencesService.get(context?.key)), map(config => config || {
|
|
35987
35966
|
columns: [],
|
|
35988
35967
|
pagination: {
|
|
35989
35968
|
pageSize: this.dataGridService.DEFAULT_PAGE_SIZE,
|
|
@@ -36198,7 +36177,7 @@ class MeasurementRealtimeService extends RealtimeService {
|
|
|
36198
36177
|
pageSize
|
|
36199
36178
|
})).pipe(
|
|
36200
36179
|
// emit null in case no value could have been retrieved so we are able to note that in certain cases.
|
|
36201
|
-
map
|
|
36180
|
+
map(result => !emitNullIfInitialValuesWereNotFound || result.data.length ? result.data : [null]),
|
|
36202
36181
|
// reverse required, so that measurements are received ordered by time (ascending).
|
|
36203
36182
|
// from ensures values are sent as single measurements and not a measurement array.
|
|
36204
36183
|
// TODO: replace `[...result].reverse()` with `result.toReversed()` once es2023 is available.
|
|
@@ -36280,6 +36259,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
36280
36259
|
class RealtimeMessage {
|
|
36281
36260
|
}
|
|
36282
36261
|
|
|
36262
|
+
class PluginLoadedPipe {
|
|
36263
|
+
constructor(pluginsResolve) {
|
|
36264
|
+
this.pluginsResolve = pluginsResolve;
|
|
36265
|
+
}
|
|
36266
|
+
transform(pluginName) {
|
|
36267
|
+
if (!pluginName) {
|
|
36268
|
+
return of(false);
|
|
36269
|
+
}
|
|
36270
|
+
return this.pluginsResolve.loadedPluginNames$.pipe(map$2(pluginNames => pluginNames.includes(pluginName)), distinctUntilChanged$1());
|
|
36271
|
+
}
|
|
36272
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, deps: [{ token: PluginsResolveService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
36273
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, isStandalone: true, name: "c8yPluginLoaded" }); }
|
|
36274
|
+
}
|
|
36275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: PluginLoadedPipe, decorators: [{
|
|
36276
|
+
type: Pipe,
|
|
36277
|
+
args: [{
|
|
36278
|
+
name: 'c8yPluginLoaded',
|
|
36279
|
+
standalone: true
|
|
36280
|
+
}]
|
|
36281
|
+
}], ctorParameters: () => [{ type: PluginsResolveService }] });
|
|
36282
|
+
|
|
36283
36283
|
/**
|
|
36284
36284
|
* AssetTypesService is being used to manage a cache of all existing asset types.
|
|
36285
36285
|
* This service is injected in the AssetOverviewNavigationFactory class, which will trigger
|
|
@@ -36295,7 +36295,7 @@ class AssetTypesService {
|
|
|
36295
36295
|
this.assetTypesCache = {};
|
|
36296
36296
|
this.allowedMethods = ['POST', 'PUT', 'DELETE'];
|
|
36297
36297
|
this.appStateService.currentUser
|
|
36298
|
-
.pipe(map
|
|
36298
|
+
.pipe(map(user => user?.id), distinctUntilChanged(), switchMap(userId => {
|
|
36299
36299
|
if (userId) {
|
|
36300
36300
|
this.assetTypesRealtimeService
|
|
36301
36301
|
.getAssetTypesCache$()
|