Skip to content

Commit

Permalink
Cyclos 4.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
acaurrinhos committed Jan 14, 2021
1 parent 1c09acd commit 47abdee
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Cyclos 4 UI",
"description": "The new Cyclos 4 frontend",
"icon": "cyclos.png",
"version": "4.14.3",
"version": "4.14.4",
"license": "MIT",
"author": {
"name": "Cyclos development team",
Expand Down
9 changes: 9 additions & 0 deletions src/app/core/error-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ export class ErrorHandlerService {
error = error || {} as UnauthorizedError;
switch (error.code) {
case UnauthorizedErrorCode.LOGIN:
const missingSecondaryPassword = error.missingSecondaryPassword;
const secondaryDeviceAllowed = !!error.secondaryDeviceAllowed;
if (missingSecondaryPassword && secondaryDeviceAllowed) {
return this.i18n.login.error.confirmation.missingBoth(missingSecondaryPassword.name);
} else if (missingSecondaryPassword && !secondaryDeviceAllowed) {
return this.i18n.login.error.confirmation.missingPassword(missingSecondaryPassword.name);
} else if (!missingSecondaryPassword && secondaryDeviceAllowed) {
return this.i18n.login.error.confirmation.missingDevice;
}
switch (error.passwordStatus) {
case PasswordStatusEnum.DISABLED:
return this.i18n.login.error.password.disabled;
Expand Down
15 changes: 10 additions & 5 deletions src/app/shared/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ export function getRootSpinnerSvg() {
}

/**
* Sets whether the root spinner in the page is visible
* Sets whether the root spinner is visible
*/
export function setRootSpinnerVisible(visible: boolean): void {
const rootSpinner = document.getElementById('rootSpinner') as HTMLElement;
rootSpinner.style.display = visible ? '' : 'none';
export function setRootSpinnerVisible(visible: boolean, hideContainer = true): void {
const spinner = document.getElementById('rootSpinner') as HTMLElement;
spinner.style.display = visible ? '' : 'none';
const root = document.getElementsByClassName('root-container').item(0) as HTMLElement;
if (root) {
root.style.display = visible ? 'none' : '';
if (!visible || hideContainer) {
root.style.display = visible ? 'none' : '';
root.style.opacity = '1';
} else {
root.style.opacity = '0.3';
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/app/ui/core/export-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ExportFormat } from 'app/api/models';
import { SvgIcon } from 'app/core/svg-icon';
import { I18n } from 'app/i18n/i18n';
import { Action, HeadingAction } from 'app/shared/action';
import { downloadResponse, empty } from 'app/shared/helper';
import { downloadResponse, empty, setRootSpinnerVisible } from 'app/shared/helper';
import { Observable } from 'rxjs';
import { first } from 'rxjs/operators';

Expand Down Expand Up @@ -46,7 +46,13 @@ export class ExportHelperService {

private downloadHandler(format: ExportFormat, callback: (f: ExportFormat) => Observable<HttpResponse<Blob>>) {
return () => {
callback(format).pipe(first()).subscribe(downloadResponse);
setRootSpinnerVisible(true, false);
callback(format).pipe(first()).subscribe(
r => {
setRootSpinnerVisible(false);
downloadResponse(r);
},
() => setRootSpinnerVisible(false));
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/app/ui/core/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,8 @@ export class MenuService {
}
const sessions = permissions.sessions || {};
if (sessions.view) {
add(Menu.CONNECTED_USERS, '/users/connected', SvgIcon.BoxArrowInRight, this.i18n.menu.marketplaceConnectedUsers);
const menu = role === RoleEnum.BROKER ? Menu.BROKER_CONNECTED_USERS : Menu.CONNECTED_USERS;
add(menu, '/users/connected', SvgIcon.BoxArrowInRight, this.i18n.menu.marketplaceConnectedUsers);
}

// Marketplace
Expand Down
1 change: 1 addition & 0 deletions src/app/ui/shared/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export namespace Menu {
export const BROKER_REGISTRATION = new Menu(RootMenu.BROKERING, 'BROKER_REGISTRATION');
export const BROKER_TRANSFERS_OVERVIEW = new Menu(RootMenu.BROKERING, 'BROKER_TRANSFERS_OVERVIEW');
export const BROKER_AUTHORIZED_PAYMENTS_OVERVIEW = new Menu(RootMenu.BROKERING, 'BROKER_AUTHORIZED_PAYMENTS_OVERVIEW');
export const BROKER_CONNECTED_USERS = new Menu(RootMenu.BROKERING, 'BROKER_CONNECTED_USERS');

// Personal
export const MY_PROFILE = new Menu(RootMenu.PERSONAL, 'MY_PROFILE');
Expand Down
4 changes: 3 additions & 1 deletion src/app/ui/users/connected/search-connected.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/c
import { RoleEnum, SessionDataForSearch, SessionQueryFilters, SessionResult } from 'app/api/models';
import { SessionsService } from 'app/api/services/sessions.service';
import { BaseSearchPageComponent } from 'app/ui/shared/base-search-page.component';
import { Menu } from 'app/ui/shared/menu';
import { Observable } from 'rxjs';

/**
Expand Down Expand Up @@ -78,6 +79,7 @@ export class SearchConnectedComponent
}

resolveMenu() {
return this.menu.searchUsersMenu();
return this.dataForFrontendHolder.role === RoleEnum.BROKER
? Menu.BROKER_CONNECTED_USERS : Menu.CONNECTED_USERS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class RegistrationStepGroupComponent extends BaseComponent implements OnI
if (groupSet == null) {
return groups.filter(g => g.groupSet == null);
} else {
return groups.filter(g => g.groupSet === groupSet.id);
return groups.filter(g => [groupSet.id, groupSet.internalName].includes(g.groupSet));
}
}
}

0 comments on commit 47abdee

Please sign in to comment.