From 3ad95772dbcb0df377b1731a7e1813e1151cadb9 Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Thu, 12 Aug 2021 17:38:44 -0700 Subject: [PATCH] Edit yaml for !rke2 cluster should show mgmt cluster --- config/product/manager.js | 3 ++- models/provisioning.cattle.io.cluster.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/config/product/manager.js b/config/product/manager.js index e52d784bec..ad0634333e 100644 --- a/config/product/manager.js +++ b/config/product/manager.js @@ -1,5 +1,5 @@ import { AGE, NAME as NAME_COL, STATE } from '@/config/table-headers'; -import { CAPI, NORMAN } from '@/config/types'; +import { CAPI, MANAGEMENT, NORMAN } from '@/config/types'; import { MULTI_CLUSTER } from '@/store/features'; import { DSL } from '@/store/type-map'; @@ -100,6 +100,7 @@ export function init(store) { weightType(CAPI.MACHINE, 1, true); basicType([ + MANAGEMENT.CLUSTER, CAPI.MACHINE_DEPLOYMENT, CAPI.MACHINE_SET, CAPI.MACHINE, diff --git a/models/provisioning.cattle.io.cluster.js b/models/provisioning.cattle.io.cluster.js index eb513fea01..5b8d82bbcc 100644 --- a/models/provisioning.cattle.io.cluster.js +++ b/models/provisioning.cattle.io.cluster.js @@ -5,6 +5,7 @@ import { set } from '@/utils/object'; import { sortBy } from '@/utils/sort'; import { ucFirst } from '@/utils/string'; import { compare } from '@/utils/version'; +import { AS, MODE, _EDIT, _YAML } from '~/config/query-params'; export const DEFAULT_WORKSPACE = 'fleet-default'; @@ -100,6 +101,28 @@ export default { return out; }, + goToEditYaml() { + return () => { + let location; + + if ( !this.isRke2 ) { + location = this.mgmt?.detailLocation; + } + + if ( !location ) { + location = this.detailLocation; + } + + location.query = { + ...location.query, + [MODE]: _EDIT, + [AS]: _YAML + }; + + this.currentRouter().push(location); + }; + }, + isImported() { return this.provisioner === 'imported'; },