Refactor ActivityMonitor component to add max height option

This commit is contained in:
Andras Bacsai
2024-04-16 13:14:09 +02:00
parent 92ee2be021
commit f0ad260eab
3 changed files with 175 additions and 170 deletions

View File

@@ -11,7 +11,7 @@
@endif @endif
<div @class([ <div @class([
'flex flex-col-reverse w-full px-4 py-2 overflow-y-auto bg-white border border-solid rounded dark:text-white dark:bg-coolgray-100 scrollbar border-neutral-300 dark:border-coolgray-300', 'flex flex-col-reverse w-full px-4 py-2 overflow-y-auto bg-white border border-solid rounded dark:text-white dark:bg-coolgray-100 scrollbar border-neutral-300 dark:border-coolgray-300',
'h-full' => $fullHeight, 'max-h-[48rem]' => $fullHeight,
'max-h-96' => !$fullHeight, 'max-h-96' => !$fullHeight,
])> ])>
<pre class="max-h-screen font-mono whitespace-pre-wrap" @if ($isPollingActive) wire:poll.1000ms="polling" @endif>{{ RunRemoteProcess::decodeOutput($this->activity) }}</pre> <pre class="max-h-screen font-mono whitespace-pre-wrap" @if ($isPollingActive) wire:poll.1000ms="polling" @endif>{{ RunRemoteProcess::decodeOutput($this->activity) }}</pre>

View File

@@ -17,86 +17,89 @@
@endif @endif
<x-applications.links :application="$application" /> <x-applications.links :application="$application" />
<div class="flex-1"></div> <div class="flex-1"></div>
@if ($application->build_pack === 'dockercompose' && is_null($application->docker_compose_raw)) <div class="flex items-center gap-2">
<div>Please load a Compose file.</div> @if ($application->build_pack === 'dockercompose' && is_null($application->docker_compose_raw))
@else <div>Please load a Compose file.</div>
@if (!$application->destination->server->isSwarm()) @else
<x-applications.advanced :application="$application" /> @if (!$application->destination->server->isSwarm())
@endif <x-applications.advanced :application="$application" />
<div class="flex gap-2"> @endif
@if (!str($application->status)->startsWith('exited')) <div class="flex gap-2">
@if (!$application->destination->server->isSwarm()) @if (!str($application->status)->startsWith('exited'))
<x-forms.button title="With rolling update if possible" wire:click='deploy'> @if (!$application->destination->server->isSwarm())
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-orange-400" <x-forms.button title="With rolling update if possible" wire:click='deploy'>
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-orange-400"
stroke-linecap="round" stroke-linejoin="round"> viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> stroke-linecap="round" stroke-linejoin="round">
<path <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
d="M10.09 4.01l.496 -.495a2 2 0 0 1 2.828 0l7.071 7.07a2 2 0 0 1 0 2.83l-7.07 7.07a2 2 0 0 1 -2.83 0l-7.07 -7.07a2 2 0 0 1 0 -2.83l3.535 -3.535h-3.988"> <path
</path> d="M10.09 4.01l.496 -.495a2 2 0 0 1 2.828 0l7.071 7.07a2 2 0 0 1 0 2.83l-7.07 7.07a2 2 0 0 1 -2.83 0l-7.07 -7.07a2 2 0 0 1 0 -2.83l3.535 -3.535h-3.988">
<path d="M7.05 11.038v-3.988"></path> </path>
</svg> <path d="M7.05 11.038v-3.988"></path>
Redeploy
</x-forms.button>
@endif
@if ($application->build_pack !== 'dockercompose')
@if ($application->destination->server->isSwarm())
<x-forms.button title="Redeploy Swarm Service (rolling update)" wire:click='deploy'>
<svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2">
<path
d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path d="M20 4v5h-5" />
</g>
</svg> </svg>
Update Service Redeploy
</x-forms.button>
@else
<x-forms.button title="Restart without rebuilding" wire:click='restart'>
<svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2">
<path
d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path d="M20 4v5h-5" />
</g>
</svg>
Restart
</x-forms.button> </x-forms.button>
@endif @endif
@endif @if ($application->build_pack !== 'dockercompose')
<x-modal-confirmation @click="$wire.dispatch('stopEvent')"> @if ($application->destination->server->isSwarm())
<x-slot:button-title> <x-forms.button title="Redeploy Swarm Service (rolling update)" wire:click='deploy'>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" xmlns="http://www.w3.org/2000/svg">
stroke-linejoin="round"> <g fill="none" stroke="currentColor" stroke-linecap="round"
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> stroke-linejoin="round" stroke-width="2">
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"> <path
</path> d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path <path d="M20 4v5h-5" />
d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"> </g>
</path> </svg>
Update Service
</x-forms.button>
@else
<x-forms.button title="Restart without rebuilding" wire:click='restart'>
<svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2">
<path
d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path d="M20 4v5h-5" />
</g>
</svg>
Restart
</x-forms.button>
@endif
@endif
<x-modal-confirmation @click="$wire.dispatch('stopEvent')">
<x-slot:button-title>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path
d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
<path
d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
</svg>
Stop
</x-slot:button-title>
This application will be stopped. <br>Please think again.
</x-modal-confirmation>
@else
<x-forms.button wire:click='deploy'>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning"
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg> </svg>
Stop Deploy
</x-slot:button-title> </x-forms.button>
This application will be stopped. <br>Please think again. @endif
</x-modal-confirmation> </div>
@else @endif
<x-forms.button wire:click='deploy'> </div>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg>
Deploy
</x-forms.button>
@endif
</div>
@endif
</div> </div>
@script @script
<script> <script>

