Skip to content

Commit

Permalink
fix(octra): click on unit number does not play segment in detail window
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpoemp committed Feb 15, 2024
1 parent d15d190 commit 16e68f2
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 52 deletions.
58 changes: 52 additions & 6 deletions apps/octra/src/app/core/modals/octra-modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import { FeedbackNoticeModalComponent } from './feedback-notice-modal/feedback-n

@Injectable()
export class OctraModalService {
public showmodal = new EventEmitter<{
type: string;
data?: any;
emitter: EventEmitter<any>;
onModalAction = new EventEmitter<{
name: string;
type: 'open' | 'close';
result?: any;
}>();
public closemodal = new EventEmitter<{ type: string }>();
private modalaction = new EventEmitter<any>();

constructor(private modalService: NgbModal) {}

Expand All @@ -42,6 +40,17 @@ export class OctraModalService {
...config,
}) as NgbModalWrapper<T>;
this.applyData(ref, data);
this.onModalAction.emit({
type: 'open',
name: modal.name,
});
ref.result.then((result) => {
this.onModalAction.emit({
type: 'close',
name: modal.name,
result,
});
});

return ref;
}
Expand All @@ -66,6 +75,19 @@ export class OctraModalService {
ref.componentInstance.type = type;
ref.componentInstance.forceLogout = forceLogout;
ref.componentInstance.actionAfterSuccess = actionAfterSuccess;

this.onModalAction.emit({
type: 'open',
name: 're-authentication',
});
ref.result.then((result) => {
this.onModalAction.emit({
type: 'close',
name: 're-authentication',
result,
});
});

return ref;
}

Expand All @@ -75,12 +97,36 @@ export class OctraModalService {
ErrorModalComponent.options
);
ref.componentInstance.text = text;

this.onModalAction.emit({
type: 'open',
name: 'error',
});
ref.result.then((result) => {
this.onModalAction.emit({
type: 'close',
name: 'error',
result,
});
});
}

openFeedbackModal() {
const ref = this.openModalRef<FeedbackNoticeModalComponent>(
FeedbackNoticeModalComponent,
FeedbackNoticeModalComponent.options
);

this.onModalAction.emit({
type: 'open',
name: 'feedback',
});
ref.result.then((result) => {
this.onModalAction.emit({
type: 'close',
name: 'feedback',
result,
});
});
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { AppInfo } from '../../../app.info';
import { hasProperty } from '@octra/utilities';
import { APIService } from '../../shared/service';
Expand Down Expand Up @@ -75,23 +75,6 @@ export class OctraModalComponent extends DefaultComponent implements OnInit {
this.appStorage.snapshot.authentication.me?.email !== undefined
? this.appStorage.snapshot.authentication.me?.email
: '';

this.subscribe(this.modService.showmodal, (result: any) => {
this.data = result;

if (result.type !== undefined) {
this.openModal(result.type)
.then((answer) => {
result.emitter.emit(answer);
})
.catch((error) => {
console.error(error);
});
} else {
const emitter: EventEmitter<any> = result.emitter;
emitter.error('modal function not supported');
}
});
}

openModal(name: string, data?: any): Promise<any> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
ChangeDetectorRef,
Component,
ComponentRef,
EventEmitter,
OnDestroy,
OnInit,
ViewChild,
Expand Down Expand Up @@ -406,33 +405,6 @@ export class TranscriptionComponent
}
});

this.subscribe(this.modService.showmodal, {
next: (event: {
type: string;
data?: any;
emitter: EventEmitter<any>;
}) => {
if (
this.currentEditor !== undefined &&
(this.currentEditor.instance as any).editor !== undefined
) {
const editor = this._currentEditor
.instance as OctraEditorRequirements;
editor.disableAllShortcuts();
}
},
});

this.subscribe(this.modService.closemodal, () => {
if (
this.currentEditor !== undefined &&
(this.currentEditor.instance as any).editor !== undefined
) {
const editor = this._currentEditor.instance as OctraEditorRequirements;
editor.enableAllShortcuts();
}
});

this.subscribe(this.audio.missingPermission, () => {
this.modService.openModal(
MissingPermissionsModalComponent,
Expand Down
11 changes: 11 additions & 0 deletions apps/octra/src/app/editors/2D-editor/2D-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
import { AnnotationStoreService } from '../../core/store/login-mode/annotation/annotation.store.service';
import { ShortcutService } from '../../core/shared/service/shortcut.service';
import { HotkeysEvent } from 'hotkeys-js';
import { OctraModalService } from '../../core/modals/octra-modal.service';

@Component({
selector: 'octra-overlay-gui',
Expand Down Expand Up @@ -340,11 +341,15 @@ export class TwoDEditorComponent
private cd: ChangeDetectorRef,
private langService: TranslocoService,
private asrStoreService: AsrStoreService,
private modalService: OctraModalService,
private shortcutService: ShortcutService
) {
super();
this.initialized = new EventEmitter<void>();
this.miniLoupeSettings = new AudioviewerConfig();
this.subscribe(this.modalService.onModalAction, {
next: this.onModalAction,
});
}

ngOnInit() {
Expand Down Expand Up @@ -1083,4 +1088,10 @@ export class TwoDEditorComponent
);
}
}

private onModalAction = (event: any) => {
if (event.type === 'open' && event.name === 'OverviewModalComponent') {
this.window.close();
}
};
}

0 comments on commit 16e68f2

Please sign in to comment.