Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
#326 update to master
Browse files Browse the repository at this point in the history
  • Loading branch information
wowshakhov committed Sep 1, 2017
2 parents 2e58cdf + 6a17119 commit c822eab
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/app/security-group/services/security-group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const GROUP_POSTFIX = '-cs-sg';
export class SecurityGroupService extends BaseBackendCachedService<SecurityGroup> {
public onSecurityGroupCreated = new Subject<SecurityGroup>();
public onSecurityGroupDeleted = new Subject<SecurityGroup>();
public onSecurityGroupUpdate = new Subject<SecurityGroup>();

constructor(
private configService: ConfigService,
Expand Down
5 changes: 4 additions & 1 deletion src/app/security-group/sg-actions/sg-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export class SecurityGroupEditAction extends SecurityGroupAction {
width: '880px',
data: { securityGroup }
})
.afterClosed();
.afterClosed()
.map(updatedGroup => {
return this.securityGroupService.onSecurityGroupUpdate.next(updatedGroup);
});
}

public hidden(securityGroup: SecurityGroup): boolean {
Expand Down
5 changes: 4 additions & 1 deletion src/app/security-group/sg-actions/sg-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export class SecurityGroupViewAction extends SecurityGroupAction {
width: '880px',
data: { securityGroup }
})
.afterClosed();
.afterClosed()
.map(updatedGroup => {
return this.securityGroupService.onSecurityGroupUpdate.next(updatedGroup);
});
}

public hidden(securityGroup: SecurityGroup): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/app/security-group/sg-rules/sg-rules.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ <h3 class="mat-dialog-title">
mdl-button
mdl-ripple
mdl-colored="primary"
(click)="dialogRef.close()"
(click)="onClose()"
>{{ 'COMMON.CLOSE' | translate }}</button>
</div>
4 changes: 4 additions & 0 deletions src/app/security-group/sg-rules/sg-rules.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export class SgRulesComponent {
});
}

public onClose(): void {
this.dialogRef.close(this.securityGroup);
}

private resetForm(): void {
// reset controls' state. instead of just setting ngModel bound variables to empty string
// we reset controls to reset the validity state of inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class SgTemplateCreationDialogComponent implements OnInit {
interpolateParams: { name: securityGroup.name }
});
this.showRulesDialog(securityGroup);

}

private onCancel(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ListService } from '../../shared/components/list/list.service';
import { LocalStorageService } from '../../shared/services/local-storage.service';
import { SecurityGroupService } from '../services/security-group.service';
import { SecurityGroupViewMode } from '../sg-filter/sg-filter.component';
import { SecurityGroup, SecurityGroupType } from '../sg.model';
import { LocalStorageService } from '../../shared/services/local-storage.service';


@Component({
Expand All @@ -27,7 +27,17 @@ export class SgTemplateListComponent implements OnInit {
private router: Router,
private activatedRoute: ActivatedRoute,
private storageService: LocalStorageService
) {}
) {
this.securityGroupService.onSecurityGroupUpdate.subscribe(updatedGroup => {
this.customSecurityGroupList = this.customSecurityGroupList.map(group => {
if (group.id === updatedGroup.id) {
return updatedGroup;
} else {
return group;
}
});
});
}

public ngOnInit(): void {
this.viewMode =
Expand Down

0 comments on commit c822eab

Please sign in to comment.