mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-28 11:17:07 +00:00
refactor: migrate to directory-based stack structure
- Updated ComposeService to run docker commands from stack-specific directories, ensuring relative paths resolve correctly. - Refactored FileSystemService to manage stacks as directories, including methods for creating, updating, and deleting stacks. - Implemented automatic migration of existing flat-file stacks to the new directory structure on server startup. - Adjusted API routes to use stack names instead of filenames, simplifying stack management. - Modified frontend components to align with the new stack naming conventions and removed unnecessary file extensions.
This commit is contained in:
@@ -104,17 +104,18 @@ export default function HomeDashboard() {
|
||||
|
||||
const handleCreateStack = async () => {
|
||||
if (!newStackName.trim() || !convertedYaml) return;
|
||||
const filename = newStackName.endsWith('.yml') ? newStackName : newStackName + '.yml';
|
||||
// Send stackName directly (no .yml extension - backend creates directory)
|
||||
const stackName = newStackName.trim();
|
||||
try {
|
||||
// Create the stack
|
||||
const createResponse = await apiFetch('/stacks', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ filename }),
|
||||
body: JSON.stringify({ stackName }),
|
||||
});
|
||||
if (!createResponse.ok) throw new Error('Failed to create stack');
|
||||
|
||||
// Save the converted YAML content
|
||||
const saveResponse = await apiFetch(`/stacks/${filename}`, {
|
||||
const saveResponse = await apiFetch(`/stacks/${stackName}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ content: convertedYaml }),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user