Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
},

computed: {
...mapGetters(['isRancherInHarvester', 'isStandaloneHarvester']),
...mapGetters(['isRancherInHarvester', 'isStandaloneHarvester', 'allNamespaces']),

isView() {
return this.mode === _VIEW;
Expand All @@ -48,6 +48,28 @@ export default {
showProjectAndCluster() {
return !this.isStandaloneHarvester;
},

uniqNamespaceOptions() {
const selectedNamespaces = this.rows.map(row => row.namespace);

const out = (this.allNamespaces || []).map((namespace) => {
const disabled = (selectedNamespaces.includes(namespace.id) || selectedNamespaces.includes('*')) && selectedNamespaces.length > 1;

return {
label: selectedNamespaces.includes('*') && selectedNamespaces.length > 1 ? `${ namespace.id } (${ this.t('harvester.ipPool.scope.overlap') })` : namespace.id,
value: namespace.id,
disabled,
};
});

const disabled = (selectedNamespaces.includes('*') || selectedNamespaces.find(n => n !== '*' && n)) && selectedNamespaces.length > 1;

return [{
label: (selectedNamespaces.find(n => n !== '*' && n) && selectedNamespaces.length > 1) ? `${ this.t('generic.all') } (${ this.t('harvester.ipPool.scope.overlap') })` : this.t('generic.all'),
value: '*',
disabled,
}, ...out];
},
},

created() {
Expand All @@ -59,7 +81,11 @@ export default {
const defaultRow = { namespace: '*' };

if (!this.showProjectAndCluster) {
this.rows.push(defaultRow);
if (this.rows.length === 0) {
this.rows.push(defaultRow);
} else {
this.rows.push({ namespace: '' });
}
} else {
this.rows.push({
...defaultRow,
Expand Down Expand Up @@ -128,6 +154,7 @@ export default {
:mode="mode"
:rows="rows"
:idx="idx"
:uniqNamespaceOptions="uniqNamespaceOptions"
@input="queueUpdate"
@remove="remove(idx)"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default {
type: Number,
required: true,
},

uniqNamespaceOptions: {
type: Array,
required: true,
},
},

data() {
Expand Down Expand Up @@ -199,7 +204,7 @@ export default {
<Select
v-else
v-model="row.namespace"
:options="namespaceOptions"
:options="showProjectAndCluster ? namespaceOptions : uniqNamespaceOptions"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Perhaps filtering duplicate namespaces is also necessary for multiple clusters.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guest cluster will have more than one under the same namespace, and it doesn't make sense to de-emphasize the namespace.

@input="update"
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions pkg/harvester/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ harvester:
scope:
label: Scope
addLabel: Add Scope
overlap: scope overlap
priority:
label: Priority
cidr:
Expand Down