diff options
author | Idan Amit <ia096e@intl.att.com> | 2018-04-15 19:19:08 +0300 |
---|---|---|
committer | Idan Amit <ia096e@intl.att.com> | 2018-04-15 19:19:08 +0300 |
commit | 6187c942bedebeb2f452ed0856652f90cd5c5772 (patch) | |
tree | 9c3463873e34d9097f2119b9ed35900f6ecab733 /catalog-ui/src/app/utils/change-lifecycle-state-handler.ts | |
parent | 821b76c6b81ebf96e8fd8340ac5f6ed79f8ed22a (diff) |
New observable notify design in pubsub
Implemented the new subscription mechanism for the pub sub notify function
Change-Id: I5e6484adf1a0413d48b54b55048cda1a59b387ee
Issue-ID: SDC-1178
Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/utils/change-lifecycle-state-handler.ts')
-rw-r--r-- | catalog-ui/src/app/utils/change-lifecycle-state-handler.ts | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts b/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts index d32730d630..f1c6544351 100644 --- a/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts +++ b/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,7 @@ import {IEmailModalModel, IEmailModalModel_Email, IEmailModalModel_Data} from ". import {AsdcComment} from "../models/comments"; import {ModalsHandler} from "./modals-handler"; import {ServiceServiceNg2} from "../ng2/services/component-services/service.service"; +import {EventBusService} from "../ng2/services/event-bus.service"; /** * Created by obarda on 2/11/2016. @@ -37,7 +38,8 @@ export class ChangeLifecycleStateHandler { 'ComponentFactory', '$filter', 'ModalsHandler', - 'ServiceServiceNg2' + 'ServiceServiceNg2', + 'EventBusService' ]; constructor(private sdcConfig:IAppConfigurtaion, @@ -45,7 +47,8 @@ export class ChangeLifecycleStateHandler { private ComponentFactory:ComponentFactory, private $filter:ng.IFilterService, private ModalsHandler:ModalsHandler, - private ServiceServiceNg2:ServiceServiceNg2) { + private ServiceServiceNg2:ServiceServiceNg2, + private eventBusService:EventBusService) { } @@ -101,7 +104,12 @@ export class ChangeLifecycleStateHandler { let onOk = (confirmationText):void => { comment.userRemarks = confirmationText; scope.isLoading = true; - component.changeLifecycleState(data.url, comment).then(onSuccess, onError); + + if (data.url === "lifecycleState/CHECKIN") { + this.eventBusService.notify("CHECK_IN").subscribe(() => { + component.changeLifecycleState(data.url, comment).then(onSuccess, onError); + }); + } }; let onCancel = ():void => { @@ -118,10 +126,14 @@ export class ChangeLifecycleStateHandler { // Show email dialog if defined in menu.json //------------------------------------------------- let onOk = (resource):void => { - if (resource) { - onSuccess(resource); - } else { - onError("Error changing life cycle state"); + if (data.url === "lifecycleState/certificationRequest") { + this.eventBusService.notify("SUBMIT_FOR_TESTING").subscribe(() => { + if (resource) { + onSuccess(resource); + } else { + onError("Error changing life cycle state"); + } + }); } }; |