Skip to content

Commit

Permalink
fix(octra): shibboleth not working since refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpoemp committed Oct 23, 2023
1 parent 8881769 commit 73c3f28
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
<span>{{ 'g.name' | transloco }}:</span>
</td>
<td>
<span>{{ audio.audioManager!.resource.info?.fullname }}</span>
<span>{{ audio.audioManager!.resource.info.fullname }}</span>
</td>
</tr>
<tr>
Expand All @@ -346,7 +346,7 @@
</td>
<td>
<span>{{
audio.audioManager!.resource!.info?.sampleRate
audio.audioManager!.resource!.info.sampleRate
}}</span>
</td>
</tr>
Expand All @@ -357,7 +357,7 @@
<td>
<span
>{{
audio.audioManager!.resource!.info?.bitrate
audio.audioManager!.resource!.info.bitrate
}}
Bit/s</span
>
Expand Down
4 changes: 2 additions & 2 deletions apps/octra/src/app/core/store/idb/idb-effects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export class IDBEffects {
if (state.application.mode === LoginMode.ONLINE) {
this.store.dispatch(
LoginModeActions.loadProjectAndTaskInformation.do({
projectID: action.onlineOptions.project!.id,
taskID: action.onlineOptions.transcriptID!,
projectID: action.onlineOptions.project?.id,
taskID: action.onlineOptions.transcriptID ?? undefined,
mode: LoginMode.ONLINE,
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
} from '@octra/annotation';
import { AppStorageService } from '../../../shared/service/appstorage.service';
import {
CurrentAccountDto,
ProjectDto,
TaskDto,
TaskInputOutputCreatorType,
Expand Down Expand Up @@ -131,7 +130,6 @@ export class AnnotationEffects {
)
)
);
} else if (state.application.mode) {
}

return of(
Expand Down Expand Up @@ -577,27 +575,58 @@ export class AnnotationEffects {
withLatestFrom(this.store),
exhaustMap(([a, state]) => {
if (a.mode === LoginMode.ONLINE) {
return forkJoin<
[CurrentAccountDto, ProjectDto | undefined, TaskDto | undefined]
>(
this.apiService.getMyAccountInformation(),
this.apiService
.getProject(a.projectID)
.pipe(catchError((a) => of(undefined))),
this.apiService
.getTask(a.projectID, a.taskID)
.pipe(catchError((a) => of(undefined)))
).pipe(
map(([currentAccount, currentProject, task]) => {
return LoginModeActions.loadProjectAndTaskInformation.success({
mode: LoginMode.ONLINE,
me: currentAccount,
currentProject: currentProject ?? undefined,
task: task ?? undefined,
});
return this.apiService.getMyAccountInformation().pipe(
exhaustMap((currentAccount) => {
if (!a.taskID || !a.projectID) {
return of(
LoginModeActions.loadProjectAndTaskInformation.success({
mode: LoginMode.ONLINE,
me: currentAccount,
})
);
}

return forkJoin<[ProjectDto | undefined, TaskDto | undefined]>(
this.apiService
.getProject(a.projectID)
.pipe(catchError((b) => of(undefined))),
this.apiService
.getTask(a.projectID, a.taskID)
.pipe(catchError((b) => of(undefined)))
).pipe(
map(([currentProject, task]) => {
return LoginModeActions.loadProjectAndTaskInformation.success(
{
mode: LoginMode.ONLINE,
me: currentAccount,
currentProject: currentProject ?? undefined,
task: task ?? undefined,
}
);
}),
catchError((error: HttpErrorResponse) => {
return checkAndThrowError(
{
statusCode: error.status,
message: error.error?.message ?? error.message,
},
a,
LoginModeActions.loadProjectAndTaskInformation.fail({
error,
}),
this.store,
() => {
this.alertService.showAlert(
'danger',
error.error?.message ?? error.message
);
}
);
})
);
}),
catchError((error: HttpErrorResponse) => {
return checkAndThrowError(
catchError((error) =>
checkAndThrowError(
{
statusCode: error.status,
message: error.error?.message ?? error.message,
Expand All @@ -613,8 +642,8 @@ export class AnnotationEffects {
error.error?.message ?? error.message
);
}
);
})
)
)
);
} else if (
[LoginMode.DEMO, LoginMode.LOCAL, LoginMode.URL].includes(a.mode)
Expand Down Expand Up @@ -657,7 +686,7 @@ export class AnnotationEffects {
}),
]).pipe(
exhaustMap(([projectConfig, guidelines, functions]) => {
const currentProject = createSampleProjectDto(a.projectID);
const currentProject = createSampleProjectDto('1234');

let inputs: TaskInputOutputDto[] = [];

Expand Down Expand Up @@ -716,7 +745,7 @@ export class AnnotationEffects {
}

const task = createSampleTask(
a.taskID,
a.taskID ?? '-1',
inputs,
[],
projectConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class LoginModeActions extends AnnotationActions {
source: `annotation/ load project and task information`,
events: {
do: props<{
projectID: string;
taskID: string;
projectID?: string;
taskID?: string;
mode: LoginMode;
}>(),
success: props<{
Expand Down

0 comments on commit 73c3f28

Please sign in to comment.