From 4e9b36ae45028c46f4b12eed7b5979aaddb06ca8 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Wed, 17 Jul 2019 10:26:58 -0700 Subject: [PATCH] edit cluster launched with cluster template --- app/authenticated/cluster/edit/route.js | 26 +++++++++++++++++-- app/authenticated/cluster/edit/template.hbs | 3 ++- .../cluster-driver/driver-rke/template.hbs | 2 +- .../addon/components/cru-cluster/template.hbs | 1 - 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/authenticated/cluster/edit/route.js b/app/authenticated/cluster/edit/route.js index 3022cc372..2549b5718 100644 --- a/app/authenticated/cluster/edit/route.js +++ b/app/authenticated/cluster/edit/route.js @@ -28,8 +28,8 @@ export default Route.extend({ if (!isEmpty(cluster.clusterTemplateRevisionId)) { setProperties(modelOut, { - clusterTemplateRevision: globalStore.find('clustertemplaterevision', cluster.clusterTemplateRevisionId), - clusterTemplate: globalStore.find('clustertemplate', cluster.clusterTemplateId), + clusterTemplateRevisions: globalStore.findAll('clustertemplaterevision'), + clusterTemplates: globalStore.findAll('clustertemplate'), }); } @@ -37,6 +37,28 @@ export default Route.extend({ }, afterModel(model) { + let { + clusterTemplateRevisions = null, + clusterTemplates = null, + cluster + } = model; + + if (clusterTemplateRevisions) { + let ctr = null; + let ct = null; + let ctId = null; + + ctr = clusterTemplateRevisions.findBy('id', cluster.clusterTemplateRevisionId); + ctId = get(ctr, 'clusterTemplateId'); + ct = clusterTemplates.findBy('id', ctId); + + setProperties(model, { + clusterTemplateRevisionId: get(ctr, 'id'), + clusterTemplateId: get(ct, 'id'), + clusterTemplateRevision: ctr + }); + } + // load the css/js url here, if the url loads fail we should error the driver out // show the driver in the ui, greyed out, and possibly add error text "can not load comonent from url [put url here]" let { kontainerDrivers } = model; diff --git a/app/authenticated/cluster/edit/template.hbs b/app/authenticated/cluster/edit/template.hbs index ef54b0ae8..d0d53de1f 100644 --- a/app/authenticated/cluster/edit/template.hbs +++ b/app/authenticated/cluster/edit/template.hbs @@ -5,7 +5,8 @@ {{#unless clusterTemplateCreate}} - {{#if model.clusterTemplateRevisions}} + {{#if (or model.clusterTemplateRevisions model.clusterTemplateRevision)}}
diff --git a/lib/shared/addon/components/cru-cluster/template.hbs b/lib/shared/addon/components/cru-cluster/template.hbs index 10beb9dde..c3bf0d5d1 100644 --- a/lib/shared/addon/components/cru-cluster/template.hbs +++ b/lib/shared/addon/components/cru-cluster/template.hbs @@ -1,4 +1,3 @@ - {{#if (eq step 1)}}