mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-02-04 06:51:44 +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;
|
return this.mode === _VIEW;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableAdd() {
|
||||||
|
return this.isStandaloneHarvester && this.rows.some((row) => row.namespace === '*');
|
||||||
|
},
|
||||||
|
|
||||||
showAdd() {
|
showAdd() {
|
||||||
return !this.isView;
|
return !this.isView;
|
||||||
},
|
},
|
||||||
@ -141,6 +145,7 @@ export default {
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
:disabled="disableAdd"
|
||||||
class="btn role-tertiary add"
|
class="btn role-tertiary add"
|
||||||
@click="add()"
|
@click="add()"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -66,17 +66,26 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
namespaceOptions() {
|
namespaceOptions() {
|
||||||
const out = (this.filteredNamespaces || []).map((namespace) => {
|
const namespaces = this.filteredNamespaces;
|
||||||
return {
|
const selected = this.rows.map((r) => r?.namespace);
|
||||||
label: namespace.metadata.name,
|
|
||||||
value: namespace.id,
|
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 [{
|
return [{
|
||||||
label: this.t('generic.all'),
|
label: this.t('generic.all'),
|
||||||
value: '*',
|
value: '*',
|
||||||
}, ...out];
|
},
|
||||||
|
...namespaces.map((ns) => ({ label: ns.metadata.name, value: ns.id }))
|
||||||
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
guestClusterOptions() {
|
guestClusterOptions() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user