mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 05:01:43 +00:00
fix: namespace can't be selected the same in IP pool page (#560)
* fix: the namespacess option can't be selected twice in standalone UI Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: disabled slected ns Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
7e0a9dcd80
commit
756ed383ac
@ -39,6 +39,10 @@ export default {
|
||||
return this.mode === _VIEW;
|
||||
},
|
||||
|
||||
disableAdd() {
|
||||
return this.isStandaloneHarvester && this.rows.some((row) => row.namespace === '*');
|
||||
},
|
||||
|
||||
showAdd() {
|
||||
return !this.isView;
|
||||
},
|
||||
@ -141,6 +145,7 @@ export default {
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="disableAdd"
|
||||
class="btn role-tertiary add"
|
||||
@click="add()"
|
||||
>
|
||||
|
||||
@ -66,17 +66,26 @@ export default {
|
||||
},
|
||||
|
||||
namespaceOptions() {
|
||||
const out = (this.filteredNamespaces || []).map((namespace) => {
|
||||
return {
|
||||
label: namespace.metadata.name,
|
||||
value: namespace.id,
|
||||
};
|
||||
});
|
||||
const namespaces = this.filteredNamespaces;
|
||||
const selected = this.rows.map((r) => r?.namespace);
|
||||
|
||||
if (this.isStandaloneHarvester) {
|
||||
return [
|
||||
{ label: this.t('generic.all'), value: '*' },
|
||||
...namespaces.map((ns) => ({
|
||||
label: ns.metadata.name,
|
||||
value: ns.id,
|
||||
disabled: selected.includes(ns.id) && ns.id !== this.row.namespace
|
||||
}))
|
||||
];
|
||||
}
|
||||
|
||||
return [{
|
||||
label: this.t('generic.all'),
|
||||
value: '*',
|
||||
}, ...out];
|
||||
},
|
||||
...namespaces.map((ns) => ({ label: ns.metadata.name, value: ns.id }))
|
||||
];
|
||||
},
|
||||
|
||||
guestClusterOptions() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user