Merge pull request #4975 from nwmac/allow-labels-imported-clusters

Allow labels to be edited on k3s imported clusters
This commit is contained in:
Neil MacDougall 2023-04-13 14:01:14 +01:00 committed by GitHub
commit 25b24c86d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -415,8 +415,18 @@ export default Component.extend(ViewNewEdit, ChildHook, {
}; };
}), }),
// If this is a k3s cluster, then prevent editing of two 'system' labels
readonlyLabels: computed('isK3sCluster', function() {
const isK3sCluster = get(this, 'isK3sCluster');
return isK3sCluster ? [
'provider.cattle.io',
'objectset.rio.cattle.io/hash'
] : [];
}),
isImportedOther: computed('isK3sCluster', 'provider', 'router.currentRoute.queryParams.importProvider', function() { isImportedOther: computed('isK3sCluster', 'provider', 'router.currentRoute.queryParams.importProvider', function() {
// This is a special case because k3s is treated as a special cluster and no longer looks imported by the time it's actve // This is a special case because k3s is treated as a special cluster and no longer looks imported by the time it's active
if (get(this, 'isK3sCluster')) { if (get(this, 'isK3sCluster')) {
return true; return true;
} }

View File

@ -87,7 +87,8 @@
expandFn=expandFn expandFn=expandFn
initialLabels=model.cluster.labels initialLabels=model.cluster.labels
model=model.cluster model=model.cluster
editing=(and (and notView (not (or isK3sCluster isRke2Cluster))) (not isEksClusterPending)) readonlyLabels=readonlyLabels
editing=(and (and notView (not isRke2Cluster)) (not isEksClusterPending))
}} }}
{{/accordion-list}} {{/accordion-list}}
{{#if isImportedOther}} {{#if isImportedOther}}