Merge ~freyes/ubuntu/+source/magnum-ui:bug/2038663-ussuri into ~ubuntu-openstack-dev/ubuntu/+source/magnum-ui:stable/ussuri

Proposed by Felipe Reyes
Status: Merged
Merged at revision: dec47fe323ccc9360c8bc42c34ede906fa54e07d
Proposed branch: ~freyes/ubuntu/+source/magnum-ui:bug/2038663-ussuri
Merge into: ~ubuntu-openstack-dev/ubuntu/+source/magnum-ui:stable/ussuri
Diff against target: 150 lines (+130/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/lp2038663.patch (+122/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Ubuntu OpenStack uploaders Pending
Review via email: mp+470653@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 223ccfc..7ec23b6 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+magnum-ui (6.0.1-0ubuntu1.1) UNRELEASED; urgency=medium
7+
8+ * d/p/lp2038663.patch: Add option to override the fixed subnet when creating
9+ a new cluster (LP: #2038663).
10+
11+ -- Felipe Reyes <felipe.reyes@canonical.com> Mon, 05 Aug 2024 12:52:52 -0400
12+
13 magnum-ui (6.0.1-0ubuntu1) focal; urgency=medium
14
15 [ Corey Bryant ]
16diff --git a/debian/patches/lp2038663.patch b/debian/patches/lp2038663.patch
17new file mode 100644
18index 0000000..163f36e
19--- /dev/null
20+++ b/debian/patches/lp2038663.patch
21@@ -0,0 +1,122 @@
22+From 6f6c3db282fe2f0e08ad69c557eb153858b0164a Mon Sep 17 00:00:00 2001
23+From: Felipe Reyes <felipe.reyes@canonical.com>
24+Date: Tue, 10 Oct 2023 18:33:27 -0300
25+Subject: [PATCH] Add dropdown list to select fixed subnet
26+
27+When creating a cluster and the user decides to reuse an existing
28+network, it must also choose a subnet, otherwise the resulting
29+configuration may be invalid when trying to allocate a port.
30+
31+Closes-Bug: #2038663
32+Related-Bug: #2038109
33+Change-Id: I08943f10418385a39eecc7b4117d162854d2d010
34+---
35+ .../clusters/create/create.service.js | 1 +
36+ .../clusters/workflow/workflow.service.js | 39 ++++++++++++++++++-
37+ 2 files changed, 39 insertions(+), 1 deletion(-)
38+
39+--- a/magnum_ui/static/dashboard/container-infra/clusters/create/create.service.js
40++++ b/magnum_ui/static/dashboard/container-infra/clusters/create/create.service.js
41+@@ -111,6 +111,7 @@
42+
43+ if (!model.create_network) {
44+ addFieldToRequestObjectIfSet('fixed_network','fixed_network');
45++ addFieldToRequestObjectIfSet('fixed_subnet','fixed_subnet');
46+ }
47+ // Labels processing order (the following overrides previous):
48+ // Cluster Templates -> Create Form -> User-defined in 'labels' textarea
49+--- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js
50++++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js
51+@@ -52,6 +52,7 @@
52+ function init(title, $scope) {
53+ var schema, form;
54+
55++ var fixedSubnetsInitial = gettext('Choose an existing subnet');
56+ // Default <option>s; will be shown in selector as a placeholder
57+ var templateTitleMap = [{value: '', name: gettext('Choose a Cluster Template') }];
58+ var availabilityZoneTitleMap = [{value: '',
59+@@ -62,6 +63,7 @@
60+ var workerFlavorTitleMap = [{value: '',
61+ name: gettext('Choose a Flavor for the Worker Node')}];
62+ var networkTitleMap = [{value: '', name: gettext('Choose an existing network')}];
63++ var subnetTitleMap = [{value: '', name: fixedSubnetsInitial}];
64+ var ingressTitleMap = [{value: '', name: gettext('Choose an ingress controller')}];
65+
66+ var addonsTitleMap = [];
67+@@ -101,6 +103,7 @@
68+
69+ 'create_network': { type: 'boolean' },
70+ 'fixed_network': { type: 'string' },
71++ 'fixed_subnet': { type: 'string' },
72+ 'floating_ip_enabled': { type: 'boolean' },
73+ 'ingress_controller': { type: 'object' },
74+
75+@@ -326,6 +329,7 @@
76+ onChange: function(isNewNetwork) {
77+ if (isNewNetwork) {
78+ model.fixed_network = MODEL_DEFAULTS.fixed_network;
79++ model.fixed_subnet = MODEL_DEFAULTS.fixed_subnet;
80+ }
81+ }
82+ },
83+@@ -335,6 +339,17 @@
84+ title: gettext('Use an Existing Network'),
85+ titleMap: networkTitleMap,
86+ condition: 'model.create_network === false',
87++ required: true,
88++ onChange: function () {
89++ changeFixedNetwork(model);
90++ }
91++ },
92++ {
93++ key: 'fixed_subnet',
94++ type: 'select',
95++ title: gettext('Use an Existing Subnet'),
96++ titleMap: subnetTitleMap,
97++ condition: 'model.create_network === false',
98+ required: true
99+ }
100+ ]
101+@@ -479,6 +494,7 @@
102+
103+ create_network: true,
104+ fixed_network: '',
105++ fixed_subnet: '',
106+ floating_ip_enabled: false,
107+ ingress_controller: '',
108+
109+@@ -563,12 +579,33 @@
110+
111+ function onGetNetworks(response) {
112+ angular.forEach(response.data.items, function(network) {
113+- networkTitleMap.push({value: network.id, name: network.name + ' (' + network.id + ')'});
114++ networkTitleMap.push({
115++ value: network.id,
116++ name: network.name + ' (' + network.id + ')',
117++ subnets: network.subnets
118++ });
119+ });
120+
121+ setSingleItemAsDefault(response.data.items, 'fixed_network', 'id');
122+ }
123+
124++ function changeFixedNetwork(model) {
125++ if (model.fixed_network) {
126++ subnetTitleMap = [{value:"", name: gettext("Choose an existing Subnet")}];
127++ angular.forEach(networkTitleMap, function(network) {
128++ if (network.value === model.fixed_network) {
129++ angular.forEach(network.subnets, function(subnet) {
130++ subnetTitleMap.push({value: subnet.id, name: subnet.name});
131++ });
132++ }
133++ });
134++ } else {
135++ fixedSubnets = [{value:"", name: fixedSubnetsInitial}];
136++ model.fixed_subnet = "";
137++ }
138++ form[0].tabs[2].items[0].items[0].items[2].titleMap = subnetTitleMap;
139++ }
140++
141+ function onGetIngressControllers(response) {
142+ angular.forEach(response.data.controllers, function(ingressController) {
143+ ingressTitleMap.push({value: ingressController, name: ingressController.name});
144diff --git a/debian/patches/series b/debian/patches/series
145index 37420e6..4edd621 100644
146--- a/debian/patches/series
147+++ b/debian/patches/series
148@@ -1 +1,2 @@
149 install-all-files.patch
150+lp2038663.patch

Subscribers

People subscribed via source and target branches