Two tweaks

- Filter out namespaces with no projects instead of including 'undefined' in 'toMove'
- (not related to this PR.. but same area) As per #3469 only show projects from current cluster
This commit is contained in:
Richard Cox 2021-07-14 11:16:08 +01:00
parent ea4cdb488a
commit 56b4133a67
1 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,11 @@ export default {
AsyncButton, Card, LabeledSelect, Loading
},
async fetch() {
this.projects = await this.$store.dispatch('management/findAll', { type: MANAGEMENT.PROJECT });
const clusterId = this.$store.getters['currentCluster'].id;
const projects = await this.$store.dispatch('management/findAll', { type: MANAGEMENT.PROJECT });
// Filter out projects not for the current cluster
this.projects = projects.filter(c => c.spec?.clusterName === clusterId);
},
data() {
return {
@ -22,7 +26,7 @@ export default {
computed: {
...mapState('action-menu', ['showPromptMove', 'toMove']),
excludedProjects() {
return this.toMove.map(namespace => namespace?.project?.shortId);
return this.toMove.filter(namespace => !!namespace.project).map(namespace => namespace.project.shortId);
},
projectOptions() {
return this.projects