Author: aschnell Date: Fri Apr 11 21:28:21 2008 New Revision: 46459 URL: http://svn.opensuse.org/viewcvs/yast?rev=46459&view=rev Log: - "resize" for vgs Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp Fri Apr 11 21:28:21 2008 @@ -9,13 +9,16 @@ textdomain "storage"; - import "Partitions"; - import "DualMultiSelectionBox"; - + symbol MiniWorkflowStepVg(map &data) + { + y2milestone("MiniWorkflowStepVg data:%1", data); + symbol mode = data["mode"]:`none; + + string vgname = ""; + string pesize = ""; + list<string> pvs = []; - string DlgCreateVolumeGroupNew() - { map<string, map> tg = Storage::GetTargetMap(); list<map> candidates = get_possible_pvs(tg); candidates = filter(map candidate, candidates, { return candidate["used_by"]:"" == ""; }); @@ -26,87 +29,88 @@ return `item(`id(device), device + " " + ByteToHumanStringWithZero(size_k*1024)); }); - string vgname = ""; - string pesize = ""; - list<string> pvs = []; - - any StepTheOne() + void UpdateTotalSizes() { - void UpdateTotalSizes() - { - integer unsel_size_k = 0; - integer sel_size_k = 0; + integer unsel_size_k = 0; + integer sel_size_k = 0; - list<term> tmp = DualMultiSelectionBox::GetSelectedItems(); + list<term> tmp = DualMultiSelectionBox::GetSelectedItems(); - foreach(map candidate, candidates, { - any id = `id(candidate["device"]:""); - if (find(term t, tmp, { return t[0]:nil == id; }) == nil) - unsel_size_k = unsel_size_k + candidate["size_k"]:0; - else - sel_size_k = sel_size_k + candidate["size_k"]:0; - }); + foreach(map candidate, candidates, { + any id = `id(candidate["device"]:""); + if (find(term t, tmp, { return t[0]:nil == id; }) == nil) + unsel_size_k = unsel_size_k + candidate["size_k"]:0; + else + sel_size_k = sel_size_k + candidate["size_k"]:0; + }); + + UI::ReplaceWidget(`id(`unsel_rp), + `Left(`Label(sformat(_("Total size: %1"), + Partitions::ByteToHumanStringWithZero(unsel_size_k*1024))))); + UI::ReplaceWidget(`id(`sel_rp), + `Left(`Label(sformat(_("Total size: %1"), + Partitions::ByteToHumanStringWithZero(sel_size_k*1024))))); + } - UI::ReplaceWidget(`id(`unsel_rp), - `Left(`Label(sformat(_("Total size: %1"), - Partitions::ByteToHumanStringWithZero(unsel_size_k*1024))))); - UI::ReplaceWidget(`id(`sel_rp), - `Left(`Label(sformat(_("Total size: %1"), - Partitions::ByteToHumanStringWithZero(sel_size_k*1024))))); - } - term contents = `VBox( - `Left(`InputField(`id("vgname"), "Volume Group Name")), - `Left(`InputField(`id("pesize"), _("&Physical Extent Size"), "4 MB")), - DualMultiSelectionBox::Create(candidates_list) - ); + term contents = `VBox(); - MiniWorkflow::SetContents(Greasemonkey::Transform(contents), - "help"); + if (mode == `create) + { + contents = add(contents, `Left(`InputField(`id("vgname"), "Volume Group Name"))); + contents = add(contents, `Left(`InputField(`id("pesize"), _("&Physical Extent Size"), "4 MB"))); + } - MiniWorkflow::SetLastStep(true); + contents = add(contents, DualMultiSelectionBox::Create(candidates_list)); - UpdateTotalSizes(); + MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help"); + MiniWorkflow::SetLastStep(true); - symbol widget = nil; + UpdateTotalSizes(); - repeat - { - widget = (symbol) MiniWorkflow::UserInput(); - DualMultiSelectionBox::Handle(widget); - if (contains([`add, `add_all, `remove, `remove_all], widget)) - { - UpdateTotalSizes(); - } - else if (widget == `next) - { - vgname = deletechars((string) UI::QueryWidget(`id("vgname"), `Value), " \t"); - pesize = (string) UI::QueryWidget(`id("pesize"), `Value); - - list<term> tmp1 = DualMultiSelectionBox::GetSelectedItems(); - list<map> candidates_selected = filter(map candidate, candidates, { - any id = `id(candidate["device"]:""); - return find (term t, tmp1, { return t[0]:nil == id; }) != nil; - }); - pvs = maplist(map candidate, candidates_selected, { return candidate["device"]:""; }); + symbol widget = nil; - // TODO: checks - } + repeat + { + widget = (symbol) MiniWorkflow::UserInput(); + DualMultiSelectionBox::Handle(widget); + + if (contains([`add, `add_all, `remove, `remove_all], widget)) + { + UpdateTotalSizes(); } - until (widget == `abort || widget == `back || widget == `next); + else if (widget == `next) + { + vgname = deletechars((string) UI::QueryWidget(`id("vgname"), `Value), " \t"); + pesize = (string) UI::QueryWidget(`id("pesize"), `Value); - if (widget == `next) - return `finish; - else - return widget; + list<term> tmp1 = DualMultiSelectionBox::GetSelectedItems(); + list<map> candidates_selected = filter(map candidate, candidates, { + any id = `id(candidate["device"]:""); + return find (term t, tmp1, { return t[0]:nil == id; }) != nil; + }); + pvs = maplist(map candidate, candidates_selected, { return candidate["device"]:""; }); + + // TODO: checks + } } + until (widget == `abort || widget == `back || widget == `next); + + y2milestone("MiniWorkflowStepVg data:%1 ret:%2", data, widget); + + return widget; + } + string DlgCreateVolumeGroupNew() + { + map data = $[ "mode" : `create ]; + map<string, any> aliases = $[ - "TheOne" : ``(StepTheOne()) + "TheOne" : ``(MiniWorkflowStepVg(data)) ]; map<string, any> sequence = $[ @@ -117,14 +121,34 @@ if (widget == `finish) { + /* if (Storage::CreateLvmVgWithDevs(vgname, pesize_str_to_byte (pesize), true, pvs)) return vgname; + */ } return ""; } + boolean DlgResizeVolumeGroup() + { + map data = $[ "mode" : `resize ]; + + map<string, any> aliases = $[ + "TheOne" : ``(MiniWorkflowStepVg(data)) + ]; + + map<string, any> sequence = $[ + "TheOne" : $[ `finish : `finish ] + ]; + + symbol widget = MiniWorkflow::Run(_("Add Volume Group"), aliases, sequence, "TheOne"); + + return false; + } + + symbol MiniWorkflowStepLvName(map &data) { y2milestone("MiniWorkflowStepLvName data:%1", data); Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp Fri Apr 11 21:28:21 2008 @@ -87,12 +87,22 @@ string device = (string) user_data; string vgname = substring(device, 5); - if (widget == `delete) + switch ((symbol) widget) { - if (EpDeleteVg(vgname)) + case `resize: { - // TODO: update tree (with focus) - UpdateNavigationTree(`lvm); + DlgResizeVolumeGroup(); + break; + } + + case `delete: + { + if (EpDeleteVg(vgname)) + { + // TODO: update tree (with focus) + UpdateNavigationTree(`lvm); + } + break; } } } Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Fri Apr 11 21:28:21 2008 @@ -16,6 +16,8 @@ import "StorageFields"; import "MiniWorkflow"; import "Greasemonkey"; + import "Partitions"; + import "DualMultiSelectionBox"; void UpdateNavigationTree(any new_focus); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org