mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-25 04:20:11 +00:00
Merge pull request #7028 from coollabsio/andrasbacsai/belgrade-v3
feat: add dynamic viewport-based height for compose editor
This commit is contained in:
@@ -146,6 +146,7 @@ class MyComponent extends Component
|
|||||||
- State management handled on the server
|
- State management handled on the server
|
||||||
- Use wire:model for two-way data binding
|
- Use wire:model for two-way data binding
|
||||||
- Dispatch events for component communication
|
- Dispatch events for component communication
|
||||||
|
- **CRITICAL**: Livewire component views **MUST** have exactly ONE root element. ALL content must be contained within this single root element. Placing ANY elements (`<style>`, `<script>`, `<div>`, comments, or any other HTML) outside the root element will break Livewire's component tracking and cause `wire:click` and other directives to fail silently.
|
||||||
|
|
||||||
### Code Organization Patterns
|
### Code Organization Patterns
|
||||||
- **Actions Pattern**: Use Actions for complex business logic (`app/Actions/`)
|
- **Actions Pattern**: Use Actions for complex business logic (`app/Actions/`)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
}, 5);" :id="monacoId">
|
}, 5);" :id="monacoId">
|
||||||
</div>
|
</div>
|
||||||
<div class="relative z-10 w-full h-full">
|
<div class="relative z-10 w-full h-full">
|
||||||
<div x-ref="monacoEditorElement" class="w-full h-[calc(100vh-20rem)] min-h-96 text-md {{ $readonly ? 'opacity-65' : '' }}"></div>
|
<div x-ref="monacoEditorElement" class="w-full text-md {{ $readonly ? 'opacity-65' : '' }}" style="height: var(--editor-height, calc(100vh - 20rem)); min-height: 300px;"></div>
|
||||||
<div x-ref="monacoPlaceholderElement" x-show="monacoPlaceholder" @click="monacoEditorFocus()"
|
<div x-ref="monacoPlaceholderElement" x-show="monacoPlaceholder" @click="monacoEditorFocus()"
|
||||||
:style="'font-size: ' + monacoFontSize"
|
:style="'font-size: ' + monacoFontSize"
|
||||||
class="w-full text-sm font-mono absolute z-50 text-gray-500 ml-14 -translate-x-0.5 mt-0.5 left-0 top-0"
|
class="w-full text-sm font-mono absolute z-50 text-gray-500 ml-14 -translate-x-0.5 mt-0.5 left-0 top-0"
|
||||||
|
|||||||
@@ -1,19 +1,29 @@
|
|||||||
<style>
|
<div x-data="{
|
||||||
.compose-editor-container .coolify-monaco-editor>div>div>div {
|
raw: true,
|
||||||
height: 512px !important;
|
showNormalTextarea: false,
|
||||||
min-height: 512px !important;
|
editorHeight: 400,
|
||||||
|
calculateEditorHeight() {
|
||||||
|
// Get viewport height
|
||||||
|
const viewportHeight = window.innerHeight;
|
||||||
|
// Modal max height is calc(100vh - 2rem) = viewport - 32px
|
||||||
|
const modalMaxHeight = viewportHeight - 32;
|
||||||
|
// Account for: modal header (~80px) + info text (~60px) + checkboxes (~80px) + buttons (~80px) + padding (~48px)
|
||||||
|
const fixedElementsHeight = 348;
|
||||||
|
// Calculate available height for editor
|
||||||
|
const availableHeight = modalMaxHeight - fixedElementsHeight;
|
||||||
|
// Set minimum height of 300px and maximum of available space
|
||||||
|
this.editorHeight = Math.max(300, Math.min(availableHeight, viewportHeight - 200));
|
||||||
}
|
}
|
||||||
</style>
|
}" x-init="calculateEditorHeight(); window.addEventListener('resize', () => calculateEditorHeight())">
|
||||||
<div x-data="{ raw: true, showNormalTextarea: false }">
|
|
||||||
<div class="pb-4">Volume names are updated upon save. The service UUID will be added as a prefix to all volumes, to
|
<div class="pb-4">Volume names are updated upon save. The service UUID will be added as a prefix to all volumes, to
|
||||||
prevent
|
prevent
|
||||||
name collision. <br>To see the actual volume names, check the Deployable Compose file, or go to Storage
|
name collision. <br>To see the actual volume names, check the Deployable Compose file, or go to Storage
|
||||||
menu.</div>
|
menu.</div>
|
||||||
|
|
||||||
<div class="compose-editor-container">
|
<div class="compose-editor-container" x-bind:style="`--editor-height: ${editorHeight}px`">
|
||||||
<div x-cloak x-show="raw" class="font-mono">
|
<div x-cloak x-show="raw" class="font-mono">
|
||||||
<div x-cloak x-show="showNormalTextarea">
|
<div x-cloak x-show="showNormalTextarea">
|
||||||
<x-forms.textarea rows="25" id="dockerComposeRaw">
|
<x-forms.textarea x-bind:style="`height: ${editorHeight}px`" id="dockerComposeRaw">
|
||||||
</x-forms.textarea>
|
</x-forms.textarea>
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="!showNormalTextarea">
|
<div x-cloak x-show="!showNormalTextarea">
|
||||||
@@ -22,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="raw === false" class="font-mono">
|
<div x-cloak x-show="raw === false" class="font-mono">
|
||||||
<x-forms.textarea rows="25" readonly id="dockerCompose">
|
<x-forms.textarea x-bind:style="`height: ${editorHeight}px`" readonly id="dockerCompose">
|
||||||
</x-forms.textarea>
|
</x-forms.textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4527,7 +4527,7 @@
|
|||||||
"web",
|
"web",
|
||||||
"admin"
|
"admin"
|
||||||
],
|
],
|
||||||
"category": "vps",
|
"category": "vpn",
|
||||||
"logo": "svgs/wireguard.svg",
|
"logo": "svgs/wireguard.svg",
|
||||||
"minversion": "0.0.0",
|
"minversion": "0.0.0",
|
||||||
"port": "8000"
|
"port": "8000"
|
||||||
|
|||||||
@@ -4527,7 +4527,7 @@
|
|||||||
"web",
|
"web",
|
||||||
"admin"
|
"admin"
|
||||||
],
|
],
|
||||||
"category": "vps",
|
"category": "vpn",
|
||||||
"logo": "svgs/wireguard.svg",
|
"logo": "svgs/wireguard.svg",
|
||||||
"minversion": "0.0.0",
|
"minversion": "0.0.0",
|
||||||
"port": "8000"
|
"port": "8000"
|
||||||
|
|||||||
Reference in New Issue
Block a user