mirror of https://github.com/rancher/dashboard.git
Ensure Cluster Tools only shows if user can access required resources
- cluster member gains visiblity of catalog app when they can see a namespace - fixed in cluster side nav and single cluster info
This commit is contained in:
parent
3f418ec177
commit
34fdaa2335
|
|
@ -1,7 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import RancherProviderIcon from '@/components/RancherProviderIcon';
|
import RancherProviderIcon from '@/components/RancherProviderIcon';
|
||||||
import ResourceSummary, { resourceCounts } from '@/pages/c/_cluster/explorer/ResourceSummary';
|
import ResourceSummary, { resourceCounts } from '@/pages/c/_cluster/explorer/ResourceSummary';
|
||||||
import { NAMESPACE, MANAGEMENT, NODE, COUNT } from '@/config/types';
|
import {
|
||||||
|
NAMESPACE, MANAGEMENT, NODE, COUNT, CATALOG
|
||||||
|
} from '@/config/types';
|
||||||
import { RESOURCES } from '@/pages/c/_cluster/explorer/index';
|
import { RESOURCES } from '@/pages/c/_cluster/explorer/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -64,6 +66,11 @@ export default {
|
||||||
|
|
||||||
canAccessNamespaces() {
|
canAccessNamespaces() {
|
||||||
return !!this.clusterCounts?.[0]?.counts?.[NAMESPACE];
|
return !!this.clusterCounts?.[0]?.counts?.[NAMESPACE];
|
||||||
|
},
|
||||||
|
|
||||||
|
showClusterTools() {
|
||||||
|
return this.$store.getters['cluster/canList'](CATALOG.CLUSTER_REPO) &&
|
||||||
|
this.$store.getters['cluster/canList'](CATALOG.APP);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -111,7 +118,7 @@ export default {
|
||||||
{{ t('nav.categories.explore') }}
|
{{ t('nav.categories.explore') }}
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="glance-item">
|
<div v-if="showClusterTools" class="glance-item">
|
||||||
<nuxt-link :to="clusterToolsLink" class="cluster-link">
|
<nuxt-link :to="clusterToolsLink" class="cluster-link">
|
||||||
{{ t('nav.clusterTools') }}
|
{{ t('nav.clusterTools') }}
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ import Group from '@/components/nav/Group';
|
||||||
import Header from '@/components/nav/Header';
|
import Header from '@/components/nav/Header';
|
||||||
import Brand from '@/mixins/brand';
|
import Brand from '@/mixins/brand';
|
||||||
import FixedBanner from '@/components/FixedBanner';
|
import FixedBanner from '@/components/FixedBanner';
|
||||||
import { COUNT, SCHEMA, MANAGEMENT, UI } from '@/config/types';
|
import {
|
||||||
|
COUNT, SCHEMA, MANAGEMENT, UI, CATALOG
|
||||||
|
} from '@/config/types';
|
||||||
import { BASIC, FAVORITE, USED } from '@/store/type-map';
|
import { BASIC, FAVORITE, USED } from '@/store/type-map';
|
||||||
import { addObjects, replaceWith, clear, addObject } from '@/utils/array';
|
import { addObjects, replaceWith, clear, addObject } from '@/utils/array';
|
||||||
import { NAME as EXPLORER } from '@/config/product/explorer';
|
import { NAME as EXPLORER } from '@/config/product/explorer';
|
||||||
|
|
@ -129,6 +131,12 @@ export default {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showClusterTools() {
|
||||||
|
return this.isExplorer &&
|
||||||
|
this.$store.getters['cluster/canList'](CATALOG.CLUSTER_REPO) &&
|
||||||
|
this.$store.getters['cluster/canList'](CATALOG.APP);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -506,7 +514,7 @@ export default {
|
||||||
</Group>
|
</Group>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<n-link v-if="isExplorer" tag="div" class="tools" :to="{name: 'c-cluster-explorer-tools', params: {cluster: clusterId}}">
|
<n-link v-if="showClusterTools" tag="div" class="tools" :to="{name: 'c-cluster-explorer-tools', params: {cluster: clusterId}}">
|
||||||
<a class="tools-button" @click="collapseAll()">
|
<a class="tools-button" @click="collapseAll()">
|
||||||
<i class="icon icon-gear" />
|
<i class="icon icon-gear" />
|
||||||
<span>{{ t('nav.clusterTools') }}</span>
|
<span>{{ t('nav.clusterTools') }}</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue