Commit c9530dd6 authored by janis.streib's avatar janis.streib 🦉
Browse files

UPD: refactore address block element

parent 2f0fd643
Pipeline #129913 passed with stages
in 4 minutes and 37 seconds
<template>
<b-tr v-if="block.type == 'free'"
variant="success"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="create_item_func('A', block.first)" variant="success"><span
v-if="block.space > 1">{{ block.space }}</span><span v-else>Eine</span> freie
Adresse<span v-if="block.space > 1">n</span>
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
<b-tr :key="'block_lower_' + item.data + '_' + j" v-else variant="warning"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="create_item_func('A', block.first)" variant="warning"><span
v-if="block.space > 1">{{ block.space }}</span><span v-else>Eine</span> reservierte
Adresse<span v-if="block.space > 1">n</span>
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
</template>
<script>
export default {
name: 'BCDFreeAddressBlock',
props: {
block: {
required: true
},
item: {
required: true
},
create_item_func: {
required: true
}
}
}
</script>
......@@ -260,28 +260,11 @@
v-for="(item, i) in filterSortPerType(record_type)">
<template
v-if="record_type === 'A' && sort_by[record_type] == 'data' && (!(record_type in filter) || filter[record_type] === '') && item.data in upperIfAsc(record_type) && (i-1 < 0 || filterSortPerType(record_type)[i-1].data !== item.data)">
<template v-for="(blk,j) in reverseIfDesc(record_type, upperIfAsc(record_type)[item.data].containing_blocks)">
<b-tr :key="'block_upper_' + item.data + '_' + j" v-if="blk.type == 'free'"
variant="success"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="createItem(record_type, blk.first)" variant="success">{{ blk.space }} freie
Adressen
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
<b-tr :key="'block_upper_' + item.data + '_' + j" v-else variant="warning"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="createItem(record_type, blk.first)" variant="warning">{{ blk.space }} reservierte
Adressen
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
<template
v-for="(blk,j) in reverseIfDesc(record_type, upperIfAsc(record_type)[item.data].containing_blocks)">
<BCDFreeAddressBlock :key="'block_upper_' + item.data + '_' + j"
:create_item_func="createItem" :block="blk"
:item="item"></BCDFreeAddressBlock>
</template>
</template>
<b-tr
......@@ -352,28 +335,11 @@
</b-tr>
<template
v-if="record_type === 'A' && (!(record_type in filter) || filter[record_type] === '') && sort_by[record_type] == 'data' && (records[record_type].slice(per_page*(current_page[record_type]-1), per_page*current_page[record_type]).length - 1) == i && item.data in lowerIfAsc(record_type)">
<template v-for="(blk,j) in reverseIfDesc(record_type, lowerIfAsc(record_type)[item.data].containing_blocks)">
<b-tr :key="'block_lower_' + item.data + '_' + j" v-if="blk.type == 'free'"
variant="success"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="createItem(record_type, blk.first)" variant="success">{{ blk.space }} freie
Adressen
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
<b-tr :key="'block_lower_' + item.data + '_' + j" v-else variant="warning"
style="padding: 0 !important; height: 1rem;">
<b-td colspan="3" style="padding: 0 0 5px 0"></b-td>
<b-td style="padding: 2px 0 5px 0.75rem">
<b-badge href="#" @click="createItem(record_type, blk.first)" variant="warning">{{ blk.space }} reservierte
Adressen
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
<template
v-for="(blk,j) in reverseIfDesc(record_type, lowerIfAsc(record_type)[item.data].containing_blocks)">
<BCDFreeAddressBlock :key="'block_lower_' + item.data + '_' + j"
:create_item_func="createItem" :block="blk"
:item="item"></BCDFreeAddressBlock>
</template>
</template>
</template>
......@@ -417,6 +383,7 @@ import RangeService from '@/api-services/dns_bcd.service'
import RecordService from '@/api-services.gen/dns.record'
import Loading from '../../components/Loading'
import DBEditor from '../../components/DBEditor'
import BCDFreeAddressBlock from '../../components/BCDFreeAddressBlock'
import transactionutil from '@/util/transactionutil'
import apiutil from '@/util/apiutil'
import EVLogViewer from '@/components/EVLogViewer'
......@@ -425,7 +392,7 @@ import ipaddress from '@/util/ipaddress'
export default {
name: 'BCDRecords',
components: {FilterInput, EVLogViewer, Loading, DBEditor},
components: {FilterInput, EVLogViewer, Loading, DBEditor, BCDFreeAddressBlock},
data() {
return {
sort_by: {},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment