Author: aschnell
Date: Fri Feb 10 11:05:53 2012
New Revision: 67400
URL: http://svn.opensuse.org/viewcvs/yast?rev=67400&view=rev
Log:
- improved device filtering and moved to modules
Modified:
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/src/dasd/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/dasd/dialogs.ycp?rev=67400&r1=67399&r2=67400&view=diff
==============================================================================
--- trunk/s390/src/dasd/dialogs.ycp (original)
+++ trunk/s390/src/dasd/dialogs.ycp Fri Feb 10 11:05:53 2012
@@ -74,43 +74,12 @@
* @param max_chan integer maximal channel number
* @return a list of terms for the table
*/
-define list<term> GetDASDDiskItems(string min_channel, string max_channel) ``{
- integer id = 0;
+list<term> GetDASDDiskItems()
+{
+ map > devices = DASDController::GetFilteredDevices();
list<term> items = [];
- integer min_css = tointeger(substring (min_channel, 0, 1));
- integer min_lcss = tointeger(sformat("0x%1",substring (min_channel, 2, 1)));
- integer min_chan = tointeger(sformat("0x%1",substring (min_channel, 4, 4)));
-
- integer max_css = tointeger(substring (max_channel, 0, 1));
- integer max_lcss = tointeger(sformat("0x%1",substring (max_channel, 2, 1)));
- integer max_chan = tointeger(sformat("0x%1",substring (max_channel, 4, 4)));
-
- map > devices = DASDController::devices;
-
- if (min_chan > 0 || min_lcss > 0 || min_css > 0 ||
- max_chan < 0xffff || max_lcss < 0xf || max_css < 0xf)
- {
- y2milestone ("Filter disks: %1.%2.%3 to %4.%5.%6",
- min_css, min_lcss, min_chan,
- max_css, max_lcss, max_chan);
-
- devices = (map >)filter (
- integer k, map d, devices,
- ``{
- string channel = d["channel"]:"0.0.0000";
- integer tmp_css = tointeger(substring (channel, 0, 1));
- integer tmp_lcss = tointeger(sformat("0x%1",substring (channel, 2, 1)));
- integer tmp_chan = tointeger(sformat("0x%1",substring (channel, 4, 4)));
-
- return (tmp_css >= min_css && tmp_lcss >= min_lcss && tmp_chan >= min_chan
- && tmp_css <= max_css && tmp_lcss <= max_lcss && tmp_chan <= max_chan);
- });
- }
-
- y2milestone ("Current disks: %1", devices);
-
if (Mode::config ())
{
items = (list<term>) maplist (integer k, map d, devices, {
@@ -254,9 +223,9 @@
term content = `VBox(
`HBox(
// text entry
- `InputField(`id(`min_chan), `opt(`hstretch), _("Mi&nimum Channel"), "0.0.0000"),
+ `InputField(`id(`min_chan), `opt(`hstretch), _("Mi&nimum Channel"), DASDController::filter_min),
// text entry
- `InputField(`id(`max_chan), `opt(`hstretch), _("Ma&ximum Channel"), "0.f.ffff"),
+ `InputField(`id(`max_chan), `opt(`hstretch), _("Ma&ximum Channel"), DASDController::filter_max),
`VBox (
`Label (""),
// push button
@@ -285,23 +254,23 @@
Wizard::SetContents(caption, content, help, true, true);
Wizard::HideBackButton();
Wizard::SetAbortButton(`abort, Label::CancelButton() );
+
+ UI::ChangeWidget(`id(`min_chan), `ValidChars, "0123456789abcdefABCDEF.");
+ UI::ChangeWidget(`id(`max_chan), `ValidChars, "0123456789abcdefABCDEF.");
}
/**
* Redraw the contents of the widgets in the DASD Dialog
*/
-define void ReloadDASDDialog () ``{
- DASDController::filter_min = (string)
- UI::QueryWidget(`min_chan, `Value);
- DASDController::filter_max = (string)
- UI::QueryWidget(`max_chan, `Value);
+void ReloadDASDDialog()
+{
+ DASDController::filter_min = (string) UI::QueryWidget(`min_chan, `Value);
+ DASDController::filter_max = (string) UI::QueryWidget(`max_chan, `Value);
DASDController::ProbeDisks ();
- list<term> items = GetDASDDiskItems (
- DASDController::filter_min,
- DASDController::filter_max);
+ list<term> items = GetDASDDiskItems();
UI::ChangeWidget(`id(`table), `Items, items);
UI::SetFocus (`table);
Modified: trunk/s390/src/modules/DASDController.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/DASDController.ycp?rev=67400&r1=67399&r2=67400&view=diff
==============================================================================
--- trunk/s390/src/modules/DASDController.ycp (original)
+++ trunk/s390/src/modules/DASDController.ycp Fri Feb 10 11:05:53 2012
@@ -29,9 +29,8 @@
global map selected = $[];
-global string filter_min = "0.0.0000";
-
-global string filter_max = "f.f.ffff";
+ global string filter_min = "0.0.0000";
+ global string filter_max = "f.f.ffff";
global map diag = $[];
@@ -230,6 +229,49 @@
}
+ global map >
+ GetDevices()
+ {
+ return devices;
+ }
+
+
+ global map >
+ GetFilteredDevices()
+ {
+ list<string> min_strs = splitstring(filter_min, ".");
+ integer min_css = tointeger("0x" + min_strs[0]:"0");
+ integer min_lcss = tointeger("0x" + min_strs[1]:"0");
+ integer min_chan = tointeger("0x" + min_strs[2]:"0");
+
+ list<string> max_strs = splitstring(filter_max, ".");
+ integer max_css = tointeger("0x" + max_strs[0]:"0");
+ integer max_lcss = tointeger("0x" + max_strs[1]:"0");
+ integer max_chan = tointeger("0x" + max_strs[2]:"0");
+
+ map > ret = GetDevices();
+
+ if (min_chan > 0 || min_lcss > 0 || min_css > 0 ||
+ max_chan < 0xffff || max_lcss < 0xf || max_css < 0xf)
+ {
+ y2milestone("filter devices: %1.%2.%3 to %4.%5.%6", min_css, min_lcss, min_chan,
+ max_css, max_lcss, max_chan);
+
+ ret = filter(integer k, map d, ret, {
+ list<string> tmp_strs = splitstring(d["channel"]:"0.0.0000", ".");
+ integer tmp_css = tointeger("0x" + tmp_strs[0]:"0");
+ integer tmp_lcss = tointeger("0x" + tmp_strs[1]:"0");
+ integer tmp_chan = tointeger("0x" + tmp_strs[2]:"0");
+
+ return tmp_css >= min_css && tmp_lcss >= min_lcss && tmp_chan >= min_chan &&
+ tmp_css <= max_css && tmp_lcss <= max_lcss && tmp_chan <= max_chan;
+ });
+ }
+
+ return ret;
+ }
+
+
/**
* Create a textual summary and a list of unconfigured cards
* @return summary of the current configuration
Modified: trunk/s390/src/modules/ZFCPController.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/ZFCPController.ycp?rev=67400&r1=67399&r2=67400&view=diff
==============================================================================
--- trunk/s390/src/modules/ZFCPController.ycp (original)
+++ trunk/s390/src/modules/ZFCPController.ycp Fri Feb 10 11:05:53 2012
@@ -27,9 +27,8 @@
global map selected = $[];
-global string filter_min = "0.0.0000";
-
-global string filter_max = "0.f.ffff";
+ global string filter_min = "0.0.0000";
+ global string filter_max = "f.f.ffff";
global map previous_settings = $[];
@@ -201,6 +200,50 @@
];
}
+
+ global map >
+ GetDevices()
+ {
+ return devices;
+ }
+
+
+ global map >
+ GetFilteredDevices()
+ {
+ list<string> min_strs = splitstring(filter_min, ".");
+ integer min_css = tointeger("0x" + min_strs[0]:"0");
+ integer min_lcss = tointeger("0x" + min_strs[1]:"0");
+ integer min_chan = tointeger("0x" + min_strs[2]:"0");
+
+ list<string> max_strs = splitstring(filter_max, ".");
+ integer max_css = tointeger("0x" + max_strs[0]:"0");
+ integer max_lcss = tointeger("0x" + max_strs[1]:"0");
+ integer max_chan = tointeger("0x" + max_strs[2]:"0");
+
+ map > ret = GetDevices();
+
+ if (min_chan > 0 || min_lcss > 0 || min_css > 0 ||
+ max_chan < 0xffff || max_lcss < 0xf || max_css < 0xf)
+ {
+ y2milestone("filter devices: %1.%2.%3 to %4.%5.%6", min_css, min_lcss, min_chan,
+ max_css, max_lcss, max_chan);
+
+ ret = filter(integer k, map d, ret, {
+ list<string> tmp_strs = splitstring(d["channel"]:"0.0.0000", ".");
+ integer tmp_css = tointeger("0x" + tmp_strs[0]:"0");
+ integer tmp_lcss = tointeger("0x" + tmp_strs[1]:"0");
+ integer tmp_chan = tointeger("0x" + tmp_strs[2]:"0");
+
+ return tmp_css >= min_css && tmp_lcss >= min_lcss && tmp_chan >= min_chan &&
+ tmp_css <= max_css && tmp_lcss <= max_lcss && tmp_chan <= max_chan;
+ });
+ }
+
+ return ret;
+ }
+
+
/**
* Create a textual summary and a list of unconfigured cards
* @return summary of the current configuration
Modified: trunk/s390/src/zfcp/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/zfcp/dialogs.ycp?rev=67400&r1=67399&r2=67400&view=diff
==============================================================================
--- trunk/s390/src/zfcp/dialogs.ycp (original)
+++ trunk/s390/src/zfcp/dialogs.ycp Fri Feb 10 11:05:53 2012
@@ -53,38 +53,11 @@
* @param max_chan integer maximal channel number
* @return a list of terms for the table
*/
-define list<term> GetZFCPDiskItems(string min_channel, string max_channel) ``{
- integer id = 0;
- list<term> items = [];
-
- map > devices = ZFCPController::devices;
+list<term> GetZFCPDiskItems()
+{
+ map > devices = ZFCPController::GetFilteredDevices();
- integer min_css = tointeger(substring (min_channel, 0, 1));
- integer min_lcss = tointeger(sformat("0x%1",substring (min_channel, 2, 1)));
- integer min_chan = tointeger(sformat("0x%1",substring (min_channel, 4, 4)));
-
- integer max_css = tointeger(substring (max_channel, 0, 1));
- integer max_lcss = tointeger(sformat("0x%1",substring (max_channel, 2, 1)));
- integer max_chan = tointeger(sformat("0x%1",substring (max_channel, 4, 4)));
-
-
- if (min_chan > 0 || min_lcss > 0 || min_css > 0 ||
- max_chan < 0xffff || max_lcss < 0xf || max_css < 0xf)
- {
- devices = (map >)filter (
- integer k, map d, devices,
- ``{
- string channel = d["detail", "controller_id"]:"0.0.0000";
- integer tmp_css = tointeger(substring (channel, 0, 1));
- integer tmp_lcss = tointeger(sformat("0x%1",substring (channel, 2, 1)));
- integer tmp_chan = tointeger(sformat("0x%1",substring (channel, 4, 4)));
-
-
- boolean ret = (tmp_css >= min_css && tmp_lcss >= min_lcss && tmp_chan >= min_chan
- && tmp_css <= max_css && tmp_lcss <= max_lcss && tmp_chan <= max_chan);
- return ret;
- });
- }
+ list<term> items = [];
items = (list<term>) maplist (integer k, map d, devices, ``{
string dev_name = (string)(d["dev_name"]:"");
@@ -104,16 +77,18 @@
return items;
}
+
/**
* Restart the ZFCP-Dialog
*/
-define void ReloadZFCPDialog () ``{
+void ReloadZFCPDialog()
+{
ZFCPController::filter_min = (string) UI::QueryWidget(`min_chan, `Value);
ZFCPController::filter_max = (string) UI::QueryWidget(`max_chan, `Value);
ZFCPController::ProbeDisks ();
- list<term> items = GetZFCPDiskItems (ZFCPController::filter_min, ZFCPController::filter_max);
+ list<term> items = GetZFCPDiskItems();
UI::ChangeWidget(`id(`table), `Items, items);
UI::ChangeWidget (`id (`delete), `Enabled, size (items) > 0);
@@ -170,8 +145,12 @@
Wizard::SetContentsButtons(caption, content, help, Label::BackButton(), Label::NextButton());
Wizard::HideBackButton();
Wizard::SetAbortButton(`abort, Label::CancelButton() );
+
+ UI::ChangeWidget(`id(`min_chan), `ValidChars, "0123456789abcdefABCDEF.");
+ UI::ChangeWidget(`id(`max_chan), `ValidChars, "0123456789abcdefABCDEF.");
}
+
/**
* Show the ZFCP-Dialog
* @return symbol From the dialog
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org