Skip to content

Commit 4414687

Browse files
committed
HARVESTER: Fix IP Pool Same Namespace Can Be Added Multiple Times
1 parent 4ab9695 commit 4414687

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

pkg/harvester/edit/loadbalancer.harvesterhci.io.ippool/Priority.vue

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default {
3131
},
3232
3333
computed: {
34-
...mapGetters(['isRancherInHarvester', 'isStandaloneHarvester']),
34+
...mapGetters(['isRancherInHarvester', 'isStandaloneHarvester', 'allNamespaces']),
3535
3636
isView() {
3737
return this.mode === _VIEW;
@@ -48,6 +48,22 @@ export default {
4848
showProjectAndCluster() {
4949
return !this.isStandaloneHarvester;
5050
},
51+
52+
uniqNamespaceOptions() {
53+
const selectedNamespaces = this.rows.map(row => row.namespace);
54+
55+
const out = (this.allNamespaces || []).filter(n => !selectedNamespaces.includes(n.id)).map((namespace) => {
56+
return {
57+
label: namespace.metadata.name,
58+
value: namespace.id,
59+
};
60+
});
61+
62+
return [{
63+
label: this.t('generic.all'),
64+
value: '*',
65+
}, ...out];
66+
},
5167
},
5268
5369
created() {
@@ -128,6 +144,7 @@ export default {
128144
:mode="mode"
129145
:rows="rows"
130146
:idx="idx"
147+
:uniqNamespaceOptions="uniqNamespaceOptions"
131148
@input="queueUpdate"
132149
@remove="remove(idx)"
133150
/>

pkg/harvester/edit/loadbalancer.harvesterhci.io.ippool/PriorityRow.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export default {
2828
type: Number,
2929
required: true,
3030
},
31+
32+
uniqNamespaceOptions: {
33+
type: Array,
34+
required: true,
35+
},
3136
},
3237
3338
data() {
@@ -199,7 +204,7 @@ export default {
199204
<Select
200205
v-else
201206
v-model="row.namespace"
202-
:options="namespaceOptions"
207+
:options="showProjectAndCluster ? namespaceOptions : uniqNamespaceOptions"
203208
@input="update"
204209
/>
205210
</div>

0 commit comments

Comments
 (0)