update optimize code
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<div class="bg-gray-50 hover:bg-gray-100 rounded-lg p-4 text-center cursor-pointer transition-colors duration-200 border border-gray-200 hover:border-green-300"
|
||||
@click="showNotification('{{ __('Chức năng đang phát triển') }}', 'info')">
|
||||
<div class="flex flex-col items-center">
|
||||
<div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-3">
|
||||
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
</div>
|
||||
<span class="text-sm font-medium text-gray-700">{{ __('Cài lại') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,13 +1,29 @@
|
||||
{{-- Restart Button Component --}}
|
||||
<div id="restartVMButton"
|
||||
<div
|
||||
class="bg-gray-50 hover:bg-gray-100 rounded-lg p-4 text-center cursor-pointer transition-colors duration-200 border border-gray-200 hover:border-red-300">
|
||||
<div class="flex flex-col items-center">
|
||||
|
||||
<button x-data
|
||||
@click="
|
||||
fetch('{{ route('service.reboot.vm') }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
body: new URLSearchParams({ product_id: '{{ $invoice->vm_id }}' })
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
showNotification(data.message);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 300);
|
||||
});
|
||||
"
|
||||
class="flex flex-col items-center w-full cursor-pointer">
|
||||
<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-3">
|
||||
<svg class="w-6 h-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
</div>
|
||||
<span class="text-sm font-medium text-gray-700">{{ __('Khởi động lại') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{ __('Khởi động lại VM') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
<div id="startVMButton"
|
||||
class="bg-green-50 hover:bg-green-100 rounded-lg p-4 text-center cursor-pointer transition-colors duration-200 border border-green-200 hover:border-green-400">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
{{-- Stop Button Component --}}
|
||||
<div
|
||||
class="bg-gray-50 hover:bg-gray-100 rounded-lg p-4 text-center cursor-pointer transition-colors duration-200 border border-gray-200 hover:border-green-300">
|
||||
|
||||
<button x-data
|
||||
@click="
|
||||
fetch('{{ route('service.start.vm') }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
body: new URLSearchParams({ product_id: '{{ $invoice->vm_id }}' })
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
showNotification(data.message);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 300);
|
||||
});
|
||||
"
|
||||
class="flex flex-col items-center w-full cursor-pointer">
|
||||
<div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-3">
|
||||
<svg class="w-6 h-6 text-green-600" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z" />
|
||||
</svg>
|
||||
</div>
|
||||
<span class="font-medium text-green-700">{{ __('Khởi động máy ảo') }}</span>
|
||||
</div>
|
||||
{{ __('Khởi động máy ảo') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
<div id="stopVMButton"
|
||||
{{-- Stop Button Component --}}
|
||||
<div
|
||||
class="bg-gray-50 hover:bg-gray-100 rounded-lg p-4 text-center cursor-pointer transition-colors duration-200 border border-gray-200 hover:border-red-300">
|
||||
<div class="flex flex-col items-center">
|
||||
|
||||
<button x-data
|
||||
@click="
|
||||
fetch('{{ route('service.stop.vm') }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
body: new URLSearchParams({ product_id: '{{ $invoice->vm_id }}' })
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
showNotification(data.message);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 300);
|
||||
});
|
||||
"
|
||||
class="flex flex-col items-center w-full cursor-pointer">
|
||||
<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-3">
|
||||
<svg class="w-6 h-6 text-red-600" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z" />
|
||||
</svg>
|
||||
</div>
|
||||
<span class="text-sm font-medium text-gray-700">{{ __('Tắt nguồn') }}</span>
|
||||
</div>
|
||||
{{ __('Tắt nguồn') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
@php
|
||||
$serverName = $invoice->invoiceItem->first()->server_name ?? 'Cloud VPS';
|
||||
$vmStatus = $vmInfo['status'] ?? null;
|
||||
$statusBg = match ($vmStatus) {
|
||||
'POWERED_ON' => 'bg-green-600',
|
||||
'POWERED_OFF' => 'bg-red-600',
|
||||
default => 'bg-gray-600',
|
||||
};
|
||||
@endphp
|
||||
|
||||
<div class="bg-gray-100 rounded-lg shadow-lg p-8 flex flex-col items-center justify-center">
|
||||
<div class="bg-gray-100 rounded-xl shadow-lg p-8 flex flex-col items-center justify-center relative">
|
||||
<span class="text-sm text-gray-600">{{ $invoice->invoiceItem->first()?->getProductAttribute()?->name }}</span>
|
||||
<div class="bg-white rounded-lg p-6 mb-4 shadow-md">
|
||||
<svg class="w-16 h-16 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
|
||||
@@ -18,12 +24,19 @@
|
||||
{{ $serverName }}
|
||||
</p>
|
||||
<div class="mt-4">
|
||||
@if ($vmStatus == 'POWERED_ON')
|
||||
<span class="bg-green-500 text-white px-4 py-2 rounded-full text-sm font-medium">{{ __('RUNNING') }}</span>
|
||||
@elseif($vmStatus == 'POWERED_OFF')
|
||||
<span class="bg-red-500 text-white px-4 py-2 rounded-full text-sm font-medium">{{ __('STOPPED') }}</span>
|
||||
@else
|
||||
<span class="bg-gray-500 text-white px-4 py-2 rounded-full text-sm font-medium">{{ __('UNKNOWN') }}</span>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="h-10 w-full rounded-b-lg absolute bottom-0 left-0 flex items-center justify-center {{ $statusBg }}">
|
||||
<span class="text-center text-white">
|
||||
@if ($vmStatus == 'POWERED_ON')
|
||||
{{ __('RUNNING') }}
|
||||
@elseif($vmStatus == 'POWERED_OFF')
|
||||
{{ __('STOPPED') }}
|
||||
@else
|
||||
{{ __('UNKNOWN') }}
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,23 +19,23 @@
|
||||
<div class="grid grid-cols-6 gap-4">
|
||||
{{-- Row 1: Basic Controls --}}
|
||||
@include('frontend.service.partials.control-buttons.renewal-button')
|
||||
@include('frontend.service.partials.control-buttons.restart-button')
|
||||
{{-- @include('frontend.service.partials.control-buttons.pause-button') --}}
|
||||
|
||||
@if ($isPoweredOff)
|
||||
@include('frontend.service.partials.control-buttons.start-button')
|
||||
@elseif ($isPoweredOn)
|
||||
@include('frontend.service.partials.control-buttons.restart-button')
|
||||
@include('frontend.service.partials.control-buttons.stop-button')
|
||||
@include('frontend.service.partials.control-buttons.console-button', ['invoice' => $invoice])
|
||||
@endif
|
||||
|
||||
{{-- @include('frontend.service.partials.control-buttons.config-button') --}}
|
||||
{{-- @include('frontend.service.partials.control-buttons.reinstall-button') --}}
|
||||
@include('frontend.service.partials.control-buttons.reinstall-button')
|
||||
|
||||
@if ($isPoweredOn)
|
||||
@include('frontend.service.partials.control-buttons.snapshot-button')
|
||||
@endif
|
||||
|
||||
@include('frontend.service.partials.control-buttons.console-button', ['invoice' => $invoice])
|
||||
|
||||
{{-- @include('frontend.service.partials.control-buttons.reset-password-button') --}}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user