@sumaris-net/ngx-components 2.4.140 → 2.4.142

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.
@@ -11920,10 +11920,10 @@ const environment = Object.freeze({
11920
11920
  helpUrl: 'https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/blob/master/user-manual/index_fr.md',
11921
11921
  // Development
11922
11922
  defaultAuthValues: {
11923
- // Basic auth (using Person.username)
11924
- // username: 'admq2', password: 'q22006'
11925
- // Token auth (using Person.pubkey)
11926
- //username: 'admin@sumaris.net', password: 'admin',
11923
+ // Basic auth (using Person.username)
11924
+ // username: 'admq2', password: 'q22006'
11925
+ // Token auth (using Person.pubkey)
11926
+ username: 'admin@sumaris.net', password: 'admin',
11927
11927
  },
11928
11928
  account: {
11929
11929
  enableListenChanges: true,
@@ -16425,6 +16425,10 @@ class PersonUtils {
16425
16425
  static personsToString(data, separator) {
16426
16426
  return (data || []).map(PersonUtils.personToString).join(separator || ', ');
16427
16427
  }
16428
+ static roleToProfile(role, defaultProfile) {
16429
+ const label = role?.replace(/^ROLE_/, '');
16430
+ return label || defaultProfile;
16431
+ }
16428
16432
  }
16429
16433
 
16430
16434
  var Account_1;
@@ -18044,8 +18048,8 @@ class AccountService extends BaseGraphqlService {
18044
18048
  // Same recorder department: OK, user can write
18045
18049
  if (this._data.department.id === recorderDepartment.id)
18046
18050
  return true;
18047
- // Else, check if supervisor (or more)
18048
- return PersonUtils.hasUpperOrEqualsProfile(this._data.profiles, 'SUPERVISOR');
18051
+ // Cannot write
18052
+ return false;
18049
18053
  }
18050
18054
  async register(data) {
18051
18055
  if (this.isLogin()) {
@@ -23089,7 +23093,7 @@ class MenuService extends StartableObservableService {
23089
23093
  this.router = router;
23090
23094
  this.environment = environment;
23091
23095
  this.accountChanges = new BehaviorSubject(undefined);
23092
- this.pinnedEvent = new EventEmitter();
23096
+ this.onPinned = new EventEmitter(true);
23093
23097
  this._detachedSubItems = [];
23094
23098
  this._itemCounter = 0;
23095
23099
  this._logPrefix = '[menu-service] ';
@@ -23225,7 +23229,7 @@ class MenuService extends StartableObservableService {
23225
23229
  else {
23226
23230
  item.pinned = true;
23227
23231
  }
23228
- this.pinnedEvent.next(item);
23232
+ this.onPinned.emit(item);
23229
23233
  }
23230
23234
  _markAsOpened() {
23231
23235
  this._$opened.next(true);
@@ -23271,13 +23275,14 @@ class MenuService extends StartableObservableService {
23271
23275
  }
23272
23276
  }));
23273
23277
  // Save pinned items
23274
- this.registerSubscription(this.pinnedEvent
23275
- //.pipe(debounceTime(1000))
23278
+ this.registerSubscription(this.onPinned
23276
23279
  .subscribe(item => {
23277
- const pinnedItems = this.subItems.filter(i => i.isPinned())
23280
+ // Collect pinned elements, the serialize it (without id)
23281
+ const pinnedSubItems = this.subItems.filter(i => i.isPinned())
23278
23282
  .map(item => item.asObject({ withChildren: true, keepLocalId: false }));
23279
- console.debug(this._logPrefix + 'Saving pinned items to settings...', pinnedItems);
23280
- this.settings.savePageSetting('menu', pinnedItems, 'sub-items');
23283
+ if (pinnedSubItems.length && this._debug)
23284
+ console.debug(this._logPrefix + `Saving ${pinnedSubItems.length} pinned items, in local settings`, pinnedSubItems);
23285
+ this.settings.savePageSetting('menu', pinnedSubItems, 'sub-items');
23281
23286
  }));
23282
23287
  return firstNotNilPromise(this.dataSubject);
23283
23288
  }