-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
16,955 additions
and
27,605 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
projects/aas-lib/src/lib/aas-provider/aas-provider.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AASProviderService { | ||
|
||
constructor() { } | ||
} |
31 changes: 31 additions & 0 deletions
31
projects/aas-lib/src/lib/aas-table/aas-table-api.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { AASCursor, AASDocumentPage, aas } from 'common'; | ||
import { encodeBase64Url } from '../convert'; | ||
|
||
@Injectable() | ||
export class AASTableApiService { | ||
constructor(private readonly http: HttpClient) { | ||
} | ||
|
||
/** | ||
* Returns a page of documents from the specified cursor. | ||
* @param cursor The current cursor. | ||
* @returns The document page. | ||
*/ | ||
public getDocuments(cursor: AASCursor): Observable<AASDocumentPage> { | ||
return this.http.get<AASDocumentPage>(`/api/v1/documents&cursor=${encodeBase64Url(JSON.stringify(cursor))}`); | ||
} | ||
|
||
/** | ||
* Loads the element structure of the specified document. | ||
* @param url The URL of the container. | ||
* @param id The identification of the AAS document. | ||
* @returns The root of the element structure. | ||
*/ | ||
public getContent(url: string, id: string): Observable<aas.Environment> { | ||
return this.http.get<aas.Environment>( | ||
`/api/v1/containers/${encodeBase64Url(url)}/documents/${encodeBase64Url(id)}/content`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019-2023 Fraunhofer IOSB-INA Lemgo, | ||
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft | ||
* zur Foerderung der angewandten Forschung e.V. | ||
* | ||
*****************************************************************************/ | ||
|
||
import { Injectable } from '@angular/core'; | ||
import { Actions, createEffect, ofType } from '@ngrx/effects'; | ||
import { Store } from '@ngrx/store'; | ||
import { AASCursor, AASWorkspace } from 'common'; | ||
import { catchError, EMPTY, exhaustMap, from, map, merge, mergeMap, Observable, of, skipWhile, zip } from 'rxjs'; | ||
|
||
import * as AASTableActions from './aas-table.actions'; | ||
import * as AASTableSelectors from './aas-table.selectors'; | ||
import { AASTableApiService } from './aas-table-api.service'; | ||
import { AASTableFeatureState } from './aas-table.state'; | ||
|
||
@Injectable() | ||
export class AASTableEffects { | ||
private readonly store: Store<AASTableFeatureState>; | ||
|
||
constructor( | ||
private readonly actions: Actions, | ||
store: Store, | ||
private readonly api: AASTableApiService | ||
) { | ||
this.store = store as Store<AASTableFeatureState>; | ||
} | ||
|
||
public initialize = createEffect(() => { | ||
return this.actions.pipe( | ||
ofType(AASTableActions.AASTableActionType.INITIALIZE), | ||
exhaustMap(() => this.store.select(AASTableSelectors.selectState)), | ||
mergeMap(state => { | ||
if (state.initialized) { | ||
return EMPTY; | ||
} | ||
|
||
return this.api.getDocuments({ previous: null, limit: state.cursor.limit }); | ||
}), | ||
mergeMap(page => from(page.documents)), | ||
skipWhile(document => document.content != null), | ||
mergeMap(document => zip(of(document), this.api.getContent(document.container, document.id))), | ||
map(tuple => AASTableActions.setDocumentContent({ document: tuple[0], content: tuple[1] }))); | ||
}); | ||
} |
Oops, something went wrong.