From 4bfea954062d98fb798a7e8c9a941bfdbf3df17e Mon Sep 17 00:00:00 2001 From: ABNER SILVA DE OLIVEIRA Date: Wed, 25 May 2016 16:34:58 -0300 Subject: [PATCH] branch com implementação incial para o loading indicator component --- src/app/layout/components/component-with-loading.ts | 23 +++++++++++++++++++++++ src/app/layout/components/loading-base.component.ts | 13 +++++++++++++ src/app/layout/components/loading.component.ts | 0 3 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 src/app/layout/components/component-with-loading.ts create mode 100644 src/app/layout/components/loading-base.component.ts create mode 100644 src/app/layout/components/loading.component.ts diff --git a/src/app/layout/components/component-with-loading.ts b/src/app/layout/components/component-with-loading.ts new file mode 100644 index 0000000..54628b2 --- /dev/null +++ b/src/app/layout/components/component-with-loading.ts @@ -0,0 +1,23 @@ +namespace noosfero { + + const NOOSFERO_DEFAULT_LOADING_MESSAGE_KEY = "noosfero.progress_indicator_message"; + + /** + * Interface to be used on components where we will add the loading progress behavior + */ + export interface ComponentWithLoading { + loadingConfig: ComponentLoadingConfig; + } + export interface ComponentLoadingConfig { + getLoadingMessageKey(): string; + getCurrentPromise(): ng.IPromise; + } + + export function setupDefaultLoadingConfig(component: ComponentWithLoading, messageKey: string) { + component.loadingConfig = { + getLoadingMessageKey: () => NOOSFERO_DEFAULT_LOADING_MESSAGE_KEY, + getCurrentPromise: () => (component)["currentPromise"] + }; + } + +} \ No newline at end of file diff --git a/src/app/layout/components/loading-base.component.ts b/src/app/layout/components/loading-base.component.ts new file mode 100644 index 0000000..db5568d --- /dev/null +++ b/src/app/layout/components/loading-base.component.ts @@ -0,0 +1,13 @@ + + +class LoadingBaseComponent { + private promise: ng.IPromise; + + setPromise(promise: ng.IPromise) { + this.promise = promise; + } + + getPromise(): ng.IPromise { + return this.promise; + } +} \ No newline at end of file diff --git a/src/app/layout/components/loading.component.ts b/src/app/layout/components/loading.component.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/app/layout/components/loading.component.ts -- libgit2 0.21.2