@eclipse-che/che-code-devworkspace-handler
Advanced tools
Comparing version 1.63.0-dev-711e3f8 to 1.63.0-dev-72b1407
@@ -65,6 +65,7 @@ "use strict"; | ||
DevContainerComponentUpdater.prototype.update = function (devfileContext, cheCodeDescriptionComponent, devContainerComponent, devContainerExisted) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var devContainer, cheCodeDescriptionComponentContainer, devContainerAttributes, existingEntrypoint, devContainerVolumes, toInsertVolumeMounts, existingComponents, volumeComponentsToAdd, devContainerEndpoints, cheCodeContainerEndpoints; | ||
var _a, _b; | ||
return __generator(this, function (_c) { | ||
var devContainer, cheCodeDescriptionComponentContainer, devContainerAttributes, existingEntrypoint, devContainerVolumes, toInsertVolumeMounts, existingComponents, volumesInsideTemplates, volumeComponentsToAdd, devContainerEndpoints, cheCodeContainerEndpoints; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
devContainer = devContainerComponent.container; | ||
@@ -95,3 +96,3 @@ if (!devContainer) { | ||
toInsertVolumeMounts = (cheCodeDescriptionComponentContainer.volumeMounts || []).filter(function (volume) { return !devContainerVolumes.some(function (containerVolume) { return containerVolume.name === volume.name; }); }); | ||
(_a = devContainer.volumeMounts).push.apply(_a, toInsertVolumeMounts); | ||
(_b = devContainer.volumeMounts).push.apply(_b, toInsertVolumeMounts); | ||
// add information that this volume has been added | ||
@@ -103,3 +104,17 @@ toInsertVolumeMounts.forEach(function (volumeMount) { | ||
existingComponents = devfileContext.devWorkspace.spec.template.components; | ||
volumeComponentsToAdd = toInsertVolumeMounts.filter(function (volumeMount) { return !existingComponents.find(function (component) { return component.volume && component.name == volumeMount.name; }); }); | ||
volumesInsideTemplates = (_a = devfileContext.devWorkspaceTemplates) === null || _a === void 0 ? void 0 : _a.map(function (template) { return template.spec.components; }).map(function (components) { | ||
return components.map(function (component) { | ||
if (component.volume) { | ||
return component.name; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
}); | ||
}).filter(function (defined) { return defined; }).flat(); | ||
volumeComponentsToAdd = toInsertVolumeMounts | ||
.filter(function (volumeMount) { return !existingComponents.find(function (component) { return component.volume && component.name == volumeMount.name; }); }) | ||
.filter( | ||
// also filter out all volumes that are defined in the editor template | ||
function (volumeMount) { return !(volumesInsideTemplates || []).includes(volumeMount.name); }); | ||
volumeComponentsToAdd.forEach(function (volume) { | ||
@@ -114,3 +129,3 @@ // volume | ||
// add all endpoints | ||
(_b = devContainer.endpoints).push.apply(_b, cheCodeContainerEndpoints); | ||
(_c = devContainer.endpoints).push.apply(_c, cheCodeContainerEndpoints); | ||
cheCodeContainerEndpoints.forEach(function (endpoint) { | ||
@@ -117,0 +132,0 @@ var endpointAttributes = endpoint.attributes || {}; |
{ | ||
"name": "@eclipse-che/che-code-devworkspace-handler", | ||
"version": "1.63.0-dev-711e3f8", | ||
"version": "1.63.0-dev-72b1407", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Handle management of devWorkspace templates for che-code", |
@@ -96,6 +96,27 @@ /********************************************************************** | ||
const existingComponents = devfileContext.devWorkspace.spec.template.components; | ||
// volumes defined in the templates | ||
const volumesInsideTemplates = devfileContext.devWorkspaceTemplates | ||
?.map(template => template.spec.components) | ||
.map(components => | ||
components.map(component => { | ||
if (component.volume) { | ||
return component.name; | ||
} else { | ||
return undefined; | ||
} | ||
}) | ||
) | ||
.filter(defined => defined) | ||
.flat(); | ||
// keep only volumes that match the given component | ||
const volumeComponentsToAdd = toInsertVolumeMounts.filter( | ||
volumeMount => !existingComponents.find(component => component.volume && component.name == volumeMount.name) | ||
); | ||
const volumeComponentsToAdd = toInsertVolumeMounts | ||
.filter( | ||
volumeMount => !existingComponents.find(component => component.volume && component.name == volumeMount.name) | ||
) | ||
.filter( | ||
// also filter out all volumes that are defined in the editor template | ||
volumeMount => !(volumesInsideTemplates || []).includes(volumeMount.name) | ||
); | ||
volumeComponentsToAdd.forEach(volume => { | ||
@@ -102,0 +123,0 @@ // volume |
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
163910
2523
0