|
13 |
dojo.require("umc.widgets.ContainerForm"); |
13 |
dojo.require("umc.widgets.ContainerForm"); |
14 |
dojo.require("umc.widgets.Grid"); |
14 |
dojo.require("umc.widgets.Grid"); |
15 |
dojo.require("umc.widgets.TabbedModule"); |
15 |
dojo.require("umc.widgets.TabbedModule"); |
|
|
16 |
dojo.require("umc.widgets.StandbyMixin"); |
17 |
dojo.require("umc.modules._join.Form"); |
16 |
dojo.require("dojox.string.sprintf"); |
18 |
dojo.require("dojox.string.sprintf"); |
17 |
dojo.require("dojox.layout.TableContainer"); |
|
|
18 |
|
19 |
|
19 |
// Inheriting from umc.widgets.TabbedModule so any pages being added |
20 |
// Inheriting from umc.widgets.TabbedModule so any pages being added |
20 |
// will become tabs automatically. |
21 |
// will become tabs automatically. |
|
22 |
|
23 |
|
23 |
_page: null, // umc.widgets.Page |
24 |
_page: null, // umc.widgets.Page |
24 |
_content: null, // umc.widgets.ExpandingTitlePane |
25 |
_content: null, // umc.widgets.ExpandingTitlePane |
25 |
_split: null, // dijit.layout.BorderContainer |
26 |
// _split: null, // dijit.layout.BorderContainer |
26 |
_grid: null, // umc.widgets.Grid |
27 |
_grid: null, // umc.widgets.Grid |
27 |
_infotext: null, |
28 |
_infotext: null, |
28 |
|
29 |
|
|
48 |
_job_running: false, // true while scripts are running |
49 |
_job_running: false, // true while scripts are running |
49 |
_polling_time: 1000, // once per second |
50 |
_polling_time: 1000, // once per second |
50 |
|
51 |
|
51 |
_grid_query: {scope: 'scripts'}, |
52 |
_grid_query: {'*': '*'}, // all? |
52 |
|
53 |
|
53 |
idProperty: 'script', // doesn't help with the sorting problem of selected rows |
54 |
idProperty: 'script', // doesn't help with the sorting problem of selected rows |
54 |
i18nClass: 'umc.modules.join', |
55 |
i18nClass: 'umc.modules.join', |
|
60 |
_switch_log_display: function(code) { |
61 |
_switch_log_display: function(code) { |
61 |
if (code == 'hide') |
62 |
if (code == 'hide') |
62 |
{ |
63 |
{ |
63 |
this._split.removeChild(this._logview); |
64 |
this._content.removeChild(this._logview); |
64 |
this._bottom.addChild(this._b_show); |
65 |
this._bottom.addChild(this._b_show); |
65 |
this._bottom.removeChild(this._b_hide); |
66 |
this._bottom.removeChild(this._b_hide); |
66 |
this._bottom.removeChild(this._b_full); |
67 |
this._bottom.removeChild(this._b_full); |
|
86 |
this._refresh_log(true); |
87 |
this._refresh_log(true); |
87 |
this._bottom.addChild(this._b_hide); |
88 |
this._bottom.addChild(this._b_hide); |
88 |
this._bottom.addChild(this._b_full); |
89 |
this._bottom.addChild(this._b_full); |
89 |
this._split.addChild(this._logview); |
90 |
this._content.addChild(this._logview); |
90 |
this._logview.addChild(this._logtext); |
91 |
this._logview.addChild(this._logtext); |
91 |
} |
92 |
} |
92 |
|
93 |
|
|
96 |
|
97 |
|
97 |
// gets the current join status and switches display mode if needed. |
98 |
// gets the current join status and switches display mode if needed. |
98 |
_check_join_status: function() { |
99 |
_check_join_status: function() { |
99 |
this.moduleStore.query({ |
100 |
this.umcpCommand('join/joined').then(dojo.hitch(this, function(data) { |
100 |
scope: 'joined' |
101 |
var result = data.result; |
101 |
}).then(dojo.hitch(this, function(result) { |
|
|
102 |
if (result != this._joined) |
102 |
if (result != this._joined) |
103 |
{ |
103 |
{ |
104 |
this._joined = result; |
104 |
this._joined = result; |
|
106 |
{ |
106 |
{ |
107 |
// show grid with join status, else.... |
107 |
// show grid with join status, else.... |
108 |
this._infotext.set('content',this._("This system joined on %s",result)); |
108 |
this._infotext.set('content',this._("This system joined on %s",result)); |
109 |
this._split.removeChild(this._joinpane); |
109 |
this._content.removeChild(this._joinpane); |
110 |
this._split.addChild(this._grid); |
110 |
this._content.addChild(this._grid); |
111 |
this._reload_grid(); // force grid reload |
111 |
this._reload_grid(); // force grid reload |
112 |
} |
112 |
} |
113 |
else |
113 |
else |
114 |
{ |
114 |
{ |
115 |
// show affordance to join, nothing more. |
115 |
// show affordance to join, nothing more. |
116 |
this._infotext.set('content',this._("This system has not been joined yet.")); |
116 |
this._infotext.set('content',this._("This system has not been joined yet.")); |
117 |
this._split.removeChild(this._grid); |
117 |
this._content.removeChild(this._grid); |
118 |
this._split.addChild(this._joinpane); |
118 |
this._content.addChild(this._joinpane); |
119 |
} |
119 |
} |
120 |
} |
120 |
} |
121 |
})); |
121 |
}), |
|
|
122 |
dojo.hitch(this, function(result) { |
123 |
console.error("check_join_status ERROR " + result.message); |
124 |
}) |
125 |
); |
122 |
}, |
126 |
}, |
123 |
|
127 |
|
124 |
// Asynchronously invokes reload of the log lines display. Before fetching real data, |
128 |
// Asynchronously invokes reload of the log lines display. Before fetching real data, |
|
131 |
} |
135 |
} |
132 |
else |
136 |
else |
133 |
{ |
137 |
{ |
134 |
this.moduleStore.query({ |
138 |
this.umcpCommand('join/logview',{ |
135 |
scope: 'logview', |
|
|
136 |
count: -1 // returns timestamp of log file |
139 |
count: -1 // returns timestamp of log file |
137 |
}).then(dojo.hitch(this,function(result) { |
140 |
}).then(dojo.hitch(this,function(data) { |
|
|
141 |
var result = data.result; |
138 |
if (result != this._log_stamp) |
142 |
if (result != this._log_stamp) |
139 |
{ |
143 |
{ |
140 |
this._log_stamp = result; // yes I know, I should do that after it was reloaded |
144 |
this._log_stamp = result; // yes I know, I should do that after it was reloaded |
|
154 |
// log really changed. |
158 |
// log really changed. |
155 |
_fetch_log_text: function() { |
159 |
_fetch_log_text: function() { |
156 |
// now really fetch log file contents. |
160 |
// now really fetch log file contents. |
157 |
this.moduleStore.query({ |
161 |
this.umcpCommand('join/logview',{ |
158 |
scope: 'logview', |
|
|
159 |
count: this._logcount |
162 |
count: this._logcount |
160 |
}).then(dojo.hitch(this,function(result) { |
163 |
}).then(dojo.hitch(this,function(data) { |
|
|
164 |
var result = data.result; |
161 |
var txt = dojox.string.sprintf("<u><b>%s</b></u><br/>\n",this._("Join Protocol")); |
165 |
var txt = dojox.string.sprintf("<u><b>%s</b></u><br/>\n",this._("Join Protocol")); |
162 |
|
166 |
|
163 |
// this is for debugging so we can see the refresh |
|
|
164 |
//var txt = dojox.string.sprintf("<u><b>%s [%d]</b></u><br/>\n",this._("Join Protocol"),this._proto_gen); |
165 |
//this._proto_gen++; |
166 |
|
167 |
if (this._logcount) |
167 |
if (this._logcount) |
168 |
{ |
168 |
{ |
169 |
var tmp = this._("last {logcount} lines"); |
169 |
var tmp = this._("last {logcount} lines"); |
|
188 |
// Establish refresh every second. We keep the last instance of our 'Deferred' |
188 |
// Establish refresh every second. We keep the last instance of our 'Deferred' |
189 |
// as an instance member this._refresh_job, thus avoiding to have more than one |
189 |
// as an instance member this._refresh_job, thus avoiding to have more than one |
190 |
// refresh running at any time. |
190 |
// refresh running at any time. |
191 |
if (! this._refresh_job) |
191 |
// |
|
|
192 |
// Added here: if this._refresh_time is set to zero we stop the timer. |
193 |
if ((! this._refresh_job) && (this._refresh_time)) |
192 |
{ |
194 |
{ |
193 |
var deferred = new dojo.Deferred(); |
195 |
var deferred = new dojo.Deferred(); |
194 |
this._refresh_job = deferred; |
196 |
this._refresh_job = deferred; |
|
236 |
{ |
238 |
{ |
237 |
// this query returns false as soon as the scripts are finished, and this |
239 |
// this query returns false as soon as the scripts are finished, and this |
238 |
// will avoid scheduling any new polling cycle. |
240 |
// will avoid scheduling any new polling cycle. |
239 |
this.moduleStore.query({ |
241 |
this.umcpCommand('join/running').then(dojo.hitch(this, function(data) { |
240 |
scope: 'running' |
242 |
try |
241 |
}).then(dojo.hitch(this, function(result) { |
|
|
242 |
if (result != this._job_running) |
243 |
{ |
243 |
{ |
244 |
this._job_running = result; |
244 |
var result = data.result; |
245 |
this._check_join_status(); // switch between join form and script grid |
245 |
if (result != this._job_running) |
246 |
this._reload_grid(); // redo the status query for the grid, effectively triggering |
|
|
247 |
// _check_grid_status() on 'fetchComplete' |
248 |
} |
249 |
// for first display: if none of the two widgets (script grid or join form) |
250 |
// is displayed AND we run into a running job we have to do two things: |
251 |
// (1) show a header text that explains the situation |
252 |
// (2) switch log display on. |
253 |
if (this._job_running) |
254 |
{ |
255 |
var txt = this._infotext.get('content'); |
256 |
if (txt == '') |
257 |
{ |
246 |
{ |
258 |
this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); |
247 |
this._job_running = result; |
259 |
this._switch_log_display('show'); |
248 |
if (! result) |
|
|
249 |
{ |
250 |
this._joinform.standby(false); |
251 |
} |
252 |
this._check_join_status(); // switch between join form and script grid |
253 |
this._reload_grid(); // redo the status query for the grid, effectively triggering |
254 |
// _check_grid_status() on 'fetchComplete' |
260 |
} |
255 |
} |
|
|
256 |
// for first display: if none of the two widgets (script grid or join form) |
257 |
// is displayed AND we run into a running job we have to do two things: |
258 |
// (1) show a header text that explains the situation |
259 |
// (2) switch log display on. |
260 |
if (this._job_running) |
261 |
{ |
262 |
var txt = this._infotext.get('content'); |
263 |
if (txt == '') |
264 |
{ |
265 |
this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); |
266 |
this._switch_log_display('show'); |
267 |
} |
268 |
} |
261 |
} |
269 |
} |
262 |
})); |
270 |
catch(error) |
|
|
271 |
{ |
272 |
console.error('job_polling_loop ERROR: ' + error.message); |
273 |
} |
274 |
}), |
275 |
dojo.hitch(this, function(result) { |
276 |
this._joinform.standby(false); |
277 |
this._grid.standby(false); |
278 |
}) |
279 |
); |
263 |
|
280 |
|
264 |
// We should have exactly one such job. If one is underway, we don't |
281 |
// We should have exactly one such job. If one is underway, we don't |
265 |
// step on its feet. Otherwise, we start a new one. |
282 |
// step on its feet. Otherwise, we start a new one. |
|
293 |
|
310 |
|
294 |
_check_grid_status: function() { |
311 |
_check_grid_status: function() { |
295 |
|
312 |
|
296 |
// While a job is running the grid is in standby() nevertheless, so it won't |
313 |
try |
297 |
// make sense to refresh it. |
|
|
298 |
if (this._job_running) |
299 |
{ |
314 |
{ |
300 |
return; |
|
|
301 |
} |
302 |
|
303 |
var runnable = 0; |
304 |
var selected = 0; |
305 |
this._runnables = []; |
306 |
var dup = {}; |
307 |
|
315 |
|
308 |
for (var rowIndex=0; rowIndex < this._grid._grid.attr("rowCount"); rowIndex++) |
316 |
// While a job is running the grid is in standby() nevertheless, so it won't |
309 |
{ |
317 |
// make sense to refresh it. |
310 |
var row = this._grid.getRowValues(rowIndex); |
318 |
if (this._job_running) |
311 |
|
|
|
312 |
// check against bug that duplicates data starting from the 26th row |
313 |
var fn = row['script']; |
314 |
if (typeof(dup[fn]) != 'undefined') |
315 |
{ |
319 |
{ |
316 |
this._reload_grid(); |
|
|
317 |
return; |
320 |
return; |
318 |
} |
321 |
} |
319 |
dup[fn] = 1; |
322 |
|
|
|
323 |
var runnable = 0; |
324 |
var selected = 0; |
325 |
this._runnables = []; |
326 |
var dup = {}; |
320 |
|
327 |
|
321 |
var allow = false; |
328 |
for (var rowIndex=0; rowIndex < this._grid._grid.attr("rowCount"); rowIndex++) |
322 |
if (row['action'] != '') |
|
|
323 |
{ |
329 |
{ |
324 |
runnable++; |
330 |
var row = this._grid.getRowValues(rowIndex); |
325 |
allow = true; |
331 |
|
326 |
this._runnables.push(row['script']); |
332 |
// check against bug that duplicates data starting from the 26th row |
327 |
} |
333 |
var fn = row['script']; |
328 |
if (this._grid._grid.selection.selected[rowIndex]) |
334 |
if (typeof(dup[fn]) != 'undefined') |
329 |
{ |
|
|
330 |
if (allow) |
331 |
{ |
335 |
{ |
332 |
selected++; |
336 |
this._reload_grid(); |
|
|
337 |
return; |
333 |
} |
338 |
} |
334 |
else |
339 |
dup[fn] = 1; |
|
|
340 |
|
341 |
var allow = false; |
342 |
if (row['action'] != '') |
335 |
{ |
343 |
{ |
336 |
// Work around bug in the Grid base class: the 'select all' checkbox |
344 |
runnable++; |
337 |
// happily selects all rows, even if some of them are disabled! |
345 |
allow = true; |
338 |
this._grid._grid.rowSelectCell.toggleRow(rowIndex, false); |
346 |
this._runnables.push(row['script']); |
339 |
} |
347 |
} |
|
|
348 |
if (this._grid._grid.selection.selected[rowIndex]) |
349 |
{ |
350 |
if (allow) |
351 |
{ |
352 |
selected++; |
353 |
} |
354 |
else |
355 |
{ |
356 |
// Work around bug in the Grid base class: the 'select all' checkbox |
357 |
// happily selects all rows, even if some of them are disabled! |
358 |
this._grid._grid.rowSelectCell.toggleRow(rowIndex, false); |
359 |
} |
360 |
} |
361 |
this._grid._grid.rowSelectCell.setDisabled(rowIndex, ! allow); |
362 |
|
340 |
} |
363 |
} |
341 |
this._grid._grid.rowSelectCell.setDisabled(rowIndex, ! allow); |
364 |
if (selected) |
342 |
|
|
|
343 |
} |
344 |
if (selected) |
345 |
{ |
346 |
var txt = (selected==1)? |
347 |
this._('1 script selected'): |
348 |
this._('%d scripts selected',selected); |
349 |
this._footers[0].set('content',txt); |
350 |
this._multi_action.set('label',this._('run selected scripts')); |
351 |
this._footers[1].addChild(this._multi_action); |
352 |
} |
353 |
else |
354 |
{ |
355 |
if (runnable) |
356 |
{ |
365 |
{ |
357 |
this._footers[0].set('content',this._('%d scripts are due to be run',runnable)); |
366 |
var txt = (selected==1)? |
358 |
this._multi_action.set('label',this._('run all')); |
367 |
this._('1 script selected'): |
|
|
368 |
this._('%d scripts selected',selected); |
369 |
this._footers[0].set('content',txt); |
370 |
this._multi_action.set('label',this._('run selected scripts')); |
359 |
this._footers[1].addChild(this._multi_action); |
371 |
this._footers[1].addChild(this._multi_action); |
360 |
} |
372 |
} |
361 |
else |
373 |
else |
362 |
{ |
374 |
{ |
363 |
this._footers[0].set('content',this._('Join status ok, nothing to do.')); |
375 |
if (runnable) |
364 |
this._footers[1].removeChild(this._multi_action); |
376 |
{ |
|
|
377 |
var due = this._('%d scripts are due to be run.',runnable); |
378 |
if (runnable == 1) |
379 |
{ |
380 |
due = this._("One script is due to be run."); |
381 |
} |
382 |
this._footers[0].set('content',due); |
383 |
|
384 |
this._multi_action.set('label',this._('run all')); |
385 |
this._footers[1].addChild(this._multi_action); |
386 |
} |
387 |
else |
388 |
{ |
389 |
this._footers[0].set('content',this._('Join status ok, nothing to do.')); |
390 |
this._footers[1].removeChild(this._multi_action); |
391 |
} |
365 |
} |
392 |
} |
366 |
} |
393 |
} |
|
|
394 |
catch(error) |
395 |
{ |
396 |
console.error("check grid status: " + error.message); |
397 |
} |
367 |
}, |
398 |
}, |
368 |
|
399 |
|
369 |
// Asynchronously runs the selected script(s). |
400 |
// Asynchronously runs the selected script(s). |
|
393 |
{ |
424 |
{ |
394 |
this._job_running = true; |
425 |
this._job_running = true; |
395 |
|
426 |
|
396 |
this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); |
427 |
if (list.length == 1) |
|
|
428 |
{ |
429 |
this._footers[0].set('content',this._("One join script is currently running")); |
430 |
} |
431 |
else |
432 |
{ |
433 |
this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); |
434 |
} |
397 |
this._footers[1].removeChild(this._multi_action); |
435 |
this._footers[1].removeChild(this._multi_action); |
398 |
|
436 |
|
399 |
this.umcpCommand('join/run',{scripts: list}).then(dojo.hitch(this, function(data) { |
437 |
this.umcpCommand('join/run',{scripts: list}).then(dojo.hitch(this, function(data) { |
|
432 |
// Trying to give the user a chance to resize the grid <-> logview ratio. |
470 |
// Trying to give the user a chance to resize the grid <-> logview ratio. |
433 |
// Even a simple BorderContainer is able to do that: just give some of its |
471 |
// Even a simple BorderContainer is able to do that: just give some of its |
434 |
// children a 'splitter: true' property. |
472 |
// children a 'splitter: true' property. |
435 |
this._split = new dijit.layout.BorderContainer({ |
|
|
436 |
}); |
437 |
this._content.addChild(this._split); |
438 |
|
473 |
|
439 |
this._grid = new umc.widgets.Grid({ |
474 |
this._grid = new umc.widgets.Grid({ |
440 |
region: 'center', |
475 |
region: 'center', |
441 |
moduleStore: this.moduleStore, |
476 |
moduleStore: umc.store.getModuleStore('script','join/scripts'), |
442 |
//query: {scope: 'scripts'}, |
477 |
// query: this._grid_query, // why? |
443 |
actions: {}, |
478 |
actions: |
|
|
479 |
[ |
480 |
{ |
481 |
name: 'run', |
482 |
label: this._( 'Execute' ), |
483 |
description: this._( 'Execute this join script' ), |
484 |
isContextAction: true, |
485 |
isStandardAction: true, |
486 |
canExecute: dojo.hitch(this, function(values) { |
487 |
// Knowledge is in the Python module! |
488 |
return (values['action'] != ''); |
489 |
}), |
490 |
callback: dojo.hitch(this, function(id) { |
491 |
if (dojo.isArray(id)) |
492 |
{ |
493 |
id = id[0]; |
494 |
} |
495 |
this._run_scripts([id]); |
496 |
}) |
497 |
} |
498 |
], |
444 |
columns: |
499 |
columns: |
445 |
[ |
500 |
[ |
446 |
{ |
501 |
{ |
447 |
name: 'script', |
502 |
name: 'script', |
448 |
label: this._("Script (package)"), |
503 |
label: this._("Script (package)"), |
449 |
description: this._("Script name (the same as the package it belongs to)"), |
504 |
description: this._("Script name (the same as the package it belongs to)"), |
450 |
editable: false, |
505 |
editable: false |
451 |
width: '40%' |
506 |
// width: '50%' |
452 |
}, |
507 |
}, |
453 |
{ |
508 |
{ |
454 |
name: 'current', |
509 |
name: 'current', |
455 |
label: this._("Current version"), |
510 |
label: this._("Current<br/>version"), |
456 |
description: this._("Latest script version ready for execution"), |
511 |
description: this._("Latest script version ready for execution"), |
457 |
editable: false, |
512 |
editable: false, |
458 |
width: '14%' |
513 |
width: 'adjust' |
459 |
}, |
514 |
}, |
460 |
{ |
515 |
{ |
461 |
name: 'last', |
516 |
name: 'last', |
462 |
label: this._("Last version"), |
517 |
label: this._("Last<br/>version"), |
463 |
description: this._("Latest script version that was executed successfully"), |
518 |
description: this._("Latest script version that was executed successfully"), |
464 |
editable: false, |
519 |
editable: false, |
465 |
width: '14%' |
520 |
width: 'adjust' |
466 |
}, |
521 |
}, |
467 |
// Status column. Currently only text. |
522 |
// Status column. Currently only text. |
468 |
{ |
523 |
{ |
|
470 |
label: this._("State"), |
525 |
label: this._("State"), |
471 |
description: this._("Status of this package"), |
526 |
description: this._("Status of this package"), |
472 |
editable: false, |
527 |
editable: false, |
473 |
width: '12%' |
528 |
width: '14%' |
474 |
// iconField: 'icon' // deactivated (for now) |
|
|
475 |
}, |
476 |
// Action field |
477 |
{ |
478 |
name: 'action', |
479 |
label: this._("Action"), |
480 |
description: this._("Run this script if it's due or never run"), |
481 |
sortable: false, |
482 |
editable: false, |
483 |
width: '10%', |
484 |
// We turn the value of the field into an action button that will |
485 |
// invoke the script named by the 'script' field of this row |
486 |
formatter: dojo.hitch(this, function(key, rowIndex) { |
487 |
// key = the value of the field, in our case empty or 'run' |
488 |
// rowIndex = needed to retrieve the script name |
489 |
try |
490 |
{ |
491 |
if (key != '') |
492 |
{ |
493 |
var tmp = this._grid.getRowValues(rowIndex); |
494 |
var script = tmp.script; |
495 |
return new umc.widgets.Button({ |
496 |
label: key, |
497 |
// FIXME style this button by a reasonable CSS class or such. |
498 |
style: 'border:outset 1px;background-color:#A0A0A0;margin:0px;padding:0px;', |
499 |
//'class': 'umcSubmitButton', // doesn't work, unfortunately. |
500 |
onClick: dojo.hitch(this, function() { |
501 |
this._run_scripts([script]); |
502 |
}) |
503 |
}); |
504 |
} |
505 |
return ''; |
506 |
} |
507 |
catch(err) |
508 |
{ |
509 |
return ''; |
510 |
} |
511 |
}) |
512 |
} |
529 |
} |
513 |
] |
530 |
] |
514 |
}); |
531 |
}); |
|
655 |
scrollable: false, |
672 |
scrollable: false, |
656 |
style: 'border:none;' |
673 |
style: 'border:none;' |
657 |
}); |
674 |
}); |
658 |
this._split.addChild(info); |
675 |
this._content.addChild(info); |
659 |
|
676 |
|
660 |
this._infotext = new umc.widgets.Text({ |
677 |
this._infotext = new umc.widgets.Text({ |
661 |
style: 'border:none;margin:.2em;', |
678 |
style: 'border:none;margin:.2em;', |
662 |
content: '', |
679 |
content: '' |
663 |
}); |
680 |
}); |
664 |
info.addChild(this._infotext); |
681 |
info.addChild(this._infotext); |
665 |
|
682 |
|
|
668 |
// password and for starting the join process. This form is prepared here and stored |
685 |
// password and for starting the join process. This form is prepared here and stored |
669 |
// into the this._joinpane variable. The _check_join_status() method will decide |
686 |
// into the this._joinpane variable. The _check_join_status() method will decide |
670 |
// which view is to show. |
687 |
// which view is to show. |
671 |
this._joinpane = new dojox.layout.TableContainer({ |
688 |
this._joinpane = new umc.widgets.ContainerWidget({ |
672 |
region: 'center', |
689 |
region: 'center', |
673 |
cols: 1, |
690 |
scrollable: true |
674 |
style: 'width:50%;', |
|
|
675 |
showLabels: false |
676 |
}); |
691 |
}); |
677 |
this._joinform = new umc.widgets.Form({ |
692 |
var buttons = |
678 |
scrollable: true, |
693 |
[ |
679 |
buttons: |
694 |
{ |
680 |
[ |
695 |
type: 'submit', |
681 |
{ |
696 |
'default': true, |
682 |
type: 'submit', |
697 |
label: this._("Start Join"), |
683 |
label: this._("Start Join"), |
698 |
onClick: dojo.hitch(this, function() { |
684 |
onClick: dojo.hitch(this, function() { |
699 |
this._joinform.standby(true); |
685 |
//this._joinform.standby(true); |
700 |
this._switch_log_display('show'); |
686 |
this._switch_log_display('show'); |
701 |
this.umcpCommand('join/join',{ |
687 |
this.umcpCommand('join/join',{ |
702 |
host: this._joinform._widgets['host'].value, |
688 |
host: this._joinform._widgets['host'].value, |
703 |
user: this._joinform._widgets['user'].value, |
689 |
user: this._joinform._widgets['user'].value, |
704 |
pass: this._joinform._widgets['pass'].value |
690 |
pass: this._joinform._widgets['pass'].value |
705 |
}).then(dojo.hitch(this, function(data) { |
691 |
}).then(dojo.hitch(this, function(data) { |
706 |
var result = dojo.getObject('result', false, data); |
692 |
var result = dojo.getObject('result', false, data); |
707 |
if (result != '') |
693 |
if (result != '') |
708 |
{ |
694 |
{ |
709 |
this._joinform.standby(false); |
695 |
// Note result is already localized |
710 |
// Note result is already localized |
696 |
umc.dialog.alert(this._("Can't start join: ") + result); |
711 |
umc.dialog.alert(this._("Can't start join: ") + result); |
697 |
this._check_join_status(); // sets meaningful messages |
712 |
this._check_join_status(); // sets meaningful messages |
698 |
} |
713 |
} |
699 |
else |
714 |
else |
700 |
{ |
715 |
{ |
701 |
// Job is started. Now wait for its completion. |
716 |
// Job is started. Now wait for its completion. |
702 |
this._job_polling_loop(true); |
717 |
this._job_polling_loop(true); |
703 |
} |
718 |
} |
704 |
})); |
719 |
})); |
705 |
}) |
720 |
}) |
706 |
} |
721 |
} |
707 |
], |
722 |
]; |
708 |
widgets: |
723 |
var widgets = |
709 |
[ |
724 |
[ |
710 |
{ |
725 |
{ |
711 |
type: 'Text', |
726 |
type: 'Text', |
712 |
name: 'text', |
727 |
name: 'text', |
713 |
style: 'margin-top:1em;margin-bottom:1em;', |
728 |
style: 'margin-top:1em;margin-bottom:1em;', |
714 |
content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") |
729 |
content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") |
715 |
}, |
730 |
}, |
716 |
{ |
731 |
{ |
717 |
type: 'TextBox', |
732 |
type: 'TextBox', |
718 |
name: 'host', |
733 |
name: 'host', |
719 |
value: '', |
734 |
value: '', |
720 |
label: this._('DC Hostname'), |
735 |
label: this._('DC Hostname'), |
721 |
description: this._('The hostname of the DC Master of the domain') |
736 |
description: this._('The hostname of the DC Master of the domain') |
722 |
}, |
737 |
}, |
723 |
{ |
738 |
{ |
724 |
type: 'TextBox', |
739 |
type: 'TextBox', |
725 |
name: 'user', |
740 |
name: 'user', |
726 |
value: 'Administrator', |
741 |
value: 'Administrator', |
727 |
label: this._('Username'), |
742 |
label: this._('Username'), |
728 |
description: this._('The username of the Domain Administrator') |
743 |
description: this._('The username of the Domain Administrator') |
729 |
}, |
744 |
}, |
730 |
{ |
745 |
{ |
731 |
type: 'PasswordBox', |
746 |
type: 'PasswordBox', |
732 |
name: 'pass', |
747 |
name: 'pass', |
733 |
value: '', |
748 |
value: '', |
734 |
label: this._( 'Password' ), |
749 |
label: this._( 'Password' ), |
735 |
description: this._( 'Password of the Domain Administrator' ) |
750 |
description: this._( 'Password of the Domain Administrator' ) |
736 |
} |
751 |
} |
737 |
] |
752 |
]; |
|
|
753 |
this._joinform = new umc.modules._join.Form({ |
754 |
buttons: buttons, |
755 |
widgets: widgets |
738 |
}); |
756 |
}); |
739 |
this._joinpane.addChild(this._joinform); |
757 |
this._joinpane.addChild(this._joinform); |
|
|
758 |
}, |
759 |
|
760 |
startup: function() { |
740 |
|
761 |
|
|
|
762 |
this.inherited(arguments); |
763 |
|
741 |
// All display elements exist. Now we check what we have to display. |
764 |
// All display elements exist. Now we check what we have to display. |
742 |
// This is done by checking once for a running job (at the Python side) |
765 |
// This is done by checking once for a running job (at the Python side) |
743 |
// and setting the display accordingly. The polling loop itself will then |
766 |
// and setting the display accordingly. The polling loop itself will then |
744 |
// establish triggers that change display if the current job is finished. |
767 |
// establish triggers that change display if the current job is finished. |
745 |
this._job_polling_loop(true); |
768 |
this._job_polling_loop(true); |
746 |
|
|
|
747 |
this._page.startup(); // start event loop and data gathering |
748 |
|
769 |
|
749 |
} |
770 |
}, |
|
|
771 |
|
772 |
uninitialize: function() { |
773 |
|
774 |
this.inherited(arguments); |
775 |
this._refresh_time = 0; |
776 |
|
777 |
} |
778 |
|
750 |
}); |
779 |
}); |