Skip to content

Commit

Permalink
feat(dedicated): add choice partitioning scheme in customer templates
Browse files Browse the repository at this point in the history
ref: MANAGER-11680
Signed-off-by: Jean-Baptiste Delon <[email protected]>
  • Loading branch information
JayBeeDe committed Aug 9, 2023
1 parent 548b935 commit 537b3ba
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import map from 'lodash/map';
import parseInt from 'lodash/parseInt';
import set from 'lodash/set';
import snakeCase from 'lodash/snakeCase';
import sortBy from 'lodash/sortBy';
import orderBy from 'lodash/orderBy';
import uniq from 'lodash/uniq';

export default class Server {
Expand Down Expand Up @@ -2152,16 +2152,14 @@ export default class Server {
);
}

getHighestPriorityPartitionScheme(productId, templateName) {
getPartitionSchemesByPriority(productId, templateName) {
return this.getPartitionSchemes(productId, templateName).then((schemes) => {
const getSchemes = map(schemes, (scheme) =>
this.getPartitionSchemePriority(productId, templateName, scheme),
);

return this.$q.all(getSchemes).then((schemesDetails) => {
const list = sortBy(schemesDetails, 'priority').reverse();

return list[0];
return map(orderBy(schemesDetails, 'priority', 'desc'), 'name');
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ angular
$scope.load = function load() {
$scope.loader.loading = true;
$scope.installation.selectGabarit = null;
$scope.installation.partitionSchemesList = null;
$scope.installation.selectPartitionScheme = null;
$scope.installation.selectFamily = null;
$scope.installation.selectLanguage = null;
$scope.installation.selectSoftRaidOnlyMirroring = null;
Expand Down Expand Up @@ -165,20 +167,24 @@ angular
validForm: true,
};

Server.getHighestPriorityPartitionScheme(
Server.getPartitionSchemesByPriority(
$stateParams.productId,
$scope.installation.selectGabarit.id,
)
.then((response) => {
$scope.installation.partitionSchemesList = response;
[$scope.installation.selectPartitionScheme] = response;
})
.then((response) =>
Server.getPartitionSchemeHardwareRaid(
$stateParams.productId,
$scope.installation.selectGabarit.id,
response.name,
response[0],
),
)
.then((response) => {
if (response) {
tempHardwareRaid = response;
if (response[0]) {
[tempHardwareRaid] = response;
return Server.getHardwareRaidProfile($stateParams.productId);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ <h4 class="panel-title">
</div>

<!-- nbDisk -->
<div
<p
class="form-inline"
data-ng-if="informations.nbDisk > 1"
>
Expand Down Expand Up @@ -505,7 +505,28 @@ <h4 class="panel-title">
data-ng-model="installation.nbDiskUse"
>
</select>
</div>
</p>

<!-- selectPartitionScheme -->
<p
class="form-inline"
data-ng-show="installation.partitionSchemesList.length > 1"
>
<label
for="selectPartitionScheme"
class="control-label"
data-translate="server_configuration_installation_ovh_step2_scheme"
>
</label>
<select
class="form-control"
id="selectPartitionScheme"
name="selectPartitionScheme"
data-ng-options="partitionScheme as partitionScheme for partitionScheme in installation.partitionSchemesList"
data-ng-model="installation.selectPartitionScheme"
>
</select>
</p>
</form>

<p
Expand Down

0 comments on commit 537b3ba

Please sign in to comment.