summaryrefslogtreecommitdiffstats
path: root/catalog-ui
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-03-06 13:52:58 +0200
committerMichael Lando <ml636r@att.com>2018-03-07 06:56:36 +0000
commitf97bae33631c3f5ef06574e9d21620c8dfff8f62 (patch)
tree5d7e2682fd7db6646b5608a417ae7af40a5ebf56 /catalog-ui
parent2064106f298ac9683821e83acbfd87dac8b5b32f (diff)
Add events hub notify calls
Added events hub notify calls. Fixed issues raised by development across the publish subscribe mechanism development Change-Id: I0768bdcb2d89f99634cdb6bc7cb75e20263f5c00 Issue-ID: SDC-1029 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui')
-rw-r--r--catalog-ui/src/app/app.ts2
-rw-r--r--catalog-ui/src/app/models/base-pubsub.ts6
-rw-r--r--catalog-ui/src/app/modules/service-module.ts2
-rw-r--r--catalog-ui/src/app/ng2/app.module.ts3
-rw-r--r--catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts41
-rw-r--r--catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts4
-rw-r--r--catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts14
-rw-r--r--catalog-ui/src/app/services/components/component-service.ts22
-rw-r--r--catalog-ui/src/app/services/components/resource-service.ts13
-rw-r--r--catalog-ui/src/app/services/components/service-service.ts10
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts15
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab-view.html6
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts14
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html5
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view-model.ts50
15 files changed, 160 insertions, 47 deletions
diff --git a/catalog-ui/src/app/app.ts b/catalog-ui/src/app/app.ts
index d67f158ded..e44e4eecb6 100644
--- a/catalog-ui/src/app/app.ts
+++ b/catalog-ui/src/app/app.ts
@@ -153,7 +153,7 @@ angular.module('sdcApp').directive('ng2SearchWithAutocomplete',
inputs: ['searchPlaceholder', 'searchBarClass', 'autoCompleteValues'],
outputs: ['searchChanged', 'searchButtonClicked']
}) as angular.IDirectiveFactory);
-angular.module('sdcApp').directive('pluginFrame', downgradeComponent( {component: PluginFrameComponent, inputs: ['plugin', 'queryParams']} ) as angular.IDirectiveFactory);
+angular.module('sdcApp').directive('pluginFrame', downgradeComponent( {component: PluginFrameComponent, inputs: ['plugin', 'queryParams'], outputs: ['onLoadingDone']} ) as angular.IDirectiveFactory);
ng1appModule.config([
'$stateProvider',
diff --git a/catalog-ui/src/app/models/base-pubsub.ts b/catalog-ui/src/app/models/base-pubsub.ts
index ca500ca173..ca313b15f5 100644
--- a/catalog-ui/src/app/models/base-pubsub.ts
+++ b/catalog-ui/src/app/models/base-pubsub.ts
@@ -37,7 +37,7 @@ export class BasePubSub {
this.eventsCallbacks.splice(index, 1)
}
- public notify(eventType:string, eventData:any) {
+ public notify(eventType:string, eventData?:any) {
let eventObj = {
type: eventType,
data: eventData,
@@ -60,9 +60,9 @@ export class BasePubSub {
export class PluginPubSub extends BasePubSub {
- constructor(pluginId: string, subscriberUrl: string) {
+ constructor(pluginId: string, parentUrl: string) {
super(pluginId);
- this.register('sdc-hub', window.parent, subscriberUrl);
+ this.register('sdc-hub', window.parent, parentUrl);
this.subscribe();
}
diff --git a/catalog-ui/src/app/modules/service-module.ts b/catalog-ui/src/app/modules/service-module.ts
index 87a435df40..387332cae5 100644
--- a/catalog-ui/src/app/modules/service-module.ts
+++ b/catalog-ui/src/app/modules/service-module.ts
@@ -52,6 +52,7 @@ import {ConnectionWizardService} from "../ng2/pages/connection-wizard/connection
import {ComponentInstanceServiceNg2} from "../ng2/services/component-instance-services/component-instance.service";
import {UserService as UserServiceNg2} from "../ng2/services/user.service";
import {PluginsService} from "../ng2/services/plugins.service";
+import {EventBusService} from "../ng2/services/event-bus.service";
let moduleName:string = 'Sdc.Services';
let serviceModule:ng.IModule = angular.module(moduleName, []);
@@ -97,3 +98,4 @@ serviceModule.factory('ConnectionWizardServiceNg2', downgradeInjectable(Connecti
serviceModule.factory('ComponentInstanceServiceNg2', downgradeInjectable(ComponentInstanceServiceNg2));
serviceModule.factory('UserServiceNg2', downgradeInjectable(UserServiceNg2));
serviceModule.factory('PluginsService', downgradeInjectable(PluginsService));
+serviceModule.factory('EventBusService', downgradeInjectable(EventBusService));
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts
index 0346b10915..ffeb1fd89f 100644
--- a/catalog-ui/src/app/ng2/app.module.ts
+++ b/catalog-ui/src/app/ng2/app.module.ts
@@ -28,7 +28,7 @@ import {UpgradeModule} from '@angular/upgrade/static';
import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module';
import {
DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
- StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
+ StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory
} from "./utils/ng1-upgraded-provider";
import {ConfigService} from "./services/config.service";
import {HttpModule} from '@angular/http';
@@ -85,6 +85,7 @@ export function configServiceFactory(config:ConfigService) {
SharingServiceProvider,
CookieServiceProvider,
StateServiceFactory,
+ ScopeServiceFactory,
StateParamsServiceFactory,
CacheServiceProvider,
EventListenerServiceProvider,
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
index 801dfa98fe..eb7d138232 100644
--- a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
+++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
@@ -1,27 +1,32 @@
-import {Component, OnInit, Input} from "@angular/core";
-import { URLSearchParams } from '@angular/http';
+import {Component, Inject, Input, Output, OnInit, EventEmitter, ViewChild, ElementRef} from "@angular/core";
+import {URLSearchParams} from '@angular/http';
import {Plugin} from "app/models";
+import {EventBusService} from "../../../services/event-bus.service";
@Component({
selector: 'plugin-frame',
templateUrl: './plugin-frame.component.html',
- styleUrls:['plugin-frame.component.less']
+ styleUrls: ['plugin-frame.component.less']
})
export class PluginFrameComponent implements OnInit {
@Input() plugin: Plugin;
@Input() queryParams: Object;
+ @Output() onLoadingDone: EventEmitter<void> = new EventEmitter<void>();
pluginUrl: string;
private urlSearchParams: URLSearchParams;
+ private isClosed: boolean;
- constructor() {
+ constructor(private eventBusService: EventBusService,
+ @Inject('$scope') private $scope: ng.IScope,
+ @Inject('$state') private $state: ng.ui.IStateService) {
this.urlSearchParams = new URLSearchParams();
}
ngOnInit(): void {
-
this.pluginUrl = this.plugin.pluginSourceUrl;
+ this.isClosed = false;
if (this.queryParams && !_.isEmpty(this.queryParams)) {
_.forOwn(this.queryParams, (value, key) => {
@@ -31,5 +36,31 @@ export class PluginFrameComponent implements OnInit {
this.pluginUrl += '?';
this.pluginUrl += this.urlSearchParams.toString();
}
+
+ this.eventBusService.on((eventData) => {
+ if (eventData.originId === this.plugin.pluginId) {
+ if (eventData.type == "READY") {
+ this.onLoadingDone.emit();
+ }
+ }
+ });
+
+ // Listening to the stateChangeStart event in order to notify the plugin about it being closed
+ // before moving to a new state
+ this.$scope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => {
+ if (fromState.name !== toState.name) {
+ if (!this.isClosed) {
+ event.preventDefault();
+
+ this.eventBusService.notify("WINDOW_OUT");
+
+ this.isClosed = true;
+
+ setTimeout(() => {
+ this.$state.go(toState.name, toParams);
+ });
+ }
+ }
+ });
}
}
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts
index 81b99cc2d8..9eebd5c47f 100644
--- a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts
+++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts
@@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
import {PluginFrameComponent} from "./plugin-frame.component";
import {LayoutModule} from "../../layout/layout.module";
import {GlobalPipesModule} from "../../../pipes/global-pipes.module";
+import {UiElementsModule} from "../ui-elements.module";
@NgModule({
@@ -12,7 +13,8 @@ import {GlobalPipesModule} from "../../../pipes/global-pipes.module";
imports: [
CommonModule,
LayoutModule,
- GlobalPipesModule
+ GlobalPipesModule,
+ UiElementsModule
],
entryComponents: [PluginFrameComponent],
exports: [
diff --git a/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts b/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts
index c21817c001..51314c04bd 100644
--- a/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts
+++ b/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.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.
@@ -46,6 +46,10 @@ export function stateServiceFactory(cacheObj: ICacheObject) {
return cacheObj.get('$state');
}
+export function scopeServiceFactory(cacheObj: ICacheObject) {
+ return cacheObj.get('$scope');
+}
+
export function stateParamsServiceFactory(cacheObj: ICacheObject) {
return cacheObj.get('$stateParams');
}
@@ -84,6 +88,12 @@ export const StateServiceFactory = {
deps: ['$injector']
};
+export const ScopeServiceFactory= {
+ provide: '$scope',
+ useFactory: scopeServiceFactory,
+ deps: ['$injector']
+};
+
export const StateParamsServiceFactory = {
provide: '$stateParams',
useFactory: stateParamsServiceFactory,
diff --git a/catalog-ui/src/app/services/components/component-service.ts b/catalog-ui/src/app/services/components/component-service.ts
index 90ae850899..1b2b9f2fa1 100644
--- a/catalog-ui/src/app/services/components/component-service.ts
+++ b/catalog-ui/src/app/services/components/component-service.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.
@@ -23,6 +23,7 @@ import {ArtifactModel, IFileDownload, InstancesInputsPropertiesMap, InputModel,
import {ComponentInstanceFactory, CommonUtils} from "app/utils";
import {SharingService} from "../sharing-service";
import {ComponentMetadata} from "../../models/component-metadata";
+import {EventBusService} from "../../ng2/services/event-bus.service";
export interface IComponentService {
@@ -79,14 +80,16 @@ export class ComponentService implements IComponentService {
'sdcConfig',
'Sdc.Services.SharingService',
'$q',
- '$base64'
+ '$base64',
+ 'EventBusService'
];
constructor(protected restangular:restangular.IElement,
protected sdcConfig:IAppConfigurtaion,
protected sharingService:SharingService,
protected $q:ng.IQService,
- protected $base64:any
+ protected $base64:any,
+ protected eventBusService:EventBusService
) {
this.restangular.setBaseUrl(sdcConfig.api.root + sdcConfig.api.component_api_root);
@@ -224,6 +227,17 @@ export class ComponentService implements IComponentService {
}, (err)=> {
deferred.reject(err);
});
+
+ // Notifying about events before executing the actual actions
+ switch (state) {
+ case "checkIn":
+ this.eventBusService.notify("CHECK_IN");
+ break;
+ case "submitForTesting":
+ this.eventBusService.notify("SUBMIT_FOR_TESTING");
+ break;
+ }
+
return deferred.promise;
};
diff --git a/catalog-ui/src/app/services/components/resource-service.ts b/catalog-ui/src/app/services/components/resource-service.ts
index 472775e50d..641d7cba48 100644
--- a/catalog-ui/src/app/services/components/resource-service.ts
+++ b/catalog-ui/src/app/services/components/resource-service.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.
@@ -25,6 +25,7 @@
import {IComponentService, ComponentService} from "./component-service";
import {PropertyModel, IAppConfigurtaion, Resource, Component} from "../../models";
import {SharingService} from "../sharing-service";
+import {EventBusService} from "../../ng2/services/event-bus.service";
export interface IResourceService extends IComponentService {
updateResourceGroupProperties(uniqueId:string, groupId:string, properties:Array<PropertyModel>):ng.IPromise<Array<PropertyModel>>
@@ -37,16 +38,18 @@ export class ResourceService extends ComponentService implements IResourceServic
'sdcConfig',
'Sdc.Services.SharingService',
'$q',
- '$base64'
+ '$base64',
+ 'EventBusService'
];
constructor(protected restangular:restangular.IElement,
protected sdcConfig:IAppConfigurtaion,
protected sharingService:SharingService,
protected $q:ng.IQService,
- protected $base64:any
+ protected $base64:any,
+ protected eventBusService:EventBusService
) {
- super(restangular, sdcConfig, sharingService, $q, $base64);
+ super(restangular, sdcConfig, sharingService, $q, $base64, eventBusService);
this.restangular = restangular.one("resources");
}
diff --git a/catalog-ui/src/app/services/components/service-service.ts b/catalog-ui/src/app/services/components/service-service.ts
index f92f5699dc..4229c4aa2a 100644
--- a/catalog-ui/src/app/services/components/service-service.ts
+++ b/catalog-ui/src/app/services/components/service-service.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.
@@ -25,6 +25,7 @@
import {IComponentService, ComponentService} from "./component-service";
import {Distribution, DistributionComponent, Service, PropertyModel, Component, IAppConfigurtaion} from "app/models";
import {SharingService} from "../sharing-service";
+import {EventBusService} from "../../ng2/services/event-bus.service";
export interface IServiceService extends IComponentService {
getDistributionsList(uuid:string):ng.IPromise<Array<Distribution>>;
@@ -49,8 +50,9 @@ export class ServiceService extends ComponentService implements IServiceService
protected sdcConfig:IAppConfigurtaion,
protected sharingService:SharingService,
protected $q:ng.IQService,
- protected $base64:any) {
- super(restangular, sdcConfig, sharingService, $q, $base64);
+ protected $base64:any,
+ protected eventBusService:EventBusService) {
+ super(restangular, sdcConfig, sharingService, $q, $base64, eventBusService);
this.restangular = restangular.one("services");
}
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
index 5e2a59925c..438cf4a60c 100644
--- a/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
+++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
@@ -8,6 +8,9 @@ interface IPluginsTabViewModelScope extends ng.IScope {
user: IUserProperties;
version: string;
queryParams: Object;
+ isLoading: boolean;
+
+ onLoadingDone(plugin: Plugin): void;
}
export class PluginsTabViewModel {
@@ -27,17 +30,23 @@ export class PluginsTabViewModel {
}
private initScope = ():void => {
+ this.$scope.isLoading = true;
this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path);
-
this.$scope.version = this.cacheService.get('version');
-
this.$scope.user = this.cacheService.get('user');
this.$scope.queryParams = {
userId: this.$scope.user.userId,
userRole: this.$scope.user.role,
displayType: "tab",
- parentUrl: window.location.origin
+ parentUrl: window.location.origin,
+ eventsClientId: this.$scope.plugin.pluginId
+ };
+
+ this.$scope.onLoadingDone = (plugin: Plugin) => {
+ if (plugin.pluginId == this.$scope.plugin.pluginId) {
+ this.$scope.isLoading = false;
+ }
};
}
}
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
index 3695434463..bc404b46d1 100644
--- a/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
+++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
@@ -1,7 +1,5 @@
<div class="sdc-catalog-container">
-
+ <loader display="isLoading"></loader>
<top-nav [version]="version" [hide-search]="true"></top-nav>
-
- <plugin-frame [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
-
+ <plugin-frame (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
</div>
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
index 959aead3ae..550fb84c10 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
@@ -8,6 +8,9 @@ interface IPluginsContextViewModelScope extends IWorkspaceViewModelScope {
plugin: Plugin;
user:IUserProperties;
queryParams: Object;
+ isLoading: boolean;
+
+ onLoadingDone(plugin: Plugin): void;
}
export class PluginsContextViewModel {
@@ -27,8 +30,8 @@ export class PluginsContextViewModel {
}
private initScope = ():void => {
+ this.$scope.isLoading = true;
this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path);
-
this.$scope.user = this.cacheService.get('user');
this.$scope.queryParams = {
@@ -40,7 +43,14 @@ export class PluginsContextViewModel {
lifecycleState: this.$scope.component.lifecycleState,
isOwner: this.$scope.component.lastUpdaterUserId === this.$scope.user.userId,
version: this.$scope.component.version ,
- parentUrl: window.location.origin
+ parentUrl: window.location.origin,
+ eventsClientId: this.$scope.plugin.pluginId
+ };
+
+ this.$scope.onLoadingDone = (plugin: Plugin) => {
+ if (plugin.pluginId == this.$scope.plugin.pluginId) {
+ this.$scope.isLoading = false;
+ }
};
}
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html
index e155370ddd..d70717a3ed 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html
+++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html
@@ -1,5 +1,4 @@
+<loader display="isLoading"></loader>
<div class="workspace-plugins">
-
- <plugin-frame [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
-
+ <plugin-frame (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
</div>
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
index 0f9d7590c7..ca34d6fdc4 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
@@ -35,6 +35,7 @@ import {
LeftPaletteLoaderService
} from "app/services";
import {FileUploadModel} from "../../directives/file-upload/file-upload";
+import {EventBusService} from "../../ng2/services/event-bus.service";
export interface IWorkspaceViewModelScope extends ng.IScope {
@@ -115,7 +116,8 @@ export class WorkspaceViewModel {
'Sdc.Services.EntityService',
'Notification',
'$stateParams',
- 'Sdc.Services.ProgressService'
+ 'Sdc.Services.ProgressService',
+ 'EventBusService'
];
constructor(private $scope:IWorkspaceViewModelScope,
@@ -134,7 +136,8 @@ export class WorkspaceViewModel {
private EntityService:EntityService,
private Notification:any,
private $stateParams:any,
- private progressService:ProgressService) {
+ private progressService:ProgressService,
+ private eventBusService:EventBusService) {
this.initScope();
this.initAfterScope();
@@ -216,6 +219,10 @@ export class WorkspaceViewModel {
}
};
+ this.$scope.$on('$stateChangeSuccess', (event, toState) => {
+ this.$scope.updateSelectedMenuItem(this.$state.current.name);
+ });
+
this.$scope.onMenuItemPressed = (state:string, params:any):ng.IPromise<boolean> => {
let deferred = this.$q.defer();
let goToState = ():void => {
@@ -223,9 +230,7 @@ export class WorkspaceViewModel {
id: this.$scope.component.uniqueId,
type: this.$scope.component.componentType.toLowerCase(),
components: this.components
- }, params)).then(() => {
- this.$scope.updateSelectedMenuItem(state);
- });
+ }, params));
deferred.resolve(true);
};
if (this.isNeedSave()) {
@@ -266,6 +271,14 @@ export class WorkspaceViewModel {
});
}
this.$scope.isLoading = true;
+
+ let eventData = {
+ uuid: this.$scope.component.uuid,
+ version: this.$scope.changeVersion.selectedVersion.versionNumber
+ };
+
+ this.eventBusService.notify("VERSION_CHANGED", eventData);
+
this.$state.go(this.$state.current.name, {
id: selectedId,
type: this.$scope.componentType.toLowerCase(),
@@ -426,6 +439,22 @@ export class WorkspaceViewModel {
let onSuccess = (component:Component, url:string):void => {
//Updating the component from server response
+ // Creating the data object to notify the plugins with
+ let eventData: any = {
+ uuid: this.$scope.component.uuid,
+ version: this.$scope.component.version
+ };
+
+ // Notifying about events after successfully executing the actions
+ switch (state) {
+ case "checkOut":
+ this.eventBusService.notify("CHECK_OUT", eventData);
+ break;
+ case "deleteVersion":
+ this.eventBusService.notify("UNDO_CHECK_OUT", eventData);
+ break;
+ }
+
//the server returns only metaData (small component) except checkout (Full component) ,so we update only the statuses of distribution & lifecycle
this.$scope.component.lifecycleState = component.lifecycleState;
this.$scope.component.distributionStatus = component.distributionStatus;
@@ -472,10 +501,12 @@ export class WorkspaceViewModel {
});
break;
case 'lifecycleState/UNDOCHECKOUT':
- defaultActionAfterChangeLifecycleState();
- this.Notification.success({
- message: this.$filter('translate')("DELETE_SUCCESS_MESSAGE_TEXT"),
- title: this.$filter('translate')("DELETE_SUCCESS_MESSAGE_TITLE")
+ setTimeout(() => {
+ defaultActionAfterChangeLifecycleState();
+ this.Notification.success({
+ message: this.$filter('translate')("DELETE_SUCCESS_MESSAGE_TEXT"),
+ title: this.$filter('translate')("DELETE_SUCCESS_MESSAGE_TITLE")
+ });
});
break;
case 'lifecycleState/certificationRequest':
@@ -550,6 +581,7 @@ export class WorkspaceViewModel {
}
};
//this.$scope.isLoading = true;
+
this.ChangeLifecycleStateHandler.changeLifecycleState(this.$scope.component, data, this.$scope, onSuccess);
};