Skip to content

Commit

Permalink
Merge pull request #487 from yast/all-in-one-overview
Browse files Browse the repository at this point in the history
CASP/CaaSP new all-in-one overview dialog
  • Loading branch information
mvidner committed Jan 26, 2017
2 parents b418549 + 6590f77 commit 6dd36ec
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -5,7 +5,7 @@ before_install:
# disable rvm, use system Ruby
- rvm reset
- wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh
- sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2-core-dev yast2 yast2-network yast2-transfer yast2-users yast2-country" -g "rspec:3.3.0 yast-rake gettext rubocop:0.41.2 simplecov coveralls cheetah"
- sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2-core-dev yast2 yast2-network yast2-transfer yast2-users yast2-country" -g "rspec:3.3.0 yast-rake gettext rubocop:0.41.2 simplecov:0.12.0 coveralls:0.8.19 cheetah"
script:
- rake check:syntax
- rake check:pot
Expand Down
6 changes: 6 additions & 0 deletions package/yast2-installation.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 25 15:29:02 UTC 2017 - mvidner@suse.com

- Added an all-in-one installation overview for CaaSP (FATE#322328)
- 3.1.217.13

-------------------------------------------------------------------
Fri Jan 20 08:44:28 UTC 2017 - mfilka@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-installation.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-installation
Version: 3.1.217.12
Version: 3.1.217.13
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
8 changes: 8 additions & 0 deletions src/Makefile.am
Expand Up @@ -23,6 +23,7 @@ client_DATA = \
clients/installation.rb \
clients/installation_settings_finish.rb \
clients/inst_ask_online_update.rb \
clients/inst_casp_overview.rb \
clients/inst_complex_welcome.rb \
clients/inst_congratulate.rb \
clients/inst_deploy_image.rb \
Expand Down Expand Up @@ -152,6 +153,7 @@ ylibclient_DATA = \
lib/installation/clients/installation.rb \
lib/installation/clients/installation_settings_finish.rb \
lib/installation/clients/inst_ask_online_update.rb \
lib/installation/clients/inst_casp_overview.rb \
lib/installation/clients/inst_complex_welcome.rb \
lib/installation/clients/inst_congratulate.rb \
lib/installation/clients/inst_deploy_image.rb \
Expand Down Expand Up @@ -210,6 +212,12 @@ ylibdialog_DATA = \
lib/installation/dialogs/ssh_import.rb \
lib/installation/dialogs/worker_role.rb

ylibwidgetdir = "${yast2dir}/lib/installation/widgets"
ylibwidget_DATA = \
lib/installation/widgets/mocked.rb \
lib/installation/widgets/overview.rb \
lib/installation/widgets/system_role.rb

EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) $(schemafiles_DATA) $(desktop_DATA) $(fillup_DATA) $(ylibdialog_DATA) $(ylib_DATA) $(ylibtransfer_DATA)

include $(top_srcdir)/Makefile.am.common
2 changes: 2 additions & 0 deletions src/clients/inst_casp_overview.rb
@@ -0,0 +1,2 @@
require "installation/clients/inst_casp_overview"
::Installation::InstCaspOverview.new.run
133 changes: 133 additions & 0 deletions src/lib/installation/clients/inst_casp_overview.rb
@@ -0,0 +1,133 @@
# 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/overview"
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?

ret = nil
loop do
ret = Yast::CWM.show(
content,
# Title for installation overview dialog
caption: _("Installation Overview"),
# Button label: start the installation
next_button: _("Install"),
# do not show abort and back button
abort_button: "",
back_button: "",
# do not store stuff when just redrawing
skip_store_for: [:redraw]
)
break if ret != :redraw
end

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
dashboard = Installation::Widgets::DashboardPlace.new
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(dashboard),
dashboard,
Tune::Widgets::SystemInformation.new
),
upper_right: VBox(
Installation::Widgets::Overview.new(client: "partitions_proposal"),
Installation::Widgets::Overview.new(client: "bootloader_proposal")
),
lower_right: VBox(
Installation::Widgets::Overview.new(client: "network_proposal"),
Installation::Widgets::Overview.new(client: "kdump_proposal"),
Installation::Widgets::InvisibleSoftwareOverview.new
)
)
end

# Returns whether we need/ed to create new UI Wizard
def separate_wizard_needed?
Yast::Mode.normal
end
end
end
17 changes: 17 additions & 0 deletions src/lib/installation/widgets/mocked.rb
@@ -0,0 +1,17 @@
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
85 changes: 85 additions & 0 deletions src/lib/installation/widgets/overview.rb
@@ -0,0 +1,85 @@
# 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
# A widget for an all-in-one installation dialog.
# It uses the `simple_mode` of {Installation::ProposalClient#make_proposal}
class Overview < CWM::CustomWidget
attr_reader :proposal_client

# @param client [String] A proposal client implementing simple_mode,
# eg. "bootloader_proposal"
def initialize(client:)
@proposal_client = client
# by default widget_id is the class name; must differentiate instances
self.widget_id = "overview_" + client
end

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",
{ "simple_mode" => true }
])
d["label_proposal"]
end

def handle(_event)
Yast::WFM.CallFunction(proposal_client, ["AskUser", {}])
:redraw
end

private

def button_id
# an arbitrary unique id
"ask_" + proposal_client
end
end

class InvisibleSoftwareOverview < Overview
def initialize
super(client: "software_proposal")
end

def contents
_ = items
Empty()
end
end
end
end

0 comments on commit 6dd36ec

Please sign in to comment.