Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement all-in-one overview for CASP/CaaSP (FATE#322328)
https://fate.suse.com/322328 Related PRs: - yast/yast-users#132 - yast/yast-country#108 - yast/yast-storage#254 - yast/yast-kdump#71
- Loading branch information
Showing
5 changed files
with
332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require "installation/clients/inst_casp_overview" | ||
::Installation::InstCaspOverview.new.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# encoding: utf-8 | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2017 SUSE LLC | ||
# | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, contact SUSE. | ||
# | ||
# To contact SUSE about this file by physical or electronic mail, you may find | ||
# current contact information at www.suse.com. | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "users/widgets" | ||
require "y2country/widgets" | ||
require "ui/widgets" | ||
require "tune/widgets" | ||
|
||
require "installation/widgets/system_role" | ||
# FIXME: prototype only | ||
require "installation/widgets/mocked" | ||
|
||
module Installation | ||
# This library provides a simple dialog for setting | ||
# - the password for the system administrator (root) | ||
# - the keyboard layout | ||
# This dialog does not write the password to the system, | ||
# only stores it in UsersSimple module, | ||
# to be written during inst_finish. | ||
class InstCaspOverview | ||
include Yast::Logger | ||
include Yast::I18n | ||
include Yast::UIShortcuts | ||
|
||
def run | ||
Yast.import "UI" | ||
Yast.import "Mode" | ||
Yast.import "CWM" | ||
|
||
textdomain "installation" | ||
|
||
# We do not need to create a wizard dialog in installation, but it's | ||
# helpful when testing all manually on a running system | ||
Yast::Wizard.CreateDialog if separate_wizard_needed? | ||
|
||
Yast::Wizard.SetTitleIcon("yast-users") # ? | ||
Yast::Wizard.EnableAbortButton | ||
|
||
# FIXME: where in the CaaSP workflow do we set the real thing? | ||
fake_release_notes = { | ||
# product name => notes (rich text) | ||
"CaaaaaaaSP!" => "<p>These are the <i>fake</i> release notes.</p>" | ||
} | ||
Yast::UI.SetReleaseNotes(fake_release_notes) | ||
# FIXME: This is copied from inst_complex_welcome | ||
# and may be superfluous here. We will find out once we integrate | ||
# this dialog in the workflow. | ||
Yast::Wizard.ShowReleaseNotesButton(_("Re&lease Notes..."), "rel_notes") | ||
|
||
ret = Yast::CWM.show( | ||
content, | ||
# Title for installation overview dialog | ||
caption: _("Installation Overview"), | ||
# Button label: start the installation | ||
next_button: _("Install") | ||
) | ||
|
||
Yast::Wizard.CloseDialog if separate_wizard_needed? | ||
|
||
ret | ||
end | ||
|
||
private | ||
|
||
def quadrant_layout(upper_left:, lower_left:, upper_right:, lower_right:) | ||
HBox( | ||
HWeight( | ||
6, | ||
VBox( | ||
VWeight(5, upper_left), | ||
VStretch(), | ||
VWeight(5, lower_left) | ||
) | ||
), | ||
HSpacing(3), | ||
HWeight( | ||
4, | ||
VBox( | ||
VWeight(5, upper_right), | ||
VStretch(), | ||
VWeight(5, lower_right) | ||
) | ||
) | ||
) | ||
end | ||
|
||
# Returns a UI widget-set for the dialog | ||
def content | ||
quadrant_layout( | ||
upper_left: VBox( | ||
::Widgets::RegistrationCode.new, | ||
::Users::PasswordWidget.new(little_space: true), | ||
# use english us as default keyboard layout | ||
::Y2Country::Widgets::KeyboardSelectionCombo.new("english-us") | ||
), | ||
lower_left: VBox( | ||
Installation::Widgets::SystemRole.new, | ||
Tune::Widgets::SystemInformation.new | ||
), | ||
upper_right: VBox( | ||
::Widgets::PartitioningOverview.new, | ||
::Widgets::BootloaderOverview.new | ||
), | ||
lower_right: VBox( | ||
::Widgets::NetworkOverview.new, | ||
::Widgets::KdumpOverview.new | ||
) | ||
) | ||
end | ||
|
||
# Returns whether we need/ed to create new UI Wizard | ||
def separate_wizard_needed? | ||
Yast::Mode.normal | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
require "yast" | ||
require "cwm/widget" | ||
|
||
# FIXME: these are mock only | ||
|
||
# move this to: yast2-registration | ||
module Widgets | ||
class RegistrationCode < CWM::InputField | ||
def initialize | ||
textdomain "FIXME" | ||
end | ||
|
||
def label | ||
_("Registration Code or SMT Server URL") | ||
end | ||
end | ||
end | ||
|
||
module Widgets | ||
class Overview < CWM::CustomWidget | ||
def contents | ||
VBox( | ||
Left(PushButton(Id(button_id), label)), | ||
* items.map { |i| Left(Label(" * #{i}")) } | ||
) | ||
end | ||
|
||
def label | ||
d = Yast::WFM.CallFunction(proposal_client, ["Description", {}]) | ||
d["menu_title"] | ||
end | ||
|
||
def items | ||
d = Yast::WFM.CallFunction(proposal_client, | ||
[ | ||
"MakeProposal", | ||
{"cramped_label_mode" => true} | ||
]) | ||
d["label_proposal"] | ||
end | ||
|
||
def handle(_event) | ||
Yast::WFM.CallFunction(proposal_client, ["AskUser", {}]) | ||
# FIXME: refresh the summary items | ||
nil | ||
end | ||
|
||
private | ||
|
||
def button_id | ||
self.class.to_s | ||
end | ||
end | ||
|
||
class PartitioningOverview < Overview | ||
def initialize | ||
textdomain "storage" | ||
end | ||
|
||
def proposal_client | ||
"partitions_proposal" | ||
end | ||
|
||
def label | ||
# FIXME: The storage subsystem is locked by an unknown app... | ||
if ENV["FAKE_STORAGE"] | ||
"&Partitioning" | ||
else | ||
super | ||
end | ||
end | ||
|
||
def items | ||
if ENV["FAKE_STORAGE"] | ||
["Standard"] | ||
else | ||
super | ||
end | ||
end | ||
end | ||
|
||
class BootloaderOverview < Overview | ||
def initialize | ||
textdomain "bootloader" | ||
|
||
Yast.import "Bootloader" | ||
end | ||
|
||
def proposal_client | ||
"bootloader_proposal" | ||
end | ||
|
||
def label | ||
_("Booting") | ||
end | ||
|
||
def items | ||
# FIXME: it returns richtext | ||
Yast::Bootloader.Summary | ||
end | ||
end | ||
|
||
class NetworkOverview < Overview | ||
def initialize | ||
textdomain "network" | ||
Yast.import "Lan" | ||
end | ||
|
||
def label | ||
_("&Network") | ||
end | ||
|
||
def items | ||
Yast::Lan.Summary("") | ||
end | ||
|
||
def handle(event) | ||
Yast::WFM.CallFunction("inst_lan", [{"skip_detection" => true}]) | ||
# FIXME: refresh the summary items | ||
nil | ||
end | ||
|
||
end | ||
|
||
class KdumpOverview < Overview | ||
def initialize | ||
textdomain "kdump" | ||
|
||
Yast.import "Kdump" | ||
end | ||
|
||
def proposal_client | ||
"kdump_proposal" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# encoding: utf-8 | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2017 SUSE LLC | ||
# | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, contact SUSE. | ||
# | ||
# To contact SUSE about this file by physical or electronic mail, you may find | ||
# current contact information at www.suse.com. | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "yast" | ||
require "cwm/widget" | ||
|
||
module Installation | ||
module Widgets | ||
# TODO: steal / refactor Installation::SelectSystemRole | ||
# from src/lib/installation/select_system_role.rb | ||
class SystemRole < CWM::ComboBox | ||
def initialize | ||
textdomain "installation" | ||
end | ||
|
||
def label | ||
_("System Role") | ||
end | ||
|
||
def opt | ||
[:hstretch] | ||
end | ||
|
||
def items | ||
[ | ||
# FIXME: still hardcoding for easier testing | ||
["foo", _("Adminstration Dashboard")], | ||
["bar", _("Worker")], | ||
["baz", _("Plain System")], | ||
["qux", _("FIXME use real data")] | ||
] | ||
end | ||
end | ||
end | ||
end |