View | Details | Raw Unified | Return to bug 40343
Collapse All | Expand All

(-)a/base/univention-updater/umc/js/updater/UpdatesPage.js (-82 / +10 lines)
 Lines 26-32    Link Here 
26
 * /usr/share/common-licenses/AGPL-3; if not, see
26
 * /usr/share/common-licenses/AGPL-3; if not, see
27
 * <http://www.gnu.org/licenses/>.
27
 * <http://www.gnu.org/licenses/>.
28
 */
28
 */
29
/*global define,console,setTimeout*/
29
/*global define,console*/
30
30
31
define([
31
define([
32
	"dojo/_base/declare",
32
	"dojo/_base/declare",
 Lines 37-46   define([ Link Here 
37
	"dojo/topic",
37
	"dojo/topic",
38
	"dojo/Deferred",
38
	"dojo/Deferred",
39
	"dojox/string/sprintf",
39
	"dojox/string/sprintf",
40
	"umc/dialog",
41
	"umc/app",
40
	"umc/app",
42
	"umc/tools",
41
	"umc/tools",
43
	"umc/store",
42
	"umc/store",
43
	"umc/modules/lib/server",
44
	"umc/widgets/TitlePane",
44
	"umc/widgets/TitlePane",
45
	"umc/widgets/Text",
45
	"umc/widgets/Text",
46
	"umc/widgets/HiddenInput",
46
	"umc/widgets/HiddenInput",
 Lines 48-57   define([ Link Here 
48
	"umc/modules/updater/Page",
48
	"umc/modules/updater/Page",
49
	"umc/modules/updater/Form",
49
	"umc/modules/updater/Form",
50
	"umc/i18n!umc/modules/updater"
50
	"umc/i18n!umc/modules/updater"
51
], function(declare, lang, array, all, domClass, topic, Deferred, sprintf, dialog, UMCApplication, tools, store, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
51
], function(declare, lang, array, all, domClass, topic, Deferred, sprintf, UMCApplication, tools, store, server, TitlePane, Text, HiddenInput, ComboBox, Page, Form, _) {
52
	return declare("umc.modules.updater.UpdatesPage", Page, {
52
	return declare("umc.modules.updater.UpdatesPage", Page, {
53
53
54
		_last_reboot: false,
55
		_update_prohibited: false,
54
		_update_prohibited: false,
56
		standby: null, // parents standby method must be passed. weird IE-Bug (#29587)
55
		standby: null, // parents standby method must be passed. weird IE-Bug (#29587)
57
		standbyDuring: null, // parents standby method must be passed. weird IE-Bug (#29587)
56
		standbyDuring: null, // parents standby method must be passed. weird IE-Bug (#29587)
 Lines 76-90   define([ Link Here 
76
					name: 'reboot_required'
75
					name: 'reboot_required'
77
				}, {
76
				}, {
78
					type: Text,
77
					type: Text,
79
					name: 'reboot_progress_text',
80
					label: '',
81
					size: 'Two',
82
					content: _("The computer is now rebooting. ") +
83
							_("This may take some time. Please be patient. ") +
84
							_("During reboot, the connection to the system will be lost. ") +
85
							_("When the connection is back you will be prompted to authenticate yourself again.")
86
				}, {
87
					type: Text,
88
					name: 'reboot_text',
78
					name: 'reboot_text',
89
					label: ' ',
79
					label: ' ',
90
					content: _("In order to complete the recently executed action, it is required to reboot the system."),
80
					content: _("In order to complete the recently executed action, it is required to reboot the system."),
 Lines 329-335   define([ Link Here 
329
				name: 'reboot',
319
				name: 'reboot',
330
				label: _("Reboot"),
320
				label: _("Reboot"),
331
				callback: lang.hitch(this, function() {
321
				callback: lang.hitch(this, function() {
332
					this._reboot();
322
					server.askReboot();
333
					topic.publish('/umc/actions', this.moduleID, this.moduleFlavor, 'reboot');
323
					topic.publish('/umc/actions', this.moduleID, this.moduleFlavor, 'reboot');
334
				}),
324
				}),
335
				style: 'margin:0',
325
				style: 'margin:0',
 Lines 349-355   define([ Link Here 
349
			var layout = [{
339
			var layout = [{
350
				label: _("Reboot required"),
340
				label: _("Reboot required"),
351
				layout: [
341
				layout: [
352
					['reboot_progress_text'],
353
					['reboot_text', 'reboot']
342
					['reboot_text', 'reboot']
354
				]
343
				]
355
			}, {
344
			}, {
 Lines 443-449   define([ Link Here 
443
					var ebu = this._form._buttons.easy_upgrade;
432
					var ebu = this._form._buttons.easy_upgrade;
444
					domClass.toggle(ebu.domNode, 'dijitHidden', ! ava);
433
					domClass.toggle(ebu.domNode, 'dijitHidden', ! ava);
445
434
446
					this._show_reboot_pane(values.reboot_required);
435
					this._show_reboot_pane(tools.isTrue(values.reboot_required));
447
436
448
				} catch(error) {
437
				} catch(error) {
449
					console.error("onLoaded: " + error.message);
438
					console.error("onLoaded: " + error.message);
 Lines 488-518   define([ Link Here 
488
477
489
		},
478
		},
490
479
491
		_attemptReconnect: function() {
492
			tools.umcpCommand('updater/poll', {}, false).then(
493
				lang.hitch(this, function() {
494
					this.onQuerySuccess('updater/poll');
495
					// most probably not restarted yet
496
					setTimeout(lang.hitch(this, function() {
497
						this._attemptReconnect();
498
					}), 5000);
499
				}),
500
				lang.hitch(this, function(data) {
501
					var result = tools.parseError(data);
502
					if (result.status == 401) {
503
						// to reset this._updates_available
504
						// see this._check_dist_upgrade()
505
						this.refreshPage(true);
506
					} else {
507
						setTimeout(lang.hitch(this, function() {
508
							this._attemptReconnect();
509
						}), 5000);
510
					}
511
					this.onQueryError('updater/poll', data);
512
				})
513
			);
514
		},
515
516
		_get_errata_link: function(version) {
480
		_get_errata_link: function(version) {
517
			var versionWithoutPatchlevel;
481
			var versionWithoutPatchlevel;
518
			try {
482
			try {
 Lines 614-668   define([ Link Here 
614
			}
578
			}
615
		},
579
		},
616
580
617
		// Switches visibility of the reboot pane on or off. Second arg 'inprogress'
581
		// Switches visibility of the reboot pane on or off
618
		// switches between 'affordance to reboot' (progress=false) and
582
		_show_reboot_pane: function(yes) {
619
		// 'reboot in progress' (progress=true).
583
			domClass.toggle(this._titlepanes.reboot.domNode, 'dijitHidden', !yes);
620
		//
621
		_show_reboot_pane: function(yes, progress) {
622
623
			if (typeof(yes) == 'string') {
624
				yes = (yes == 'true');
625
			}
626
627
			// pop a message up whenever the 'on' value changes
628
			if (yes != this._last_reboot) {
629
				this._last_reboot = yes;
630
			}
631
632
			domClass.toggle(this._titlepanes.reboot.domNode, 'dijitHidden', ! yes);
633
584
634
			if (yes) {
585
			if (yes) {
635
				if (progress === undefined) {
586
				this._form.showWidget('reboot_text', yes);
636
					progress = false;
637
				}
638
				this._form.showWidget('reboot_text', ! progress);
639
				this._form.showWidget('reboot_progress_text', progress);
640
587
641
				var but = this._form._buttons.reboot;
588
				var but = this._form._buttons.reboot;
642
				domClass.toggle(but.domNode, 'dijitHidden', progress);
589
				domClass.toggle(but.domNode, 'dijitHidden', false);
643
			}
590
			}
644
591
645
		},
592
		},
646
593
647
		// called when the 'reboot' button is pressed.
648
		// now with confirmation that doesn't depend on the 'confirmations' setting.
649
		_reboot: function() {
650
651
			dialog.confirm(_("Do you really want to reboot the machine?"), [{
652
				label: _("Cancel"),
653
				'default': true
654
			}, {
655
				label: _("Reboot"),
656
				callback: lang.hitch(this, function() {
657
					this.standbyDuring(tools.umcpCommand('updater/installer/reboot').then(lang.hitch(this, function() {
658
						this._show_reboot_pane(true, true);
659
						this._attemptReconnect();
660
					})));
661
				})
662
			}]);
663
664
		},
665
666
		// First page refresh doesn't work properly when invoked in 'buildRendering()' so
594
		// First page refresh doesn't work properly when invoked in 'buildRendering()' so
667
		// we defer it until the UI is being shown
595
		// we defer it until the UI is being shown
668
		startup: function() {
596
		startup: function() {

Return to bug 40343