Skip to content

Commit

Permalink
fix: display selected AAS as tree
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Apr 19, 2024
1 parent 15a6b99 commit 2486587
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 16 deletions.
139 changes: 137 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"semantic-release": "^23.0.8",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsx": "^4.7.2",
"typescript": "^5.2.2"
}
Expand Down
2 changes: 0 additions & 2 deletions projects/aas-lib/src/lib/busy-indicator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { BehaviorSubject, map } from 'rxjs';
export class BusyIndicatorService {
private readonly busyCount = new BehaviorSubject(0);

public constructor() {}

public readonly isBusy = this.busyCount.pipe(map(value => value > 0));

public readonly isIdle = this.busyCount.pipe(map(value => value === 0));
Expand Down
6 changes: 5 additions & 1 deletion projects/aas-portal/src/app/start/start.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ export interface GetFavoritesAction extends TypedAction<StartActionType.GET_FIRS
documents: AASDocument[];
}

export interface SetTreeViewAction extends TypedAction<StartActionType.SET_TREE_VIEW> {
documents: AASDocument[];
}

export const setListView = createAction(StartActionType.SET_LIST_VIEW);

export const setTreeView = createAction(StartActionType.SET_TREE_VIEW);
export const setTreeView = createAction(StartActionType.SET_TREE_VIEW, props<{ documents: AASDocument[] }>());

export const setViewMode = createAction(StartActionType.SET_VIEW_MODE, props<{ viewMode: ViewMode }>());

Expand Down
2 changes: 1 addition & 1 deletion projects/aas-portal/src/app/start/start.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class StartComponent implements OnDestroy, AfterViewInit {
}
}
} else {
this.store.dispatch(StartActions.setTreeView());
this.store.dispatch(StartActions.setTreeView({ documents: this._selected }));
}
}

Expand Down
15 changes: 5 additions & 10 deletions projects/aas-portal/src/app/start/start.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,13 @@ export class StartEffects {

public setTreeView = createEffect(() => {
return this.actions.pipe(
ofType(StartActions.StartActionType.SET_TREE_VIEW),
exhaustMap(() =>
ofType<StartActions.SetTreeViewAction>(StartActions.StartActionType.SET_TREE_VIEW),
exhaustMap(action =>
concat(
of(StartActions.setViewMode({ viewMode: ViewMode.Tree })),
this.store.select(StartSelectors.selectDocuments).pipe(
first(),
mergeMap(documents =>
from(documents).pipe(
mergeMap(document => this.api.getHierarchy(document.endpoint, document.id)),
mergeMap(nodes => this.addTreeAndLoadContents(nodes)),
),
),
from(action.documents).pipe(
mergeMap(document => this.api.getHierarchy(document.endpoint, document.id)),
mergeMap(nodes => this.addTreeAndLoadContents(nodes)),
),
),
),
Expand Down

0 comments on commit 2486587

Please sign in to comment.