other fixes

This commit is contained in:
Dan Percic 2024-11-04 13:03:12 +02:00
parent b3dc8b04c8
commit ff8009167b
4 changed files with 18 additions and 20 deletions

View File

@ -83,14 +83,15 @@
icon="iqser:trash"
></iqser-circle-button>
<iqser-circle-button
(action)="annotationActionsService.undoDirectAction(annotations())"
*allow="roles.redactions.deleteManual; if: annotationPermissions().canUndo"
[tooltipPosition]="tooltipPosition"
[tooltip]="'annotation-actions.undo' | translate"
[type]="buttonType"
icon="red:undo"
></iqser-circle-button>
<ng-template [allow]="roles.redactions.deleteManual" [allowIf]="annotationPermissions().canUndo">
<iqser-circle-button
(action)="annotationActionsService.undoDirectAction(annotations())"
[tooltipPosition]="tooltipPosition"
[tooltip]="'annotation-actions.undo' | translate"
[type]="buttonType"
icon="red:undo"
></iqser-circle-button>
</ng-template>
<iqser-circle-button
(action)="annotationReferencesService.show(annotations()[0])"

View File

@ -1,6 +1,6 @@
import { AsyncPipe, NgIf } from '@angular/common';
import { Component, computed, input, Input, untracked } from '@angular/core';
import { CircleButtonComponent, getConfig, HelpModeService, IqserPermissionsService } from '@iqser/common-ui';
import { CircleButtonComponent, getConfig, HelpModeService, IqserAllowDirective, IqserPermissionsService } from '@iqser/common-ui';
import { AnnotationPermissions } from '@models/file/annotation.permissions';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { TranslateModule } from '@ngx-translate/core';
@ -26,7 +26,7 @@ export type AnnotationButtonType = keyof typeof AnnotationButtonTypes;
templateUrl: './annotation-actions.component.html',
styleUrls: ['./annotation-actions.component.scss'],
standalone: true,
imports: [CircleButtonComponent, TranslateModule, AsyncPipe, NgIf],
imports: [CircleButtonComponent, TranslateModule, AsyncPipe, NgIf, IqserAllowDirective],
})
export class AnnotationActionsComponent {
readonly #isDocumine = getConfig().IS_DOCUMINE;

View File

@ -158,8 +158,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
});
const file = this.state.file();
console.log(file);
console.log(this._fileDataService.annotations());
if (this._fileDataService.annotations().length) {
firstValueFrom(this._fileDataService.updateAnnotations(file, file.numberOfAnalyses)).then();
} else {

View File

@ -1,4 +1,4 @@
import { inject, Injectable } from '@angular/core';
import { inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { KeycloakStatusService } from '@common-ui/tenants';
import { log } from '@common-ui/utils';
@ -10,8 +10,7 @@ import { NGXLogger } from 'ngx-logger';
import { firstValueFrom, Observable } from 'rxjs';
import { map, tap } from 'rxjs/operators';
@Injectable()
export class StompService extends RxStomp {
export abstract class StompService extends RxStomp {
readonly #logger = inject(NGXLogger);
readonly #config = getConfig();
readonly #keycloakStatusService = inject(KeycloakStatusService);
@ -38,7 +37,7 @@ export class StompService extends RxStomp {
}
send(value: unknown) {
throw 'Not implemented';
throw new Error('Not implemented');
}
override watch(opts: IWatchParams): Observable<IMessage>;
@ -53,8 +52,7 @@ export class StompService extends RxStomp {
listen<T>(topic: string): Observable<T> {
return this.watch(topic).pipe(
log('[WS] Listen to topic ' + topic),
tap(msg => console.log(msg.body)),
tap(msg => this.#logger.info('[WS] Response on topic ' + topic, msg.body)),
map(msg => JSON.parse(msg.body)),
);
}
@ -63,12 +61,13 @@ export class StompService extends RxStomp {
this.configure({
debug: (msg: string) => this.#logger.debug(msg),
brokerURL: this.#config.API_URL + url,
reconnectDelay: 0,
});
this.activate();
}
connectAsync(url: string) {
return firstValueFrom(this.#keycloakStatusService.token$.pipe(map(() => this.connect(url))));
async connectAsync(url: string) {
return await firstValueFrom(this.#keycloakStatusService.token$.pipe(map(() => this.connect(url))));
}
}