-
Notifications
You must be signed in to change notification settings - Fork 9
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
7 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
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
15 changes: 8 additions & 7 deletions
15
...ons/components/dialogs/dialog-delete-application/dialog-delete-application.component.html
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
|
||
<div class="dialog__content dialog__content--question dialog__content--center"> | ||
<span>Remove the application?</span> | ||
<div class="dialog__content dialog__content--center"> | ||
<span class=" dialog__content--question ">Remove the application?</span> | ||
<p class="dialog__text dialog__text--is-alert">{{ name }}</p> | ||
<div class="buttons-group"> | ||
<button class="button button--flat button--large dialog__button" (click)="dialog.closeDialog()" type="button">cancel</button> | ||
<button class="button button--primary button--primary-remove button--large dialog__button" (click)="onDelete()">Remove</button> | ||
</div> | ||
</div> | ||
<div class="buttons-group"> | ||
<button class="button button--flat button--large dialog__button" (click)="dialog.closeDialog()" type="button">cancel</button> | ||
<button class="button button--primary button--primary-remove button--large dialog__button" (click)="onDelete()">Remove</button> | ||
</div> | ||
|
22 changes: 17 additions & 5 deletions
22
...tions/components/dialogs/dialog-delete-application/dialog-delete-application.component.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
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
13 changes: 7 additions & 6 deletions
13
src/modules/models/components/dialogs/dialog-delete-model/dialog-delete-model.component.html
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<div class="dialog__content dialog__content--question"> | ||
<span class="">Remove the model?</span> | ||
<div class="dialog__content"> | ||
<span class="dialog__content--question">Remove the model?</span> | ||
<p class="dialog__text dialog__text--is-alert">{{ name }}</p> | ||
<div class="dialog__buttons"> | ||
<button class="button button--flat button--large dialog__button" (click)="onClose()" type="button">cancel</button> | ||
<button class="button button--primary button--primary-remove button--large dialog__button" (click)="onDelete()">Remove</button> | ||
</div> | ||
</div> | ||
<div class="dialog__buttons"> | ||
<button class="button button--flat button--large dialog__button" (click)="onClose()" type="button">cancel</button> | ||
<button class="button button--primary button--primary-remove button--large dialog__button" (click)="onDelete()">Remove</button> | ||
</div> |
23 changes: 17 additions & 6 deletions
23
src/modules/models/components/dialogs/dialog-delete-model/dialog-delete-model.component.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 |
---|---|---|
@@ -1,32 +1,43 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, InjectionToken, Inject } from '@angular/core'; | ||
|
||
import { HydroServingState } from '@core/reducers'; | ||
import { DeleteModelAction } from '@models/actions'; | ||
import * as fromModel from '@models/reducers'; | ||
import { Store } from '@ngrx/store'; | ||
|
||
import { DialogService } from '@dialog/dialog.service'; | ||
import { IModel } from '@shared/_index'; | ||
import { Observable } from 'rxjs'; | ||
import { take, tap } from 'rxjs/operators'; | ||
|
||
export const SELECTED_MODEL$ = new InjectionToken<Observable<IModel>>('selected model'); | ||
@Component({ | ||
selector: 'hydro-dialog-delete-model', | ||
templateUrl: './dialog-delete-model.component.html', | ||
}) | ||
export class DialogDeleteModelComponent { | ||
private modelId: number; | ||
private model: IModel; | ||
get name(): string { | ||
return this.model.name; | ||
} | ||
|
||
constructor( | ||
public dialog: DialogService, | ||
private store: Store<HydroServingState> | ||
private store: Store<HydroServingState>, | ||
@Inject(SELECTED_MODEL$) private model$: Observable<IModel> | ||
) { | ||
this.store.select(fromModel.getSelectedModelId) | ||
.subscribe(id => this.modelId = id); | ||
this.model$.pipe( | ||
take(1), | ||
tap( model => this.model = model) | ||
).subscribe(); | ||
} | ||
|
||
public onClose(): void { | ||
this.dialog.closeDialog(); | ||
} | ||
|
||
public onDelete(): void { | ||
this.store.dispatch(new DeleteModelAction(this.modelId)); | ||
this.store.dispatch(new DeleteModelAction(this.model.id)); | ||
this.onClose(); | ||
} | ||
} |
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