Commit 4bfea954062d98fb798a7e8c9a941bfdbf3df17e
1 parent
d5a304a4
Exists in
loading-indicator-component
branch com implementação incial para o loading indicator component
Showing
3 changed files
with
36 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +namespace noosfero { | ||
2 | + | ||
3 | + const NOOSFERO_DEFAULT_LOADING_MESSAGE_KEY = "noosfero.progress_indicator_message"; | ||
4 | + | ||
5 | + /** | ||
6 | + * Interface to be used on components where we will add the loading progress behavior | ||
7 | + */ | ||
8 | + export interface ComponentWithLoading { | ||
9 | + loadingConfig: ComponentLoadingConfig; | ||
10 | + } | ||
11 | + export interface ComponentLoadingConfig { | ||
12 | + getLoadingMessageKey(): string; | ||
13 | + getCurrentPromise(): ng.IPromise<any>; | ||
14 | + } | ||
15 | + | ||
16 | + export function setupDefaultLoadingConfig(component: ComponentWithLoading, messageKey: string) { | ||
17 | + component.loadingConfig = <ComponentLoadingConfig>{ | ||
18 | + getLoadingMessageKey: () => NOOSFERO_DEFAULT_LOADING_MESSAGE_KEY, | ||
19 | + getCurrentPromise: () => (<any>component)["currentPromise"] | ||
20 | + }; | ||
21 | + } | ||
22 | + | ||
23 | +} | ||
0 | \ No newline at end of file | 24 | \ No newline at end of file |
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | + | ||
2 | + | ||
3 | +class LoadingBaseComponent { | ||
4 | + private promise: ng.IPromise<any>; | ||
5 | + | ||
6 | + setPromise(promise: ng.IPromise<any>) { | ||
7 | + this.promise = promise; | ||
8 | + } | ||
9 | + | ||
10 | + getPromise(): ng.IPromise<any> { | ||
11 | + return this.promise; | ||
12 | + } | ||
13 | +} | ||
0 | \ No newline at end of file | 14 | \ No newline at end of file |