|
Lines 70-78
Link Here
|
| 70 |
callback: lang.hitch(this, function(data) { |
70 |
callback: lang.hitch(this, function(data) { |
| 71 |
if (data.length) { |
71 |
if (data.length) { |
| 72 |
var command = 'services/start'; |
72 |
var command = 'services/start'; |
|
|
73 |
var action = _('Start services'); |
| 73 |
var confirmMessage = _('Please confirm to start the following services: '); |
74 |
var confirmMessage = _('Please confirm to start the following services: '); |
| 74 |
var errorMessage = _('Starting the following services failed: '); |
75 |
var errorMessage = _('Starting the following services failed: '); |
| 75 |
this._changeState(data, command, confirmMessage, errorMessage); |
76 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 76 |
} |
77 |
} |
| 77 |
}), |
78 |
}), |
| 78 |
isStandardAction: false, |
79 |
isStandardAction: false, |
|
Lines 83-91
Link Here
|
| 83 |
callback: lang.hitch(this, function(data) { |
84 |
callback: lang.hitch(this, function(data) { |
| 84 |
if (data.length) { |
85 |
if (data.length) { |
| 85 |
var command = 'services/stop'; |
86 |
var command = 'services/stop'; |
|
|
87 |
var action = _('Stop services'); |
| 86 |
var confirmMessage = _('Please confirm to stop the following services: '); |
88 |
var confirmMessage = _('Please confirm to stop the following services: '); |
| 87 |
var errorMessage = _('Stopping the following services failed: '); |
89 |
var errorMessage = _('Stopping the following services failed: '); |
| 88 |
this._changeState(data, command, confirmMessage, errorMessage); |
90 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 89 |
} |
91 |
} |
| 90 |
}), |
92 |
}), |
| 91 |
isStandardAction: false, |
93 |
isStandardAction: false, |
|
Lines 96-104
Link Here
|
| 96 |
callback: lang.hitch(this, function(data) { |
98 |
callback: lang.hitch(this, function(data) { |
| 97 |
if (data.length) { |
99 |
if (data.length) { |
| 98 |
var command = 'services/restart'; |
100 |
var command = 'services/restart'; |
|
|
101 |
var action = _('Restart services'); |
| 99 |
var confirmMessage = _('Please confirm to restart the following services: '); |
102 |
var confirmMessage = _('Please confirm to restart the following services: '); |
| 100 |
var errorMessage = _('Restarting the following services failed: '); |
103 |
var errorMessage = _('Restarting the following services failed: '); |
| 101 |
this._changeState(data, command, confirmMessage, errorMessage); |
104 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 102 |
} |
105 |
} |
| 103 |
}), |
106 |
}), |
| 104 |
isStandardAction: false, |
107 |
isStandardAction: false, |
|
Lines 108-116
Link Here
|
| 108 |
label: _('Start automatically'), |
111 |
label: _('Start automatically'), |
| 109 |
callback: lang.hitch(this, function(data) { |
112 |
callback: lang.hitch(this, function(data) { |
| 110 |
var command = 'services/start_auto'; |
113 |
var command = 'services/start_auto'; |
|
|
114 |
var action = _('Start automatically'); |
| 111 |
var confirmMessage = _('Please confirm to automatically start the following services: '); |
115 |
var confirmMessage = _('Please confirm to automatically start the following services: '); |
| 112 |
var errorMessage = _('Could not change start type of the following services: '); |
116 |
var errorMessage = _('Could not change start type of the following services: '); |
| 113 |
this._changeState(data, command, confirmMessage, errorMessage); |
117 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 114 |
}), |
118 |
}), |
| 115 |
isStandardAction: false, |
119 |
isStandardAction: false, |
| 116 |
isMultiAction: true |
120 |
isMultiAction: true |
|
Lines 119-127
Link Here
|
| 119 |
label: _('Start manually'), |
123 |
label: _('Start manually'), |
| 120 |
callback: lang.hitch(this, function(data) { |
124 |
callback: lang.hitch(this, function(data) { |
| 121 |
var command = 'services/start_manual'; |
125 |
var command = 'services/start_manual'; |
|
|
126 |
var action = _('Start manually'); |
| 122 |
var confirmMessage = _('Please confirm to manually start the following services: '); |
127 |
var confirmMessage = _('Please confirm to manually start the following services: '); |
| 123 |
var errorMessage = _('Could not change start type of the following services: '); |
128 |
var errorMessage = _('Could not change start type of the following services: '); |
| 124 |
this._changeState(data, command, confirmMessage, errorMessage); |
129 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 125 |
}), |
130 |
}), |
| 126 |
isStandardAction: false, |
131 |
isStandardAction: false, |
| 127 |
isMultiAction: true |
132 |
isMultiAction: true |
|
Lines 130-138
Link Here
|
| 130 |
label: _('Start never'), |
135 |
label: _('Start never'), |
| 131 |
callback: lang.hitch(this, function(data) { |
136 |
callback: lang.hitch(this, function(data) { |
| 132 |
var command = 'services/start_never'; |
137 |
var command = 'services/start_never'; |
|
|
138 |
var action = _('Start never'); |
| 133 |
var confirmMessage = _('Please confirm to never start the following services: '); |
139 |
var confirmMessage = _('Please confirm to never start the following services: '); |
| 134 |
var errorMessage = _('Could not change start type of the following services: '); |
140 |
var errorMessage = _('Could not change start type of the following services: '); |
| 135 |
this._changeState(data, command, confirmMessage, errorMessage); |
141 |
this._changeState(data, command, action, confirmMessage, errorMessage); |
| 136 |
}), |
142 |
}), |
| 137 |
isStandardAction: false, |
143 |
isStandardAction: false, |
| 138 |
isMultiAction: true |
144 |
isMultiAction: true |
|
Lines 207-215
Link Here
|
| 207 |
titlePane.addChild(this._searchWidget); |
213 |
titlePane.addChild(this._searchWidget); |
| 208 |
|
214 |
|
| 209 |
this._page.startup(); |
215 |
this._page.startup(); |
| 210 |
}, |
216 |
}, |
| 211 |
|
217 |
|
| 212 |
_changeState: function(data, command, confirmMessage, errorMessage) { |
218 |
_changeState: function(data, command, action, confirmMessage, errorMessage) { |
| 213 |
confirmMessage += '<ul>'; |
219 |
confirmMessage += '<ul>'; |
| 214 |
array.forEach(data, function(idata) { |
220 |
array.forEach(data, function(idata) { |
| 215 |
confirmMessage += '<li>' + idata + '</li>'; |
221 |
confirmMessage += '<li>' + idata + '</li>'; |
|
Lines 217-246
Link Here
|
| 217 |
confirmMessage += '</ul>'; |
223 |
confirmMessage += '</ul>'; |
| 218 |
|
224 |
|
| 219 |
dialog.confirm(confirmMessage, [{ |
225 |
dialog.confirm(confirmMessage, [{ |
| 220 |
label: _('OK'), |
226 |
label: _('Cancel'), |
|
|
227 |
'default': true |
| 228 |
}, { |
| 229 |
label: action, |
| 221 |
callback: lang.hitch(this, function() { |
230 |
callback: lang.hitch(this, function() { |
| 222 |
this.standby(true); |
231 |
var operation = tools.umcpCommand(command, data).then(lang.hitch(this, function(response) { |
| 223 |
tools.umcpCommand(command, data).then( |
232 |
if (response.result.success === false) { |
| 224 |
lang.hitch(this, function(response) { |
233 |
errorMessage += '<ul>'; |
| 225 |
this.standby(false); |
234 |
array.forEach(response.result.objects, function(item) { |
| 226 |
if (response.result.success === false) { |
235 |
errorMessage += '<li>' + item + '</li>'; |
| 227 |
errorMessage += '<ul>'; |
236 |
}); |
| 228 |
array.forEach(response.result.objects, function(item) { |
237 |
errorMessage += '</ul>'; |
| 229 |
errorMessage += '<li>' + item + '</li>'; |
238 |
dialog.alert(errorMessage); |
| 230 |
}); |
239 |
} |
| 231 |
errorMessage += '</ul>'; |
240 |
data = this._searchWidget.gatherFormValues(); |
| 232 |
dialog.alert(errorMessage); |
241 |
this._grid.filter(data); |
| 233 |
} |
242 |
})); |
| 234 |
data = this._searchWidget.get('value'); |
243 |
this.standbyDuring(operation); |
| 235 |
this._grid.filter(data); |
|
|
| 236 |
}), lang.hitch(this, function() { |
| 237 |
this.standby(false); |
| 238 |
}) |
| 239 |
); |
| 240 |
}) |
244 |
}) |
| 241 |
}, { |
|
|
| 242 |
'default': true, |
| 243 |
label: _('Cancel') |
| 244 |
}]); |
245 |
}]); |
| 245 |
} |
246 |
} |
| 246 |
}); |
247 |
}); |