Skip to content
Snippets Groups Projects
Commit 869808eb authored by Alexander Kaschta's avatar Alexander Kaschta :owl:
Browse files

UPD: Finish BCDRequestForm UI

parent cb2b67ab
No related branches found
No related tags found
No related merge requests found
......@@ -182,14 +182,18 @@
{{ $t('components.bcd_request_form.dhcp_pool_wish') }}
</b-form-checkbox>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.dhcp_pool_size')">
<b-form-select v-model="dhcp_pool_size_select" :options="translated_dhcp_pool_size">
<template #first>
<b-form-select-option :value="null" disabled>{{ $t('system.please_select') }}</b-form-select-option>
</template>
</b-form-select>
<b-form-group :label="$t('components.bcd_request_form.dhcp_pool_size')"
:disabled="!dhcp_pool_wish_value || loading_edit_action"
:description="$t('components.bcd_request_form.dhcp_pool_size_note')">
<b-form-input v-model="dhcp_pool_size_value" type="number" min="2" step="1"
:state="checkDHCPPoolSize"
:max="getSubnetSize(this.subnet_size_select ?? 29) - 5"/>
<b-form-invalid-feedback>
{{ $t('components.bcd_request_form.dhcp_pool_size_error') }}
</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.device_location')">
<b-form-group :label="$t('components.bcd_request_form.device_location')"
:disabled="!types_of_subnets_select || loading_edit_action">
<b-form-checkbox>{{ $t('components.bcd_request_form.device_locations.cs') }}</b-form-checkbox>
<b-form-checkbox>{{ $t('components.bcd_request_form.device_locations.cn') }}</b-form-checkbox>
<b-form-checkbox>{{ $t('components.bcd_request_form.device_locations.vm_cluster_unknown') }}</b-form-checkbox>
......@@ -199,7 +203,8 @@
<b-form-checkbox>{{ $t('components.bcd_request_form.device_locations.scc_server_room_cn') }}</b-form-checkbox>
<b-form-checkbox>{{ $t('components.bcd_request_form.device_locations.vpn_wifi_to_vlan') }}</b-form-checkbox>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.realized_services')">
<b-form-group :label="$t('components.bcd_request_form.realized_services')"
:disabled="!types_of_subnets_select || loading_edit_action">
<b-form-checkbox>{{ $t('components.bcd_request_form.realizable_services.vpn2vlan') }} <a
href="https://www.scc.kit.edu/ts-vpn2vlan" target="_blank">
<netvs-icon icon="external_link"></netvs-icon>
......@@ -214,6 +219,16 @@
</b-form-group>
</b-form>
</b-overlay>
<template #modal-footer="{ ok, cancel }">
<b-button variant="secondary" @click="cancel()">
{{ $t('components.patch_request_form.cancel') }}
</b-button>
<b-button variant="primary" :disabled="!types_of_subnets_select" @click="ok()">
{{ $t('components.patch_request_form.send') }}
<b-spinner small v-show="sending"/>
<netvs-icon v-show="status_icon !== null" :icon="status_icon"></netvs-icon>
</b-button>
</template>
</b-modal>
</template>
......@@ -242,7 +257,7 @@ export default {
access_from_internet_value: null,
access_from_internet_explanation_value: null,
dhcp_pool_wish_value: null,
dhcp_pool_size_select: null,
dhcp_pool_size_value: '2',
dhcp_own_server_value: null,
dhcp_wish_value: null,
protection_requirements_select: null,
......@@ -275,26 +290,14 @@ export default {
{ value: 26, translation_key: 'components.bcd_request_form.ipv4_subnet_sizes.size_26' },
{ value: 25, translation_key: 'components.bcd_request_form.ipv4_subnet_sizes.size_25' },
{ value: 24, translation_key: 'components.bcd_request_form.ipv4_subnet_sizes.size_24' }
]
],
sending: false,
status_icon: null
}
},
computed: {
translated_dhcp_pool_size() {
// Calculate the number of ipv4 addresses
const subnet_size = ipaddress.ipv4_subnet_size(this.subnet_size_select ?? 29)
const dhcp_pool_size_options = []
for (let dhcp_pool_size = 2; dhcp_pool_size <= subnet_size - 5; dhcp_pool_size++) {
// Generate the entries dynamically
dhcp_pool_size_options.push({
value: dhcp_pool_size,
translation_key: 'components.bcd_request_form.dhcp_pool_address_count',
translation_args: { number: dhcp_pool_size }
})
}
return this.translateOptions(dhcp_pool_size_options)
checkDHCPPoolSize() {
return parseInt(this.dhcp_pool_size_value) >= 2 && parseInt(this.dhcp_pool_size_value) <= (this.getSubnetSize(this.subnet_size_select ?? 29) - 5)
},
translated_protection_requirements() {
return this.translateOptions(this.protection_requirements_options)
......@@ -316,6 +319,9 @@ export default {
}
},
methods: {
getSubnetSize(value) {
return ipaddress.ipv4_subnet_size(value)
},
async update() {
await this.updateOEs()
},
......
......@@ -37,7 +37,9 @@
"dhcp_own": "Eigener DHCP-Server",
"dhcp_own_question": "Wird ein eigener DHCP-Server betrieben?",
"dhcp_pool": "DHCP-Pool",
"dhcp_pool_size": "Wie groß soll der DHCP-Pool sein?",
"dhcp_pool_size": "Wie viele Adressen soll der DHCP-Pool haben?",
"dhcp_pool_size_note": "Der DHCP-Pool kann zwischen zwei und der Subnetzgröße minus fünf Adressen groß sein.",
"dhcp_pool_size_error": "Der angegebene Wert liegt nicht außerhalb der erlaubten Grenzen.",
"dhcp_pool_address_count": "{number} Adressen",
"dhcp_pool_wish": "Wird zusätzlich ein DHCP-Pool gewünscht?",
"dhcp_wish": "Wird DHCP gewünscht?",
......
......@@ -37,7 +37,9 @@
"dhcp_own": "Own DHCP Server",
"dhcp_own_question": "Do you operate your own DHCP server?",
"dhcp_pool": "DHCP-Pool",
"dhcp_pool_size": "How large should the DHCP pool be?",
"dhcp_pool_size": "How many addresses should the DHCP pool contain?",
"dhcp_pool_size_note": "The DHCP pool can have between two and the subnet size minus five addresses.",
"dhcp_pool_size_error": "The given value is not within the specified boundaries.",
"dhcp_pool_address_count": "{number} addresses",
"dhcp_pool_wish": "Is a DHCP pool also desired?",
"dhcp_wish": "Is DHCP wished?",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment