Added admin configuration
This is not working just yet but the fields have been added to the admin control area.
This commit is contained in:
parent
da30977364
commit
d80660f047
5 changed files with 85 additions and 25 deletions
|
@ -16,6 +16,7 @@ import GreyRowBox from '@/components/elements/GreyRowBox';
|
|||
|
||||
const NetworkContainer = () => {
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const allocationLimit = ServerContext.useStoreState(state => state.server.data!.featureLimits.allocations);
|
||||
const allocations = useDeepMemoize(ServerContext.useStoreState(state => state.server.data!.allocations));
|
||||
const [ addingAllocation, setAddingAllocation ] = useState(false);
|
||||
|
||||
|
@ -48,14 +49,16 @@ const NetworkContainer = () => {
|
|||
clearFlashes('server:network');
|
||||
setAddingAllocation(true);
|
||||
|
||||
const initial = data;
|
||||
|
||||
newServerAllocation(uuid)
|
||||
.then(allocation => {
|
||||
mutate(data => ({ ...data, items: data.concat(allocation) }), false);
|
||||
mutate(data?.concat(allocation), false);
|
||||
setAddingAllocation(false);
|
||||
})
|
||||
.catch(error => {
|
||||
clearAndAddHttpError({ key: 'server:network', error });
|
||||
mutate(data, false);
|
||||
mutate(initial, false);
|
||||
setAddingAllocation(false);
|
||||
});
|
||||
};
|
||||
|
@ -78,23 +81,29 @@ const NetworkContainer = () => {
|
|||
/>
|
||||
))
|
||||
}
|
||||
<GreyRowBox
|
||||
$hoverable={false}
|
||||
css={tw`mt-2 overflow-x-auto flex items-center justify-center`}
|
||||
>
|
||||
{addingAllocation ?
|
||||
<Spinner size={'base'} centered/>
|
||||
:
|
||||
<Button
|
||||
color={'primary'}
|
||||
isSecondary
|
||||
onClick={() => getNewAllocation() }
|
||||
css={tw`my-2`}
|
||||
>
|
||||
Add New Allocation
|
||||
</Button>
|
||||
}
|
||||
</GreyRowBox>
|
||||
{allocationLimit > data!.length ?
|
||||
<GreyRowBox
|
||||
$hoverable={false}
|
||||
css={tw`mt-2 overflow-x-auto flex items-center justify-center`}
|
||||
>
|
||||
{addingAllocation ?
|
||||
<Spinner size={'base'} centered/>
|
||||
:
|
||||
<Button
|
||||
color={'primary'}
|
||||
isSecondary
|
||||
onClick={() => getNewAllocation()}
|
||||
css={tw`my-2`}
|
||||
>
|
||||
Add New Allocation
|
||||
</Button>
|
||||
}
|
||||
</GreyRowBox>
|
||||
:
|
||||
<p css={tw`mt-2 text-center text-sm text-neutral-400`}>
|
||||
You have reached the max number of allocations allowed for your server.
|
||||
</p>
|
||||
}
|
||||
</ServerContentBlock>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -105,6 +105,39 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Automatic Allocation Creation</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="control-label">Status</label>
|
||||
<div>
|
||||
<select class="form-control" name="allocation:enabled">
|
||||
<option value="true" @if(old('allocation:enabled', config('allocation.enabled')) == '1') selected @endif>Enabled</option>
|
||||
<option value="false">Disabled</option>
|
||||
</select>
|
||||
<p class="text-muted small">If enabled, the panel will attempt to auto create a new allocation in the range specified if there are no more allocations already created on the node.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="control-label">Starting Port</label>
|
||||
<div>
|
||||
<input type="number" required class="form-control" name="pterodactyl:allocation:start" value="{{ old('pterodactyl:allocation:start', config('pterodactyl.allocation.start')) }}">
|
||||
<p class="text-muted small">The starting port in the range that can be automatically allocated.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="control-label">Ending Port</label>
|
||||
<div>
|
||||
<input type="number" required class="form-control" name="pterodactyl:allocation:stop" value="{{ old('pterodactyl:allocation:stop', config('pterodactyl.allocation.stop')) }}">
|
||||
<p class="text-muted small">The ending port in the range that can be automatically allocated.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-footer">
|
||||
{{ csrf_field() }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue