Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Mar 7, 2024
1 parent c43827a commit 9ddc148
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
8 changes: 5 additions & 3 deletions products.d/tumbleweed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ storage:
- mount_path: "swap"
filesystem: swap
size:
auto: false
min: 1 GiB
max: 2 GiB
auto: true
outline:
auto_size:
base_min: 1 GiB
base_max: 2 GiB
adjust_by_ram: true
required: false
filesystems:
- swap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def outline_conversion(target)
"Required" => outline.required?,
"FsTypes" => outline.filesystems.map(&:to_human_string),
"SupportAutoSize" => outline.adaptive_sizes?,
"AdjustByRam" => outline.adjust_by_ram?,
"SnapshotsConfigurable" => outline.snapshots_configurable?,
"SnapshotsAffectSizes" => outline.snapshots_affect_sizes?,
"SizeRelevantVolumes" => outline.size_relevant_volumes
Expand Down
2 changes: 2 additions & 0 deletions web/src/client/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class ProposalManager {
* @property {boolean} required
* @property {string[]} fsTypes
* @property {boolean} supportAutoSize
* @property {boolean} adjustByRam
* @property {boolean} snapshotsConfigurable
* @property {boolean} snapshotsAffectSizes
* @property {string[]} sizeRelevantVolumes
Expand Down Expand Up @@ -543,6 +544,7 @@ class ProposalManager {
required: dbusOutline.Required.v,
fsTypes: dbusOutline.FsTypes.v.map(val => val.v),
supportAutoSize: dbusOutline.SupportAutoSize.v,
adjustByRam: dbusOutline.AdjustByRam.v,
snapshotsConfigurable: dbusOutline.SnapshotsConfigurable.v,
snapshotsAffectSizes: dbusOutline.SnapshotsAffectSizes.v,
sizeRelevantVolumes: dbusOutline.SizeRelevantVolumes.v.map(val => val.v)
Expand Down
8 changes: 5 additions & 3 deletions web/src/components/storage/ProposalVolumes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import { noop } from "~/utils";
* @returns {(ReactComponent|null)} component to display (can be `null`)
*/
const AutoCalculatedHint = (volume) => {
// no hint, the size is not affected by snapshots or other volumes
const { snapshotsAffectSizes = false, sizeRelevantVolumes = [] } = volume.outline;
const { snapshotsAffectSizes = false, sizeRelevantVolumes = [], adjustByRam } = volume.outline;

if (!snapshotsAffectSizes && sizeRelevantVolumes.length === 0) {
// no hint, the size is not affected by known criteria
if (!snapshotsAffectSizes && !adjustByRam && sizeRelevantVolumes.length === 0) {
return null;
}

Expand All @@ -65,6 +65,8 @@ const AutoCalculatedHint = (volume) => {
// TRANSLATORS: list item, this affects the computed partition size limits
// %s is replaced by a list of the volumes (like "/home, /boot")
<ListItem>{sprintf(_("Presence of other volumes (%s)"), sizeRelevantVolumes.join(", "))}</ListItem>}
{adjustByRam &&
<ListItem>{_("The amount of RAM in the system")}</ListItem>}
</List>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions web/src/components/storage/VolumeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ const SizeAuto = ({ volume }) => {
// TRANSLATORS: conjunction for merging two list items
volume.outline.sizeRelevantVolumes.join(_(", "))));

if (volume.outline.adjustByRam)
// TRANSLATORS: item which affects the final computed partition size
conditions.push(_("the amount of RAM in the system"));

// TRANSLATORS: the %s is replaced by the items which affect the computed size
const conditionsText = sprintf(_("The final size depends on %s."),
// TRANSLATORS: conjunction for merging two texts
Expand Down

0 comments on commit 9ddc148

Please sign in to comment.