Skip to content

Commit

Permalink
Merge pull request #2018 from noobaa/ohad-frontend-dev
Browse files Browse the repository at this point in the history
Move "unable to activate" modal to "loading server info screen"
  • Loading branch information
nb-ohad authored Sep 22, 2016
2 parents 7b3d786 + 7a55307 commit f54bd64
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions frontend/src/app/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,3 @@ <h1 class="heading1">Welcome to NooBaa</h1>
</div>
</section>

<!-- ko if: isUnableToActivateModalVisible -->
<unable-to-activate-modal></unable-to-activate-modal>
<!-- /ko -->

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
<svg-icon class="loading-icon icon-big spin"
params="name: 'in-progress'"></svg-icon>
</div>

<!-- ko if: isUnableToActivateModalVisible -->
<unable-to-activate-modal></unable-to-activate-modal>
<!-- /ko -->
Original file line number Diff line number Diff line change
@@ -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
};
15 changes: 12 additions & 3 deletions frontend/src/app/components/login/login-layout/login-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
);
}
Expand Down

0 comments on commit f54bd64

Please sign in to comment.