Author: aschnell
Date: Mon Mar 3 12:42:52 2008
New Revision: 45151
URL: http://svn.opensuse.org/viewcvs/yast?rev=45151&view=rev
Log:
- simplifications
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp
branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp?rev=45151&r1=45150&r2=45151&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp Mon Mar 3 12:42:52 2008
@@ -49,7 +49,7 @@
term header = StorageFields::TableHeader(fields);
map tg = Storage::GetTargetMap();
- list table_list = StorageFields::TableContent(tg, fields, predicate_all);
+ list table_list = StorageFields::TableContent(fields, tg, predicate_all);
UI::ReplaceWidget(`tree_panel,
`VBox(
@@ -81,7 +81,7 @@
filter_ = UI::QueryWidget(`filter, `Value);
map tg = Storage::GetTargetMap();
- list table_list = StorageFields::TableContent(tg, fields, predicate_all);
+ list table_list = StorageFields::TableContent(fields, tg, predicate_all);
UI::ChangeWidget(`table, `Items, table_list);
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp?rev=45151&r1=45150&r2=45151&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp Mon Mar 3 12:42:52 2008
@@ -43,7 +43,6 @@
string device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = tg[device]:$[];
list<symbol> fields = StorageFields::Filter([ `device, `vendor, `model, `size,
`newline, `bus, `udev_path, `udev_id,
@@ -52,7 +51,7 @@
UI::ReplaceWidget(`tab_panel,
`VBox(
`HStretch(),
- StorageFields::Overview(disk, nil, fields),
+ StorageFields::Overview(fields, tg, device),
`VStretch(),
`HBox(
`PushButton(`id(`smart), "Smart..." ),
@@ -99,7 +98,7 @@
term header = StorageFields::TableHeader(fields);
map tg = Storage::GetTargetMap();
- list table_list = StorageFields::TableContent(tg, fields, predicate);
+ list table_list = StorageFields::TableContent(fields, tg, predicate);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -186,8 +185,6 @@
{
string device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = Storage::GetDisk(tg, device);
- map partition = Storage::GetPartition(tg, device);
list<symbol> fields = StorageFields::Filter([ `device, `mount_point, `mount_by, `size,
`fs_type, `newline, `uuid, `label, `udev_path,
@@ -198,7 +195,7 @@
`VBox(
`HStretch(),
`Left(`Heading("Partition: " + device)),
- StorageFields::Overview(disk, partition, fields),
+ StorageFields::Overview(fields, tg, device),
`VStretch(),
`HBox(
`PushButton(`id(`edit), "Edit..."),
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp?rev=45151&r1=45150&r2=45151&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp Mon Mar 3 12:42:52 2008
@@ -53,14 +53,13 @@
string device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = tg[device]:$[];
list<symbol> fields = StorageFields::Filter([ `size, `pe_size, `lvm_metadata ]);
UI::ReplaceWidget(`tab_panel,
`VBox(
`HStretch(),
- StorageFields::Overview(disk, nil, fields),
+ StorageFields::Overview(fields, tg, device),
`VStretch(),
`HBox(
`PushButton(`id(`delete), "Delete..."),
@@ -113,7 +112,7 @@
term header = StorageFields::TableHeader(fields);
map tg = Storage::GetTargetMap();
- list table_list = StorageFields::TableContent(tg, fields, predicate);
+ list table_list = StorageFields::TableContent(fields, tg, predicate);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -161,7 +160,6 @@
string device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = tg[device]:$[];
symbol predicate(map disk, map partition)
{
@@ -182,7 +180,7 @@
`used_by ]);
term header = StorageFields::TableHeader(fields);
- list table_list = StorageFields::TableContent(tg, fields, predicate);
+ list table_list = StorageFields::TableContent(fields, tg, predicate);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -234,8 +232,6 @@
{
string device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = Storage::GetDisk(tg, device);
- map partition = Storage::GetPartition(tg, device);
list<symbol> fields = StorageFields::Filter([ `mount_point, `mount_by, `size, `stripes,
`fs_type, `uuid, `label ]);
@@ -244,7 +240,7 @@
`VBox(
`HStretch(),
`Left(`Heading("Logical Volume: " + device)),
- StorageFields::Overview(disk, partition, fields),
+ StorageFields::Overview(fields, tg, device),
`VStretch(),
`HBox(
`PushButton(`id(`edit), "Edit..."),
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp?rev=45151&r1=45150&r2=45151&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp Mon Mar 3 12:42:52 2008
@@ -39,15 +39,13 @@
string part_device = (string) user_data;
map tg = Storage::GetTargetMap();
- map disk = Storage::GetDisk(tg, part_device);
- map partition = Storage::GetPartition(tg, part_device);
list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `raid_type ]);
UI::ReplaceWidget(`tab_panel,
`VBox(
`HStretch(),
- StorageFields::Overview(disk, partition, fields),
+ StorageFields::Overview(fields, tg, part_device),
`VStretch(),
`HBox(
`PushButton(`id(`edit), "Edit..."),
@@ -96,7 +94,7 @@
term header = StorageFields::TableHeader(fields);
map tg = Storage::GetTargetMap();
- list table_list = StorageFields::TableContent(tg, fields, predicate);
+ list table_list = StorageFields::TableContent(fields, tg, predicate);
UI::ReplaceWidget(`tab_panel,
`VBox(
Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp?rev=45151&r1=45150&r2=45151&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp Mon Mar 3 12:42:52 2008
@@ -40,24 +40,22 @@
/**
- * Sorted call of disk_cb for every disk.
+ * Call callback for every disk of target_map in a well defined sorted order.
*/
- global void IterateTargetMap(map targets, void(map, map) disk_cb)
+ global void IterateTargetMap(map target_map, void(map, map) callback)
{
map disk_order = $[ `CT_DMRAID : 0, `CT_DISK : 1, `CT_MD : 2, `CT_LOOP : 3,
`CT_LVM : 4, `CT_EVMS : 5, `CT_DM : 6, `CT_NFS : 7 ];
- list<string> keys = maplist(string dev, map disk, targets, { return dev; });
+ list<string> keys = maplist(string dev, map disk, target_map, { return dev; });
keys = sort(string a, string b, keys, {
- integer oa = disk_order[targets[a,"type"]:`CT_UNKNOWN]:8;
- integer ob = disk_order[targets[b,"type"]:`CT_UNKNOWN]:8;
+ integer oa = disk_order[target_map[a,"type"]:`CT_UNKNOWN]:8;
+ integer ob = disk_order[target_map[b,"type"]:`CT_UNKNOWN]:8;
return (oa==ob) ? (a target_map, list<symbol> fields,
+ global list<term> TableContent(list<symbol> fields, map target_map,
symbol(map, map) predicate)
{
list<term> content = [];
@@ -602,7 +600,7 @@
if (!AlwaysHideDisk(target_map, disk) &&
contains([`show, `showandfollow], disk_predicate))
{
- term row = StorageFields::TableRow(disk, nil, fields);
+ term row = StorageFields::TableRow(fields, disk, nil);
content = add(content, row);
}
@@ -617,7 +615,7 @@
if (!AlwaysHidePartition(target_map, disk, partition) &&
contains([`show, `showandfollow], part_predicate))
{
- term row = StorageFields::TableRow(disk, partition, fields);
+ term row = StorageFields::TableRow(fields, disk, partition);
content = add(content, row);
}
});
@@ -630,14 +628,21 @@
}
- global term Overview(map disk, map part, list<symbol> fields)
+ global term Overview(list<symbol> fields, map target_map, string device)
{
+ map disk = Storage::GetDisk(target_map, device);
+ map part = Storage::GetPartition(target_map, device);
+
+ if (part == $[])
+ part = nil;
+
string ret = mergestring(maplist(symbol field, fields, {
if (field == `newline)
return "\n";
else
return MakeSubInfo(disk, part, field, `overview);
}), "");
+
return `RichText(`opt(`plainText), ret);
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org