Compare commits
5 Commits
master
...
release-4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd4580f60d | ||
|
|
1610a4c3a5 | ||
|
|
3776e8ecef | ||
|
|
48b3abaf2c | ||
|
|
b27c4e60d8 |
@ -17,4 +17,6 @@
|
||||
</button>
|
||||
|
||||
<div *ngIf="showDot" class="dot"></div>
|
||||
|
||||
<div *ngIf="dropdownButton" [class.disabled]="disabled" class="arrow-down"></div>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,16 @@
|
||||
:host > div {
|
||||
width: var(--circle-button-size);
|
||||
height: var(--circle-button-size);
|
||||
|
||||
.arrow-down {
|
||||
border: 5px solid transparent;
|
||||
border-top-color: black;
|
||||
position: fixed;
|
||||
margin-left: 12px;
|
||||
margin-top: -8px;
|
||||
|
||||
&.disabled {
|
||||
border-top-color: var(--iqser-grey-3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ export class CircleButtonComponent implements OnInit {
|
||||
@Input() helpModeButton = false;
|
||||
@Input() removeTooltip = false;
|
||||
@Input() isSubmit = false;
|
||||
@Input() dropdownButton = false;
|
||||
@Input() size = 34;
|
||||
@Input() iconSize = 14;
|
||||
@Output() readonly action = new EventEmitter<MouseEvent>();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<ng-container *ngIf="!editing">
|
||||
<div *ngIf="showPreview">
|
||||
{{ value }}
|
||||
<li *ngIf="listValue; else simpleValue">{{ value }}</li>
|
||||
<ng-template #simpleValue> {{ value }} </ng-template>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
@ -35,8 +36,8 @@
|
||||
[placeholder]="placeholder"
|
||||
[id]="id"
|
||||
name="name"
|
||||
[style.width]="this.parentDimensions.width + 'px'"
|
||||
[style.height]="this.parentDimensions.height + 'px'"
|
||||
[style.width]="this.parentDimensions?.width + 'px'"
|
||||
[style.height]="this.parentDimensions?.height + 'px'"
|
||||
></textarea>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
@ -18,3 +18,7 @@ textarea {
|
||||
margin: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@ -24,6 +24,8 @@ export class EditableInputComponent implements OnChanges {
|
||||
@Input() canEdit = true;
|
||||
@Input() buttonsType: CircleButtonType = CircleButtonTypes.default;
|
||||
@Input() helpModeKey: string = '';
|
||||
@Input() lastChild = false;
|
||||
@Input() listValue = false;
|
||||
@Output() readonly save = new EventEmitter<string>();
|
||||
parentDimensions?: { width: number; height: number };
|
||||
newValue = '';
|
||||
@ -44,12 +46,10 @@ export class EditableInputComponent implements OnChanges {
|
||||
if (changes['value']) {
|
||||
this.editing = false;
|
||||
}
|
||||
if (changes['parentId']?.currentValue) {
|
||||
setTimeout(() => {
|
||||
const parent = document.getElementById(this.parentId as string) as HTMLElement;
|
||||
this.parentDimensions = { width: parent.offsetWidth - 98, height: parent.offsetHeight - 16 };
|
||||
}, 20);
|
||||
}
|
||||
setTimeout(() => {
|
||||
const parent = document.getElementById(this.parentId as string) as HTMLElement;
|
||||
this.parentDimensions = { width: parent.offsetWidth - 98, height: parent.offsetHeight - 16 };
|
||||
}, 20);
|
||||
}
|
||||
|
||||
saveValue(): void {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActiveToast, ToastrService } from 'ngx-toastr';
|
||||
import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||
import { ActiveToast, ToastrService } from 'ngx-toastr';
|
||||
import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config';
|
||||
import { filter, tap } from 'rxjs/operators';
|
||||
import { ErrorMessageService } from './error-message.service';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
const enum NotificationType {
|
||||
SUCCESS = 'SUCCESS',
|
||||
@ -26,6 +26,7 @@ export interface ToasterOptions extends IndividualConfig {
|
||||
*/
|
||||
readonly params?: Record<string, string | number>;
|
||||
readonly actions?: ToasterActions[];
|
||||
readonly useRaw?: boolean;
|
||||
}
|
||||
|
||||
export interface ErrorToasterOptions extends ToasterOptions {
|
||||
@ -86,7 +87,7 @@ export class Toaster {
|
||||
notificationType = NotificationType.INFO,
|
||||
options?: Partial<ToasterOptions>,
|
||||
): ActiveToast<unknown> {
|
||||
const translatedMsg = this._translateService.instant(message, options?.params) as string;
|
||||
const translatedMsg = options?.useRaw ? message : (this._translateService.instant(message, options?.params) as string);
|
||||
|
||||
switch (notificationType) {
|
||||
case NotificationType.SUCCESS:
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { inject } from '@angular/core';
|
||||
import { IqserUserService } from '../services/iqser-user.service';
|
||||
import { TenantsService } from '../../tenants';
|
||||
|
||||
export function hasAnyRoleGuard(): CanActivateFn {
|
||||
return async () => {
|
||||
const router = inject(Router);
|
||||
const activeTenantId = inject(TenantsService).activeTenantId;
|
||||
const user = await inject(IqserUserService).loadCurrentUser();
|
||||
if (user?.hasAnyRole) {
|
||||
await router.navigate([`/${activeTenantId}/main`]);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
31
src/lib/users/guards/roles.guard.ts
Normal file
31
src/lib/users/guards/roles.guard.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { inject } from '@angular/core';
|
||||
import { IqserUserService } from '../services/iqser-user.service';
|
||||
import { TenantsService } from '../../tenants';
|
||||
import { AsyncGuard } from '../../services';
|
||||
|
||||
export function doesNotHaveAnyRole(): AsyncGuard {
|
||||
return async () => {
|
||||
const router = inject(Router);
|
||||
const activeTenantId = inject(TenantsService).activeTenantId;
|
||||
const user = await inject(IqserUserService).loadCurrentUser();
|
||||
if (user?.hasAnyRole) {
|
||||
await router.navigate([`/${activeTenantId}/main`]);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
export function hasAnyRole(): AsyncGuard {
|
||||
return async () => {
|
||||
const router = inject(Router);
|
||||
const activeTenantId = inject(TenantsService).activeTenantId;
|
||||
const user = await inject(IqserUserService).loadCurrentUser();
|
||||
if (!user?.hasAnyRole) {
|
||||
await router.navigate([`/${activeTenantId}/auth-error`]);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@ -11,6 +11,6 @@ export * from './services/default-user.service';
|
||||
export * from './iqser-users.module';
|
||||
export * from './guards/iqser-auth-guard.service';
|
||||
export * from './guards/iqser-role-guard.service';
|
||||
export * from './guards/has-roles.guard';
|
||||
export * from './guards/roles.guard';
|
||||
export * from './components/user-button/user-button.component';
|
||||
export * from './components/initials-avatar/initials-avatar.component';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user