Author: aschnell
Date: Wed May 28 17:40:13 2008
New Revision: 47927
URL: http://svn.opensuse.org/viewcvs/yast?rev=47927&view=rev
Log:
- group data in overviews
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.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-dm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp?rev=47927&r1=47926&r2=47927&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp Wed May 28 17:40:13 2008
@@ -48,8 +48,9 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `device, `mount_point, `mount_by,
- `size, `fs_type, `uuid, `label, `newline, `used_by ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `used_by,
+ `heading_filesystem, `fs_type, `mount_point,
+ `mount_by, `uuid, `label ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
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=47927&r1=47926&r2=47927&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 Wed May 28 17:40:13 2008
@@ -157,9 +157,9 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `device, `vendor, `model, `size, `newline,
- `bus, `bios_id, `udev_path, `udev_id, `newline,
- `disk_label, `used_by ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `udev_path,
+ `udev_id, `used_by, `heading_hd, `vendor,
+ `model, `bus, `bios_id, `disk_label ]);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -319,9 +319,10 @@
map target_map = Storage::GetTargetMap();
map part = Storage::GetPartition(target_map, device);
- list<symbol> fields = StorageFields::Filter([ `device, `mount_point, `mount_by, `size,
- `fs_type, `encrypted, `newline, `uuid, `label,
- `udev_path, `udev_id, `newline, `used_by ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `udev_path,
+ `udev_id, `used_by, `heading_filesystem,
+ `fs_type, `mount_point, `mount_by, `uuid,
+ `label, `encrypted ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp?rev=47927&r1=47926&r2=47927&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp Wed May 28 17:40:13 2008
@@ -58,7 +58,8 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `fs_type, `file_path ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `file_path,
+ `heading_filesystem, `fs_type, `mount_point ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
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=47927&r1=47926&r2=47927&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 Wed May 28 17:40:13 2008
@@ -70,7 +70,8 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `size, `pe_size, `lvm_metadata ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size,
+ `heading_lvm, `lvm_metadata, `pe_size ]);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -238,8 +239,10 @@
string device = (string) user_data;
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `mount_point, `mount_by, `size, `stripes,
- `fs_type, `uuid, `label ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `used_by,
+ `heading_lvm, `stripes, `heading_filesystem,
+ `fs_type, `mount_point, `mount_by, `uuid,
+ `label, `encrypted ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp?rev=47927&r1=47926&r2=47927&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp Wed May 28 17:40:13 2008
@@ -57,7 +57,8 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `fs_type ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size,
+ `heading_filesystem, `fs_type, `mount_point ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
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=47927&r1=47926&r2=47927&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 Wed May 28 17:40:13 2008
@@ -56,9 +56,10 @@
map tg = Storage::GetTargetMap();
- list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `raid_type, `newline,
- `fs_type, `encrypted, `newline, `uuid, `label,
- `used_by ]);
+ list<symbol> fields = StorageFields::Filter([ `heading_device, `device, `size, `used_by,
+ `heading_md, `raid_type, `heading_filesystem,
+ `fs_type, `mount_point, `mount_by, `uuid,
+ `label, `encrypted ]);
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=47927&r1=47926&r2=47927&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp Wed May 28 17:40:13 2008
@@ -16,6 +16,7 @@
import "Partitions";
import "Arch";
import "Mode";
+ import "HTML";
global list<symbol> Filter(list<symbol> fields)
@@ -205,7 +206,7 @@
if (style == `table)
return value;
else
- return sformat(_("Device: %1"), value) + "\n";
+ return sformat(_("Device: %1"), value);
}
case `size:
@@ -214,7 +215,7 @@
if (style == `table)
return value;
else
- return sformat(_("Size: %1"), value) + "\n";
+ return sformat(_("Size: %1"), value);
}
case `type:
@@ -270,7 +271,7 @@
if (style == `table)
return value;
else
- return sformat(_("Type: %1"), value) + "\n";
+ return sformat(_("Type: %1"), value);
}
case `format:
@@ -288,7 +289,7 @@
if (style == `table)
return value;
else
- return sformat(_("Format: %1"), value) + "\n";
+ return sformat(_("Format: %1"), value);
}
case `encrypted:
@@ -297,7 +298,7 @@
if (style == `table)
return value;
else
- return sformat(_("Encrypted: %1"), value) + "\n";
+ return sformat(_("Encrypted: %1"), value);
}
case `fs_type:
@@ -306,7 +307,7 @@
if (style == `table)
return value;
else
- return sformat(_("File System: %1"), value) + "\n";
+ return sformat(_("File System: %1"), value);
}
case `mount_point:
@@ -317,7 +318,7 @@
if (style == `table)
return value;
else
- return sformat(_("Mount Point: %1"), value) + "\n";
+ return sformat(_("Mount Point: %1"), value);
}
case `mount_by:
@@ -331,7 +332,7 @@
if (style == `table)
return value;
else
- return sformat(_("Mount By: %1"), value) + "\n";
+ return sformat(_("Mount By: %1"), value);
}
case `used_by:
@@ -340,7 +341,7 @@
if (style == `table)
return value;
else
- return sformat(_("Used By: %1"), value) + "\n";
+ return sformat(_("Used By: %1"), value);
}
case `uuid:
@@ -349,7 +350,7 @@
if (style == `table)
return value;
else
- return sformat(_("UUID: %1"), value) + "\n";
+ return sformat(_("UUID: %1"), value);
}
case `label:
@@ -358,7 +359,7 @@
if (style == `table)
return value;
else
- return sformat(_("Label: %1"), value) + "\n";
+ return sformat(_("Label: %1"), value);
}
case `udev_path:
@@ -367,7 +368,7 @@
if (style == `table)
return value;
else
- return sformat(_("Path: %1"), value) + "\n";
+ return sformat(_("Path: %1"), value);
}
case `udev_id:
@@ -378,7 +379,9 @@
string ret = "";
integer i = 1;
foreach(string id, data["udev_id"]:[""], {
- ret = ret + sformat(_("ID %1: %2"), i, id) + "\n";
+ if (i > 1)
+ ret = ret + HTML::Newline();
+ ret = ret + sformat(_("ID %1: %2"), i, id);
i = i + 1;
});
return ret;
@@ -391,7 +394,7 @@
if (style == `table)
return value;
else
- return sformat(_("BIOS ID: %1"), value) + "\n";
+ return sformat(_("BIOS ID: %1"), value);
}
case `disk_label:
@@ -400,7 +403,7 @@
if (style == `table)
return value;
else
- return sformat(_("Disk Label: %1"), value) + "\n";
+ return sformat(_("Disk Label: %1"), value);
}
case `vendor:
@@ -409,7 +412,7 @@
if (style == `table)
return value;
else
- return sformat(_("Vendor: %1"), value) + "\n";
+ return sformat(_("Vendor: %1"), value);
}
case `model:
@@ -418,7 +421,7 @@
if (style == `table)
return value;
else
- return sformat(_("Model: %1"), value) + "\n";
+ return sformat(_("Model: %1"), value);
}
case `bus:
@@ -427,7 +430,7 @@
if (style == `table)
return value;
else
- return sformat(_("Bus: %1"), value) + "\n";
+ return sformat(_("Bus: %1"), value);
}
case `lvm_metadata:
@@ -438,7 +441,7 @@
if (style == `table)
return value;
else
- return sformat(_("Metadata Type: %1"), value) + "\n";
+ return sformat(_("Metadata Type: %1"), value);
}
case `pe_size:
@@ -449,7 +452,7 @@
if (style == `table)
return value;
else
- return sformat(_("Physical Extent Size: %1"), value) + "\n";
+ return sformat(_("Physical Extent Size: %1"), value);
}
case `stripes:
@@ -467,7 +470,7 @@
if (style == `table)
return value;
else
- return sformat(_("Stripes: %1"), value) + "\n";
+ return sformat(_("Stripes: %1"), value);
}
case `raid_type:
@@ -476,7 +479,7 @@
if (style == `table)
return value;
else
- return sformat(_("RAID Type: %1"), value) + "\n";
+ return sformat(_("RAID Type: %1"), value);
}
case `start_cyl:
@@ -491,7 +494,7 @@
if (style == `table)
return value;
else
- return sformat(_("Start Cylinder: %1"), value) + "\n";
+ return sformat(_("Start Cylinder: %1"), value);
}
case `end_cyl:
@@ -506,7 +509,7 @@
if (style == `table)
return value;
else
- return sformat(_("End Cylinder: %1"), value) + "\n";
+ return sformat(_("End Cylinder: %1"), value);
}
case `file_path:
@@ -515,16 +518,13 @@
if (style == `table)
return value;
else
- return sformat(_("File Path: %1"), value) + "\n";
+ return sformat(_("File Path: %1"), value);
}
default:
{
y2error("unknown field %1", field);
- if (style == `table)
- return "error";
- else
- return "error\n";
+ return "error";
}
}
}
@@ -737,20 +737,63 @@
if (disk == nil)
{
foreach(string s, map d, target_map, {
- if (part == nil)
- {
- part = find(map p, d["partitions"]:[], { return p["device"]:"" == device; });
- if (part != nil)
- disk = d;
+ part = find(map p, d["partitions"]:[], { return p["device"]:"" == device; });
+ if (part != nil) {
+ disk = d;
+ break;
}
});
}
- string content = mergestring(maplist(symbol field, fields, {
- if (field == `newline)
- return "\n";
- else
+ // this could be an builtin, with flex type and predicate function
+ list my_unflatten(list<symbol> fields)
+ {
+ list ret = [];
+
+ list<symbol> tmp = [];
+ foreach(symbol field, fields, {
+ if (substring(tostring(field), 0, 8) == "`heading") {
+ if (size(tmp) > 0)
+ ret = add(ret, tmp);
+ tmp = [ field ];
+ } else {
+ tmp = add(tmp, field);
+ }
+ });
+ if (size(tmp) > 0)
+ ret = add(ret, tmp);
+
+ return ret;
+ }
+
+ string Heading(symbol field)
+ {
+ switch (field) {
+ case `heading_device:
+ return _("Device:");
+ case `heading_filesystem:
+ return _("File System:");
+ case `heading_hd:
+ return _("Hard Disk:");
+ case `heading_lvm:
+ return _("LVM:");
+ case `heading_md:
+ return _("RAID:");
+ default:
+ return "error";
+ }
+ }
+
+ list<string> List(list<symbol> fields)
+ {
+ return maplist(symbol field, fields, {
return MakeSubInfo(disk, part, field, `overview);
+ });
+ };
+
+ string content = mergestring(maplist(list<symbol> subfields, my_unflatten(fields), {
+ return HTML::Heading(Heading(subfields[0]:`none)) +
+ HTML::List(List(sublist(subfields, 1, size(subfields) - 1)));
}), "");
return content;
@@ -761,6 +804,6 @@
{
string content = OverviewContent(fields, target_map, device);
- return `RichText(`opt(`plainText, `hstretch, `vstretch), content);
+ return `RichText(`opt(`hstretch, `vstretch), content);
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org