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

WIP: BCDRequestForm

parent 5543b1e4
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,9 @@
<b-form-select-option :value="null" disabled>{{ $t('system.please_select') }}</b-form-select-option>
</template>
</b-form-select>
<b-form-invalid-feedback :state="load_balancer_firewall_state">{{ $t('components.bcd_request_form.level_2_warning') }}</b-form-invalid-feedback>
<b-form-invalid-feedback :state="load_balancer_firewall_state">
{{ $t('components.bcd_request_form.level_2_warning') }}
</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.protection_requirements_explanation')">
<b-form-textarea :disabled="protection_requirements_select !== 10 || loading_edit_action"
......@@ -70,11 +72,13 @@
v-model="types_of_systems_other_explanation_text"/>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.load_balancing')">
<b-form-checkbox :disabled="types_of_systems_select !== 2 || loading_edit_action"
:state="load_balancer_firewall_state"
v-model="load_balancing_value">{{ $t('components.bcd_request_form.load_balancing_text') }}
</b-form-checkbox>
<b-form-invalid-feedback :state="load_balancer_firewall_state">{{ $t('components.bcd_request_form.level_2_warning') }}</b-form-invalid-feedback>
<b-form-checkbox :disabled="types_of_systems_select !== 2 || loading_edit_action"
:state="load_balancer_firewall_state"
v-model="load_balancing_value">{{ $t('components.bcd_request_form.load_balancing_text') }}
</b-form-checkbox>
<b-form-invalid-feedback :state="load_balancer_firewall_state">
{{ $t('components.bcd_request_form.level_2_warning') }}
</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.name_of_bcd')"
:description="$t('components.bcd_request_form.name_of_bcd_description')">
......@@ -123,7 +127,8 @@
:disabled="!access_from_internet_value || types_of_systems_select === 2 || loading_edit_action"/>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.ip_address_version')">
<b-form-select v-model="types_of_subnets_select" :options="translated_types_of_subnets">
<b-form-select v-model="types_of_subnets_select" :options="translated_types_of_subnets"
:disabled="!(bcd_name && bcd_name.length > 0) || loading_edit_action">
<template #first>
<b-form-select-option :value="null" disabled>{{ $t('system.please_select') }}</b-form-select-option>
</template>
......@@ -140,7 +145,8 @@
</b-row>
</b-alert>
<b-form-group :label="$t('components.bcd_request_form.ipv4_subnet_size')">
<b-form-select v-model="subnet_size_select" :options="translated_subnet_sizes">
<b-form-select v-model="subnet_size_select" :options="translated_subnet_sizes"
:disabled="!(types_of_subnets_select === 2) || loading_edit_action">
<template #first>
<b-form-select-option :value="null" disabled>{{ $t('system.please_select') }}</b-form-select-option>
</template>
......@@ -156,17 +162,25 @@
</b-col>
</b-row>
</b-alert>
<b-form-group :label="$t('components.bcd_request_form.ipv4_subnet_size_explanation')">
<b-form-textarea/>
<b-form-group :label="$t('components.bcd_request_form.ipv4_subnet_size_explanation')"
:disabled="subnet_size_select !== 24">
<b-form-textarea :placeholder="$t('components.bcd_request_form.placeholder_text')"/>
</b-form-group>
<b-form-group :label="$t('system.dhcp')" :description="$t('components.bcd_request_form.dhcp_wish_note')">
<b-form-checkbox>{{ $t('components.bcd_request_form.dhcp_wish') }}</b-form-checkbox>
<b-form-checkbox v-model="dhcp_wish_value" :disabled="!types_of_subnets_select || loading_edit_action">
{{ $t('components.bcd_request_form.dhcp_wish') }}
</b-form-checkbox>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.dhcp_own')">
<b-form-checkbox>{{ $t('components.bcd_request_form.dhcp_own_question') }}</b-form-checkbox>
<b-form-checkbox v-model="dhcp_own_server_value" :disabled="!dhcp_wish_value || loading_edit_action">
{{ $t('components.bcd_request_form.dhcp_own_question') }}
</b-form-checkbox>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.dhcp_pool')">
<b-form-checkbox>{{ $t('components.bcd_request_form.dhcp_pool_wish') }}</b-form-checkbox>
<b-form-checkbox v-model="dhcp_pool_wish_value"
:disabled="dhcp_own_server_value || !dhcp_wish_value || loading_edit_action">
{{ $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">
......@@ -196,7 +210,7 @@
</a></b-form-checkbox>
</b-form-group>
<b-form-group :label="$t('components.bcd_request_form.additional_comments')">
<b-form-textarea/>
<b-form-textarea :placeholder="$t('components.bcd_request_form.placeholder_text')"/>
</b-form-group>
</b-form>
</b-overlay>
......@@ -206,6 +220,7 @@
<script>
import Typeahead from '@/components/Typeahead.vue'
import OUService from '@/api-services/ou.service'
import ipaddress from '@/util/ipaddress'
export default {
name: 'BCDRequestForm',
......@@ -226,13 +241,10 @@ export default {
access_to_internet_value: null,
access_from_internet_value: null,
access_from_internet_explanation_value: null,
dhcp_pool_wish_value: null,
dhcp_pool_size_select: null,
dhcp_pool_size_options: [
{ value: 2, translation_key: 'components.bcd_request_form.dhcp_pool_sizes.size_2' },
{ value: 3, translation_key: 'components.bcd_request_form.dhcp_pool_sizes.size_3' },
{ value: 4, translation_key: 'components.bcd_request_form.dhcp_pool_sizes.size_4' },
{ value: 5, translation_key: 'components.bcd_request_form.dhcp_pool_sizes.size_5' }
],
dhcp_own_server_value: null,
dhcp_wish_value: null,
protection_requirements_select: null,
protection_requirements_explanation_text: null,
protection_requirements_options: [
......@@ -268,7 +280,21 @@ export default {
},
computed: {
translated_dhcp_pool_size() {
return this.translateOptions(this.dhcp_pool_size_options)
// 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)
},
translated_protection_requirements() {
return this.translateOptions(this.protection_requirements_options)
......@@ -362,8 +388,13 @@ export default {
// Check if the item is an object to apply translations to
if (typeof copy_element === 'object') {
if (Object.hasOwn(copy_element, 'translation_key')) {
// Generate the text of the item dynamically
copy_element.text = this.$t(copy_element.translation_key)
if (Object.hasOwn(copy_element, 'translation_args')) {
// Generate the text of the item dynamically
copy_element.text = this.$t(copy_element.translation_key, copy_element.translation_args)
} else {
// Generate the text of the item dynamically
copy_element.text = this.$t(copy_element.translation_key)
}
}
}
}
......
......@@ -38,12 +38,7 @@
"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_sizes": {
"size_2": "2 Adressen",
"size_3": "3 Adressen",
"size_4": "4 Adressen",
"size_5": "5 Adressen"
},
"dhcp_pool_address_count": "{number} Adressen",
"dhcp_pool_wish": "Wird zusätzlich ein DHCP-Pool gewünscht?",
"dhcp_wish": "Wird DHCP gewünscht?",
"dhcp_wish_note": "Statische Zuordnungen sind möglich.",
......
......@@ -38,12 +38,7 @@
"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_sizes": {
"size_2": "2 addresses",
"size_3": "3 addresses",
"size_4": "4 addresses",
"size_5": "5 addresses"
},
"dhcp_pool_address_count": "{number} addresses",
"dhcp_pool_wish": "Is a DHCP pool also desired?",
"dhcp_wish": "Is DHCP wished?",
"dhcp_wish_note": "Static assignments are possible.",
......
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