refactor: remove unused Type components and relocate module-related API routes to admin routes.
This commit is contained in:
@@ -16,14 +16,12 @@ use App\Repositories\Addon\AddonRepositoryInterface;
|
|||||||
use App\Repositories\Domain\DomainRepositoryInterface;
|
use App\Repositories\Domain\DomainRepositoryInterface;
|
||||||
use App\Repositories\Group\GroupRepositoryInterface;
|
use App\Repositories\Group\GroupRepositoryInterface;
|
||||||
use App\Repositories\Hosting\HostingRepositoryInterface;
|
use App\Repositories\Hosting\HostingRepositoryInterface;
|
||||||
use App\Repositories\Type\TypeRepositoryInterface;
|
|
||||||
use App\Repositories\VPS\VPSRepositoryInterface;
|
use App\Repositories\VPS\VPSRepositoryInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ShopController extends Controller
|
class ShopController extends Controller
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public TypeRepositoryInterface $typeRepository,
|
|
||||||
public GroupRepositoryInterface $groupRepository,
|
public GroupRepositoryInterface $groupRepository,
|
||||||
public VPSRepositoryInterface $vpsRepository,
|
public VPSRepositoryInterface $vpsRepository,
|
||||||
public HostingRepositoryInterface $hostingRepository,
|
public HostingRepositoryInterface $hostingRepository,
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ use App\Repositories\Module\Snapshot\SnapshotLimitRepositoryInterface;
|
|||||||
use App\Repositories\Module\Snapshot\SnapshotRepositoryInterface;
|
use App\Repositories\Module\Snapshot\SnapshotRepositoryInterface;
|
||||||
use App\Repositories\Module\Vmware\VmwareCachedRepository;
|
use App\Repositories\Module\Vmware\VmwareCachedRepository;
|
||||||
use App\Repositories\Module\Vmware\VmwareRepositoryInterface;
|
use App\Repositories\Module\Vmware\VmwareRepositoryInterface;
|
||||||
use App\Repositories\Type\TypeCachedRepository;
|
|
||||||
use App\Repositories\Type\TypeRepositoryInterface;
|
|
||||||
use App\Repositories\Admin\Product\ProductRepository;
|
use App\Repositories\Admin\Product\ProductRepository;
|
||||||
use App\Repositories\Admin\Product\ProductRepositoryInterface;
|
use App\Repositories\Admin\Product\ProductRepositoryInterface;
|
||||||
use App\Repositories\User\UserCachedRepository;
|
use App\Repositories\User\UserCachedRepository;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\View\Components\Order;
|
namespace App\View\Components\Order;
|
||||||
|
|
||||||
use App\Repositories\Type\TypeRepositoryInterface;
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
@@ -13,7 +12,7 @@ class Type extends Component
|
|||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public TypeRepositoryInterface $typeRepository
|
// public TypeRepositoryInterface $typeRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -24,7 +23,7 @@ class Type extends Component
|
|||||||
*/
|
*/
|
||||||
public function render(): View|Closure|string
|
public function render(): View|Closure|string
|
||||||
{
|
{
|
||||||
$types= $this->typeRepository->getAll();
|
$types = null;
|
||||||
return view('components.order.type',compact('types'));
|
return view('components.order.type',compact('types'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\View\Components;
|
|
||||||
|
|
||||||
use App\Repositories\Type\TypeRepositoryInterface;
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\View\Component;
|
|
||||||
|
|
||||||
class Type extends Component
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create a new component instance.
|
|
||||||
*/
|
|
||||||
public function __construct(
|
|
||||||
public $model = null,
|
|
||||||
public TypeRepositoryInterface $typeRepository
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the view / contents that represent the component.
|
|
||||||
*/
|
|
||||||
public function render(): View|Closure|string
|
|
||||||
{
|
|
||||||
$types = $this->typeRepository->getAll();
|
|
||||||
return view('components.type',compact('types'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
{{-- Thumbnail using component --}}
|
{{-- Thumbnail using component --}}
|
||||||
<x-image-picker name="thumbnail" label="Thumbnail" :value="$group->thumbnail" />
|
<x-image-picker name="thumbnail" label="Thumbnail" :value="$group->thumbnail" />
|
||||||
|
|
||||||
<x-module.v-center :model="$group->host->datacenter" />
|
<x-module.v-center :model="$group->host?->datacenter" />
|
||||||
<x-module.datacenter :model="$group->host" />
|
<x-module.datacenter :model="$group->host" />
|
||||||
<x-module.host :model="$group" />
|
<x-module.host :model="$group" />
|
||||||
{{-- Status --}}
|
{{-- Status --}}
|
||||||
|
|||||||
@@ -77,7 +77,6 @@
|
|||||||
value="{{ old('slug') }}" class="form-control">
|
value="{{ old('slug') }}" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-type :model="null"/>
|
|
||||||
{{--Status--}}
|
{{--Status--}}
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-4" for="company">Status</label>
|
<label class="col-md-4" for="company">Status</label>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ if (!$selectedDatacenterId && $model) {
|
|||||||
$datacenter.html('<option value="">Đang tải Datacenter...</option>').prop('disabled', true);
|
$datacenter.html('<option value="">Đang tải Datacenter...</option>').prop('disabled', true);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ route('api.getDatacenter') }}',
|
url: '{{ route('module-vcenter.getDatacenter') }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
data: {
|
data: {
|
||||||
vcenter: vcenterId
|
vcenter: vcenterId
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ $selectedHostId = old('module_host_id') ?? ($model?->module_host_id ?? ($model?-
|
|||||||
$host.html('<option value="">Đang tải Host...</option>').prop('disabled', true);
|
$host.html('<option value="">Đang tải Host...</option>').prop('disabled', true);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ route('api.getHost') }}',
|
url: '{{ route('module-vcenter.getHost') }}',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
data: {
|
data: {
|
||||||
datacenter: datacenterId
|
datacenter: datacenterId
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<div class="row form-group">
|
|
||||||
<label for="order_product_type" class="col-md-4">Product Type
|
|
||||||
(*)</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<select class="form-control order_product_type"
|
|
||||||
data-append="product[0][product_id]"
|
|
||||||
name="product[0][type]">
|
|
||||||
<option value="0">-----------</option>
|
|
||||||
@if(count($types) > 0)
|
|
||||||
@foreach($types as $item)
|
|
||||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{{--Last name--}}
|
|
||||||
<div class="form-group row">
|
|
||||||
<label class="col-md-4" for="lastname">Product Type</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<select class="custom-select" name="type_id">
|
|
||||||
@if(count($types) > 0)
|
|
||||||
@foreach($types->all() as $item)
|
|
||||||
<option value="{{ $item->id }}" @selected(old('type_id') === $item->id) >{{ $item->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -35,6 +35,8 @@ use App\Http\Controllers\admin\TaskController;
|
|||||||
use App\Http\Controllers\admin\TemplateController;
|
use App\Http\Controllers\admin\TemplateController;
|
||||||
use App\Http\Controllers\admin\UserController;
|
use App\Http\Controllers\admin\UserController;
|
||||||
use App\Http\Controllers\admin\vm\VirtualMachineController;
|
use App\Http\Controllers\admin\vm\VirtualMachineController;
|
||||||
|
use App\Http\Controllers\Api\VpsActionController;
|
||||||
|
use App\Http\Controllers\rest\ModuleController;
|
||||||
use Illuminate\Support\Facades\Cookie;
|
use Illuminate\Support\Facades\Cookie;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
@@ -448,5 +450,21 @@ Route::prefix('')->group(function () {
|
|||||||
Route::put('edit-menu/{id}', 'update')->name('menu.update');
|
Route::put('edit-menu/{id}', 'update')->name('menu.update');
|
||||||
Route::delete('remove-menu/{id}', 'destroy')->name('menu.destroy');
|
Route::delete('remove-menu/{id}', 'destroy')->name('menu.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Route::controller(ModuleController::class)->as('module-vcenter.')->group(function () {
|
||||||
|
Route::get('get-list-vcenter', 'getVCenter')->name('getVCenter');
|
||||||
|
Route::get('get-list-datacenter', 'getDatacenter')->name('getDatacenter');
|
||||||
|
Route::get('get-list-host', 'getHost')->name('getHost');
|
||||||
|
Route::get('get-list-datastore', 'getDatastore')->name('getDatastore');
|
||||||
|
Route::get('get-list-network', 'getNetwork')->name('getNetwork');
|
||||||
|
Route::get('get-list-ipaddress', 'getIpAddress')->name('getIPAddress');
|
||||||
|
Route::get('get-list-version-os', 'getOsServerVersion')->name('getVersion');
|
||||||
|
Route::get('get-list-os-group', 'getOsGroup')->name('getOsGroup');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::controller(VpsActionController::class)->group(function () {
|
||||||
|
Route::post('rebuild-vps', 'rebuildVps')->name('rebuildVps');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
-1477
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user