[yast-commit] r67412 - in /trunk/s390: package/yast2-s390.changes src/dasd/dialogs.ycp src/modules/DASDController.ycp src/modules/ZFCPController.ycp src/zfcp/dialogs.ycp

Author: aschnell Date: Fri Feb 10 15:02:29 2012 New Revision: 67412 URL: http://svn.opensuse.org/viewcvs/yast?rev=67412&view=rev Log: - use multiselection table in main dasd dialog - added quoting to program execution - changed initial filter_max to 0.0.ffff (recommended by Ihno) Modified: trunk/s390/package/yast2-s390.changes trunk/s390/src/dasd/dialogs.ycp trunk/s390/src/modules/DASDController.ycp trunk/s390/src/modules/ZFCPController.ycp trunk/s390/src/zfcp/dialogs.ycp Modified: trunk/s390/package/yast2-s390.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/package/yast2-s390.changes?r... ============================================================================== --- trunk/s390/package/yast2-s390.changes (original) +++ trunk/s390/package/yast2-s390.changes Fri Feb 10 15:02:29 2012 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Feb 10 14:59:45 CET 2012 - aschnell@suse.de + +- used multiselection table in main DASD dialog + +------------------------------------------------------------------- Wed Dec 7 10:04:50 UTC 2011 - coolo@suse.com - fix license to be in spdx.org format Modified: trunk/s390/src/dasd/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dasd/dialogs.ycp?rev=674... ============================================================================== --- trunk/s390/src/dasd/dialogs.ycp (original) +++ trunk/s390/src/dasd/dialogs.ycp Fri Feb 10 15:02:29 2012 @@ -22,28 +22,18 @@ include "s390/dasd/helps.ycp"; -/** - * List DASD devices that are currently being selected - * @return list<integer> list of IDs of selected DASD devices - */ -define list<integer> ListSelectedDASD () ``{ - map<integer, boolean> sel_list = (map<integer, boolean>)filter ( - integer k, boolean v, DASDController::selected, - ``( - v == true - )); - list<integer> to_activate = maplist (integer k, boolean v, sel_list, ``(k)); - y2milestone ("Selected list: %1", to_activate); - return to_activate; -} - - -// -------------------------------------------------------------------------- - - + /** + * List DASD devices that are currently being selected + * @return list<integer> list of IDs of selected DASD devices + */ + list<integer> ListSelectedDASD() + { + list<integer> selected = (list<integer>) UI::QueryWidget(`id(`table), `SelectedItems); + y2milestone("selected %1", selected); + return selected; + } -// now real dialogs /** * Read settings dialog @@ -92,10 +82,9 @@ { items = maplist(integer k, map<string, any> d, devices, { boolean active = d["resource", "io", 0, "active"]:false; - integer channel = d["resource", "io", 0, "start"]:0; - string str_channel = d["channel"]:""; + string channel = d["channel"]:""; string access = toupper(d["resource", "io", 0, "mode"]:"RO"); - string diag = String::YesNo(DASDController::diag[str_channel]:false); + string diag = String::YesNo(DASDController::diag[channel]:false); string device = d["dev_name"]:""; string type = toupper(sformat("%1/%2, %3/%4", substring(tohexstring(d["device_id"]:0 & 0xffff, 4), 2), @@ -107,11 +96,6 @@ string formatted = String::YesNo(d["formatted"]:false); string partition_info = d["partition_info"]:"--"; - string selected = DASDController::selected[k]:false - // table cell - ? _("Yes") - : "-"; - if (!active) { type = "--"; @@ -121,7 +105,7 @@ device = "--"; } - return `item(`id(k), selected, str_channel, device, type, access, diag, formatted, + return `item(`id(k), channel, device, type, access, diag, formatted, partition_info); }); } @@ -146,8 +130,6 @@ term header = `header( // table header - _("Sel."), - // table header `Right(_("Channel")), // table header _("Device"), @@ -201,7 +183,7 @@ `PushButton (`id (`filter), _("&Filter")) ) ), - `Table(`id(`table), `opt(`notify), header, []), + `Table(`id(`table), `opt(`multiSelection), header, []), Mode::config () ? `HBox ( // push button @@ -211,8 +193,6 @@ `HStretch () ) : `HBox ( - // pudh button - `PushButton (`id (`select), _("&Select or Deselect")), `HStretch (), // menu button `MenuButton (`id (`operation), _("Perform &Action"), actions) @@ -237,14 +217,17 @@ DASDController::filter_min = (string) UI::QueryWidget(`min_chan, `Value); DASDController::filter_max = (string) UI::QueryWidget(`max_chan, `Value); - DASDController::ProbeDisks (); + DASDController::ProbeDisks(); list<term> items = GetDASDDiskItems(); + list<integer> selected = (list<integer>) UI::QueryWidget(`id(`table), `SelectedItems); UI::ChangeWidget(`id(`table), `Items, items); - UI::SetFocus (`table); + UI::ChangeWidget(`id(`table), `SelectedItems, selected); + UI::SetFocus(`table); } + /** * Run the dialog for DASD disks configuration * @return symbol for wizard sequencer @@ -259,72 +242,53 @@ { ret = UI::UserInput(); - integer selected = (integer) UI::QueryWidget(`id(`table), `CurrentItem); - if (ret == `filter) { ReloadDASDDialog (); ret = nil; continue; } - else if (ret == `table || ret == `select) + else if (ret == `table) { - DASDController::selected[selected] - = ! DASDController::selected[selected]:false; - UI::ChangeWidget (`id (`table), `Item (selected, 0), - DASDController::selected[selected]:false - // table cell - ? _("Yes") - : "-"); ret = nil; - UI::SetFocus (`table); continue; } else if (ret == `activate) { - list<integer>to_activate = ListSelectedDASD (); - if (0 == size (to_activate)) + list<integer> selected = ListSelectedDASD(); + if (isempty(selected)) { Popup::Message (_("No disk selected.")); ret = nil; continue; } - foreach (integer id, to_activate, ``{ + + foreach (integer id, selected, { string channel = DASDController::devices[id,"channel"]:""; boolean diag = DASDController::diag[channel]:false; - DASDController::ActivateDisk ( - channel, - diag - ); + DASDController::ActivateDisk(channel, diag); }); ReloadDASDDialog (); - -// UI::ChangeWidget(`id(`table), `CurrentItem, ids_to_activate[0]:nil); ret = nil; - } else if (ret == `deactivate) { - list<integer>to_activate = ListSelectedDASD (); - if (0 == size (to_activate)) + list<integer> selected = ListSelectedDASD(); + if (isempty(selected)) { // error popup message Popup::Message (_("No disk selected.")); ret = nil; continue; } - foreach (integer id, to_activate, ``{ + + foreach (integer id, selected, { string channel = DASDController::devices[id,"channel"]:""; boolean diag = DASDController::diag[channel]:false; - DASDController::DeactivateDisk ( - channel, - diag - ); + DASDController::DeactivateDisk(channel, diag); }); ReloadDASDDialog (); - -// UI::ChangeWidget(`id(`table), `CurrentItem, ids_to_activate[0]:nil); ret = nil; } else if (ret == `diag_on) @@ -347,8 +311,6 @@ }); ReloadDASDDialog (); - -// UI::ChangeWidget(`id(`table), `CurrentItem, ids_to_activate[0]:nil); ret = nil; } else if (ret == `diag_off) @@ -371,26 +333,23 @@ }); ReloadDASDDialog (); - -// UI::ChangeWidget(`id(`table), `CurrentItem, ids_to_activate[0]:nil); ret = nil; } else if (ret == `format) { - list<integer>to_activate = ListSelectedDASD (); - if (0 == size (to_activate)) + list<integer> selected = ListSelectedDASD (); + if (isempty(selected)) { Popup::Message (_("No disk selected.")); ret = nil; continue; } + // check if disks are R/W and active string problem = ""; - foreach (integer id, to_activate, { - boolean active = (boolean) - (DASDController::devices[id, "resource", "io", 0, "active"]:false); - string access = toupper ( - (string)(DASDController::devices[id, "resource", "io", 0, "mode"]:"RO")); + foreach (integer id, selected, { + boolean active = DASDController::devices[id, "resource", "io", 0, "active"]:false; + string access = toupper(DASDController::devices[id, "resource", "io", 0, "mode"]:"RO"); if (! active) { // error report, %1 is device identification @@ -412,8 +371,8 @@ continue; } integer par = 8; - if (par > size (to_activate)) - par = size (to_activate); + if (par > size (selected)) + par = size (selected); boolean cancel = false; UI::OpenDialog (`VBox ( `IntField (`id (`par), @@ -428,9 +387,8 @@ ) )); ret = UI::UserInput (); - par = (integer)UI::QueryWidget (`id (`par), `Value); - boolean write_vl = (boolean) - UI::QueryWidget (`id (`write_label), `Value); + par = (integer) UI::QueryWidget(`id(`par), `Value); + boolean write_vl = (boolean) UI::QueryWidget(`id(`write_label), `Value); UI::CloseDialog (); if (ret == `cancel) { @@ -440,7 +398,7 @@ } // final confirmation before formatting the discs - list<string> channels = maplist (integer id, to_activate, { + list<string> channels = maplist (integer id, selected, { return DASDController::devices[id, "channel"]:""; }); string channels_str = mergestring (channels, ", "); @@ -464,7 +422,7 @@ } // final confirmation -- end - list<string> devices = maplist (integer id, to_activate, ``{ + list<string> devices = maplist (integer id, selected, { return DASDController::devices[id, "dev_name"]:""; }); DASDController::FormatDisks (devices, par, write_vl, true); @@ -548,7 +506,6 @@ } return (symbol) ret; - } } Modified: trunk/s390/src/modules/DASDController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/DASDController.y... ============================================================================== --- trunk/s390/src/modules/DASDController.ycp (original) +++ trunk/s390/src/modules/DASDController.ycp Fri Feb 10 15:02:29 2012 @@ -25,10 +25,8 @@ global map<integer,map<string,any> > devices = $[]; -global map<integer, boolean> selected = $[]; - global string filter_min = "0.0.0000"; - global string filter_max = "f.f.ffff"; + global string filter_max = "0.0.ffff"; global map<string, boolean> diag = $[]; @@ -343,7 +341,7 @@ { string device = d["dev_name"]:""; map scr_out = (map)SCR::Execute (.target.bash_output, sformat ( - "dasdview -x -f %1 | grep formatted", device)); + "dasdview -x -f '%1' | grep formatted", device)); boolean formatted = false; if (scr_out["exit"]:0 == 0) { @@ -464,7 +462,7 @@ global define void ActivateDisk (string channel, boolean diag) { // if (! Arch::s390_32 ()) diag = false; string command = sformat ( - "/sbin/dasd_configure %1 %2 %3", + "/sbin/dasd_configure '%1' '%2' '%3'", channel, 1, diag ? 1 : 0 @@ -479,7 +477,7 @@ if ((Mode::autoinst() && Popup::TimedOKCancel(popup, 10)) || Popup::ContinueCancel (popup)) { - string cmd = sformat("ls /sys/bus/ccw/devices/%1/block/|tr -d '\n'", channel); + string cmd = sformat("ls '/sys/bus/ccw/devices/%1/block/' | tr -d '\n'", channel); map<string, any> disk = (map<string, any>)SCR::Execute(.target.bash_output, cmd); if (disk["exit"]:-1 == 0 && size(disk["stdout"]:"")>0){ FormatDisks ([ sformat("/dev/%1", disk["stdout"]:"") ], 1, true, true); @@ -508,7 +506,7 @@ global define void DeactivateDisk (string channel, boolean diag) { // if (! Arch::s390_32 ()) diag = false; string command = sformat ( - "/sbin/dasd_configure %1 %2 %3", + "/sbin/dasd_configure '%1' '%2' '%3'", channel, 0, diag ? 1 : 0 @@ -538,7 +536,7 @@ foreach (string device, disks_list, ``{ index = index + 1; disks[index] = device; - disks_cmd = add (disks_cmd, sformat ("-f %1", device)); + disks_cmd = add(disks_cmd, sformat("-f '%1'", device)); }); string disks_param = mergestring (disks_cmd, " "); string additional_param = ""; @@ -668,9 +666,9 @@ * @param disk string Disk to read info from * @return GetPartitionInfo string The info */ -global define string GetPartitionInfo (string disk) { - map outmap = (map)SCR::Execute (.target.bash_output, sformat ( - "/sbin/fdasd -p %1", disk)); +global string GetPartitionInfo (string disk) +{ + map outmap = (map) SCR::Execute (.target.bash_output, sformat("/sbin/fdasd -p '%1'", disk)); // if not an eckd-disk it's an fba-disk. fba-disks have only one partition if (outmap["exit"]:0 != 0) Modified: trunk/s390/src/modules/ZFCPController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/ZFCPController.y... ============================================================================== --- trunk/s390/src/modules/ZFCPController.ycp (original) +++ trunk/s390/src/modules/ZFCPController.ycp Fri Feb 10 15:02:29 2012 @@ -13,7 +13,6 @@ module "ZFCPController"; textdomain "s390"; -import "Arch"; import "Mode"; import "Progress"; import "Report"; @@ -23,10 +22,8 @@ global map<integer,map<string,any> > devices = $[]; -global map<integer, boolean> selected = $[]; - global string filter_min = "0.0.0000"; - global string filter_max = "f.f.ffff"; + global string filter_max = "0.0.ffff"; global map<string, any> previous_settings = $[]; @@ -429,7 +426,7 @@ if (! activated_controllers[channel]:false) { string command = sformat ( - "/sbin/zfcp_host_configure %1 %2", + "/sbin/zfcp_host_configure '%1' '%2'", channel, 1 ); Modified: trunk/s390/src/zfcp/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/zfcp/dialogs.ycp?rev=674... ============================================================================== --- trunk/s390/src/zfcp/dialogs.ycp (original) +++ trunk/s390/src/zfcp/dialogs.ycp Fri Feb 10 15:02:29 2012 @@ -9,7 +9,6 @@ { textdomain "s390"; -import "Arch"; import "Label"; import "Mode"; import "Popup"; @@ -43,7 +42,6 @@ return ret ? `next : `abort; } - // ------------------------------------------------------------------------------------ /** * Get the list of items for the table of ZFCP devices @@ -64,10 +62,6 @@ string fcp_lun = d["detail", "fcp_lun"]:"unknown"; if (fcp_lun != "unknown") fcp_lun = ZFCPController::HexNumSize (fcp_lun, 16); - string selected = ZFCPController::selected[k]:false - // table cell - ? _("Yes") - : "-"; return `item(`id(k), channel, wwpn, fcp_lun); }); @@ -84,13 +78,13 @@ ZFCPController::filter_min = (string) UI::QueryWidget(`min_chan, `Value); ZFCPController::filter_max = (string) UI::QueryWidget(`max_chan, `Value); - ZFCPController::ProbeDisks (); + ZFCPController::ProbeDisks(); list<term> items = GetZFCPDiskItems(); UI::ChangeWidget(`id(`table), `Items, items); - UI::ChangeWidget (`id (`delete), `Enabled, size (items) > 0); - UI::SetFocus (`table); + UI::ChangeWidget(`id(`delete), `Enabled, !isempty(items)); + UI::SetFocus(`table); } /** @@ -371,7 +365,6 @@ } return (symbol) ret; - } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn2.opensuse.org