-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #610 from yast/btrfs_storage_ui
[Storage-UI] Add Btrfs options
- Loading branch information
Showing
36 changed files
with
1,257 additions
and
107 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
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,40 @@ | ||
# Copyright (c) [2020] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# 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 LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "cwm/common_widgets" | ||
|
||
module Y2Autoinstallation | ||
module Widgets | ||
module Storage | ||
# Determines a Btrfs device | ||
class BtrfsDevice < CWM::InputField | ||
def initalize | ||
textdomain "autoinst" | ||
super | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def label | ||
_("Device") | ||
end | ||
end | ||
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,77 @@ | ||
# Copyright (c) [2020] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# 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 LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "cwm/custom_widget" | ||
require "autoinstall/widgets/storage/btrfs_name" | ||
|
||
module Y2Autoinstallation | ||
module Widgets | ||
module Storage | ||
# Btrfs member attributes | ||
# | ||
# It groups those attributes that are specific for a partition being used as a Btrfs member. | ||
# | ||
# @see PartitionUsageTab | ||
class BtrfsMemberAttrs < CWM::CustomWidget | ||
# Constructor | ||
# | ||
# @param section [Presenters::Partition] presenter for the partition section | ||
def initialize(section) | ||
textdomain "autoinst" | ||
super() | ||
@section = section | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def label | ||
"" | ||
end | ||
|
||
# @macro seeCustomWidget | ||
def contents | ||
Left(HSquash(MinWidth(15, btrfs_name_widget))) | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def init | ||
btrfs_name_widget.items = section.available_btrfs | ||
btrfs_name_widget.value = section.btrfs_name | ||
end | ||
|
||
# Returns the widgets values | ||
# | ||
# @return [Hash<String,Object>] | ||
def values | ||
{ "btrfs_name" => btrfs_name_widget.value } | ||
end | ||
|
||
private | ||
|
||
# @return [Presenters::Partition] presenter for the partition section | ||
attr_reader :section | ||
|
||
# Widget for setting the Btrfs multi-device filesystem | ||
def btrfs_name_widget | ||
@btrfs_name_widget ||= BtrfsName.new | ||
end | ||
end | ||
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,50 @@ | ||
# Copyright (c) [2020] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# 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 LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "cwm/common_widgets" | ||
|
||
module Y2Autoinstallation | ||
module Widgets | ||
module Storage | ||
# Widget to specify the Btrfs multi-device filesystem in which the device will be included. | ||
class BtrfsName < CWM::ComboBox | ||
def initalize | ||
textdomain "autoinst" | ||
super | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def label | ||
_("Btrfs Name") | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def opt | ||
[:editable] | ||
end | ||
|
||
def items=(devices) | ||
values = [["", ""]] + devices.map { |i| [i, i] } | ||
change_items(values) | ||
end | ||
end | ||
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,83 @@ | ||
# Copyright (c) [2020] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# 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 LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "autoinstall/widgets/storage/drive_page" | ||
require "autoinstall/widgets/storage/btrfs_device" | ||
require "autoinstall/widgets/storage/data_raid_level" | ||
require "autoinstall/widgets/storage/metadata_raid_level" | ||
|
||
module Y2Autoinstallation | ||
module Widgets | ||
module Storage | ||
# This page allows to edit a drive section representing a Btrfs device | ||
class BtrfsPage < DrivePage | ||
# @see DrivePage#initialize | ||
def initialize(*args) | ||
textdomain "autoinst" | ||
super | ||
end | ||
|
||
# @see DrivePage#widgets | ||
def widgets | ||
[ | ||
HSquash(MinWidth(15, device_widget)), | ||
data_raid_level_widget, | ||
metadata_raid_level_widget | ||
] | ||
end | ||
|
||
# @see DrivePage#init_widgets_values | ||
def init_widgets_values | ||
device_widget.value = section.device | ||
data_raid_level_widget.value = section.btrfs_options&.data_raid_level | ||
metadata_raid_level_widget.value = section.btrfs_options&.metadata_raid_level | ||
end | ||
|
||
# @see DrivePage#widgets_values | ||
def widgets_values | ||
{ | ||
"device" => device_widget.value, | ||
"btrfs_options" => { | ||
"data_raid_level" => data_raid_level_widget.value, | ||
"metadata_raid_level" => metadata_raid_level_widget.value | ||
} | ||
} | ||
end | ||
|
||
private | ||
|
||
# Widget for setting the device | ||
def device_widget | ||
@device_widget ||= BtrfsDevice.new | ||
end | ||
|
||
# Widget for setting the data RAID level | ||
def data_raid_level_widget | ||
@data_raid_level_widget ||= DataRaidLevel.new | ||
end | ||
|
||
# Widget for setting the metadata RAID level | ||
def metadata_raid_level_widget | ||
@metadata_raid_level_widget ||= MetadataRaidLevel.new | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.