diff --git a/web/src/client/storage.js b/web/src/client/storage.js index 66a92956bf..488862d9a1 100644 --- a/web/src/client/storage.js +++ b/web/src/client/storage.js @@ -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 @@ -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) diff --git a/web/src/client/storage.test.js b/web/src/client/storage.test.js index 73610f9a1b..6b797556a2 100644 --- a/web/src/client/storage.test.js +++ b/web/src/client/storage.test.js @@ -329,6 +329,7 @@ const contexts = { SupportAutoSize: { t: "b", v: true }, SnapshotsConfigurable: { t: "b", v: true }, SnapshotsAffectSizes: { t: "b", v: true }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [{ t: "s", v: "/home" }] } } } @@ -349,6 +350,7 @@ const contexts = { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1017,6 +1019,7 @@ describe("#proposal", () => { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1037,6 +1040,7 @@ describe("#proposal", () => { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1064,6 +1068,7 @@ describe("#proposal", () => { supportAutoSize: false, snapshotsConfigurable: false, snapshotsAffectSizes: false, + adjustByRam: false, sizeRelevantVolumes: [] } }); @@ -1084,6 +1089,7 @@ describe("#proposal", () => { supportAutoSize: false, snapshotsConfigurable: false, snapshotsAffectSizes: false, + adjustByRam: false, sizeRelevantVolumes: [] } }); diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index be080ece93..4015589800 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -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; } @@ -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") {sprintf(_("Presence of other volumes (%s)"), sizeRelevantVolumes.join(", "))}} + {adjustByRam && + {_("The amount of RAM in the system")}} ); diff --git a/web/src/components/storage/VolumeForm.jsx b/web/src/components/storage/VolumeForm.jsx index b93f3bae11..b106d9925d 100644 --- a/web/src/components/storage/VolumeForm.jsx +++ b/web/src/components/storage/VolumeForm.jsx @@ -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