From e4a24b4203370eeaa2b9526e55f3afde67c9abff Mon Sep 17 00:00:00 2001 From: nb-ohad Date: Thu, 22 Sep 2016 13:47:48 +0300 Subject: [PATCH] Loader screen to be used when waiting for system_config --- .../loading-server-information-from.html | 6 ++++++ .../loading-server-information-from.js | 5 +++++ .../loading-server-information-from.less | 3 +++ .../src/app/components/login/login-layout/login-layout.js | 4 ++-- frontend/src/app/components/register.js | 1 + frontend/src/app/utils.js | 7 +++++-- 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.html create mode 100644 frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.js create mode 100644 frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.less diff --git a/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.html b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.html new file mode 100644 index 0000000000..0f005bfb09 --- /dev/null +++ b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.html @@ -0,0 +1,6 @@ +
+

Initializing Server...

+ + +
diff --git a/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.js b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.js new file mode 100644 index 0000000000..82f1112ede --- /dev/null +++ b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.js @@ -0,0 +1,5 @@ +import template from './loading-server-information-from.html'; + +export default { + template: template +}; diff --git a/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.less b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.less new file mode 100644 index 0000000000..875ac11381 --- /dev/null +++ b/frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.less @@ -0,0 +1,3 @@ +loading-server-information-from { + display: block; +} diff --git a/frontend/src/app/components/login/login-layout/login-layout.js b/frontend/src/app/components/login/login-layout/login-layout.js index 199b479a1b..31613954f6 100644 --- a/frontend/src/app/components/login/login-layout/login-layout.js +++ b/frontend/src/app/components/login/login-layout/login-layout.js @@ -17,9 +17,9 @@ class LoginLayoutViewModel extends Disposable { if (serverInfo()) { return serverInfo().initialized ? 'signin-form' : 'create-system-form'; + } else { + return 'loading-server-information-from'; } - - return; } ); } diff --git a/frontend/src/app/components/register.js b/frontend/src/app/components/register.js index a73179b8c9..64d8ce5d0d 100644 --- a/frontend/src/app/components/register.js +++ b/frontend/src/app/components/register.js @@ -30,6 +30,7 @@ export default function register(ko) { ko.components.register('create-system-form', require('./login/create-system-form/create-system-form')); ko.components.register('unsupported-form', require('./login/unsupported-form/unsupported-form')); ko.components.register('unable-to-activate-modal', require('./login/unable-to-activate-modal/unable-to-activate-modal')); + ko.components.register('loading-server-information-from', require('./login/loading-server-information-from/loading-server-information-from')); /** INJECT:login **/ // ------------------------------- diff --git a/frontend/src/app/utils.js b/frontend/src/app/utils.js index 6812c66e64..b8625be4f9 100644 --- a/frontend/src/app/utils.js +++ b/frontend/src/app/utils.js @@ -344,9 +344,12 @@ export function deepFreeze(val) { } } -export function waitFor(miliseconds) { +export function waitFor(miliseconds, value) { return new Promise( - resolve => setTimeout(resolve, miliseconds) + resolve => setTimeout( + () => resolve(value), + miliseconds + ) ); }