Skip to content

Commit f54bd64

Browse files
authored
Merge pull request #2018 from noobaa/ohad-frontend-dev
Move "unable to activate" modal to "loading server info screen"
2 parents 7b3d786 + 7a55307 commit f54bd64

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

frontend/src/app/actions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export function signOut(shouldRefresh = true) {
371371
export function loadServerInfo() {
372372
logAction('loadServerInfo');
373373

374+
model.serverInfo(null);
374375
api.account.accounts_status()
375376
.then(
376377
reply => reply.has_accounts ?

frontend/src/app/components/login/create-system-form/create-system-form.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,3 @@ <h1 class="heading1">Welcome to NooBaa</h1>
8585
</div>
8686
</section>
8787

88-
<!-- ko if: isUnableToActivateModalVisible -->
89-
<unable-to-activate-modal></unable-to-activate-modal>
90-
<!-- /ko -->
91-

frontend/src/app/components/login/loading-server-information-from/loading-server-information-from.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
<svg-icon class="loading-icon icon-big spin"
55
params="name: 'in-progress'"></svg-icon>
66
</div>
7+
8+
<!-- ko if: isUnableToActivateModalVisible -->
9+
<unable-to-activate-modal></unable-to-activate-modal>
10+
<!-- /ko -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
import template from './loading-server-information-from.html';
2+
import Disposable from 'disposable';
3+
import ko from 'knockout';
4+
import { serverInfo } from 'model';
5+
6+
class LoadingServerInformationFromViewModel extends Disposable{
7+
constructor() {
8+
super();
9+
10+
this.isUnableToActivateModalVisible = ko.pureComputed(
11+
() => Boolean(
12+
serverInfo() &&
13+
serverInfo().config &&
14+
serverInfo().config.phone_home_connectivity_status !== 'CONNECTED'
15+
)
16+
);
17+
}
18+
}
219

320
export default {
21+
viewModel: LoadingServerInformationFromViewModel,
422
template: template
523
};

frontend/src/app/components/login/login-layout/login-layout.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@ class LoginLayoutViewModel extends Disposable {
1515
return 'unsupported-form';
1616
}
1717

18-
if (serverInfo()) {
19-
return serverInfo().initialized ? 'signin-form' : 'create-system-form';
20-
} else {
18+
if (!serverInfo()) {
2119
return 'loading-server-information-from';
2220
}
21+
22+
let { initialized, config } = serverInfo();
23+
if (initialized) {
24+
return 'signin-form';
25+
}
26+
27+
if (config.phone_home_connectivity_status !== 'CONNECTED') {
28+
return 'loading-server-information-from';
29+
} else {
30+
return 'create-system-form';
31+
}
2332
}
2433
);
2534
}

0 commit comments

Comments
 (0)