Compare commits
1 commit
develop
...
template-s
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e19a514a0b |
10 changed files with 64 additions and 23 deletions
|
@ -49,6 +49,7 @@ class Node extends Model
|
|||
'memory_overallocate' => 'required|integer',
|
||||
'disk' => 'required|integer',
|
||||
'disk_overallocate' => 'required|integer',
|
||||
'template_storage' => ['required', 'string', 'max:191', 'regex:/^\S*$/u'],
|
||||
'vm_storage' => ['required', 'string', 'max:191', 'regex:/^\S*$/u'],
|
||||
'backup_storage' => ['required', 'string', 'max:191', 'regex:/^\S*$/u'],
|
||||
'iso_storage' => ['required', 'string', 'max:191', 'regex:/^\S*$/u'],
|
||||
|
|
|
@ -15,7 +15,7 @@ class ProxmoxServerRepository extends ProxmoxRepository
|
|||
/**
|
||||
* @throws ProxmoxConnectionException
|
||||
*/
|
||||
public function getState()
|
||||
public function getState(): ServerStateData
|
||||
{
|
||||
Assert::isInstanceOf($this->server, Server::class);
|
||||
|
||||
|
|
|
@ -23,14 +23,12 @@ class NodeTransformer extends TransformerAbstract
|
|||
'disk' => $node->disk,
|
||||
'disk_overallocate' => $node->disk_overallocate,
|
||||
'disk_allocated' => $node->disk_allocated,
|
||||
'template_storage' => $node->template_storage,
|
||||
'vm_storage' => $node->vm_storage,
|
||||
'backup_storage' => $node->backup_storage,
|
||||
'iso_storage' => $node->iso_storage,
|
||||
'network' => $node->network,
|
||||
'coterm_enabled' => $node->coterm_enabled,
|
||||
'coterm_tls_enabled' => $node->coterm_tls_enabled,
|
||||
'coterm_fqdn' => $node->coterm_fqdn,
|
||||
'coterm_port' => $node->coterm_port,
|
||||
'coterm_id' => $node->coterm_id,
|
||||
'servers_count' => (int)$node->servers_count,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ class NodeFactory extends Factory
|
|||
'memory_overallocate' => 0,
|
||||
'disk' => 137438953472, // 128 gb
|
||||
'disk_overallocate' => 0,
|
||||
'template_storage' => 'local',
|
||||
'vm_storage' => 'local',
|
||||
'backup_storage' => 'local',
|
||||
'iso_storage' => 'local',
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('nodes', function (Blueprint $table) {
|
||||
$table->string('template_storage')->after('disk_overallocate');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE nodes SET template_storage = vm_storage");
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('nodes', function (Blueprint $table) {
|
||||
$table->dropColumn('template_storage');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -14,6 +14,7 @@ interface CreateNodeParameters {
|
|||
memoryOverallocate: number
|
||||
disk: number
|
||||
diskOverallocate: number
|
||||
templateStorage: string
|
||||
vmStorage: string
|
||||
backupStorage: string
|
||||
isoStorage: string
|
||||
|
@ -36,6 +37,7 @@ const createNode = async (data: CreateNodeParameters): Promise<Node> => {
|
|||
memory_overallocate: data.memoryOverallocate,
|
||||
disk: data.disk,
|
||||
disk_overallocate: data.diskOverallocate,
|
||||
template_storage: data.templateStorage,
|
||||
vm_storage: data.vmStorage,
|
||||
backup_storage: data.backupStorage,
|
||||
iso_storage: data.isoStorage,
|
||||
|
|
|
@ -14,14 +14,12 @@ export interface Node {
|
|||
disk: number
|
||||
diskOverallocate: number
|
||||
diskAllocated: number
|
||||
templateStorage: string
|
||||
vmStorage: string
|
||||
backupStorage: string
|
||||
isoStorage: string
|
||||
network: string
|
||||
cotermEnabled: boolean
|
||||
cotermTlsEnabled: boolean
|
||||
cotermFqdn: string | null
|
||||
cotermPort: number
|
||||
cotermId: number
|
||||
serversCount: number
|
||||
}
|
||||
|
||||
|
@ -39,14 +37,12 @@ export const rawDataToNode = (data: any): Node => ({
|
|||
disk: data.disk,
|
||||
diskOverallocate: data.disk_overallocate,
|
||||
diskAllocated: data.disk_allocated,
|
||||
templateStorage: data.template_storage,
|
||||
vmStorage: data.vm_storage,
|
||||
backupStorage: data.backup_storage,
|
||||
isoStorage: data.iso_storage,
|
||||
network: data.network,
|
||||
cotermEnabled: data.coterm_enabled,
|
||||
cotermTlsEnabled: data.coterm_tls_enabled,
|
||||
cotermFqdn: data.coterm_fqdn,
|
||||
cotermPort: data.coterm_port,
|
||||
cotermId: data.coterm_id,
|
||||
serversCount: data.servers_count,
|
||||
})
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ interface UpdateNodeParameters {
|
|||
memoryOverallocate: number
|
||||
disk: number
|
||||
diskOverallocate: number
|
||||
templateStorage: string
|
||||
vmStorage: string
|
||||
backupStorage: string
|
||||
isoStorage: string
|
||||
|
@ -36,6 +37,7 @@ const updateNode = async (nodeId: number, payload: UpdateNodeParameters) => {
|
|||
memory_overallocate: payload.memoryOverallocate,
|
||||
disk: payload.disk,
|
||||
disk_overallocate: payload.diskOverallocate,
|
||||
template_storage: payload.templateStorage,
|
||||
vm_storage: payload.vmStorage,
|
||||
backup_storage: payload.backupStorage,
|
||||
iso_storage: payload.isoStorage,
|
||||
|
|
|
@ -43,6 +43,7 @@ const CreateNodeModal = ({ open, onClose }: Props) => {
|
|||
memoryOverallocate: z.preprocess(Number, z.number().int().min(0)),
|
||||
disk: z.preprocess(Number, z.number().int().min(0)),
|
||||
diskOverallocate: z.preprocess(Number, z.number().int().min(0)),
|
||||
templateStorage: z.string().min(1).max(191),
|
||||
vmStorage: z.string().min(1).max(191),
|
||||
backupStorage: z.string().min(1).max(191),
|
||||
isoStorage: z.string().min(1).max(191),
|
||||
|
@ -64,6 +65,7 @@ const CreateNodeModal = ({ open, onClose }: Props) => {
|
|||
memoryOverallocate: '0',
|
||||
disk: '0',
|
||||
diskOverallocate: '0',
|
||||
templateStorage: '',
|
||||
vmStorage: '',
|
||||
backupStorage: '',
|
||||
isoStorage: '',
|
||||
|
@ -163,6 +165,11 @@ const CreateNodeModal = ({ open, onClose }: Props) => {
|
|||
/>
|
||||
</div>
|
||||
<div className='grid gap-3 grid-cols-3'>
|
||||
<TextInputForm
|
||||
name='templateStorage'
|
||||
label={'Template Storage'}
|
||||
placeholder='local'
|
||||
/>
|
||||
<TextInputForm
|
||||
name='vmStorage'
|
||||
label={t('vm_storage')}
|
||||
|
@ -173,17 +180,19 @@ const CreateNodeModal = ({ open, onClose }: Props) => {
|
|||
label={t('backup_storage')}
|
||||
placeholder='local'
|
||||
/>
|
||||
</div>
|
||||
<div className={'grid gap-3 grid-cols-2'}>
|
||||
<TextInputForm
|
||||
name='isoStorage'
|
||||
label={t('iso_storage')}
|
||||
placeholder='local'
|
||||
/>
|
||||
<TextInputForm
|
||||
name='network'
|
||||
label={tStrings('network')}
|
||||
placeholder='vmbr0'
|
||||
/>
|
||||
</div>
|
||||
<TextInputForm
|
||||
name='network'
|
||||
label={tStrings('network')}
|
||||
placeholder='vmbr0'
|
||||
/>
|
||||
</Modal.Body>
|
||||
<Modal.Actions>
|
||||
<Modal.Action type='button' onClick={handleClose}>
|
||||
|
|
|
@ -39,6 +39,7 @@ const NodeInformationCard = () => {
|
|||
memoryOverallocate: z.preprocess(Number, z.number().int().min(0)),
|
||||
disk: z.preprocess(Number, z.number().int().min(0)),
|
||||
diskOverallocate: z.preprocess(Number, z.number().int().min(0)),
|
||||
templateStorage: z.string().min(1).max(191),
|
||||
vmStorage: z.string().min(1).max(191),
|
||||
backupStorage: z.string().min(1).max(191),
|
||||
isoStorage: z.string().min(1).max(191),
|
||||
|
@ -60,6 +61,7 @@ const NodeInformationCard = () => {
|
|||
memoryOverallocate: node.memoryOverallocate,
|
||||
disk: node.disk / 1048576,
|
||||
diskOverallocate: node.diskOverallocate,
|
||||
templateStorage: node.templateStorage,
|
||||
vmStorage: node.vmStorage,
|
||||
backupStorage: node.backupStorage,
|
||||
isoStorage: node.isoStorage,
|
||||
|
@ -177,6 +179,11 @@ const NodeInformationCard = () => {
|
|||
/>
|
||||
</div>
|
||||
<div className='grid gap-3 grid-cols-3'>
|
||||
<TextInputForm
|
||||
name='templateStorage'
|
||||
label={'Template Storage'}
|
||||
placeholder='local'
|
||||
/>
|
||||
<TextInputForm
|
||||
name='vmStorage'
|
||||
label={tIndex('vm_storage')}
|
||||
|
@ -187,17 +194,19 @@ const NodeInformationCard = () => {
|
|||
label={tIndex('backup_storage')}
|
||||
placeholder='local'
|
||||
/>
|
||||
</div>
|
||||
<div className='grid gap-3 grid-cols-2'>
|
||||
<TextInputForm
|
||||
name='isoStorage'
|
||||
label={tIndex('iso_storage')}
|
||||
placeholder='local'
|
||||
/>
|
||||
<TextInputForm
|
||||
name='network'
|
||||
label={tIndex('network')}
|
||||
placeholder='local'
|
||||
/>
|
||||
</div>
|
||||
<TextInputForm
|
||||
name='network'
|
||||
label={tStrings('network')}
|
||||
placeholder='vmbr0'
|
||||
/>
|
||||
</div>
|
||||
</FormCard.Body>
|
||||
<FormCard.Footer>
|
||||
|
|
Loading…
Add table
Reference in a new issue