| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626 |
1
1
1
1
3
3
3
2
3
13
4
2
31
27
27
27
27
27
2
1
1
25
1
24
2
22
7
15
11
4
2
27
21
27
7
3
3
3
3
15
15
15
11
11
5
6
4
4
2
2
11
11
11
11
11
9
3
3
3
3
3
2
2
2
2
2
4
4
4
1
4
4
4
4
1
1
1
1
3
3
4
2
9
2
2
4
4
4
4
1
3
4
4
4
4
7
1
1
1
1
1
1
1
1
5
5
2
3
2
5
5
5
5
14
14
5
4
4
4
4
12
4
2
4
12
2
2
2
2
2
2
2
1
1
1
1
1
4
1
1
1
1
| 'use strict';
;require.register("views/main/admin/stack_upgrade/upgrade_version_box_view", function (exports, require, module) {
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var App = require('app');
var stringUtils = require('utils/string_utils');
App.UpgradeVersionBoxView = Em.View.extend({
templateName: require('templates/main/admin/stack_upgrade/upgrade_version_box'),
classNames: ['version-box'],
classNameBindings: ['versionClass'],
/**
* @type {string}
* @constant
*/
PROGRESS_STATUS: 'IN_PROGRESS',
/**
* @type {boolean}
*/
upgradeCheckInProgress: false,
/**
* progress of version installation
* @type {number}
*/
installProgress: function () {
Iif (App.get('testMode')) return 100;
var installRequest,
requestIds = this.get('controller').getRepoVersionInstallId();
if (requestIds) {
installRequest = App.router.get('backgroundOperationsController.services').findProperty('id', requestIds[0]);
}
return installRequest ? installRequest.get('progress') : 0;
}.property('App.router.backgroundOperationsController.serviceTimestamp'),
/**
* version is upgrading or downgrading
* @type {boolean}
*/
isUpgrading: function () {
return (this.get('controller.upgradeVersion') === this.get('content.displayName') || this.get('controller.fromVersion') === this.get('content.repositoryVersion')) && App.get('upgradeState') !== 'NOT_REQUIRED';
}.property('App.upgradeState', 'content.displayName', 'controller.upgradeVersion'),
isRepoUrlsEditDisabled: function () {
return ['INSTALLING', 'UPGRADING'].contains(this.get('content.status')) || this.get('isUpgrading') || !App.isAuthorized('AMBARI.MANAGE_STACK_VERSIONS');
}.property('content.status', 'isUpgrading'),
/**
* @type {string}
*/
versionClass: function () {
return this.get('content.status') === 'CURRENT' ? 'current-version-box' : '';
}.property('content.status'),
/**
* @type {boolean}
*/
isOutOfSync: Em.computed.equal('content.status', 'OUT_OF_SYNC'),
/**
* map containing version (id, label)
* this is used as param for <code>showHosts<code> method
* @type {Object}
*/
versionStateMap: {
'current': {
'type': 'CURRENT',
'value': ['CURRENT'],
'property': 'currentHosts',
'label': Em.I18n.t('admin.stackVersions.hosts.popup.header.current')
},
'installed': {
'type': 'INSTALLED',
'value': ['INSTALLED'],
'property': 'installedHosts',
'label': Em.I18n.t('admin.stackVersions.hosts.popup.header.installed')
},
'not_installed': {
'type': 'NOT_INSTALLED',
'value': ['INSTALLING', 'INSTALL_FAILED', 'OUT_OF_SYNC'],
'property': 'notInstalledHosts',
'label': Em.I18n.t('admin.stackVersions.hosts.popup.header.not_installed')
}
},
/**
* @type {object}
* @default null
*/
content: null,
currentLabelClass: 'label label-success',
/**
* map of properties which correspond to particular state of Upgrade version
* @type {object}
*/
statePropertiesMap: function () {
return {
'CURRENT': {
isLabel: true,
text: Em.I18n.t('common.current'),
class: this.get('currentLabelClass')
},
'NOT_REQUIRED': {
isButton: true,
text: Em.I18n.t('admin.stackVersions.version.installNow'),
action: 'installRepoVersionPopup'
},
'LOADING': {
isSpinner: true,
class: 'spinner'
},
'INSTALLING': {
iconClass: 'glyphicon glyphicon-cog',
isLink: true,
text: Em.I18n.t('hosts.host.stackVersions.status.installing'),
action: 'showProgressPopup'
},
'INSTALLED': {
iconClass: 'glyphicon glyphicon-ok',
isButtonGroup: true,
text: Em.I18n.t('common.installed'),
action: null
},
'SUSPENDED': {
isButton: true,
text: Em.I18n.t('admin.stackUpgrade.dialog.resume'),
action: 'resumeUpgrade'
},
'CURRENT_PATCH': {
isLabel: true,
text: Em.I18n.t('common.current'),
class: this.get('currentLabelClass')
},
'CURRENT_PATCH_REVERTABLE': {
isButtonGroup: true,
text: Em.I18n.t('common.current'),
action: null,
buttons: [{
text: Em.I18n.t('common.revert'),
action: 'confirmRevertPatchUpgrade'
}]
}
};
}.property(),
/**
* object that describes how content should be displayed
* @type {Em.Object}
* TODO remove <code>isUpgrading</code> condition when transition of version states in API fixed
*/
stateElement: function () {
var statePropertiesMap = this.get('statePropertiesMap');
var status = this.get('content.status');
var element = Em.Object.create({
status: status,
isInstalling: Em.computed.equal('status', 'INSTALLING'),
buttons: [],
isDisabled: false
});
var isSuspended = App.get('upgradeSuspended');
if (status === 'CURRENT' && this.get('content.isPatch') && !this.get('isUpgrading')) {
if (this.get('content.stackVersion.supportsRevert')) {
element.setProperties(statePropertiesMap['CURRENT_PATCH_REVERTABLE']);
} else {
element.setProperties(statePropertiesMap['CURRENT_PATCH']);
}
} else if (['INSTALLING', 'CURRENT'].contains(status)) {
element.setProperties(statePropertiesMap[status]);
} else if (status === 'NOT_REQUIRED') {
this.processNotRequiredState(element);
} else if (status === 'INSTALLED' && !this.get('isUpgrading') || ['INSTALL_FAILED', 'OUT_OF_SYNC'].contains(status)) {
this.processPreUpgradeState(element);
} else if (this.get('isUpgrading') && !isSuspended) {
this.processUpgradingState(element);
} else if (isSuspended) {
this.processSuspendedState(element);
}
//For restricted upgrade wizard should be disabled in any state
if (this.get('controller.isWizardRestricted') || !App.isAuthorized('CLUSTER.UPGRADE_DOWNGRADE_STACK')) {
element.set('isDisabled', true);
}
return element;
}.property('content.status', 'controller.isDowngrade', 'isUpgrading', 'controller.requestInProgress', 'controller.requestInProgressRepoId', 'parentView.repoVersions.@each.status', 'isCurrentStackPresent'),
/**
* check if actions of NOT_REQUIRED stack version disabled
* @returns {boolean}
*/
isDisabledOnInit: function isDisabledOnInit() {
return this.get('controller.requestInProgress') || !this.get('isCurrentStackPresent') || !this.get('content.isCompatible') || App.get('upgradeIsRunning') && !App.get('upgradeSuspended') || this.get('parentView.repoVersions').someProperty('status', 'INSTALLING');
},
/**
* @param {Em.Object} element
*/
processSuspendedState: function processSuspendedState(element) {
element.setProperties(this.get('statePropertiesMap')['SUSPENDED']);
var text = this.get('controller.isDowngrade') ? Em.I18n.t('admin.stackUpgrade.dialog.resume.downgrade') : Em.I18n.t('admin.stackUpgrade.dialog.resume');
element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.resume') : text);
element.set('isDisabled', this.get('controller.requestInProgress'));
},
/**
* @param {Em.Object} element
*/
processUpgradingState: function processUpgradingState(element) {
element.set('isLink', true);
element.set('action', 'openUpgradeDialog');
if (['HOLDING', 'HOLDING_FAILED', 'HOLDING_TIMEDOUT', 'ABORTED'].contains(App.get('upgradeState'))) {
element.set('iconClass', 'glyphicon glyphicon-pause');
if (this.get('controller.isDowngrade')) {
element.set('text', Em.I18n.t('admin.stackVersions.version.downgrade.pause'));
} else {
element.set('text', Em.I18n.t('admin.stackVersions.version.upgrade.pause'));
}
} else {
element.set('iconClass', 'glyphicon glyphicon-cog');
if (this.get('controller.isDowngrade')) {
element.set('text', Em.I18n.t('admin.stackVersions.version.downgrade.running'));
} else {
element.set('text', Em.I18n.t('admin.stackVersions.version.upgrade.running'));
}
}
},
/**
* @param {Em.Object} element
*/
processPreUpgradeState: function processPreUpgradeState(element) {
var currentVersion = this.get('controller.currentVersion');
var status = this.get('content.status');
var isVersionHigherThanCurrent = stringUtils.compareVersions(this.get('content.repositoryVersion'), Em.get(currentVersion, 'repository_version')) === 1;
var isDisabled = this.isDisabledOnInstalled();
if (Em.get(currentVersion, 'stack_name') !== this.get('content.stackVersionType') || isVersionHigherThanCurrent) {
switch (status) {
case 'OUT_OF_SYNC':
Iif (Em.isNone(currentVersion)) {
element.set('text', Em.I18n.t('admin.stackVersions.version.installError'));
element.set('iconClass', 'glyphicon glyphicon-warning-sign');
element.set('isLabel', true);
} else {
element.set('isButton', true);
element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'));
element.set('action', 'installRepoVersionPopup');
}
break;
case 'INSTALL_FAILED':
Iif (Em.isNone(currentVersion)) {
element.set('text', Em.I18n.t('admin.stackVersions.version.installError'));
element.set('iconClass', 'glyphicon glyphicon-warning-sign');
element.set('isLabel', true);
} else {
element.set('isButton', true);
element.set('text', this.get('isVersionColumnView') ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'));
element.set('action', 'installRepoVersionPopup');
}
break;
default:
var isVersionColumnView = this.get('isVersionColumnView');
var stackServices = this.get('content.stackServices');
var isUpgradable = stackServices && (this.get('content.isStandard') || stackServices.some(function (stackService) {
return stackService.get('isUpgradable');
}));
var isPatch = this.get('content.isPatch');
var isMaint = this.get('content.isMaint');
element.set('isButtonGroup', true);
if (isUpgradable) {
element.set('text', isVersionColumnView ? Em.I18n.t('common.upgrade') : Em.I18n.t('admin.stackVersions.version.performUpgrade'));
element.set('action', 'confirmUpgrade');
element.get('buttons').pushObject({
text: isVersionColumnView ? Em.I18n.t('common.reinstall') : Em.I18n.t('admin.stackVersions.version.reinstall'),
action: 'installRepoVersionPopup',
isDisabled: isDisabled
});
element.get('buttons').pushObject({
text: Em.I18n.t('admin.stackVersions.version.preUpgradeCheck'),
action: 'showUpgradeOptions',
isDisabled: isDisabled
});
} else {
element.set('iconClass', 'icon-ok');
element.set('text', Em.I18n.t('common.installed'));
}
if (isPatch || isMaint) {
element.get('buttons').pushObject({
text: Em.I18n.t('common.hide'),
action: 'confirmDiscardRepoVersion',
isDisabled: isDisabled
});
}
}
element.set('isDisabled', isDisabled);
} else {
element.setProperties(this.get('statePropertiesMap')['INSTALLED']);
Iif (this.get('content.isPatch') || this.get('content.isMaint')) {
element.get('buttons').pushObject({
text: Em.I18n.t('common.hide'),
action: 'confirmDiscardRepoVersion',
isDisabled: isDisabled
});
}
}
},
/**
* @param {Em.Object} element
*/
processNotRequiredState: function processNotRequiredState(element) {
var isDisabledOnInit = this.isDisabledOnInit();
var requestInProgressRepoId = this.get('controller.requestInProgressRepoId');
var status = this.get('content.status');
if (requestInProgressRepoId && requestInProgressRepoId === this.get('content.id')) {
element.setProperties(this.get('statePropertiesMap')['LOADING']);
} else {
element.setProperties(this.get('statePropertiesMap')[status]);
}
element.set('isDisabled', isDisabledOnInit);
element.set('isButtonGroup', true);
element.set('isButton', false);
element.get('buttons').pushObject({
text: Em.I18n.t('common.hide'),
action: 'confirmDiscardRepoVersion',
isDisabled: isDisabledOnInit
});
},
/**
* check if actions of INSTALLED stack version disabled
* @returns {boolean}
*/
isDisabledOnInstalled: function isDisabledOnInstalled() {
return !this.get('isCurrentStackPresent') || !App.isAuthorized('CLUSTER.UPGRADE_DOWNGRADE_STACK') || this.get('controller.requestInProgress') || this.get('parentView.repoVersions').someProperty('status', 'INSTALLING') || this.get('controller.isDowngrade') && this.get('controller.currentVersion.repository_name') === this.get('controller.upgradeVersion');
},
didInsertElement: function didInsertElement() {
App.tooltip($('.link-tooltip'), { title: Em.I18n.t('admin.stackVersions.version.linkTooltip') });
App.tooltip($('.hosts-tooltip'));
App.tooltip($('.out-of-sync-badge'), { title: Em.I18n.t('hosts.host.stackVersions.status.out_of_sync') });
Eif (!this.get('content.isCompatible')) {
App.tooltip(this.$(".repo-version-tooltip"), {
title: Em.I18n.t('admin.stackVersions.version.noCompatible.tooltip')
});
}
Em.run.later(this, function () {
Eif (this.get('state') !== 'inDOM') {
return;
}
if (this.get('maintenanceHosts').length + this.get('notRequiredHosts').length) {
App.tooltip(this.$('.hosts-section'), { placement: 'bottom', title: Em.I18n.t('admin.stackVersions.version.hostsInfoTooltip').format(this.get('maintenanceHosts').length + this.get('notRequiredHosts').length, this.get('maintenanceHosts').length, this.get('notRequiredHosts').length) });
}
}, 1000);
},
willDestroyElement: function willDestroyElement() {
$('.link-tooltip').tooltip('destroy');
$('.hosts-tooltip').tooltip('destroy');
$('.out-of-sync-badge').tooltip('destroy');
},
isCurrentStackPresent: Ember.computed('parentView.repoVersions.@each.stackVersion.state', function () {
return this.get('parentView.repoVersions').someProperty('stackVersion.state', 'CURRENT');
}),
/**
* run custom action of controller
*/
runAction: function runAction(event) {
var target = event && event.target,
action = event && event.context || this.get('stateElement.action');
if (target && ($(target).hasClass('disabled') || $(target).parent().hasClass('disabled'))) {
return;
}
if (action) {
this.get('controller')[action](this.get('content'));
}
},
/**
* @param App.RepositoryVersion
* */
getStackVersionNumber: function getStackVersionNumber(repository) {
var stackVersion = null;
var systems = repository.get('operatingSystems');
systems.forEach(function (os) {
os.get('repositories').forEach(function (repo) {
stackVersion = repo.get('stackVersion');
if (null != stackVersion) return stackVersion;
});
});
return stackVersion;
},
/**
* show popup with repositories to edit
* @return {App.ModalPopup}
*/
editRepositories: function editRepositories() {
var self = this;
var repoRecord = App.RepositoryVersion.find(this.get('content.id'));
//make deep copy of repoRecord
var repo = Em.Object.create({
repoVersionId: repoRecord.get('id'),
displayName: repoRecord.get('displayName'),
repositoryVersion: repoRecord.get('displayName'),
stackVersion: self.getStackVersionNumber(repoRecord),
useRedhatSatellite: repoRecord.get('useRedhatSatellite'),
operatingSystems: repoRecord.get('operatingSystems').map(function (os) {
return Em.Object.create({
osType: os.get('osType'),
isSelected: true,
repositories: os.get('repositories').map(function (repository) {
return Em.Object.create({
repoName: repository.get('repoName'),
repoId: repository.get('repoId'),
baseUrl: repository.get('baseUrl'),
hasError: false,
showRepo: repository.get('showRepo')
});
})
});
})
});
return this.get('isRepoUrlsEditDisabled') ? null : App.ModalPopup.show({
classNames: ['repository-list', 'common-modal-wrapper'],
modalDialogClasses: ['modal-lg'],
skipValidation: false,
autoHeight: false,
/**
* @type {boolean}
*/
serverValidationFailed: false,
bodyClass: Ember.View.extend({
content: repo,
skipCheckBox: App.CheckboxView.extend({
repoBinding: 'parentView.content',
checkboxClassNames: ["align-checkbox"],
change: function change() {
this.get('repo.operatingSystems').forEach(function (os) {
os.get('repositories').forEach(function (repo) {
repo.set('skipValidation', this.get('checked'));
}, this);
}, this);
}
}),
/**
* set <code>disablePrimary</code> of popup depending on base URL validation
*/
uiValidation: function uiValidation() {
var disablePrimary = !(App.get('isAdmin') && !App.get('isOperator'));
this.get('content.operatingSystems').forEach(function (os) {
os.get('repositories').forEach(function (repo) {
disablePrimary = !disablePrimary ? repo.get('hasError') : disablePrimary;
}, this);
}, this);
this.set('parentView.disablePrimary', disablePrimary);
},
templateName: require('templates/main/admin/stack_upgrade/edit_repositories'),
didInsertElement: function didInsertElement() {
App.tooltip($("[rel=skip-validation-tooltip], [rel=use-redhat-tooltip]"), { placement: 'right' });
},
willDestroyElement: function willDestroyElement() {
$("[rel=skip-validation-tooltip], [rel=use-redhat-tooltip]").tooltip('destroy');
}
}),
header: Em.I18n.t('common.repositories'),
primary: Em.I18n.t('common.save'),
disablePrimary: false,
onPrimary: function onPrimary() {
var self = this;
App.get('router.mainAdminStackAndUpgradeController').saveRepoOS(repo, this.get('skipValidation')).done(function (data) {
if (data.length > 0) {
self.set('serverValidationFailed', true);
self.set('disablePrimary', true);
} else {
self.hide();
}
});
}
});
},
/**
* shows popup with listed hosts wich has current state of hostStackVersion
* @param {object} event
* @returns {App.ModalPopup}
* @method showHostsListPopup
*/
showHosts: function showHosts(event) {
var status = event.contexts[0];
var displayName = this.get('content.displayName');
var hosts = this.get(status['property']);
var self = this;
var title = status.type === 'CURRENT' ? Em.I18n.t('admin.stackVersions.hosts.popup.current.title').format(displayName, hosts.length) : Em.I18n.t('admin.stackVersions.hosts.popup.title').format(displayName, status.label, hosts.length);
hosts.sort();
if (hosts.length) {
return App.ModalPopup.show({
bodyClass: Ember.View.extend({
title: title,
hosts: hosts,
template: Em.Handlebars.compile('<h4>{{view.title}}</h4><div class="limited-height-2">{{#each view.hosts}}<div>{{this}}</div>{{/each}}</div>')
}),
header: Em.I18n.t('admin.stackVersions.hosts.popup.header').format(status.label),
primary: Em.I18n.t('admin.stackVersions.hosts.popup.primary'),
secondary: Em.I18n.t('common.close'),
onPrimary: function onPrimary() {
this.hide();
Eif ($('.version-box-popup .modal')) {
$('.version-box-popup .modal .modal-footer .btn-success').click();
}
self.filterHostsByStack(displayName, status.value);
}
});
}
},
/**
* goes to the hosts page with content filtered by repo_version_name and repo_version_state
* @param {string} displayName
* @param {Array} states
* @method filterHostsByStack
*/
filterHostsByStack: function filterHostsByStack(displayName, states) {
if (Em.isNone(displayName) || Em.isNone(states) || !states.length) return;
App.router.get('mainHostController').filterByStack(displayName, states);
App.router.get('mainHostController').set('showFilterConditionsFirstLoad', true);
App.router.get('mainHostController').set('filterChangeHappened', true);
App.router.transitionTo('hosts.index');
},
/**
* Not installed hosts should exclude 1.not required hosts 2. Maintenance Mode hosts,
* or it maybe confusing to users
* @type {Array}
*/
notInstalledHosts: function () {
var notInstalledHosts = this.get('content.notInstalledHosts') || App.get('allHostNames');
var notRequiredHosts = this.get('notRequiredHosts');
var maintenanceHosts = this.get('maintenanceHosts');
if (notInstalledHosts.length && notRequiredHosts.length) {
notRequiredHosts.forEach(function (not_required) {
var index = notInstalledHosts.indexOf(not_required);
if (index > -1) {
notInstalledHosts.splice(index, 1);
}
});
}
if (notInstalledHosts.length && maintenanceHosts.length) {
maintenanceHosts.forEach(function (mm_host) {
var index = notInstalledHosts.indexOf(mm_host);
if (index > -1) {
notInstalledHosts.splice(index, 1);
}
});
}
return notInstalledHosts;
}.property('content.notInstalledHosts', 'notRequiredHosts', 'maintenanceHosts'),
/**
* @type {Array}
*/
maintenanceHosts: function () {
return App.Host.find().filterProperty('passiveState', 'ON').mapProperty('hostName') || [];
}.property(''),
/**
* Host with no HDP component is not required to install new version
* @type {Array}
*/
notRequiredHosts: function () {
var notRequiredHosts = [];
App.Host.find().forEach(function (host) {
if (!host.get('hostComponents').someProperty('isHDPComponent')) {
notRequiredHosts.push(host.get('hostName'));
}
});
return notRequiredHosts.uniq() || [];
}.property(''),
/**
* @type {Array}
*/
installedHosts: function () {
return this.get('content.installedHosts') || [];
}.property('content.installedHosts'),
/**
* @type {Array}
*/
currentHosts: function () {
return this.get('content.currentHosts') || [];
}.property('content.currentHosts')
});
}); |