diff --git a/frontend/src/app/actions.js b/frontend/src/app/actions.js index 677289bffc..19df41445c 100644 --- a/frontend/src/app/actions.js +++ b/frontend/src/app/actions.js @@ -371,6 +371,7 @@ export function signOut(shouldRefresh = true) { export function loadServerInfo() { logAction('loadServerInfo'); + model.serverInfo(null); api.account.accounts_status() .then( reply => reply.has_accounts ? diff --git a/frontend/src/app/components/login/create-system-form/create-system-form.html b/frontend/src/app/components/login/create-system-form/create-system-form.html index 523dfe176d..6ad2d014c4 100644 --- a/frontend/src/app/components/login/create-system-form/create-system-form.html +++ b/frontend/src/app/components/login/create-system-form/create-system-form.html @@ -85,7 +85,3 @@

Welcome to NooBaa

- - - - 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 index 0f005bfb09..22ce71ee24 100644 --- 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 @@ -4,3 +4,7 @@ + + + + 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 index 82f1112ede..5a0115c8f2 100644 --- 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 @@ -1,5 +1,23 @@ import template from './loading-server-information-from.html'; +import Disposable from 'disposable'; +import ko from 'knockout'; +import { serverInfo } from 'model'; + +class LoadingServerInformationFromViewModel extends Disposable{ + constructor() { + super(); + + this.isUnableToActivateModalVisible = ko.pureComputed( + () => Boolean( + serverInfo() && + serverInfo().config && + serverInfo().config.phone_home_connectivity_status !== 'CONNECTED' + ) + ); + } +} export default { + viewModel: LoadingServerInformationFromViewModel, template: template }; 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 31613954f6..8ccb851836 100644 --- a/frontend/src/app/components/login/login-layout/login-layout.js +++ b/frontend/src/app/components/login/login-layout/login-layout.js @@ -15,11 +15,20 @@ class LoginLayoutViewModel extends Disposable { return 'unsupported-form'; } - if (serverInfo()) { - return serverInfo().initialized ? 'signin-form' : 'create-system-form'; - } else { + if (!serverInfo()) { return 'loading-server-information-from'; } + + let { initialized, config } = serverInfo(); + if (initialized) { + return 'signin-form'; + } + + if (config.phone_home_connectivity_status !== 'CONNECTED') { + return 'loading-server-information-from'; + } else { + return 'create-system-form'; + } } ); }