Skip to content

Commit 24f6185

Browse files
committed
refactor: remove console logs and clean up unused code in Harvester management components
1 parent 322b8a6 commit 24f6185

2 files changed

Lines changed: 5 additions & 20 deletions

File tree

pkg/harvester-manager/list/harvesterhci.io.management.cluster.vue

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ export default {
5353
},
5454
5555
async fetch() {
56-
console.log('isRancherPrime=', isRancherPrime())
57-
console.log('HARVESTER_REPO=', HARVESTER_REPO)
5856
const inStore = this.$store.getters['currentProduct'].inStore;
5957
6058
const _hash = {
@@ -125,10 +123,8 @@ export default {
125123
126124
harvester() {
127125
const extension = this.uiplugins?.find((c) => c.name === HARVESTER_CHART.name);
128-
console.log('harvester extension=', extension);
129126
// if installed harvester ui extension, but no harvester repository, then we will show missing repository warning message
130127
const missingRepository = !!extension && !this.harvesterRepository;
131-
console.log('harvester this.harvesterRepository=',this.harvesterRepository)
132128
133129
const action = async(btnCb) => {
134130
const action = `${ !extension ? 'install' : 'update' }HarvesterExtension`;
@@ -209,18 +205,6 @@ export default {
209205
};
210206
},
211207
212-
// canCreateCluster() {
213-
// // we also check MANAGEMENT.CLUSTER (management.cattle.io.cluster) to avoid `View Virtualization Resource` role (introduced in Harvester RBAC) to create or manage the harvester cluster
214-
// const mgmtClusterSchema = this.$store.getters['management/schemaFor'](MANAGEMENT.CLUSTER);
215-
// const schema = this.$store.getters['management/schemaFor'](CAPI.RANCHER_CLUSTER);
216-
217-
// const mgmtClusterCreate = !!mgmtClusterSchema?.collectionMethods?.find((x) => x.toLowerCase() === 'post');
218-
// console.log('mgmtClusterCreate=', mgmtClusterCreate);
219-
// const clusterCreate = !!schema?.collectionMethods?.find((x) => x.toLowerCase() === 'post');
220-
// console.log('clusterCreate=', clusterCreate);
221-
// return clusterCreate && mgmtClusterCreate;
222-
// },
223-
224208
rows() {
225209
return this.hciClusters
226210
.filter((c) => {
@@ -262,8 +246,6 @@ export default {
262246
if (isRancherPrime()) {
263247
return await getHelmRepositoryExact(this.$store, HARVESTER_REPO.gitRepo);
264248
} else {
265-
console.log('getHarvesterRepository communityRepoRegexes=',communityRepoRegexes)
266-
console.log('getHarvesterRepository HARVESTER_CATALOG_IMAGES=',HARVESTER_CATALOG_IMAGES)
267249
return await getHelmRepositoryMatch(this.$store, communityRepoRegexes, HARVESTER_CATALOG_IMAGES);
268250
}
269251
} catch (error) {

pkg/harvester-manager/models/harvesterhci.io.management.cluster.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,30 @@ export default class HciCluster extends ProvCluster {
4343
// We do not allow users to edit Harvester clusters from Cluster Management, so we need to re-enable that action here.
4444
get _availableActions() {
4545
const out = super._availableActions;
46-
if(!this.canCreateAndManageCluster){
46+
47+
if (!this.canCreateAndManageCluster) {
4748
const allowActions = ['goToViewYaml', 'download', 'viewInApi'];
49+
4850
return out.filter((action) => allowActions.includes(action.action));
4951
}
5052

5153
const edit = out.find((action) => action.action === 'goToEdit');
54+
5255
if (edit) {
5356
edit.enabled = this.canEdit;
5457
}
5558

5659
return out;
5760
}
5861

59-
6062
get canCreateAndManageCluster() {
6163
// we check MANAGEMENT.CLUSTER (management.cattle.io.cluster) to avoid standard user role to create or manage the harvester clusters.
6264
const mgmtClusterSchema = this.$rootGetters['management/schemaFor'](MANAGEMENT.CLUSTER);
6365
const schema = this.$rootGetters['management/schemaFor'](CAPI.RANCHER_CLUSTER);
6466

6567
const mgmtClusterCreate = !!mgmtClusterSchema?.collectionMethods?.find((x) => x.toLowerCase() === 'post');
6668
const clusterCreate = !!schema?.collectionMethods?.find((x) => x.toLowerCase() === 'post');
69+
6770
return clusterCreate && mgmtClusterCreate;
6871
}
6972

0 commit comments

Comments
 (0)