View File

@@ -15,102 +15,104 @@
</a> </a>
<x-services.links :service="$service" /> <x-services.links :service="$service" />
<div class="flex-1"></div> <div class="flex-1"></div>
@if (str($service->status())->contains('running')) <div class="flex gap-2">
<button @click="$wire.dispatch('restartEvent')" class="gap-2 button"> @if (str($service->status())->contains('running'))
<svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <button @click="$wire.dispatch('restartEvent')" class="gap-2 button">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
stroke-width="2"> <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
<path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" /> stroke-width="2">
<path d="M20 4v5h-5" /> <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
</g> <path d="M20 4v5h-5" />
</svg> </g>
Pull Latest Images & Restart
</button>
<x-modal-confirmation @click="$wire.dispatch('stopEvent')">
<x-slot:button-title>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
<path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
</svg> </svg>
Stop Pull Latest Images & Restart
</x-slot:button-title> </button>
This service will be stopped. <br>Please think again. <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
</x-modal-confirmation> <x-slot:button-title>
@elseif (str($service->status())->contains('degraded')) <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
<button @click="$wire.dispatch('startEvent')" class="gap-2 button"> stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
<svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> stroke-linejoin="round">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
stroke-width="2"> <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
<path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" /> </path>
<path d="M20 4v5h-5" /> <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</g> </path>
</svg> </svg>
Restart Degraded Services Stop
</button> </x-slot:button-title>
<x-modal-confirmation @click="$wire.dispatch('stopEvent')"> This service will be stopped. <br>Please think again.
<x-slot:button-title> </x-modal-confirmation>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" @elseif (str($service->status())->contains('degraded'))
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
stroke-linejoin="round"> <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"> stroke-width="2">
</path> <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"> <path d="M20 4v5h-5" />
</path> </g>
</svg> </svg>
Stop Restart Degraded Services
</x-slot:button-title> </button>
This service will be stopped. <br>Please think again. <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
</x-modal-confirmation> <x-slot:button-title>
@elseif (str($service->status())->contains('exited')) <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
<button wire:click='stop(true)' class="gap-2 button"> stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
<svg class="w-5 h-5 " viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> stroke-linejoin="round">
<path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" /> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path fill="red" <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" /> </path>
</svg> <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
Force Cleanup Containers </path>
</button> </svg>
<button @click="$wire.dispatch('startEvent')" class="gap-2 button"> Stop
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" </x-slot:button-title>
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" This service will be stopped. <br>Please think again.
stroke-linejoin="round"> </x-modal-confirmation>
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> @elseif (str($service->status())->contains('exited'))
<path d="M7 4v16l13 -8z" /> <button wire:click='stop(true)' class="gap-2 button">
</svg> <svg class="w-5 h-5 " viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
Deploy <path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" />
</button> <path fill="red"
@else d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" />
<x-modal-confirmation @click="$wire.dispatch('stopEvent')">
<x-slot:button-title>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
<path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
</svg> </svg>
Stop Force Cleanup Containers
</x-slot:button-title> </button>
This service will be stopped. <br>Please think again. <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
</x-modal-confirmation> <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
<button @click="$wire.dispatch('startEvent')" class="gap-2 button"> stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" stroke-linejoin="round">
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" <path stroke="none" d="M0 0h24v24H0z" fill="none" />
stroke-linejoin="round"> <path d="M7 4v16l13 -8z" />
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> </svg>
<path d="M7 4v16l13 -8z" /> Deploy
</svg> </button>
Deploy @else
</button> <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
@endif <x-slot:button-title>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
<path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
</path>
</svg>
Stop
</x-slot:button-title>
This service will be stopped. <br>Please think again.
</x-modal-confirmation>
<button @click="$wire.dispatch('startEvent')" class="gap-2 button">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg>
Deploy
</button>
@endif
</div>
</div> </div>
@script @script
<script> <script>