Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Duplicate Rack Functionality (βœ“ Sandbox Passed) #104

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/app/components/rack-parts/rack-detail-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ElementRef, Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import _ from 'lodash';
import { cloneDeep } from 'lodash';
import { BehaviorSubject, combineLatest, of, ReplaySubject, Subject } from 'rxjs';
import { filter, map, switchMap, takeUntil, tap, withLatestFrom } from 'rxjs/operators';
import { UserManagementService } from '../../features/backbone/login/user-management.service';
Expand Down Expand Up @@ -47,6 +47,14 @@ export class RackDetailDataService extends SubManager {
) {
super();

// when user toggles locked status of rack, update backend
this.manageSub(
this.requestRackEditableStatusChange$
.pipe(
requestRackDuplication$ = new Subject<RackMinimal>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declaration is can't be done here

}
super();

// when user toggles locked status of rack, update backend
this.manageSub(
this.requestRackEditableStatusChange$
Expand Down Expand Up @@ -84,6 +92,14 @@ export class RackDetailDataService extends SubManager {
this.singleRackData$.pipe(
tap(x => this.rowedRackedModules$.next(null)),
filter(x => !!x),
this.manageSub(
this.requestRackDuplication$
.pipe(switchMap(rack => this.duplicateRack(rack)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.duplicateRack(rack) function is not declrared anywhere

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

.subscribe(newRack => {
this.snackBar.open('Rack duplicated', undefined, {duration: 4000});
this.updateSingleRackData$.next(newRack.id);
})
);
switchMap(x => x ? this.backend.get.rackedModules(x.id) : of([])),
withLatestFrom(this.singleRackData$)
)
Expand Down
Loading