File tree 23 files changed +337
-0
lines changed
packages/manager/modules/netapp/src/dashboard/volumes
components/edit-reserve-space
23 files changed +337
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export default {
19
19
canEditVolumes : '<' ,
20
20
isDashboardAvailable : '<' ,
21
21
trackClick : '<' ,
22
+ goToEditVolumeReserveSpace : '<' ,
22
23
totalVolumesStorage : '<' ,
23
24
} ,
24
25
template,
Original file line number Diff line number Diff line change
1
+ import template from './template.html' ;
2
+ import controller from './controller' ;
3
+
4
+ export default {
5
+ bindings : {
6
+ storage : '<' ,
7
+ volume : '<' ,
8
+ goBack : '<' ,
9
+ } ,
10
+ template,
11
+ controller,
12
+ } ;
Original file line number Diff line number Diff line change
1
+ export const BOUNDARIES = {
2
+ MIN_SPACE_PERCENT : 5 ,
3
+ MAX_SPACE_PERCENT : 100 ,
4
+ } ;
5
+
6
+ export default {
7
+ BOUNDARIES ,
8
+ } ;
Original file line number Diff line number Diff line change
1
+ import { BOUNDARIES } from './constant' ;
2
+
3
+ export default class VolumeEditReserveSpaceCtrl {
4
+ /* @ngInject */
5
+ constructor ( $translate , EditReserveSpaceService ) {
6
+ this . $translate = $translate ;
7
+ this . EditReserveSpaceService = EditReserveSpaceService ;
8
+ }
9
+
10
+ $onInit ( ) {
11
+ this . isLoading = true ;
12
+ this . errorMessage = null ;
13
+ this . model = {
14
+ percent : BOUNDARIES . MIN_SPACE_PERCENT ,
15
+ } ;
16
+
17
+ this . boundaries = BOUNDARIES ;
18
+ this . EditReserveSpaceService . getSnapshotReserveSpace (
19
+ this . storage . id ,
20
+ this . volume ,
21
+ ) . then ( ( data ) => {
22
+ this . model . percent = data . percent ;
23
+ this . isLoading = false ;
24
+ } ) ;
25
+ }
26
+
27
+ cancel ( ) {
28
+ this . goBack ( ) ;
29
+ }
30
+
31
+ modifySnapshotReserveSpace ( ) {
32
+ this . EditReserveSpaceService . modifySnapshotReserveSpace (
33
+ this . storage . id ,
34
+ this . volume ,
35
+ this . model . percent ,
36
+ )
37
+ . then ( ( ) => {
38
+ this . goBack (
39
+ this . $translate . instant ( 'netapp_volumes_edit_reserve_space_success' , {
40
+ volumeName : this . volume . name || this . volume . id ,
41
+ } ) ,
42
+ ) ;
43
+ } )
44
+ . catch ( ( error ) => {
45
+ this . errorMessage = this . $translate . instant (
46
+ 'netapp_volumes_edit_reserve_space_error' ,
47
+ {
48
+ message : error ?. data ?. message || error . message ,
49
+ requestId : error . headers ( 'X-Ovh-Queryid' ) ,
50
+ } ,
51
+ ) ;
52
+ } ) ;
53
+ }
54
+ }
Original file line number Diff line number Diff line change
1
+ import angular from 'angular' ;
2
+ import component from './component' ;
3
+ import service from './service' ;
4
+
5
+ const moduleName = 'ovhManagerNetAppVolumesEditReserveSpaceModule' ;
6
+
7
+ angular
8
+ . module ( moduleName , [ 'oui' , 'pascalprecht.translate' ] )
9
+ . service ( 'EditReserveSpaceService' , service )
10
+ . component ( 'ovhManagerNetAppVolumesEditReserveSpaceComponent' , component )
11
+ . run ( /* @ngTranslationsInject :json ./translations */ ) ;
12
+
13
+ export default moduleName ;
Original file line number Diff line number Diff line change
1
+ export default class NetAppDashboardEditReserveSpaceService {
2
+ /* @ngInject */
3
+ constructor ( $http ) {
4
+ this . $http = $http ;
5
+ }
6
+
7
+ modifySnapshotReserveSpace ( serviceName , volume , newPercent ) {
8
+ return this . $http . put (
9
+ `/storage/netapp/${ serviceName } /share/${ volume . id } /snapshotReserve` ,
10
+ {
11
+ percent : newPercent ,
12
+ } ,
13
+ ) ;
14
+ }
15
+
16
+ getSnapshotReserveSpace ( serviceName , volume ) {
17
+ return this . $http
18
+ . get ( `/storage/netapp/${ serviceName } /share/${ volume . id } /snapshotReserve` )
19
+ . then ( ( { data } ) => data ) ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ < oui-modal
2
+ data-heading ="{{:: 'netapp_volumes_edit_reserve_space_title' | translate }} "
3
+ data-loading ="$ctrl.isLoading "
4
+ data-primary-action ="$ctrl.modifySnapshotReserveSpace() "
5
+ data-primary-label ="{{:: 'netapp_volumes_edit_reserve_space_submit' | translate }} "
6
+ data-primary-disabled ="$ctrl.editVolumeSizeForm.$invalid "
7
+ data-
8
+ secondary-action ="$ctrl.cancel() "
9
+ data-secondary-label ="{{:: 'netapp_volumes_edit_reserve_space_cancel' | translate }} "
10
+ data-on-dismiss ="$ctrl.cancel() "
11
+ >
12
+ < oui-message data-type ="error " data-ng-if ="$ctrl.errorMessage ">
13
+ < span data-ng-bind-html ="$ctrl.errorMessage "> </ span >
14
+ </ oui-message >
15
+ < form novalidate name ="$ctrl.editVolumeSizeForm ">
16
+ < oui-field
17
+ data-label ="{{:: 'netapp_volumes_edit_reserve_space_label' | translate: { name: $ctrl.volume.name || $ctrl.volume.id } }} "
18
+ data-help-text ="{{:: 'netapp_volumes_edit_reserve_space_rules' | translate: { min: $ctrl.boundaries.MIN_SPACE_PERCENT, max: $ctrl.boundaries.MAX_SPACE_PERCENT } }} "
19
+ >
20
+ < oui-numeric
21
+ data-id ="percent "
22
+ data-name ="percent "
23
+ min ="$ctrl.boundaries.MIN_SPACE_PERCENT "
24
+ max ="$ctrl.boundaries.MAX_SPACE_PERCENT "
25
+ model ="$ctrl.model.percent "
26
+ >
27
+ </ oui-numeric >
28
+ </ oui-field >
29
+ </ form >
30
+ </ oui-modal >
Original file line number Diff line number Diff line change
1
+ {
2
+ "netapp_volumes_edit_reserve_space_title" : " Modifier la réserve des snapshots" ,
3
+ "netapp_volumes_edit_reserve_space_submit" : " Modifier l'espace" ,
4
+ "netapp_volumes_edit_reserve_space_cancel" : " Annuler" ,
5
+ "netapp_volumes_edit_reserve_space_label" : " Espace réservé" ,
6
+ "netapp_volumes_edit_reserve_space_rules" : " Taille autorisée : min {{min}}%, max {{max}}%" ,
7
+ "netapp_volumes_edit_reserve_space_success" : " L'espace réservé pour les snapshots sera modifiée dans quelques instants" ,
8
+ "netapp_volumes_edit_reserve_space_error" : " Une erreur est survenue <br> {{message}} <br> request_id: {{requestId}}"
9
+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ export default {
12
12
updateVolume : '<' ,
13
13
goToVolumeDashboard : '<' ,
14
14
goToEditVolumeSize : '<' ,
15
+ goToEditVolumeReserveSpace : '<' ,
16
+ volumeReserveSpacePercentage : '<' ,
15
17
} ,
16
18
controller,
17
19
template,
Original file line number Diff line number Diff line change
1
+ import angular from 'angular' ;
2
+ import '@uirouter/angularjs' ;
3
+ import 'oclazyload' ;
4
+
5
+ const moduleName =
6
+ 'ovhManagerNetAppVolumesDashboardEditReserveSpaceLazyLoading' ;
7
+
8
+ angular . module ( moduleName , [ 'ui.router' , 'oc.lazyLoad' ] ) . config (
9
+ /* @ngInject */ ( $stateProvider ) => {
10
+ $stateProvider . state (
11
+ 'netapp.dashboard.volumes.dashboard.edit-reserve-space.**' ,
12
+ {
13
+ url : '/edit-reserve-space' ,
14
+ lazyLoad : ( $transition$ ) => {
15
+ const $ocLazyLoad = $transition$ . injector ( ) . get ( '$ocLazyLoad' ) ;
16
+
17
+ return import ( './module' ) . then ( ( mod ) =>
18
+ $ocLazyLoad . inject ( mod . default || mod ) ,
19
+ ) ;
20
+ } ,
21
+ } ,
22
+ ) ;
23
+ } ,
24
+ ) ;
25
+
26
+ export default moduleName ;
Original file line number Diff line number Diff line change
1
+ import angular from 'angular' ;
2
+ import '@ovh-ux/manager-core' ;
3
+ import '@uirouter/angularjs' ;
4
+ import 'angular-translate' ;
5
+ import routing from './routing' ;
6
+ import editReserveSpace from '../../components/edit-reserve-space' ;
7
+
8
+ const moduleName = 'ovhManagerNetAppVolumesDashboardEditReserveSpace' ;
9
+
10
+ angular
11
+ . module ( moduleName , [
12
+ 'ovhManagerCore' ,
13
+ 'pascalprecht.translate' ,
14
+ 'ui.router' ,
15
+ editReserveSpace ,
16
+ ] )
17
+ . config ( routing )
18
+ . run ( /* @ngTranslationsInject :json ./translations */ ) ;
19
+
20
+ export default moduleName ;
Original file line number Diff line number Diff line change
1
+ export default /* @ngInject */ ( $stateProvider ) => {
2
+ $stateProvider . state (
3
+ 'netapp.dashboard.volumes.dashboard.edit-reserve-space' ,
4
+ {
5
+ url : '/edit-reserve-space' ,
6
+ views : {
7
+ modal : {
8
+ component : 'ovhManagerNetAppVolumesEditReserveSpaceComponent' ,
9
+ } ,
10
+ } ,
11
+ layout : 'modal' ,
12
+ resolve : {
13
+ breadcrumb : ( ) => null ,
14
+ volumeId : /* @ngInject */ ( $transition$ ) =>
15
+ $transition$ . params ( ) . volumeId ,
16
+ volume : /* @ngInject */ ( volumes , volumeId ) =>
17
+ volumes . find ( ( { id } ) => id === volumeId ) ,
18
+ goBack : /* @ngInject */ ( goToVolumeDetails , volume ) => ( message ) => {
19
+ goToVolumeDetails ( volume , message ) ;
20
+ } ,
21
+ } ,
22
+ } ,
23
+ ) ;
24
+ } ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import routing from './routing';
11
11
import aclModule from './acl' ;
12
12
import snapshotsModule from './snapshots' ;
13
13
import editSize from './edit-size' ;
14
+ import editReserveSpace from './edit-reserve-space' ;
14
15
15
16
const moduleName = 'ovhManagerNetAppVolumesDashboard' ;
16
17
@@ -23,6 +24,7 @@ angular
23
24
aclModule ,
24
25
snapshotsModule ,
25
26
editSize ,
27
+ editReserveSpace ,
26
28
] )
27
29
. config ( routing )
28
30
. component ( 'ovhManagerNetAppVolumesDashboard' , component )
Original file line number Diff line number Diff line change @@ -87,6 +87,26 @@ export default /* @ngInject */ ($stateProvider) => {
87
87
volumeId,
88
88
} ) ;
89
89
} ,
90
+ volumeReserveSpacePercentage : /* @ngInject */ (
91
+ $http ,
92
+ serviceName ,
93
+ volumeId ,
94
+ ) =>
95
+ $http
96
+ . get (
97
+ `/storage/netapp/${ serviceName } /share/${ volumeId } /snapshotReserve` ,
98
+ )
99
+ . then ( ( { data } ) => data ?. percent || 5 )
100
+ . catch ( ( ) => null ) ,
101
+ goToEditVolumeReserveSpace : /* @ngInject */ (
102
+ $state ,
103
+ serviceName ,
104
+ volumeId ,
105
+ ) => ( ) =>
106
+ $state . go ( 'netapp.dashboard.volumes.dashboard.edit-reserve-space' , {
107
+ serviceName,
108
+ volumeId,
109
+ } ) ,
90
110
breadcrumb : /* @ngInject */ ( volumeId ) => volumeId ,
91
111
} ,
92
112
} ) ;
Original file line number Diff line number Diff line change 78
78
</ oui-action-menu-item >
79
79
</ oui-action-menu >
80
80
</ oui-tile-definition >
81
+ < oui-tile-definition
82
+ data-term ="{{:: 'netapp_volumes_dashboard_information_reserve_space' | translate }} "
83
+ data-description ="{{ $ctrl.volumeReserveSpacePercentage + '%'}} "
84
+ >
85
+ < oui-action-menu compact >
86
+ < oui-action-menu-item
87
+ data-on-click ="$ctrl.goToEditVolumeReserveSpace() "
88
+ >
89
+ < span
90
+ data-translate ="netapp_volumes_edit_reserve_space "
91
+ > </ span >
92
+ </ oui-action-menu-item >
93
+ </ oui-action-menu >
94
+ </ oui-tile-definition >
81
95
</ oui-tile >
82
96
< oui-tile
83
97
class ="col-md-8 "
Original file line number Diff line number Diff line change 6
6
"netapp_volumes_dashboard_information_protocol" : " Protocole" ,
7
7
"netapp_volumes_dashboard_information_size" : " Taille du volume" ,
8
8
"netapp_volumes_dashboard_information_size_unit" : " {{size }} Go" ,
9
+ "netapp_volumes_dashboard_information_reserve_space" : " Réserve des snapshots" ,
9
10
"netapp_volumes_dashboard_connection" : " Connexion des volumes" ,
10
11
"netapp_volumes_dashboard_connection_mount_path" : " Mount path" ,
11
12
"netapp_volumes_dashboard_connection_how_to" : " Comment connecter votre volume" ,
Original file line number Diff line number Diff line change
1
+ import angular from 'angular' ;
2
+ import '@uirouter/angularjs' ;
3
+ import 'oclazyload' ;
4
+
5
+ const moduleName = 'ovhManagerNetAppVolumesEditReserveSpaceLazyLoading' ;
6
+
7
+ angular . module ( moduleName , [ 'ui.router' , 'oc.lazyLoad' ] ) . config (
8
+ /* @ngInject */ ( $stateProvider ) => {
9
+ $stateProvider . state ( 'netapp.dashboard.volumes.edit-reserve-space.**' , {
10
+ url : '/edit-reserve-space' ,
11
+ lazyLoad : ( $transition$ ) => {
12
+ const $ocLazyLoad = $transition$ . injector ( ) . get ( '$ocLazyLoad' ) ;
13
+
14
+ return import ( './module' ) . then ( ( mod ) =>
15
+ $ocLazyLoad . inject ( mod . default || mod ) ,
16
+ ) ;
17
+ } ,
18
+ } ) ;
19
+ } ,
20
+ ) ;
21
+
22
+ export default moduleName ;
Original file line number Diff line number Diff line change
1
+ import angular from 'angular' ;
2
+ import '@ovh-ux/manager-core' ;
3
+ import '@uirouter/angularjs' ;
4
+ import 'angular-translate' ;
5
+ import editSize from '../components/edit-reserve-space' ;
6
+
7
+ import routing from './routing' ;
8
+
9
+ const moduleName = 'ovhManagerNetAppVolumesEditReserveSpace' ;
10
+
11
+ angular
12
+ . module ( moduleName , [
13
+ 'ovhManagerCore' ,
14
+ 'pascalprecht.translate' ,
15
+ 'ui.router' ,
16
+ editSize ,
17
+ ] )
18
+ . config ( routing )
19
+ . run ( /* @ngTranslationsInject :json ./translations */ ) ;
20
+
21
+ export default moduleName ;
Original file line number Diff line number Diff line change
1
+ export default /* @ngInject */ ( $stateProvider ) => {
2
+ $stateProvider . state ( 'netapp.dashboard.volumes.edit-reserve-space' , {
3
+ url : '/edit-reserve-space?volumeId' ,
4
+ views : {
5
+ modal : {
6
+ component : 'ovhManagerNetAppVolumesEditReserveSpaceComponent' ,
7
+ } ,
8
+ } ,
9
+ layout : 'modal' ,
10
+ resolve : {
11
+ breadcrumb : ( ) => null ,
12
+ volumeId : /* @ngInject */ ( $transition$ ) =>
13
+ $transition$ . params ( ) . volumeId ,
14
+ volume : /* @ngInject */ ( volumes , volumeId ) =>
15
+ volumes . find ( ( { id } ) => id === volumeId ) ,
16
+ goBack : /* @ngInject */ ( goToVolumes ) => ( message ) => {
17
+ goToVolumes ( message ) ;
18
+ } ,
19
+ } ,
20
+ } ) ;
21
+ } ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import create from './create';
11
11
import deleteModule from './delete' ;
12
12
import dashboard from './dashboard' ;
13
13
import editSize from './edit-size' ;
14
+ import editReserveSpace from './edit-reserve-space' ;
14
15
15
16
const moduleName = 'ovhManagerNetAppVolumes' ;
16
17
@@ -24,6 +25,7 @@ angular
24
25
deleteModule ,
25
26
dashboard ,
26
27
editSize ,
28
+ editReserveSpace ,
27
29
] )
28
30
. config ( routing )
29
31
. component ( 'ovhManagerNetAppVolumes' , component )
Original file line number Diff line number Diff line change @@ -138,6 +138,14 @@ export default /* @ngInject */ ($stateProvider) => {
138
138
volumeId : volume . id ,
139
139
} ) ;
140
140
} ,
141
+ goToEditVolumeReserveSpace : /* @ngInject */ ( $state , serviceName ) => (
142
+ volume ,
143
+ ) => {
144
+ return $state . go ( 'netapp.dashboard.volumes.edit-reserve-space' , {
145
+ serviceName,
146
+ volumeId : volume . id ,
147
+ } ) ;
148
+ } ,
141
149
goToDeleteVolume : /* @ngInject */ ( $state , serviceName , trackClick ) => (
142
150
volume ,
143
151
) => {
Original file line number Diff line number Diff line change 111
111
< oui-action-menu-item data-on-click ="$ctrl.goToDeleteVolume($row) ">
112
112
< span data-translate ="netapp_volumes_delete_volume "> </ span >
113
113
</ oui-action-menu-item >
114
+ < oui-action-menu-item
115
+ data-on-click ="$ctrl.goToEditVolumeReserveSpace($row) "
116
+ >
117
+ < span data-translate ="netapp_volumes_edit_reserve_space "> </ span >
118
+ </ oui-action-menu-item >
114
119
</ oui-action-menu >
115
120
</ oui-datagrid >
116
121
</ div >
Original file line number Diff line number Diff line change 42
42
"netapp_volumes_manage_acl" : " Gérer IP Access (ACL)" ,
43
43
"netapp_volumes_delete_volume" : " Supprimer le volume" ,
44
44
"netapp_volumes_edit_volume_size" : " Modifier la taille" ,
45
+ "netapp_volumes_edit_reserve_space" : " Modifier l'espace réservé des snapshots" ,
45
46
"netapp_volumes_mount_path_not_configurated" : " Non configuré"
46
47
}
You can’t perform that action at this time.
0 commit comments