magnum-ui 14.0.0__py3-none-any.whl → 15.0.0.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- magnum_ui/locale/en_GB/LC_MESSAGES/djangojs.po +12 -40
- magnum_ui/locale/ru/LC_MESSAGES/djangojs.po +1 -19
- magnum_ui/static/dashboard/container-infra/cluster-templates/actions.module.spec.js +1 -3
- magnum_ui/static/dashboard/container-infra/cluster-templates/cluster-templates.module.js +1 -1
- magnum_ui/static/dashboard/container-infra/cluster-templates/delete/delete.service.js +3 -0
- magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.js +1 -1
- magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.spec.js +3 -1
- magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.js +1 -1
- magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.spec.js +3 -1
- magnum_ui/static/dashboard/container-infra/cluster-templates/update/update.service.js +36 -50
- magnum_ui/static/dashboard/container-infra/clusters/actions.module.spec.js +1 -3
- magnum_ui/static/dashboard/container-infra/clusters/clusters.module.js +31 -7
- magnum_ui/static/dashboard/container-infra/clusters/clusters.scss +10 -0
- magnum_ui/static/dashboard/container-infra/clusters/clusters.utils.js +134 -0
- magnum_ui/static/dashboard/container-infra/clusters/clusters.utils.spec.js +56 -0
- magnum_ui/static/dashboard/container-infra/clusters/config/config.service.js +1 -1
- magnum_ui/static/dashboard/container-infra/clusters/delete/delete.service.js +3 -0
- magnum_ui/static/dashboard/container-infra/clusters/details/drawer.controller.js +1 -1
- magnum_ui/static/dashboard/container-infra/clusters/details/drawer.controller.spec.js +3 -1
- magnum_ui/static/dashboard/container-infra/clusters/details/drawer.html +12 -2
- magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.js +1 -1
- magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.spec.js +3 -1
- magnum_ui/static/dashboard/container-infra/clusters/workflow/advanced.help.html +2 -2
- magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.spec.js +8 -8
- magnum_ui/static/dashboard/container-infra/clusters/workflow/size.help.html +6 -1
- magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js +58 -21
- magnum_ui/static/dashboard/container-infra/magnum.service.js +2 -2
- magnum_ui/static/dashboard/container-infra/quotas/actions.module.spec.js +1 -3
- magnum_ui/static/dashboard/container-infra/quotas/delete/delete.service.js +3 -0
- magnum_ui/static/dashboard/container-infra/utils.service.js +16 -13
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/AUTHORS +1 -0
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/METADATA +1 -1
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/RECORD +37 -35
- magnum_ui-15.0.0.0rc1.dist-info/pbr.json +1 -0
- magnum_ui-14.0.0.dist-info/pbr.json +0 -1
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/LICENSE +0 -0
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/WHEEL +0 -0
- {magnum_ui-14.0.0.dist-info → magnum_ui-15.0.0.0rc1.dist-info}/top_level.txt +0 -0
@@ -6,15 +6,16 @@
|
|
6
6
|
# Andi Chandler <andi@gowling.com>, 2020. #zanata
|
7
7
|
# Andi Chandler <andi@gowling.com>, 2022. #zanata
|
8
8
|
# Andi Chandler <andi@gowling.com>, 2023. #zanata
|
9
|
+
# Andi Chandler <andi@gowling.com>, 2024. #zanata
|
9
10
|
msgid ""
|
10
11
|
msgstr ""
|
11
12
|
"Project-Id-Version: magnum-ui VERSION\n"
|
12
13
|
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
|
13
|
-
"POT-Creation-Date:
|
14
|
+
"POT-Creation-Date: 2024-06-06 07:30+0000\n"
|
14
15
|
"MIME-Version: 1.0\n"
|
15
16
|
"Content-Type: text/plain; charset=UTF-8\n"
|
16
17
|
"Content-Transfer-Encoding: 8bit\n"
|
17
|
-
"PO-Revision-Date:
|
18
|
+
"PO-Revision-Date: 2024-04-18 12:35+0000\n"
|
18
19
|
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
|
19
20
|
"Language-Team: English (United Kingdom)\n"
|
20
21
|
"Language: en_GB\n"
|
@@ -155,9 +156,6 @@ msgstr "Choose a Flavour for the Master Node"
|
|
155
156
|
msgid "Choose a Flavor for the Node"
|
156
157
|
msgstr "Choose a Flavour for the Node"
|
157
158
|
|
158
|
-
msgid "Choose a Flavor for the Worker Node"
|
159
|
-
msgstr "Choose a Flavour for the Worker Node"
|
160
|
-
|
161
159
|
msgid "Choose a Keypair"
|
162
160
|
msgstr "Choose a Keypair"
|
163
161
|
|
@@ -185,9 +183,15 @@ msgstr "Choose an Availability Zone"
|
|
185
183
|
msgid "Choose an Image"
|
186
184
|
msgstr "Choose an Image"
|
187
185
|
|
186
|
+
msgid "Choose an existing Subnet"
|
187
|
+
msgstr "Choose an existing Subnet"
|
188
|
+
|
188
189
|
msgid "Choose an existing network"
|
189
190
|
msgstr "Choose an existing network"
|
190
191
|
|
192
|
+
msgid "Choose an existing subnet"
|
193
|
+
msgstr "Choose an existing Subnet"
|
194
|
+
|
191
195
|
msgid "Choose an ingress controller"
|
192
196
|
msgstr "Choose an ingress controller"
|
193
197
|
|
@@ -413,9 +417,6 @@ msgstr "Flavour"
|
|
413
417
|
msgid "Flavor ID"
|
414
418
|
msgstr "Flavour ID"
|
415
419
|
|
416
|
-
msgid "Flavor of Master Nodes"
|
417
|
-
msgstr "Flavour of Master Nodes"
|
418
|
-
|
419
420
|
msgid "Flavor of Worker Nodes"
|
420
421
|
msgstr "Flavour of Worker Nodes"
|
421
422
|
|
@@ -452,15 +453,6 @@ msgstr "I do want to override Template and Workflow Labels"
|
|
452
453
|
msgid "ID"
|
453
454
|
msgstr "ID"
|
454
455
|
|
455
|
-
msgid ""
|
456
|
-
"If Kubernetes is unable to schedule a Pod due to insuficient CPU or memory "
|
457
|
-
"in the cluster, a worker node will be added, as long as the maximum number "
|
458
|
-
"of worker nodes has not been reached."
|
459
|
-
msgstr ""
|
460
|
-
"If Kubernetes is unable to schedule a Pod due to insufficient CPU or memory "
|
461
|
-
"in the cluster, a worker node will be added, as long as the maximum number "
|
462
|
-
"of worker nodes has not been reached."
|
463
|
-
|
464
456
|
msgid ""
|
465
457
|
"If enabled, the minimum and maximum number of worker nodes must be specified."
|
466
458
|
msgstr ""
|
@@ -586,9 +578,6 @@ msgstr "Master LB"
|
|
586
578
|
msgid "Master LB Enabled"
|
587
579
|
msgstr "Master LB Enabled"
|
588
580
|
|
589
|
-
msgid "Master Nodes"
|
590
|
-
msgstr "Master Nodes"
|
591
|
-
|
592
581
|
msgid "Maximum Batch Size"
|
593
582
|
msgstr "Maximum Batch Size"
|
594
583
|
|
@@ -646,9 +635,6 @@ msgstr "Nodes"
|
|
646
635
|
msgid "None"
|
647
636
|
msgstr "None"
|
648
637
|
|
649
|
-
msgid "Number of Master Nodes"
|
650
|
-
msgstr "Number of Master Nodes"
|
651
|
-
|
652
638
|
msgid "Number of Worker Nodes"
|
653
639
|
msgstr "Number of Worker Nodes"
|
654
640
|
|
@@ -751,17 +737,6 @@ msgstr "Sign Certificate To Cluster: {$ ctrl.model.cluster_name $}"
|
|
751
737
|
msgid "Size"
|
752
738
|
msgstr "Size"
|
753
739
|
|
754
|
-
msgid ""
|
755
|
-
"Specify additional kube_labels to apply to the cluster or override labels "
|
756
|
-
"set by the cluster template. Overriding labels set by the cluster template "
|
757
|
-
"may result in your cluster being misconfigured, unstable or unable to be "
|
758
|
-
"created."
|
759
|
-
msgstr ""
|
760
|
-
"Specify additional kube_labels to apply to the cluster or override labels "
|
761
|
-
"set by the cluster template. Overriding labels set by the cluster template "
|
762
|
-
"may result in your cluster being misconfigured, unstable or unable to be "
|
763
|
-
"created."
|
764
|
-
|
765
740
|
msgid "Specify the Container Orchestration Engine to use."
|
766
741
|
msgstr "Specify the Container Orchestration Engine to use."
|
767
742
|
|
@@ -860,15 +835,9 @@ msgstr ""
|
|
860
835
|
"The nova flavour id to use when launching the master node of the cluster. "
|
861
836
|
"Default: m1.small"
|
862
837
|
|
863
|
-
msgid "The number of master nodes for the cluster"
|
864
|
-
msgstr "The number of master nodes for the cluster"
|
865
|
-
|
866
838
|
msgid "The number of worker nodes for the cluster"
|
867
839
|
msgstr "The number of worker nodes for the cluster"
|
868
840
|
|
869
|
-
msgid "The selected Cluster Template does not support multiple master nodes."
|
870
|
-
msgstr "The selected Cluster Template does not support multiple master nodes."
|
871
|
-
|
872
841
|
msgid "The size in GB for Docker Volume. Default: 25"
|
873
842
|
msgstr "The size in GB for Docker Volume. Default: 25"
|
874
843
|
|
@@ -1012,6 +981,9 @@ msgstr "Updated At"
|
|
1012
981
|
msgid "Use an Existing Network"
|
1013
982
|
msgstr "Use an Existing Network"
|
1014
983
|
|
984
|
+
msgid "Use an Existing Subnet"
|
985
|
+
msgstr "Use an existing Subnet"
|
986
|
+
|
1015
987
|
msgid "Used {$ ctrl.stats.clusters $} of {$ ctrl.quota.clusters $}"
|
1016
988
|
msgstr "Used {$ ctrl.stats.clusters $} of {$ ctrl.quota.clusters $}"
|
1017
989
|
|
@@ -8,7 +8,7 @@ msgid ""
|
|
8
8
|
msgstr ""
|
9
9
|
"Project-Id-Version: magnum-ui VERSION\n"
|
10
10
|
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
|
11
|
-
"POT-Creation-Date:
|
11
|
+
"POT-Creation-Date: 2024-06-06 07:30+0000\n"
|
12
12
|
"MIME-Version: 1.0\n"
|
13
13
|
"Content-Type: text/plain; charset=UTF-8\n"
|
14
14
|
"Content-Transfer-Encoding: 8bit\n"
|
@@ -138,9 +138,6 @@ msgstr "Выберите тип инстанса для мастер узла"
|
|
138
138
|
msgid "Choose a Flavor for the Node"
|
139
139
|
msgstr "Выберите тип инстанса для узла."
|
140
140
|
|
141
|
-
msgid "Choose a Flavor for the Worker Node"
|
142
|
-
msgstr "Выберите тип инстанса для рабочего узла"
|
143
|
-
|
144
141
|
msgid "Choose a Keypair"
|
145
142
|
msgstr "Выберите ключевую пару"
|
146
143
|
|
@@ -402,9 +399,6 @@ msgstr "Тип инстанса"
|
|
402
399
|
msgid "Flavor ID"
|
403
400
|
msgstr "ID типа инстанса"
|
404
401
|
|
405
|
-
msgid "Flavor of Master Nodes"
|
406
|
-
msgstr "Тип главных узлов"
|
407
|
-
|
408
402
|
msgid "Flavor of Worker Nodes"
|
409
403
|
msgstr "Тип рабочих нод"
|
410
404
|
|
@@ -522,9 +516,6 @@ msgstr "Главный балансировщик нагрузки"
|
|
522
516
|
msgid "Master LB Enabled"
|
523
517
|
msgstr "Главный Балансировщик Нагрузки Разрешен "
|
524
518
|
|
525
|
-
msgid "Master Nodes"
|
526
|
-
msgstr "Главные узлы"
|
527
|
-
|
528
519
|
msgid "Maximum Batch Size"
|
529
520
|
msgstr "Максимальный размер пакета"
|
530
521
|
|
@@ -582,9 +573,6 @@ msgstr "Узлы"
|
|
582
573
|
msgid "None"
|
583
574
|
msgstr "Нет"
|
584
575
|
|
585
|
-
msgid "Number of Master Nodes"
|
586
|
-
msgstr "Количество главных узлов"
|
587
|
-
|
588
576
|
msgid "Number of Worker Nodes"
|
589
577
|
msgstr "Количество рабочих узлов"
|
590
578
|
|
@@ -747,15 +735,9 @@ msgstr ""
|
|
747
735
|
"ID типа инстанса nova для использования при запуске мастер узла кластера. По "
|
748
736
|
"умолчанию: m1.small"
|
749
737
|
|
750
|
-
msgid "The number of master nodes for the cluster"
|
751
|
-
msgstr "Количество главных узлов для кластера"
|
752
|
-
|
753
738
|
msgid "The number of worker nodes for the cluster"
|
754
739
|
msgstr "Количество рабочих узлов для кластера"
|
755
740
|
|
756
|
-
msgid "The selected Cluster Template does not support multiple master nodes."
|
757
|
-
msgstr "Выбранный Темплейт кластера не поддерживает несколько главных узлов"
|
758
|
-
|
759
741
|
msgid "The size in GB for Docker Volume. Default: 25"
|
760
742
|
msgstr "Размер диска Docker в ГБ. По умолчанию: 25"
|
761
743
|
|
@@ -40,12 +40,14 @@
|
|
40
40
|
* @name delete.service
|
41
41
|
* @param {Object} $location
|
42
42
|
* @param {Object} $q
|
43
|
+
* @param {Object} $rootScope
|
43
44
|
* @param {Object} magnum service
|
44
45
|
* @param {Object} policy
|
45
46
|
* @param {Object} actionResult
|
46
47
|
* @param {Object} gettext
|
47
48
|
* @param {Object} $qExtensions
|
48
49
|
* @param {Object} deleteModal
|
50
|
+
* @param {Object} tableEvents
|
49
51
|
* @param {Object} toast
|
50
52
|
* @param {Object} resourceType
|
51
53
|
* @param {Object} events
|
@@ -143,6 +145,7 @@
|
|
143
145
|
if (result.result.failed.length === 0 && result.result.deleted.length > 0 &&
|
144
146
|
currentPath !== indexPath) {
|
145
147
|
$location.path(indexPath);
|
148
|
+
return null;
|
146
149
|
} else {
|
147
150
|
$rootScope.$broadcast(tableEvents.CLEAR_SELECTIONS);
|
148
151
|
return result.result;
|
magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.spec.js
CHANGED
@@ -27,7 +27,9 @@
|
|
27
27
|
}));
|
28
28
|
|
29
29
|
it('objLen returns number of attributes of object', inject(function() {
|
30
|
-
expect(ctrl.objLen(
|
30
|
+
expect(ctrl.objLen()).toBe(0);
|
31
|
+
expect(ctrl.objLen(null)).toBe(0);
|
32
|
+
expect(ctrl.objLen({})).toBe(0);
|
31
33
|
expect(ctrl.objLen({a: 0})).toBe(1);
|
32
34
|
}));
|
33
35
|
});
|
magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.spec.js
CHANGED
@@ -42,7 +42,9 @@
|
|
42
42
|
}));
|
43
43
|
|
44
44
|
it('objLen returns number of attributes of object', inject(function() {
|
45
|
-
expect(ctrl.objLen(
|
45
|
+
expect(ctrl.objLen()).toBe(0);
|
46
|
+
expect(ctrl.objLen(null)).toBe(0);
|
47
|
+
expect(ctrl.objLen({})).toBe(0);
|
46
48
|
expect(ctrl.objLen({a: 0})).toBe(1);
|
47
49
|
}));
|
48
50
|
});
|
@@ -63,56 +63,42 @@
|
|
63
63
|
// load current data
|
64
64
|
magnum.getClusterTemplate(selected.id).then(onLoad);
|
65
65
|
function onLoad(response) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
config.model.no_proxy = response.data.no_proxy
|
103
|
-
? response.data.no_proxy : "";
|
104
|
-
config.model.external_network_id = response.data.external_network_id
|
105
|
-
? response.data.external_network_id : "";
|
106
|
-
config.model.fixed_network = response.data.fixed_network
|
107
|
-
? response.data.fixed_network : "";
|
108
|
-
config.model.fixed_subnet = response.data.fixed_subnet
|
109
|
-
? response.data.fixed_subnet : "";
|
110
|
-
config.model.dns_nameserver = response.data.dns_nameserver
|
111
|
-
? response.data.dns_nameserver : "";
|
112
|
-
config.model.master_lb_enabled = response.data.master_lb_enabled
|
113
|
-
? response.data.master_lb_enabled : false;
|
114
|
-
config.model.floating_ip_enabled = response.data.floating_ip_enabled
|
115
|
-
? response.data.floating_ip_enabled : false;
|
66
|
+
|
67
|
+
function setModelFromResponse(key, defaultValue) {
|
68
|
+
if (response.data[key]) {
|
69
|
+
config.model[key] = response.data[key];
|
70
|
+
} else {
|
71
|
+
config.model[key] = defaultValue;
|
72
|
+
}
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
setModelFromResponse('name', "");
|
77
|
+
setModelFromResponse('coe', "");
|
78
|
+
setModelFromResponse('server_type', "");
|
79
|
+
setModelFromResponse('public', false);
|
80
|
+
setModelFromResponse('hidden', false);
|
81
|
+
setModelFromResponse('registry_enabled', false);
|
82
|
+
setModelFromResponse('tls_disabled', false);
|
83
|
+
setModelFromResponse('image_id', "");
|
84
|
+
setModelFromResponse('flavor_id', "");
|
85
|
+
setModelFromResponse('master_flavor_id', "");
|
86
|
+
setModelFromResponse('docker_volume_size', "");
|
87
|
+
setModelFromResponse('docker_storage_driver', "");
|
88
|
+
setModelFromResponse('keypair_id', "");
|
89
|
+
setModelFromResponse('network_driver', "");
|
90
|
+
setModelFromResponse('volume_driver', "");
|
91
|
+
setModelFromResponse('insecure_registry', "");
|
92
|
+
setModelFromResponse('http_proxy', "");
|
93
|
+
setModelFromResponse('https_proxy', "");
|
94
|
+
setModelFromResponse('no_proxy', "");
|
95
|
+
setModelFromResponse('external_network_id', "");
|
96
|
+
setModelFromResponse('fixed_network', "");
|
97
|
+
setModelFromResponse('fixed_subnet', "");
|
98
|
+
setModelFromResponse('dns_nameserver', "");
|
99
|
+
setModelFromResponse('master_lb_enabled', false);
|
100
|
+
setModelFromResponse('floating_ip_enabled', false);
|
101
|
+
|
116
102
|
var labels = "";
|
117
103
|
for (var key in response.data.labels) {
|
118
104
|
if (response.data.labels.hasOwnProperty(key)) {
|
@@ -32,6 +32,7 @@
|
|
32
32
|
'horizon.dashboard.container-infra.clusters.actions',
|
33
33
|
'horizon.dashboard.container-infra.clusters.details'
|
34
34
|
])
|
35
|
+
.decorator('actionsDirective', actionsDirectiveDecorator)
|
35
36
|
.constant('horizon.dashboard.container-infra.clusters.events', events())
|
36
37
|
.constant('horizon.dashboard.container-infra.clusters.resourceType', 'OS::Magnum::Cluster')
|
37
38
|
.run(run)
|
@@ -77,13 +78,13 @@
|
|
77
78
|
label: gettext('Health Status')
|
78
79
|
})
|
79
80
|
.setProperty('master_count', {
|
80
|
-
label: gettext('
|
81
|
+
label: gettext('Control Plane Count')
|
81
82
|
})
|
82
83
|
.setProperty('node_count', {
|
83
84
|
label: gettext('Node Count')
|
84
85
|
})
|
85
|
-
.setProperty('
|
86
|
-
label: gettext('
|
86
|
+
.setProperty('coe_version', {
|
87
|
+
label: gettext('Kubernetes Version')
|
87
88
|
})
|
88
89
|
.setListFunction(clustersService.getClustersPromise)
|
89
90
|
.tableColumns
|
@@ -115,7 +116,7 @@
|
|
115
116
|
priority: 2
|
116
117
|
})
|
117
118
|
.append({
|
118
|
-
id: '
|
119
|
+
id: 'coe_version',
|
119
120
|
priority: 2
|
120
121
|
});
|
121
122
|
|
@@ -159,7 +160,7 @@
|
|
159
160
|
'singleton': true
|
160
161
|
})
|
161
162
|
.append({
|
162
|
-
'label': gettext('
|
163
|
+
'label': gettext('Control Plane Count'),
|
163
164
|
'name': 'master_count',
|
164
165
|
'singleton': true
|
165
166
|
})
|
@@ -169,8 +170,8 @@
|
|
169
170
|
'singleton': true
|
170
171
|
})
|
171
172
|
.append({
|
172
|
-
'label': gettext('
|
173
|
-
'name': '
|
173
|
+
'label': gettext('Kubernetes Version'),
|
174
|
+
'name': 'coe_version',
|
174
175
|
'singleton': true
|
175
176
|
});
|
176
177
|
}
|
@@ -196,4 +197,27 @@
|
|
196
197
|
templateUrl: path + 'panel.html'
|
197
198
|
});
|
198
199
|
}
|
200
|
+
|
201
|
+
actionsDirectiveDecorator.$inject = [
|
202
|
+
'$delegate',
|
203
|
+
'horizon.dashboard.container-infra.clusters.utils'
|
204
|
+
];
|
205
|
+
|
206
|
+
/**
|
207
|
+
* @param {Object} $delegate
|
208
|
+
* @param {Object} clustersUtils
|
209
|
+
* @description Extends behaviour of `horizon.framework.widgets.action-list.directive:actions`
|
210
|
+
* with business logic in clusters.getActionsDirectiveLinkFn();
|
211
|
+
* @return {Object} Returns the ammended directive.
|
212
|
+
*/
|
213
|
+
function actionsDirectiveDecorator($delegate, clustersUtils) {
|
214
|
+
var directive = $delegate[0];
|
215
|
+
|
216
|
+
// Angular's `link` is wrapped inside the compile function
|
217
|
+
directive.compile = function() {
|
218
|
+
return clustersUtils.getActionsDirectiveLinkFn(directive);
|
219
|
+
};
|
220
|
+
|
221
|
+
return $delegate;
|
222
|
+
}
|
199
223
|
})();
|
@@ -0,0 +1,134 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2017 NEC Corporation
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
5
|
+
* not use this file except in compliance with the License. You may obtain
|
6
|
+
* a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
* License for the specific language governing permissions and limitations
|
14
|
+
* under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
(function() {
|
18
|
+
'use strict';
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @ngdoc overview
|
22
|
+
* @name horizon.dashboard.container-infra.clusters.utils
|
23
|
+
* @description Service utilities for Clusters module.
|
24
|
+
*/
|
25
|
+
angular
|
26
|
+
.module('horizon.dashboard.container-infra.clusters')
|
27
|
+
.factory('horizon.dashboard.container-infra.clusters.utils',
|
28
|
+
clustersUtilsService);
|
29
|
+
|
30
|
+
clustersUtilsService.$inject = [
|
31
|
+
'$parse',
|
32
|
+
'horizon.framework.util.q.extensions',
|
33
|
+
'$timeout'
|
34
|
+
];
|
35
|
+
|
36
|
+
function clustersUtilsService($parse, $qExtensions, $timeout) {
|
37
|
+
|
38
|
+
var service = {
|
39
|
+
getActionsDirectiveLinkFn: getActionsDirectiveLinkFn
|
40
|
+
};
|
41
|
+
|
42
|
+
return service;
|
43
|
+
|
44
|
+
//////////////
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Extends <actions> directive by conditionally enabling/disabling selected actions in the
|
48
|
+
* cluster item's dropdown menu. This allows to block actions that are unavailable in certain
|
49
|
+
* cluster states.
|
50
|
+
* @param {Object} directive Extended directive
|
51
|
+
* @returns {function} Directive's Link function
|
52
|
+
*/
|
53
|
+
function getActionsDirectiveLinkFn(directive) {
|
54
|
+
// List of Cluster statuses that will enable the 'conditional action'
|
55
|
+
var ALLOWED_STATUSES_LIST = [
|
56
|
+
'DELETE_COMPLETE',
|
57
|
+
'CREATE_COMPLETE',
|
58
|
+
'UPDATE_COMPLETE',
|
59
|
+
'ROLLBACK_COMPLETE',
|
60
|
+
'SNAPSHOT_COMPLETE',
|
61
|
+
'CHECK_COMPLETE',
|
62
|
+
'ADOPT_COMPLETE'
|
63
|
+
];
|
64
|
+
|
65
|
+
// List of actions disabled/enabled based on the allowed statuses
|
66
|
+
var CONDITIONAL_ACTIONS_LIST = [
|
67
|
+
'resizeClusterAction',
|
68
|
+
'rollingUpgradeClusterAction'
|
69
|
+
];
|
70
|
+
|
71
|
+
// Important: If the <actions> directive template structure changes,
|
72
|
+
// this selector might need to be updated.
|
73
|
+
var ELEMENT_ACTIONS_SELECTOR = '.split-button,.dropdown-menu>li';
|
74
|
+
var DISABLED_CLASS_NAME = 'disabled';
|
75
|
+
|
76
|
+
var actionsDirectiveLinkFn = function(scope, element, attrs) {
|
77
|
+
// Call the original `link` method to keep the default behaviour
|
78
|
+
directive.link.apply(this, arguments);
|
79
|
+
var listType = attrs.type;
|
80
|
+
|
81
|
+
// Only do this for actions in the table's row
|
82
|
+
if (listType !== 'row') { return; }
|
83
|
+
|
84
|
+
var item = $parse(attrs.item)(scope);
|
85
|
+
var allowedActions;
|
86
|
+
|
87
|
+
var actionsParam = $parse(attrs.allowed)(scope);
|
88
|
+
if (angular.isFunction(actionsParam)) {
|
89
|
+
allowedActions = actionsParam();
|
90
|
+
} else {
|
91
|
+
allowedActions = actionsParam;
|
92
|
+
}
|
93
|
+
|
94
|
+
allowedActions.forEach(function(allowedAction) {
|
95
|
+
allowedAction.promise = allowedAction.service.allowed(item);
|
96
|
+
});
|
97
|
+
|
98
|
+
$qExtensions.allSettled(allowedActions).then(disableConditionalRowActions);
|
99
|
+
|
100
|
+
function disableConditionalRowActions(permittedActions) {
|
101
|
+
if (permittedActions.pass.length < 1) { return; }
|
102
|
+
|
103
|
+
// Gets evaluated AFTER DOM finishes rendering
|
104
|
+
$timeout(applyActionAvailability, 0);
|
105
|
+
|
106
|
+
function applyActionAvailability() {
|
107
|
+
var actionElementsList = element[0].querySelectorAll(ELEMENT_ACTIONS_SELECTOR);
|
108
|
+
permittedActions.pass.forEach(function(action, actionIndex) {
|
109
|
+
if (isConditionalAction(action.context.id)) {
|
110
|
+
var actionElement = angular.element(actionElementsList[actionIndex]);
|
111
|
+
// If the status is not allowed - add disabling class
|
112
|
+
if (isAllowedStatus(item.status)) {
|
113
|
+
actionElement.removeClass(DISABLED_CLASS_NAME);
|
114
|
+
} else {
|
115
|
+
actionElement.addClass(DISABLED_CLASS_NAME);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
});
|
119
|
+
}
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
123
|
+
function isAllowedStatus(statusId) {
|
124
|
+
return ALLOWED_STATUSES_LIST.indexOf(statusId) > -1;
|
125
|
+
}
|
126
|
+
|
127
|
+
function isConditionalAction(actionId) {
|
128
|
+
return CONDITIONAL_ACTIONS_LIST.indexOf(actionId) > -1;
|
129
|
+
}
|
130
|
+
|
131
|
+
return actionsDirectiveLinkFn;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
})();
|