Skip to content

Commit

Permalink
feat: #189 pick a single node as a placement server for volume'd temp…
Browse files Browse the repository at this point in the history
…lates
  • Loading branch information
bohdan-shulha committed Sep 14, 2024
1 parent 59e4def commit efc958a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 11 additions & 1 deletion resources/js/Pages/Services/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ const hideTemplatePicker = () => {
const applyTemplate = (template) => {
form.name = template.name;
form.deploymentData.processes = template.deploymentData.processes;
const processes = template.deploymentData.processes.map((process) => {
return {
...process,
placementNodeId:
process.volumes.length > 0 && props.nodes.length === 1
? props.nodes[0].id
: null,
};
});
form.deploymentData.processes = processes;
hideTemplatePicker();
};
Expand Down
11 changes: 1 addition & 10 deletions resources/js/Pages/Services/Partials/TemplatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const mapProcessTemplate = (templateSlug, process, newIndex) => {
return {
id: makeId("process"),
name: "process_" + newIndex,
placementNodeId: null,
dockerRegistryId: null,
dockerImage: "",
releaseCommand: {
Expand Down Expand Up @@ -148,14 +149,6 @@ const applyTemplate = () => {
validateForm(form.data, state.template.form, form.errors);
state.extends.forEach((template) => {
console.log(
JSON.stringify({
data: form.data,
form: template.form,
errors: form.errors,
slug: template.slug,
}),
);
validateForm(form.data, template.form, form.errors, template.slug);
});
Expand Down Expand Up @@ -197,8 +190,6 @@ const validateForm = (formData, schema, errors, scope) => {
break;
case "text-field":
console.log(JSON.stringify({ formData, schema, errors, scope }));
const itemName = scope ? `${scope}/${schema.name}` : schema.name;
if (
schema.required &&
Expand Down

0 comments on commit efc958a

Please sign in to comment.