Univention Bugzilla – Attachment 3605 Details for
Bug 23701
UMC-Join-Modul: Anpassungen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch behebt restliche QA-Mängel
univention-management-console-module-join-2011-10-06.patch (text/plain), 35.53 KB, created by
Frank Greif
on 2011-10-06 11:09 CEST
(
hide
)
Description:
Patch behebt restliche QA-Mängel
Filename:
MIME Type:
Creator:
Frank Greif
Created:
2011-10-06 11:09 CEST
Size:
35.53 KB
patch
obsolete
>Index: umc/python/join/de.po >=================================================================== >--- umc/python/join/de.po (revision 3554) >+++ umc/python/join/de.po (working copy) >@@ -4,7 +4,7 @@ > msgstr "" > "Project-Id-Version: univention-management-console-module-join\n" > "Report-Msgid-Bugs-To: packages@univention.de\n" >-"POT-Creation-Date: 2011-09-20 12:07+0200\n" >+"POT-Creation-Date: 2011-10-06 10:49+0200\n" > "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" > "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" > "Language-Team: LANGUAGE <LL@li.org>\n" >@@ -13,31 +13,31 @@ > "Content-Type: text/plain; charset=UTF-8\n" > "Content-Transfer-Encoding: 8bit\n" > >-#: umc/python/join/__init__.py:213 >+#: umc/python/join/__init__.py:273 > msgid "Another join operation is in progress" > msgstr "Es wird gerade eine andere Join Operation ausgeführt" > >-#: umc/python/join/__init__.py:408 >+#: umc/python/join/__init__.py:462 > #, python-format > msgid "Removing temp file: %s" > msgstr "Lösche temporäre Datei: " > >-#: umc/python/join/__init__.py:327 >+#: umc/python/join/__init__.py:386 > msgid "due" > msgstr "fällig" > >-#: umc/python/join/__init__.py:353 >+#: umc/python/join/__init__.py:410 > msgid "never run" > msgstr "noch nie ausgeführt" > >-#: umc/python/join/__init__.py:336 >+#: umc/python/join/__init__.py:394 > msgid "not installed" > msgstr "nicht installiert" > >-#: umc/python/join/__init__.py:326 umc/python/join/__init__.py:355 >+#: umc/python/join/__init__.py:385 umc/python/join/__init__.py:411 > msgid "run" > msgstr "ausführen" > >-#: umc/python/join/__init__.py:329 >+#: umc/python/join/__init__.py:388 > msgid "successful" > msgstr "erfolgreich" >Index: umc/python/join/__init__.py >=================================================================== >--- umc/python/join/__init__.py (revision 3554) >+++ umc/python/join/__init__.py (working copy) >@@ -38,7 +38,7 @@ > > import re > from os import stat,listdir,chmod,unlink,path >-from locale import nl_langinfo,D_T_FMT >+from locale import nl_langinfo,D_T_FMT,getlocale,setlocale,LC_ALL > from time import strftime,localtime,sleep > from string import join > from subprocess import Popen >@@ -51,8 +51,6 @@ > class Instance(umcm.Base): > def init(self): > MODULE.warn("Initializing 'join' module with LANG = '%s'" % self.locale) >- global _ >- _ = umc.Translation('univention-management-console-module-join',self.locale).translate > > # some constants > self._instdir = '/usr/lib/univention-install' # where to find *.inst files >@@ -69,7 +67,7 @@ > self._process = None > > def query(self,request): >- """Dispatcher for different query scopes.""" >+ """ Query to fill the scripts grid. """ > # ----------- DEBUG ----------------- > MODULE.info("join/query invoked with:") > MODULE.info(" << LANG = '%s'" % self.locale) >@@ -78,37 +76,99 @@ > for s in st: > MODULE.info(" << %s" % s) > # ----------------------------------- >- result = [] >- # please don't bite me, rather tell me how to write a 'case' in Python >- scope = request.options.get('scope','') >- # list join scripts and their status >- if scope == 'scripts': >- result = self._scripts() >- request.status = SUCCESS >- # list join log (or log file stamp, for tail-like display) >- elif scope == 'logview': >- # let it fail if arg is not numerical >- result = self._logview(int(request.options.get('count',10))) >- request.status = SUCCESS >- # ask for the join date (file timestamp of the 'joined' status file) >- elif scope == 'joined': >- result = self._joined() >- request.status = SUCCESS >- # check if a subprocess is running >- elif scope == 'running': >- result = self._running() >- request.status = SUCCESS >- else: >- request.status = FAILURE >+ result = self._scripts() >+ request.status = SUCCESS > >- # PURE DEBUG: print all that we'll return >+ # ---------- DEBUG -------------- >+ MODULE.info("join/query returns:") > pp = pprint.PrettyPrinter(indent=4) > st = pp.pformat(result).split("\n") > for s in st: > MODULE.info(" >> %s" % s) >+ # -------------------------------- > > self.finished(request.id,result) >+ >+ def joined(self,request): >+ """ returns the (localized) join date/time or >+ the empty string. >+ """ >+ # ----------- DEBUG ----------------- >+ MODULE.info("join/joined invoked with:") >+ MODULE.info(" << LANG = '%s'" % self.locale) >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(request.options).split("\n") >+ for s in st: >+ MODULE.info(" << %s" % s) >+ # ----------------------------------- >+ >+ result = self._joined() >+ request.status = SUCCESS >+ >+ # ---------- DEBUG -------------- >+ MODULE.info("join/joined returns:") >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(result).split("\n") >+ for s in st: >+ MODULE.info(" >> %s" % s) >+ # -------------------------------- > >+ self.finished(request.id,result) >+ >+ def running(self,request): >+ """ returns true if a join script is running. >+ """ >+ # ----------- DEBUG ----------------- >+ MODULE.info("join/running invoked with:") >+ MODULE.info(" << LANG = '%s'" % self.locale) >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(request.options).split("\n") >+ for s in st: >+ MODULE.info(" << %s" % s) >+ # ----------------------------------- >+ >+ result = self._running() >+ request.status = SUCCESS >+ >+ # ---------- DEBUG -------------- >+ MODULE.info("join/running returns:") >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(result).split("\n") >+ for s in st: >+ MODULE.info(" >> %s" % s) >+ # -------------------------------- >+ >+ self.finished(request.id,result) >+ >+ def logview(self,request): >+ """ Frontend to the _logview() function: returns >+ either the timestamp of the log file or >+ some log lines. >+ """ >+ # ----------- DEBUG ----------------- >+ MODULE.info("join/logview invoked with:") >+ MODULE.info(" << LANG = '%s'" % self.locale) >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(request.options).split("\n") >+ for s in st: >+ MODULE.info(" << %s" % s) >+ # ----------------------------------- >+ >+ result = self._logview(int(request.options.get('count',10))) >+ request.status = SUCCESS >+ >+ # ---------- DEBUG -------------- >+ # TODO: We should not repeat the whole log into >+ # the module log file! >+ MODULE.info("join/logview returns:") >+ pp = pprint.PrettyPrinter(indent=4) >+ st = pp.pformat(result).split("\n") >+ for s in st: >+ MODULE.info(" >> %s" % s) >+ # -------------------------------- >+ >+ self.finished(request.id,result) >+ > def join(self,request): > """runs the 'univention-join' script for a unjoined system with > the given arguments.""" >@@ -322,19 +382,16 @@ > next # ... ignore this entry > files[fname]['last'] = version > if files[fname]['last'] < files[fname]['current']: >- files[fname]['icon'] = 'join-run' > files[fname]['action'] = _('run') > files[fname]['status'] = _('due') > else: > files[fname]['status'] = _('successful') >- files[fname]['icon'] = 'join-success' > files[fname]['action'] = '' > else: > MODULE.warn(" Script '%s' has no package" % fname) > e = {} > e['script'] = fname > e['status'] = _('not installed') >- e['icon'] = 'join-error' > e['last'] = version > files[fname] = e > except Exception,ex: >@@ -351,15 +408,12 @@ > entry['last'] = '--' > if 'current' in entry: > entry['status'] = _('never run') >- entry['icon'] = 'join-run' > entry['action'] = _('run') > # to avoid double expressions in the JS code, checking for > # definedness and non-emptiness of strings: We set all empty > # properties to the empty string. > if not 'action' in entry: > entry['action'] = '' >- if not 'icon' in entry: >- entry['icon'] = '' > # Return only entries that have a 'current' property. > if 'current' in entry: > result.append(entry) >Index: umc/js/de.po >=================================================================== >--- umc/js/de.po (revision 3554) >+++ umc/js/de.po (working copy) >@@ -1,10 +1,9 @@ > # This file is auto-generated by the dh-umc tools and should not be edited! >-#, fuzzy > msgid "" > msgstr "" > "Project-Id-Version: univention-management-console-module-join\n" > "Report-Msgid-Bugs-To: packages@univention.de\n" >-"POT-Creation-Date: 2011-08-30 18:03+0200\n" >+"POT-Creation-Date: 2011-10-05 18:14+0200\n" > "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" > "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" > "Language-Team: LANGUAGE <LL@li.org>\n" >@@ -13,92 +12,104 @@ > "Content-Type: text/plain; charset=UTF-8\n" > "Content-Transfer-Encoding: 8bit\n" > >-#: umc/js/join.js:396 >-#, fuzzy, python-format >+#: umc/js/join.js:433 >+#, python-format > msgid "%d join scripts are currently running" > msgstr "Momentan werden %d Skripte ausgeführt." > >-#: umc/js/join.js:357 >+#: umc/js/join.js:377 > #, python-format >-msgid "%d scripts are due to be run" >+msgid "%d scripts are due to be run." > msgstr "Insgesamt können %d Skripte ausgeführt werden." > >-#: umc/js/join.js:348 >+#: umc/js/join.js:368 > #, python-format > msgid "%d scripts selected" > msgstr "%d Skripte ausgewählt" > >-#: umc/js/join.js:597 >+#: umc/js/join.js:614 > msgid "... loading log ..." > msgstr "... Protokoll wird geladen ..." > >-#: umc/js/join.js:347 >+#: umc/js/join.js:367 > msgid "1 script selected" > msgstr "1 Skript ausgewählt" > >-#: umc/js/join.js:479 >-msgid "Action" >-msgstr "Aktion" >- >-#: umc/js/join.js:404 umc/js/join.js:696 >+#: umc/js/join.js:442 umc/js/join.js:711 > msgid "Can't start join: " > msgstr "Kann Join-Prozess nicht starten: " > >-#: umc/js/join.js:428 >-#, fuzzy >+#: umc/js/join.js:466 > msgid "Current status" > msgstr "Aktueller Status" > >-#: umc/js/join.js:455 >-msgid "Current version" >-msgstr "Aktuelle Version" >+#: umc/js/join.js:510 >+msgid "Current<br/>version" >+msgstr "Aktuelle<br/>Version" > >-#: umc/js/join.js:258 >+#: umc/js/join.js:265 > msgid "" > "Currently some join scripts are running. You may watch the log file until " > "they are finished." > msgstr "" >+"Momentan werden Join-Skripte abgearbeitet. Sie können den Fortschritt im Log-" >+"File verfolgen, bis der Vorgang abgeschlossen ist." > >-#: umc/js/join.js:720 >+#: umc/js/join.js:735 > msgid "DC Hostname" > msgstr "Name des Domaincontroller-Computers" > >-#: umc/js/join.js:161 umc/js/join.js:164 >+#: umc/js/join.js:482 >+msgid "Execute" >+msgstr "Ausführen" >+ >+#: umc/js/join.js:483 >+msgid "Execute this join script" >+msgstr "Diesen Join-Skript ausführen" >+ >+#: umc/js/join.js:165 > msgid "Join Protocol" > msgstr "Protokoll aller Join-Skripte" > >-#: umc/js/join.js:421 >+#: umc/js/join.js:459 > msgid "Join status" > msgstr "Join-Status" > >-#: umc/js/join.js:363 >+#: umc/js/join.js:389 > msgid "Join status ok, nothing to do." > msgstr "" > "Domänenbeitritt ist komplett; es sind keine Skripte übrig, die ausgeführt " > "werden müÃten." > >-#: umc/js/join.js:462 >-msgid "Last version" >-msgstr "Letzte Version" >+#: umc/js/join.js:517 >+msgid "Last<br/>version" >+msgstr "Letzte<br/>Version" > >-#: umc/js/join.js:456 >+#: umc/js/join.js:511 > msgid "Latest script version ready for execution" > msgstr "Neuester Skript, der ausgeführt werden kann" > >-#: umc/js/join.js:463 >+#: umc/js/join.js:518 > msgid "Latest script version that was executed successfully" > msgstr "Letzter Skript, der erfolgreich ausgeführt wurde" > >-#: umc/js/join.js:734 >+#: umc/js/join.js:429 >+msgid "One join script is currently running" >+msgstr "Ein Skript wird momentan ausgeführt." >+ >+#: umc/js/join.js:380 >+msgid "One script is due to be run." >+msgstr "Ein Skript steht zur Ausführung an." >+ >+#: umc/js/join.js:749 > msgid "Password" > msgstr "Passwort" > >-#: umc/js/join.js:735 >+#: umc/js/join.js:750 > msgid "Password of the Domain Administrator" > msgstr "Passwort des Domänen-Administrators" > >-#: umc/js/join.js:714 >-#, fuzzy >+#: umc/js/join.js:729 > msgid "" > "Please enter the required information below and click the 'Start Join' " > "button. This will join your system into the domain." >@@ -107,40 +118,35 @@ > "auf den Knopf 'Domänenbeitritt starten'. Dies gliedert Ihr System in die " > "Domäne ein." > >-#: umc/js/join.js:480 >-msgid "Run this script if it's due or never run" >-msgstr "" >- >-#: umc/js/join.js:448 >+#: umc/js/join.js:503 > msgid "Script (package)" > msgstr "Skript (Paket)" > >-#: umc/js/join.js:449 >+#: umc/js/join.js:504 > msgid "Script name (the same as the package it belongs to)" > msgstr "Skriptname (benannt nach dem Paket, zu dem er gehört)" > >-#: umc/js/join.js:683 >+#: umc/js/join.js:697 > msgid "Start Join" > msgstr "Domänenbeitritt starten" > >-#: umc/js/join.js:470 >+#: umc/js/join.js:525 > msgid "State" > msgstr "Status" > >-#: umc/js/join.js:471 >+#: umc/js/join.js:526 > msgid "Status of this package" > msgstr "Status dieses Paketes" > >-#: umc/js/join.js:721 >+#: umc/js/join.js:736 > msgid "The hostname of the DC Master of the domain" > msgstr "Der Computername des Master-Domaincontrollers der Domäne" > >-#: umc/js/join.js:728 >-#, fuzzy >+#: umc/js/join.js:743 > msgid "The username of the Domain Administrator" >-msgstr "Passwort des Domänen-Administrators" >+msgstr "Nutzername des Domänen-Administrators" > >-#: umc/js/join.js:422 >+#: umc/js/join.js:460 > msgid "" > "This page shows the status of all available join scripts on this system, " > "along with all join-related actions (run selected or all join scripts, or " >@@ -158,35 +164,30 @@ > msgid "This system joined on %s" > msgstr "Dieses System ist der Domäne am %s beigetreten." > >-#: umc/js/join.js:727 >+#: umc/js/join.js:742 > msgid "Username" > msgstr "Nutzername" > >-#: umc/js/join.js:617 >+#: umc/js/join.js:634 > msgid "hide log" > msgstr "Protokoll ausblenden" > > #: umc/js/join.js:169 >-#, fuzzy > msgid "last {logcount} lines" > msgstr "letzte {logcount} Zeilen" > >-#: umc/js/join.js:358 >+#: umc/js/join.js:384 > msgid "run all" > msgstr "Alle Skripte ausführen" > >-#: umc/js/join.js:350 >+#: umc/js/join.js:370 > msgid "run selected scripts" > msgstr "Ausgewählte Skripte ausführen" > >-#: umc/js/join.js:624 >-#, fuzzy >+#: umc/js/join.js:641 > msgid "show all" > msgstr "Gesamtes Protokoll zeigen" > >-#: umc/js/join.js:609 >+#: umc/js/join.js:626 > msgid "show log" > msgstr "Protokoll einblenden" >- >-#~ msgid "Run this script" >-#~ msgstr "Diesen Skript ausführen" >Index: umc/js/join.js >=================================================================== >--- umc/js/join.js (revision 3554) >+++ umc/js/join.js (working copy) >@@ -13,8 +13,9 @@ > dojo.require("umc.widgets.ContainerForm"); > dojo.require("umc.widgets.Grid"); > dojo.require("umc.widgets.TabbedModule"); >+dojo.require("umc.widgets.StandbyMixin"); >+dojo.require("umc.modules._join.Form"); > dojo.require("dojox.string.sprintf"); >-dojo.require("dojox.layout.TableContainer"); > > // Inheriting from umc.widgets.TabbedModule so any pages being added > // will become tabs automatically. >@@ -22,7 +23,7 @@ > > _page: null, // umc.widgets.Page > _content: null, // umc.widgets.ExpandingTitlePane >- _split: null, // dijit.layout.BorderContainer >+// _split: null, // dijit.layout.BorderContainer > _grid: null, // umc.widgets.Grid > _infotext: null, > >@@ -48,7 +49,7 @@ > _job_running: false, // true while scripts are running > _polling_time: 1000, // once per second > >- _grid_query: {scope: 'scripts'}, >+ _grid_query: {'*': '*'}, // all? > > idProperty: 'script', // doesn't help with the sorting problem of selected rows > i18nClass: 'umc.modules.join', >@@ -60,7 +61,7 @@ > _switch_log_display: function(code) { > if (code == 'hide') > { >- this._split.removeChild(this._logview); >+ this._content.removeChild(this._logview); > this._bottom.addChild(this._b_show); > this._bottom.removeChild(this._b_hide); > this._bottom.removeChild(this._b_full); >@@ -86,7 +87,7 @@ > this._refresh_log(true); > this._bottom.addChild(this._b_hide); > this._bottom.addChild(this._b_full); >- this._split.addChild(this._logview); >+ this._content.addChild(this._logview); > this._logview.addChild(this._logtext); > } > >@@ -96,9 +97,8 @@ > > // gets the current join status and switches display mode if needed. > _check_join_status: function() { >- this.moduleStore.query({ >- scope: 'joined' >- }).then(dojo.hitch(this, function(result) { >+ this.umcpCommand('join/joined').then(dojo.hitch(this, function(data) { >+ var result = data.result; > if (result != this._joined) > { > this._joined = result; >@@ -106,19 +106,23 @@ > { > // show grid with join status, else.... > this._infotext.set('content',this._("This system joined on %s",result)); >- this._split.removeChild(this._joinpane); >- this._split.addChild(this._grid); >+ this._content.removeChild(this._joinpane); >+ this._content.addChild(this._grid); > this._reload_grid(); // force grid reload > } > else > { > // show affordance to join, nothing more. > this._infotext.set('content',this._("This system has not been joined yet.")); >- this._split.removeChild(this._grid); >- this._split.addChild(this._joinpane); >+ this._content.removeChild(this._grid); >+ this._content.addChild(this._joinpane); > } > } >- })); >+ }), >+ dojo.hitch(this, function(result) { >+ console.error("check_join_status ERROR " + result.message); >+ }) >+ ); > }, > > // Asynchronously invokes reload of the log lines display. Before fetching real data, >@@ -131,10 +135,10 @@ > } > else > { >- this.moduleStore.query({ >- scope: 'logview', >+ this.umcpCommand('join/logview',{ > count: -1 // returns timestamp of log file >- }).then(dojo.hitch(this,function(result) { >+ }).then(dojo.hitch(this,function(data) { >+ var result = data.result; > if (result != this._log_stamp) > { > this._log_stamp = result; // yes I know, I should do that after it was reloaded >@@ -154,16 +158,12 @@ > // log really changed. > _fetch_log_text: function() { > // now really fetch log file contents. >- this.moduleStore.query({ >- scope: 'logview', >+ this.umcpCommand('join/logview',{ > count: this._logcount >- }).then(dojo.hitch(this,function(result) { >+ }).then(dojo.hitch(this,function(data) { >+ var result = data.result; > var txt = dojox.string.sprintf("<u><b>%s</b></u><br/>\n",this._("Join Protocol")); > >- // this is for debugging so we can see the refresh >- //var txt = dojox.string.sprintf("<u><b>%s [%d]</b></u><br/>\n",this._("Join Protocol"),this._proto_gen); >- //this._proto_gen++; >- > if (this._logcount) > { > var tmp = this._("last {logcount} lines"); >@@ -188,7 +188,9 @@ > // Establish refresh every second. We keep the last instance of our 'Deferred' > // as an instance member this._refresh_job, thus avoiding to have more than one > // refresh running at any time. >- if (! this._refresh_job) >+ // >+ // Added here: if this._refresh_time is set to zero we stop the timer. >+ if ((! this._refresh_job) && (this._refresh_time)) > { > var deferred = new dojo.Deferred(); > this._refresh_job = deferred; >@@ -236,30 +238,45 @@ > { > // this query returns false as soon as the scripts are finished, and this > // will avoid scheduling any new polling cycle. >- this.moduleStore.query({ >- scope: 'running' >- }).then(dojo.hitch(this, function(result) { >- if (result != this._job_running) >+ this.umcpCommand('join/running').then(dojo.hitch(this, function(data) { >+ try > { >- this._job_running = result; >- this._check_join_status(); // switch between join form and script grid >- this._reload_grid(); // redo the status query for the grid, effectively triggering >- // _check_grid_status() on 'fetchComplete' >- } >- // for first display: if none of the two widgets (script grid or join form) >- // is displayed AND we run into a running job we have to do two things: >- // (1) show a header text that explains the situation >- // (2) switch log display on. >- if (this._job_running) >- { >- var txt = this._infotext.get('content'); >- if (txt == '') >+ var result = data.result; >+ if (result != this._job_running) > { >- this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); >- this._switch_log_display('show'); >+ this._job_running = result; >+ if (! result) >+ { >+ this._joinform.standby(false); >+ } >+ this._check_join_status(); // switch between join form and script grid >+ this._reload_grid(); // redo the status query for the grid, effectively triggering >+ // _check_grid_status() on 'fetchComplete' > } >+ // for first display: if none of the two widgets (script grid or join form) >+ // is displayed AND we run into a running job we have to do two things: >+ // (1) show a header text that explains the situation >+ // (2) switch log display on. >+ if (this._job_running) >+ { >+ var txt = this._infotext.get('content'); >+ if (txt == '') >+ { >+ this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); >+ this._switch_log_display('show'); >+ } >+ } > } >- })); >+ catch(error) >+ { >+ console.error('job_polling_loop ERROR: ' + error.message); >+ } >+ }), >+ dojo.hitch(this, function(result) { >+ this._joinform.standby(false); >+ this._grid.standby(false); >+ }) >+ ); > > // We should have exactly one such job. If one is underway, we don't > // step on its feet. Otherwise, we start a new one. >@@ -293,77 +310,91 @@ > > _check_grid_status: function() { > >- // While a job is running the grid is in standby() nevertheless, so it won't >- // make sense to refresh it. >- if (this._job_running) >+ try > { >- return; >- } >- >- var runnable = 0; >- var selected = 0; >- this._runnables = []; >- var dup = {}; > >- for (var rowIndex=0; rowIndex < this._grid._grid.attr("rowCount"); rowIndex++) >- { >- var row = this._grid.getRowValues(rowIndex); >- >- // check against bug that duplicates data starting from the 26th row >- var fn = row['script']; >- if (typeof(dup[fn]) != 'undefined') >+ // While a job is running the grid is in standby() nevertheless, so it won't >+ // make sense to refresh it. >+ if (this._job_running) > { >- this._reload_grid(); > return; > } >- dup[fn] = 1; >+ >+ var runnable = 0; >+ var selected = 0; >+ this._runnables = []; >+ var dup = {}; > >- var allow = false; >- if (row['action'] != '') >+ for (var rowIndex=0; rowIndex < this._grid._grid.attr("rowCount"); rowIndex++) > { >- runnable++; >- allow = true; >- this._runnables.push(row['script']); >- } >- if (this._grid._grid.selection.selected[rowIndex]) >- { >- if (allow) >+ var row = this._grid.getRowValues(rowIndex); >+ >+ // check against bug that duplicates data starting from the 26th row >+ var fn = row['script']; >+ if (typeof(dup[fn]) != 'undefined') > { >- selected++; >+ this._reload_grid(); >+ return; > } >- else >+ dup[fn] = 1; >+ >+ var allow = false; >+ if (row['action'] != '') > { >- // Work around bug in the Grid base class: the 'select all' checkbox >- // happily selects all rows, even if some of them are disabled! >- this._grid._grid.rowSelectCell.toggleRow(rowIndex, false); >+ runnable++; >+ allow = true; >+ this._runnables.push(row['script']); > } >+ if (this._grid._grid.selection.selected[rowIndex]) >+ { >+ if (allow) >+ { >+ selected++; >+ } >+ else >+ { >+ // Work around bug in the Grid base class: the 'select all' checkbox >+ // happily selects all rows, even if some of them are disabled! >+ this._grid._grid.rowSelectCell.toggleRow(rowIndex, false); >+ } >+ } >+ this._grid._grid.rowSelectCell.setDisabled(rowIndex, ! allow); >+ > } >- this._grid._grid.rowSelectCell.setDisabled(rowIndex, ! allow); >- >- } >- if (selected) >- { >- var txt = (selected==1)? >- this._('1 script selected'): >- this._('%d scripts selected',selected); >- this._footers[0].set('content',txt); >- this._multi_action.set('label',this._('run selected scripts')); >- this._footers[1].addChild(this._multi_action); >- } >- else >- { >- if (runnable) >+ if (selected) > { >- this._footers[0].set('content',this._('%d scripts are due to be run',runnable)); >- this._multi_action.set('label',this._('run all')); >+ var txt = (selected==1)? >+ this._('1 script selected'): >+ this._('%d scripts selected',selected); >+ this._footers[0].set('content',txt); >+ this._multi_action.set('label',this._('run selected scripts')); > this._footers[1].addChild(this._multi_action); > } > else > { >- this._footers[0].set('content',this._('Join status ok, nothing to do.')); >- this._footers[1].removeChild(this._multi_action); >+ if (runnable) >+ { >+ var due = this._('%d scripts are due to be run.',runnable); >+ if (runnable == 1) >+ { >+ due = this._("One script is due to be run."); >+ } >+ this._footers[0].set('content',due); >+ >+ this._multi_action.set('label',this._('run all')); >+ this._footers[1].addChild(this._multi_action); >+ } >+ else >+ { >+ this._footers[0].set('content',this._('Join status ok, nothing to do.')); >+ this._footers[1].removeChild(this._multi_action); >+ } > } > } >+ catch(error) >+ { >+ console.error("check grid status: " + error.message); >+ } > }, > > // Asynchronously runs the selected script(s). >@@ -393,7 +424,14 @@ > { > this._job_running = true; > >- this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); >+ if (list.length == 1) >+ { >+ this._footers[0].set('content',this._("One join script is currently running")); >+ } >+ else >+ { >+ this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); >+ } > this._footers[1].removeChild(this._multi_action); > > this.umcpCommand('join/run',{scripts: list}).then(dojo.hitch(this, function(data) { >@@ -432,37 +470,54 @@ > // Trying to give the user a chance to resize the grid <-> logview ratio. > // Even a simple BorderContainer is able to do that: just give some of its > // children a 'splitter: true' property. >- this._split = new dijit.layout.BorderContainer({ >- }); >- this._content.addChild(this._split); > > this._grid = new umc.widgets.Grid({ > region: 'center', >- moduleStore: this.moduleStore, >- //query: {scope: 'scripts'}, >- actions: {}, >+ moduleStore: umc.store.getModuleStore('script','join/scripts'), >+ // query: this._grid_query, // why? >+ actions: >+ [ >+ { >+ name: 'run', >+ label: this._( 'Execute' ), >+ description: this._( 'Execute this join script' ), >+ isContextAction: true, >+ isStandardAction: true, >+ canExecute: dojo.hitch(this, function(values) { >+ // Knowledge is in the Python module! >+ return (values['action'] != ''); >+ }), >+ callback: dojo.hitch(this, function(id) { >+ if (dojo.isArray(id)) >+ { >+ id = id[0]; >+ } >+ this._run_scripts([id]); >+ }) >+ } >+ ], > columns: > [ > { > name: 'script', > label: this._("Script (package)"), > description: this._("Script name (the same as the package it belongs to)"), >- editable: false, >- width: '40%' >+ editable: false >+// width: '50%' > }, > { > name: 'current', >- label: this._("Current version"), >+ label: this._("Current<br/>version"), > description: this._("Latest script version ready for execution"), > editable: false, >- width: '14%' >+ width: 'adjust' > }, > { > name: 'last', >- label: this._("Last version"), >+ label: this._("Last<br/>version"), > description: this._("Latest script version that was executed successfully"), > editable: false, >- width: '14%' >+ width: 'adjust' > }, > // Status column. Currently only text. > { >@@ -470,45 +525,7 @@ > label: this._("State"), > description: this._("Status of this package"), > editable: false, >- width: '12%' >- // iconField: 'icon' // deactivated (for now) >- }, >- // Action field >- { >- name: 'action', >- label: this._("Action"), >- description: this._("Run this script if it's due or never run"), >- sortable: false, >- editable: false, >- width: '10%', >- // We turn the value of the field into an action button that will >- // invoke the script named by the 'script' field of this row >- formatter: dojo.hitch(this, function(key, rowIndex) { >- // key = the value of the field, in our case empty or 'run' >- // rowIndex = needed to retrieve the script name >- try >- { >- if (key != '') >- { >- var tmp = this._grid.getRowValues(rowIndex); >- var script = tmp.script; >- return new umc.widgets.Button({ >- label: key, >- // FIXME style this button by a reasonable CSS class or such. >- style: 'border:outset 1px;background-color:#A0A0A0;margin:0px;padding:0px;', >- //'class': 'umcSubmitButton', // doesn't work, unfortunately. >- onClick: dojo.hitch(this, function() { >- this._run_scripts([script]); >- }) >- }); >- } >- return ''; >- } >- catch(err) >- { >- return ''; >- } >- }) >+ width: '14%' > } > ] > }); >@@ -655,11 +672,11 @@ > scrollable: false, > style: 'border:none;' > }); >- this._split.addChild(info); >+ this._content.addChild(info); > > this._infotext = new umc.widgets.Text({ > style: 'border:none;margin:.2em;', >- content: '', >+ content: '' > }); > info.addChild(this._infotext); > >@@ -668,83 +685,95 @@ > // password and for starting the join process. This form is prepared here and stored > // into the this._joinpane variable. The _check_join_status() method will decide > // which view is to show. >- this._joinpane = new dojox.layout.TableContainer({ >+ this._joinpane = new umc.widgets.ContainerWidget({ > region: 'center', >- cols: 1, >- style: 'width:50%;', >- showLabels: false >+ scrollable: true > }); >- this._joinform = new umc.widgets.Form({ >- scrollable: true, >- buttons: >- [ >- { >- type: 'submit', >- label: this._("Start Join"), >- onClick: dojo.hitch(this, function() { >- //this._joinform.standby(true); >- this._switch_log_display('show'); >- this.umcpCommand('join/join',{ >- host: this._joinform._widgets['host'].value, >- user: this._joinform._widgets['user'].value, >- pass: this._joinform._widgets['pass'].value >- }).then(dojo.hitch(this, function(data) { >- var result = dojo.getObject('result', false, data); >- if (result != '') >- { >- // Note result is already localized >- umc.dialog.alert(this._("Can't start join: ") + result); >- this._check_join_status(); // sets meaningful messages >- } >- else >- { >- // Job is started. Now wait for its completion. >- this._job_polling_loop(true); >- } >- })); >- }) >- } >- ], >- widgets: >- [ >- { >- type: 'Text', >- name: 'text', >- style: 'margin-top:1em;margin-bottom:1em;', >- content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") >- }, >- { >- type: 'TextBox', >- name: 'host', >- value: '', >- label: this._('DC Hostname'), >- description: this._('The hostname of the DC Master of the domain') >- }, >- { >- type: 'TextBox', >- name: 'user', >- value: 'Administrator', >- label: this._('Username'), >- description: this._('The username of the Domain Administrator') >- }, >- { >- type: 'PasswordBox', >- name: 'pass', >- value: '', >- label: this._( 'Password' ), >- description: this._( 'Password of the Domain Administrator' ) >- } >- ] >+ var buttons = >+ [ >+ { >+ type: 'submit', >+ 'default': true, >+ label: this._("Start Join"), >+ onClick: dojo.hitch(this, function() { >+ this._joinform.standby(true); >+ this._switch_log_display('show'); >+ this.umcpCommand('join/join',{ >+ host: this._joinform._widgets['host'].value, >+ user: this._joinform._widgets['user'].value, >+ pass: this._joinform._widgets['pass'].value >+ }).then(dojo.hitch(this, function(data) { >+ var result = dojo.getObject('result', false, data); >+ if (result != '') >+ { >+ this._joinform.standby(false); >+ // Note result is already localized >+ umc.dialog.alert(this._("Can't start join: ") + result); >+ this._check_join_status(); // sets meaningful messages >+ } >+ else >+ { >+ // Job is started. Now wait for its completion. >+ this._job_polling_loop(true); >+ } >+ })); >+ }) >+ } >+ ]; >+ var widgets = >+ [ >+ { >+ type: 'Text', >+ name: 'text', >+ style: 'margin-top:1em;margin-bottom:1em;', >+ content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") >+ }, >+ { >+ type: 'TextBox', >+ name: 'host', >+ value: '', >+ label: this._('DC Hostname'), >+ description: this._('The hostname of the DC Master of the domain') >+ }, >+ { >+ type: 'TextBox', >+ name: 'user', >+ value: 'Administrator', >+ label: this._('Username'), >+ description: this._('The username of the Domain Administrator') >+ }, >+ { >+ type: 'PasswordBox', >+ name: 'pass', >+ value: '', >+ label: this._( 'Password' ), >+ description: this._( 'Password of the Domain Administrator' ) >+ } >+ ]; >+ this._joinform = new umc.modules._join.Form({ >+ buttons: buttons, >+ widgets: widgets > }); > this._joinpane.addChild(this._joinform); >+ }, >+ >+ startup: function() { > >+ this.inherited(arguments); >+ > // All display elements exist. Now we check what we have to display. > // This is done by checking once for a running job (at the Python side) > // and setting the display accordingly. The polling loop itself will then > // establish triggers that change display if the current job is finished. > this._job_polling_loop(true); >- >- this._page.startup(); // start event loop and data gathering > >- } >+ }, >+ >+ uninitialize: function() { >+ >+ this.inherited(arguments); >+ this._refresh_time = 0; >+ >+ } >+ > }); >Index: umc/join.xml >=================================================================== >--- umc/join.xml (revision 3554) >+++ umc/join.xml (working copy) >@@ -6,12 +6,21 @@ > <categories> > <category name="system"/> > </categories> >- <command name="join/query" function="query"> >- <attribute name="scope" syntax="Join-Query-Scope"/> >+ <!-- should be used only for the grid, so no arg is needed --> >+ <command name="join/scripts/query" function="query"> >+ <attribute name="script" syntax="String"/> > </command> >+ <!-- Status queries, distinct URLs now --> >+ <command name="join/logview" function="logview"> >+ <attribute name="count" syntax="Integer"/> >+ </command> >+ <command name="join/joined" function="joined"/> >+ <command name="join/running" function="running"/> >+ <!-- run one or more script(s) --> > <command name="join/run" function="run"> > <attribute name="scripts" syntax="Join-Run-Scripts"/> > </command> >+ <!-- do a domain join --> > <command name="join/join" function="join"> > <attribute name="host" syntax="String"/> > <attribute name="user" syntax="String"/>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 23701
:
3566
|
3596
|
3597
| 3605