edit cluster launched with cluster template

This commit is contained in:
Westly Wright 2019-07-17 10:26:58 -07:00
parent 7ee41a0cc3
commit 4e9b36ae45
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
4 changed files with 27 additions and 5 deletions

View File

@ -28,8 +28,8 @@ export default Route.extend({
if (!isEmpty(cluster.clusterTemplateRevisionId)) { if (!isEmpty(cluster.clusterTemplateRevisionId)) {
setProperties(modelOut, { setProperties(modelOut, {
clusterTemplateRevision: globalStore.find('clustertemplaterevision', cluster.clusterTemplateRevisionId), clusterTemplateRevisions: globalStore.findAll('clustertemplaterevision'),
clusterTemplate: globalStore.find('clustertemplate', cluster.clusterTemplateId), clusterTemplates: globalStore.findAll('clustertemplate'),
}); });
} }
@ -37,6 +37,28 @@ export default Route.extend({
}, },
afterModel(model) { 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 // 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]" // 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; let { kontainerDrivers } = model;

View File

@ -5,7 +5,8 @@
</section> </section>
<CruCluster <CruCluster
@applyClusterTemplate={{not (is-empty model.clusterTemplateRevision)}} @applyClusterTemplate={{not (is-empty model.clusterTemplateRevisionId)}}
@clusterTemplateRevisionId={{model.clusterTemplateRevisionId}}
@model={{model}} @model={{model}}
@initialProvider={{cluster.provider}} @initialProvider={{cluster.provider}}
@provider={{provider}} @provider={{provider}}

View File

@ -14,7 +14,7 @@
</section> </section>
{{#unless clusterTemplateCreate}} {{#unless clusterTemplateCreate}}
{{#if model.clusterTemplateRevisions}} {{#if (or model.clusterTemplateRevisions model.clusterTemplateRevision)}}
<section class="cluster-template-select mb-20"> <section class="cluster-template-select mb-20">
<div class="row"> <div class="row">
<div class="col span-6"> <div class="col span-6">

View File

@ -1,4 +1,3 @@
{{#if (eq step 1)}} {{#if (eq step 1)}}
<form onsubmit={{action "clickNext"}}> <form onsubmit={{action "clickNext"}}>
<div class="row"> <div class="row">