aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/utils
diff options
context:
space:
mode:
authorys9693 <ys9693@att.com>2020-01-19 13:50:02 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-22 12:33:31 +0000
commit16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch)
tree03a2aff3060ddb5bc26a90115805a04becbaffc9 /catalog-ui/src/app/ng2/utils
parentaa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff)
Catalog alignment
Issue-ID: SDC-2724 Signed-off-by: ys9693 <ys9693@att.com> Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'catalog-ui/src/app/ng2/utils')
-rw-r--r--catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts36
-rw-r--r--catalog-ui/src/app/ng2/utils/queue-service-utils.ts58
2 files changed, 70 insertions, 24 deletions
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 fcb21c0c83..aab531d205 100644
--- a/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts
+++ b/catalog-ui/src/app/ng2/utils/ng1-upgraded-provider.ts
@@ -23,13 +23,12 @@
*/
import { DataTypesService } from "../../services/data-types-service";
import ICacheObject = angular.ICacheObject;
-import { SharingService } from "../../services/sharing-service";
import { CookieService } from "../../services/cookie-service";
-import { CacheService } from "../../services/cache-service";
import {ComponentFactory} from "../../utils/component-factory"
import { EventListenerService } from "app/services/event-listener-service";
import { ModalsHandler } from "app/utils";
import IScope = angular.IScope;
+import { SharingService } from "../services/sharing.service";
/** Services we need to upgrade from angular1 to angular2 - in the future we need to rewrite them all to angular2 **/
@@ -61,10 +60,6 @@ export function scopeServiceFactory(cacheObj: ICacheObject) {
return cacheObj.get('$scope');
}
-export function cacheServiceFactory(cacheObj: ICacheObject) {
- return cacheObj.get('Sdc.Services.CacheService');
-}
-
export function eventListenerServiceServiceFactory(cacheObj: ICacheObject) {
return cacheObj.get('EventListenerService');
}
@@ -73,6 +68,10 @@ export function notificationServiceFactory(cacheObj: ICacheObject) {
return cacheObj.get('Notification');
}
+export function ModalsHandlerFactory(cacheObj: ICacheObject) {
+ return cacheObj.get('ModalsHandler');
+}
+
export const ComponentFactoryProvider = {
provide: ComponentFactory,
@@ -80,18 +79,12 @@ export const ComponentFactoryProvider = {
deps: ['$injector']
};
-
-export function ModalsHandlerFactory(cacheObj: ICacheObject) {
- return cacheObj.get('ModalsHandler');
-}
-
export const DataTypesServiceProvider = {
provide: DataTypesService,
useFactory: dataTypesServiceFactory,
deps: ['$injector']
};
-
export const SharingServiceProvider = {
provide: SharingService,
useFactory: sharingServiceFactory,
@@ -122,17 +115,12 @@ export const StateParamsServiceFactory = {
useFactory: stateParamsServiceFactory,
deps: ['$injector']
};
-export const CacheServiceProvider = {
- provide: CacheService,
- useFactory: cacheServiceFactory,
- deps: ['$injector']
-};
-
-export const EventListenerServiceProvider = {
- provide: EventListenerService,
- useFactory: eventListenerServiceServiceFactory,
- deps: ['$injector']
-};
+//
+// export const EventListenerServiceProvider = {
+// provide: EventListenerService,
+// useFactory: eventListenerServiceServiceFactory,
+// deps: ['$injector']
+// };
export const NotificationServiceProvider = {
provide: 'Notification',
@@ -144,4 +132,4 @@ export const ModalsHandlerProvider = {
provide: ModalsHandler,
useFactory: ModalsHandlerFactory,
deps: ['$injector']
-}
+};
diff --git a/catalog-ui/src/app/ng2/utils/queue-service-utils.ts b/catalog-ui/src/app/ng2/utils/queue-service-utils.ts
new file mode 100644
index 0000000000..8cf7f98383
--- /dev/null
+++ b/catalog-ui/src/app/ng2/utils/queue-service-utils.ts
@@ -0,0 +1,58 @@
+/**
+ * Created by ob0695 on 6/3/2018.
+ */
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+import {Injectable} from "@angular/core";
+
+@Injectable()
+export class QueueServiceUtils {
+
+ private executionQueue:any;
+
+ constructor() {
+ if(!this.executionQueue) {
+ this.executionQueue = this.getQueue();
+ }
+ }
+
+ private getQueue = () => new Promise((resolve, reject) => {
+ resolve(true);
+ });
+
+ private addMethodToQueue = (runMe:Function):void => {
+ this.executionQueue = this.executionQueue.then(runMe, runMe);
+ };
+
+ addNonBlockingUIAction = (update:Function, releaseUIcallBack?:Function):void => {
+ // releaseUIcallBack();
+ this.addMethodToQueue(update);
+ };
+
+ // The Method call is responsible for releasing the UI
+ addBlockingUIAction = (blockingServerRequest:Function):void => {
+ this.addMethodToQueue(blockingServerRequest);
+ };
+
+ addBlockingUIActionWithReleaseCallback = (blockingServerRequest:Function, releaseUIcallBack:Function):void=> {
+ this.addMethodToQueue(blockingServerRequest);
+ // this.addMethodToQueue(releaseUIcallBack);
+ };
+}