Commit 02066bc8 authored by Janis Streib's avatar Janis Streib 🦉

whoups.. this feature wasn't supposed to be deployed (yet)

parent b5a660e9
Pipeline #119390 passed with stages
in 8 minutes and 37 seconds
...@@ -216,129 +216,80 @@ ...@@ -216,129 +216,80 @@
<b-card-body body-class="p-0"> <b-card-body body-class="p-0">
<b-collapse :id="'records-'+record_type+'-collapse'" v-model="collapse_states[2+index]"> <b-collapse :id="'records-'+record_type+'-collapse'" v-model="collapse_states[2+index]">
<FilterInput v-model="filter[record_type]"></FilterInput> <FilterInput v-model="filter[record_type]"></FilterInput>
<b-pagination <b-pagination v-if="(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page" :per-page="per_page"
v-if="(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page" align="center" v-model="current_page[record_type]"
:per-page="per_page" :total-rows="records[record_type].length"></b-pagination>
align="center" v-model="current_page[record_type]" <b-table responsive :filter="filter[record_type]" :items="records[record_type]"
:total-rows="records[record_type].length"></b-pagination> :per-page="(!(record_type in filter) || filter[record_type] === '') ? per_page : null"
:current-page="current_page[record_type]"
<b-table-simple responsive class="table b-table"> :fields="record_list_fields">
<b-thead> <template v-slot:cell(fqdn)="data">
<b-th aria-sort="ascending">FQDN</b-th> {{ data.item.fqdn }}
<b-th>Weitere Info</b-th> <b-badge variant="secondary" v-if="data.item.fqdn_type === 'domain'">Domain</b-badge>
<b-th>FQDN-Beschriebung</b-th> <b-badge v-if="data.item.host_is_nws" variant="primary"
<b-th>Record-Daten</b-th> :href="$sysinfo.host_oper_mode.is_prod?`https://www-net.scc.kit.edu/~netadmin/natvs/user/wrapper.cgi/${range.name}/0/${range.name}/0/nat_index.html`:`https://www-net-${$sysinfo.host_oper_mode.mode}.scc.kit.edu/~netadmin/natvs/user/wrapper.cgi/${range.name}/0/${range.name}/0/nat_index.html`"
<b-th>TTL</b-th> title="Host besitzt einen NATVS-Eintrag">NATVS
<b-th> </b-badge>
<b-button block variant="outline-success" </template>
:id="'button-create-record-' + record_type" @click="createItem(record_type)" <template v-slot:cell(info)="data">
v-if="user_possible_record_types.includes(record_type)"> <b-dropdown variant="light">
<font-awesome-icon :icon="['fas', 'plus']"/> <template v-slot:button-content>
</b-button> <font-awesome-icon :icon="['fas', 'info-circle']"></font-awesome-icon>
<b-tooltip :target="'button-create-record-' + record_type" triggers="hover"
variant="success" placement="left">
Neuen Record anlegen
</b-tooltip>
</b-th>
</b-thead>
<b-tbody>
<template
v-for="(item, i) in records[record_type].slice(per_page*(current_page[record_type]-1), per_page*current_page[record_type])">
<template
v-if="record_type === 'A' && item.data in asc_v4_blocklist_by_upper && (i-1 < 0 || records[record_type][i-1].data !== item.data)">
<template v-for="(blk,j) in asc_v4_blocklist_by_upper[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 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 variant="warning">{{ blk.space }} reservierte
Adressen
</b-badge>
</b-td>
<b-td colspan="2" style="padding: 0"></b-td>
</b-tr>
</template>
</template> </template>
<b-tr <b-dropdown-item :to="'/dnsvs/fqdns/' + data.item.fqdn + '/records'">Records zu FQDN
:key="item.fqdn + '_' + item.data"> </b-dropdown-item>
<b-td> <b-dropdown-item :to="'/dnsvs/fqdns/' + data.item.fqdn + '/references'">Referenzen auf FQDN
{{ item.fqdn }} </b-dropdown-item>
<b-badge variant="secondary" v-if="item.fqdn_type === 'domain'">Domain</b-badge> </b-dropdown>
<b-badge v-if="item.host_is_nws" variant="primary" </template>
:href="$sysinfo.host_oper_mode.is_prod?`https://www-net.scc.kit.edu/~netadmin/natvs/user/wrapper.cgi/${range.name}/0/${range.name}/0/nat_index.html`:`https://www-net-${$sysinfo.host_oper_mode.mode}.scc.kit.edu/~netadmin/natvs/user/wrapper.cgi/${range.name}/0/${range.name}/0/nat_index.html`" <template v-slot:cell(data)="data">
title="Host besitzt einen NATVS-Eintrag">NATVS <code>{{ data.value }} </code>
</b-badge> <b-badge v-if="!data.item.target_is_singleton" variant="warning">RR-Set</b-badge>
</b-td> <b-badge v-if="data.item.target_is_reverse_unique" title="Rückwärts-eindeutig">PTR</b-badge>
<b-td> </template>
<b-dropdown variant="light"> <template v-slot:cell(actions)="data">
<template v-slot:button-content> <b-button-group>
<font-awesome-icon :icon="['fas', 'info-circle']"></font-awesome-icon> <b-dropdown :id="'button-edit-record-' + data.item.fqdn + '_' + record_type + '_' + data.item.data" @click="editItem(data.item)" split variant="outline-primary">
</template> <template #button-content>
<b-dropdown-item :to="'/dnsvs/fqdns/' + item.fqdn + '/records'">Records zu FQDN <font-awesome-icon :icon="['far', 'edit']"></font-awesome-icon>
</b-dropdown-item> </template>
<b-dropdown-item :to="'/dnsvs/fqdns/' + item.fqdn + '/references'">Referenzen auf FQDN <b-dropdown-item @click="editFQDN(fqdns[data.item.fqdn])">FQDN Bearbeiten</b-dropdown-item>
</b-dropdown-item> </b-dropdown>
</b-dropdown> <b-dropdown @click="deleteItem(data.item, false)" split variant="outline-danger">
</b-td> <template #button-content>
<b-td> <font-awesome-icon :icon="['far', 'trash-alt']"></font-awesome-icon>
{{ item.fqdn_description }} </template>
</b-td> <b-dropdown-item @click="deleteItem(data.item, true)">Falls FQDN gelöscht wird: Alle den
<b-td> FQDN referenzierende Records
<code>{{ item.data }} </code> mitlöschen
<b-badge v-if="!item.target_is_singleton" variant="warning">RR-Set</b-badge> </b-dropdown-item>
<b-badge v-if="item.target_is_reverse_unique" title="Rückwärts-eindeutig">PTR</b-badge> </b-dropdown>
</b-td> </b-button-group>
<b-td> <b-tooltip :target="'button-edit-record-' + data.item.fqdn + '_' + record_type + '_' + data.item.data" triggers="hover"
<template v-if="item.ttl != null">{{ item.ttl }}s</template> variant="primary" placement="left">
<span v-else title="Geerbt von Zone" Record bearbeiten
class="text-muted">{{ item.ttl_zone_default }}s</span> </b-tooltip>
<span v-if="item.ttl_reset_days" </template>
class="text-danger"><br/>Reset in {{ item.ttl_reset_days }} Tagen</span> <template v-slot:cell(ttl)="data">
</b-td> <template v-if="data.item.ttl != null">{{ data.item.ttl }}s</template>
<b-td> <span v-else title="Geerbt von Zone"
<b-button-group> class="text-muted">{{ data.item.ttl_zone_default }}s</span>
<b-dropdown <span v-if="data.item.ttl_reset_days"
:id="'button-edit-record-' + item.fqdn + '_' + record_type + '_' + item.data" class="text-danger"><br/>Reset in {{ data.item.ttl_reset_days }} Tagen</span>
@click="editItem(item)" split variant="outline-primary"> </template>
<template #button-content> <template v-slot:head(actions)>
<font-awesome-icon :icon="['far', 'edit']"></font-awesome-icon> <b-button block variant="outline-success"
</template> :id="'button-create-record-' + record_type" @click="createItem(record_type)"
<b-dropdown-item @click="editFQDN(fqdns[item.fqdn])">FQDN Bearbeiten</b-dropdown-item> v-if="user_possible_record_types.includes(record_type)">
</b-dropdown> <font-awesome-icon :icon="['fas', 'plus']"/>
<b-dropdown @click="deleteItem(item, false)" split variant="outline-danger"> </b-button>
<template #button-content> <b-tooltip :target="'button-create-record-' + record_type" triggers="hover"
<font-awesome-icon :icon="['far', 'trash-alt']"></font-awesome-icon> variant="success" placement="left">
</template> Neuen Record anlegen
<b-dropdown-item @click="deleteItem(item, true)">Falls FQDN gelöscht wird: Alle den </b-tooltip>
FQDN referenzierende Records </template>
mitlöschen </b-table>
</b-dropdown-item> <b-pagination v-if="(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page"
</b-dropdown>
</b-button-group>
<b-tooltip
:target="'button-edit-record-' + item.fqdn + '_' + record_type + '_' + item.data"
triggers="hover"
variant="primary" placement="left">
Record bearbeiten
</b-tooltip>
</b-td>
</b-tr>
</template>
</b-tbody>
</b-table-simple>
<b-pagination
v-if="(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page"
:per-page="per_page" :per-page="per_page"
align="center" v-model="current_page[record_type]" align="center" v-model="current_page[record_type]"
:total-rows="records[record_type].length"></b-pagination> :total-rows="records[record_type].length"></b-pagination>
...@@ -379,16 +330,12 @@ import transactionutil from '@/util/transactionutil' ...@@ -379,16 +330,12 @@ import transactionutil from '@/util/transactionutil'
import apiutil from '@/util/apiutil' import apiutil from '@/util/apiutil'
import EVLogViewer from '@/components/EVLogViewer' import EVLogViewer from '@/components/EVLogViewer'
import FilterInput from '@/components/FilterInput' import FilterInput from '@/components/FilterInput'
import ipaddress from '@/util/ipaddress'
export default { export default {
name: 'BCDRecords', name: 'BCDRecords',
components: {FilterInput, EVLogViewer, Loading, DBEditor}, components: {FilterInput, EVLogViewer, Loading, DBEditor},
data() { data() {
return { return {
asc_v4_blocklist: [],
asc_v4_blocklist_by_lower: {},
asc_v4_blocklist_by_upper: {},
filter: {}, filter: {},
vlans: null, vlans: null,
fqdns: null, fqdns: null,
...@@ -416,7 +363,6 @@ export default { ...@@ -416,7 +363,6 @@ export default {
ou: null, ou: null,
parent_ous: null, parent_ous: null,
reserved_addrs: null, reserved_addrs: null,
reserved_addrs_by_ip: {},
records: null, records: null,
record_types: null, record_types: null,
record_types_by_name: null, record_types_by_name: null,
...@@ -428,6 +374,38 @@ export default { ...@@ -428,6 +374,38 @@ export default {
sortable: false // TODO: Sort function sortable: false // TODO: Sort function
} }
],
record_list_fields: [
{
label: 'FQDN',
key: 'fqdn',
sortable: true
},
{
label: 'Weitere Info',
key: 'info',
sortable: false
},
{
label: 'FQDN-Beschreibung',
key: 'fqdn_description',
sortable: true
},
{
label: 'Record-Data',
key: 'data',
sortable: false
},
{
label: 'TTL',
key: 'ttl',
sortable: true
},
{
label: 'Aktionen',
key: 'actions',
sortable: false
}
] ]
} }
}, },
...@@ -518,7 +496,6 @@ export default { ...@@ -518,7 +496,6 @@ export default {
this.ou = rangeResponse.data[1][0] this.ou = rangeResponse.data[1][0]
this.subnets = rangeResponse.data[2] this.subnets = rangeResponse.data[2]
this.reserved_addrs = rangeResponse.data[3] this.reserved_addrs = rangeResponse.data[3]
this.reserved_addrs_by_ip = apiutil.dict_by_value_of_array(this.reserved_addrs, 'value')
this.bcd_groups = rangeResponse.data[4] this.bcd_groups = rangeResponse.data[4]
this.group2mgrs = apiutil.dict_of_lists_by_value_of_array(rangeResponse.data[6], 'group_name') this.group2mgrs = apiutil.dict_of_lists_by_value_of_array(rangeResponse.data[6], 'group_name')
this.group_mgrs = apiutil.dict_by_value_of_array(rangeResponse.data[7], 'login_name') this.group_mgrs = apiutil.dict_by_value_of_array(rangeResponse.data[7], 'login_name')
...@@ -553,62 +530,7 @@ export default { ...@@ -553,62 +530,7 @@ export default {
type: selections type: selections
} }
// Precalculate blocklists
this.records = apiutil.dict_of_lists_by_value_of_array(recordQuery.data[0], 'type') this.records = apiutil.dict_of_lists_by_value_of_array(recordQuery.data[0], 'type')
if ('A' in this.records) {
let last = ipaddress.ip_to_int(this.subnets[0].cidr.split('/')[0])
for (const r of this.records.A) {
const cur = ipaddress.ip_to_int(r.data)
if (cur - last > 1) {
const blk = {
lower: ipaddress.int_to_ip(last),
upper: ipaddress.int_to_ip(cur)
}
const containing_blocks = []
let last_chg_ip = last + 1
let last_was_reserved = ipaddress.int_to_ip(last_chg_ip) in this.reserved_addrs_by_ip
for (var i = 1; i < cur - last; i++) {
if (ipaddress.int_to_ip(last + i) in this.reserved_addrs_by_ip) {
if (!last_was_reserved) {
containing_blocks.push({
type: 'free',
space: (last + i) - last_chg_ip
})
last_was_reserved = true
last_chg_ip = (last + i)
}
} else {
if (last_was_reserved) {
containing_blocks.push({
type: 'reserved',
space: (last + i) - last_chg_ip
})
last_was_reserved = false
last_chg_ip = last + i
}
}
}
if (last_was_reserved) {
containing_blocks.push({
type: 'reserved',
space: cur - last_chg_ip
})
} else {
containing_blocks.push({
type: 'free',
space: cur - last_chg_ip
})
}
blk.containing_blocks = containing_blocks
this.asc_v4_blocklist.push(blk)
}
last = cur
}
}
this.asc_v4_blocklist_by_lower = apiutil.dict_by_value_of_array(this.asc_v4_blocklist, 'lower')
this.asc_v4_blocklist_by_upper = apiutil.dict_by_value_of_array(this.asc_v4_blocklist, 'upper')
this.record_types = Object.keys(this.records) this.record_types = Object.keys(this.records)
for (let i = 0; i < this.record_types.length; i++) { for (let i = 0; i < this.record_types.length; i++) {
if (!(this.record_types[i] in this.current_page)) { if (!(this.record_types[i] in this.current_page)) {
......
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