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

UPD: use bcd instead of range (very basic)

parent 8255e5a4
Pipeline #64569 passed with stages
in 6 minutes
import TransactionService from './transaction.service'
export default {
getOverview(config) {
let ta = [
{"name": "nd.bcd.list", "old": {"is_own": true}},
{"name": "vw.ou.list", "join": {"0": "nd.bcd.fkey_nd_bcd_oe"}},
{"name": "nd.ip_subnet.list", "join": {"0": "nd.ip_subnet.fkey_nd_ip_subnet_bcd"}},
{"name": "nd.vlan.list", "join": {"0": "nd.vlan.fkey_nd_vlan_bcd"}},
]
return TransactionService.execute(config, ta);
},
getDetail(config, name) {
let ta = [
{"name": "nd.bcd.list", "old": {"name_list": [name]}},
{"name": "dns.mgr2bcd.list", "join": {"0": "dns.mgr2bcd.fkey_dns_mgr2bcd_bcd"}},
{"name": "cntl.mgr.list", "join": {"1": "dns.mgr2bcd.fkey_dns_mgr2bcd_mgr"}},
{"name": "dns.domain2bcd.list", "join": {"0": "dns.domain2bcd.fkey_dns_domain2bcd_bcd"}},
{"name": "vw.ou.list", "join": {"0": "nd.bcd.fkey_nd_bcd_oe"}},
{"name": "nd.ip_subnet.list", "join": {"0": "nd.ip_subnet.fkey_nd_ip_subnet_bcd"}}
]
return TransactionService.execute(config, ta);
}
};
import TransactionService from './transaction.service'
export default {
getOverview(config) {
let ta = [
{"name": "dns.range.list", "old": {"is_own": true}},
{"name": "vw.ou.list", "join": {"0": "dns.range.fkey_dns_range_oe"}}
]
return TransactionService.execute(config, ta);
},
getDetail(config, name, suffix) {
let ta = [
{"name": "dns.range.list", "old": {"name_list": [name + '/' + suffix]}},
{"name": "dns.mgr2range.list", "join": {"0": "dns.mgr2range.fkey_dns_mgr2range_range"}},
{"name": "cntl.mgr.list", "join": {"1": "dns.mgr2range.fkey_dns_mgr2range_mgr"}},
{"name": "dns.domain2range.list", "join": {"0": "dns.domain2range.fkey_dns_domain2range_range"}},
{"name": "vw.ou.list", "join": {"0": "dns.range.fkey_dns_range_oe"}},
]
return TransactionService.execute(config, ta);
}
};
......@@ -51,7 +51,7 @@ export default new Router({
},
children: [
{
path: '', beforeEnter: (to, from, next) => next('/dnsvs/ranges')
path: '', beforeEnter: (to, from, next) => next('/dnsvs/bcds')
},
{
path: 'fqdns',
......@@ -122,24 +122,24 @@ export default new Router({
}
},
{
path: 'ranges',
name: 'ranges',
path: 'bcds',
name: 'bcds',
component: () => import('./views/dnsvs/entry.vue'),
meta: {
resolveName: function () {
return "Bereiche"
return "BCDs"
}
}
},
{
path: 'ranges/:name/:suffix',
component: () => import('./views/dnsvs/range_records.vue'),
path: 'bcds/:name',
component: () => import('./views/dnsvs/bcd_records.vue'),
meta: {
resolveName: function (query) {
return query.name + '/' + query.suffix
return query.name
},
resolveParents: function () {
return ['/dnsvs/ranges']
return ['/dnsvs/bcds']
}
}
}
......
<template>
<div id="dnsvs_range_overview">
<h2>Ihre Bereiche</h2>
<div class="text-center" v-if="!ranges">
<div class="text-center" v-if="!bcds">
<b-spinner style="width: 3rem; height: 3rem;" type="grow" label="Loading..."></b-spinner>
</div>
<div v-if="ranges">
<div v-if="bcds">
<div class="net-filter-direct d-print-none">
<div class="input-group">
<div class="input-group-prepend">
......@@ -20,10 +20,10 @@
</div>
</div>
</div>
<table class="table table-striped">
<table class="table">
<thead>
<tr>
<th>{{ $colnames['DBNetArea']['name'].short_title_abs }} <a class="sort d-print-none"><i
<th>BCD-Name <a class="sort d-print-none"><i
class="fas fa-sort"></i></a></th>
<th>{{ $colnames['DBNetArea']['description'].short_title_abs }} <a class="sort d-print-none"><i
class="fas fa-sort"></i></a></th>
......@@ -34,30 +34,40 @@
class="fas fa-sort"></i></a></th>
<th>{{ $colnames['Facility']['name'].short_title_abs }} <a class="sort d-print-none"><i
class="fas fa-sort-up"></i></a></th>
<th>BCD (VLAN-Liste) <a class="sort"><i
<th>VLANs <a class="sort"><i
class="fas fa-sort"></i></a></th>
</tr>
</thead>
<tbody>
<tr v-for="r in ranges" :key="r.name">
<th>
<router-link :to="'ranges/'+r.name">{{ r.name }}</router-link>
</th>
<td>{{ r.description }}</td>
<td><code>{{ r.ip_subnet_cidr }}</code></td>
<td>
<b-progress height="20px" show-progress v-if="is_ip_v4(r.ip_subnet_cidr)"
:max="ip_num_addr(r.ip_subnet_cidr)" class="mb-3">
<b-progress-bar :label="`${((r.addr_rr_count/ip_num_addr(r.ip_subnet_cidr)) * 100).toFixed(0)}%`"
:variant="get_progress_variant(r)"
:value="r.addr_rr_count"></b-progress-bar>
</b-progress>
<span v-if="!is_ip_v4(r.ip_subnet_cidr)">{{r.addr_rr_count}}</span>
</td>
<td :title="ou_by_shortname[r.ou_short_name].name">{{ r.ou_short_name }}</td>
<td v-if="r.bcd_dict">{{ r.bcd_dict.name }} ({{ r.bcd_dict.vlan_list}})</td>
<td v-if="!r.bcd_dict"></td>
</tr>
<template v-for="r in bcds">
<tr v-for="(n, i) in ip_subnet_by_bcd[r.name]" :key="n.name">
<th :rowspan="r.subnet_count" v-if="i == 0" class="vertical-center">
<router-link :to="'bcds/'+r.name">{{ r.name }}</router-link>
</th>
<td class="vertical-center" v-if="i == 0" :rowspan="r.subnet_count">{{ r.description }}</td>
<td><code>{{ n.cidr }}</code></td>
<td class="vertical-center">
<b-progress height="20px" show-progress v-if="is_ip_v4(n.cidr)"
:max="ip_num_addr(n.cidr)" class="mb-3">
<b-progress-bar
:label="`${((n.dns_addr_rr_count/ip_num_addr(n.cidr)) * 100).toFixed(0)}%`"
:variant="get_progress_variant(n)"
:value="n.dns_addr_rr_count"></b-progress-bar>
</b-progress>
<span v-if="!is_ip_v4(n.cidr)">{{n.addr_rr_count}}</span>
</td>
<td class="vertical-center" v-if="i == 0" :rowspan="r.subnet_count" :title="ou_by_shortname[r.ou_short_name].name">
{{r.ou_short_name }}
</td>
<td v-if="i==0" :rowspan="r.subnet_count" class="vertical-center">
<ul class="list-unstyled" v-for="v in vlans[r.name]" :key="v.id">
<li>{{v.name}} ({{v.id}})</li>
</ul>
<i v-if="!(r.name in vlans)">Kein VLAN vorhanden</i>
</td>
</tr>
</template>
</tbody>
</table>
</div>
......@@ -65,7 +75,7 @@
</template>
<script>
import RangeService from '@/api-services/range.service'
import RangeService from '@/api-services/dns_bcd.service'
import ApiUtil from '@/util/apiutil'
import ipaddress from "../../util/ipaddress";
......@@ -73,15 +83,19 @@
name: 'dnsvs_range_overview',
data() {
return {
ranges: null,
bcds: null,
utilization: null,
ou_by_shortname: null
ou_by_shortname: null,
ip_subnet_by_bcd: null,
vlans: null
}
},
created() {
RangeService.getOverview(this.$store.state.netdb_axios_config).then((response) => {
this.ou_by_shortname = ApiUtil.dict_by_value_of_array(response.data[1], 'short_name')
this.ranges = response.data[0]
this.bcds = response.data[0]
this.ip_subnet_by_bcd = ApiUtil.dict_of_lists_by_value_of_array(response.data[2], 'bcd')
this.vlans = ApiUtil.dict_of_lists_by_value_of_array(response.data[3], 'bcd')
Object.freeze(this.ranges)
})
},
......@@ -89,7 +103,7 @@
is_ip_v4: ipaddress.is_ip_v4,
ip_num_addr: ipaddress.ip_num_addr,
get_progress_variant: function (range) {
let perc = range.addr_rr_count / this.ip_num_addr(range.ip_subnet_cidr)
let perc = range.dns_addr_rr_count / this.ip_num_addr(range.cidr)
if (perc <= .5) {
return 'success'
}
......
<template>
<div class="dnsvs_range_records">
<div v-if="range" class="page-header net-header">
<h1>Bereich '{{range.name}}'
<h1>Broadcastdomain '{{range.name}}'
<small class="text-muted"><code>{{range.ip_subnet_cidr}}</code></small>
</h1>
</div>
......@@ -43,16 +43,23 @@
<th :title="$colnames['Net']['net'].long_title">{{
$colnames['Net']['net'].short_title_abs }}
</th>
<td colspan="2"><code>{{ range.ip_subnet_cidr }}</code></td>
<td colspan="2">
<ul class="list-unstyled" v-for="n in ip_nets" :key="n.cidr">
<li>
<code>{{ n.cidr }}</code>
</li>
</ul>
</td>
</tr>
<tr v-if="is_ip_v4(range.ip_subnet_cidr)">
<!-- <tr v-if="is_ip_v4(range.ip_subnet_cidr)">
<th :title="$colnames['Net']['ip_mask'].long_title">{{
$colnames['Net']['ip_mask'].short_title_abs
}}
</th>
<td colspan="2"><code>{{ ip_net_get_mask(range.ip_subnet_cidr) }}</code></td>
<td colspan="2"><code>{{ ip_net_get_mask(range.ip_subnet_cidr) }}</code>
</td>
</tr>
<tr v-if="is_ip_v4(range.ip_subnet_cidr)">
<tr v-if="is_ip_v4(range.ip_subnet_cidr)">
<th :title="$colnames['Net']['b0'].long_title">{{
$colnames['Net']['b0'].short_title_abs }}
</th>
......@@ -63,8 +70,9 @@
<th :title="$colnames['Net']['b1'].long_title">{{
$colnames['Net']['b1'].short_title_abs }}
</th>
<td colspan="2"><code>{{ ip_net_get_last(range.ip_subnet_cidr) }}</code></td>
</tr>
<td colspan="2"><code>{{ ip_net_get_last(range.ip_subnet_cidr) }}</code>
</td>
</tr> -->
<tr>
<th :title="$colnames['DBNetArea']['gateway_list'].long_title">{{
$colnames['DBNetArea']['gateway_list'].short_title_abs }}
......@@ -252,16 +260,25 @@
<tbody class="list card-table">
<template
v-if="r == 'A' && filter_text.trim() == '' && sort_opts['A']._sorted && sort_opts['A'].sort_by == 'rr_data'">
<tr v-for="b in calc_free_ip4_blocks(-1)" class="table-sm ip-block" :key="b.id"
<tr v-for="b in calc_free_ip4_blocks(-1)" class="table-sm ip-block"
:key="b.id"
:class="{'table-success': b.type == 'usable', 'table-warning': b.type == 'reserved'}">
<td colspan="4"></td>
<td v-if="b.type=='usable'">
<b-badge v-if="b.count <= 1" variant="success">{{b.count}} nutzbare Adresse</b-badge>
<b-badge v-if="b.count > 1" variant="success">{{b.count}} nutzbare Adressen</b-badge>
<b-badge v-if="b.count <= 1" variant="success">{{b.count}}
nutzbare Adresse
</b-badge>
<b-badge v-if="b.count > 1" variant="success">{{b.count}}
nutzbare Adressen
</b-badge>
</td>
<td v-if="b.type=='reserved'">
<b-badge v-if="b.count <= 1" variant="warning">{{b.count}} reservierte Adresse</b-badge>
<b-badge v-if="b.count > 1" variant="warning">{{b.count}} reservierte Adressen</b-badge>
<b-badge v-if="b.count <= 1" variant="warning">{{b.count}}
reservierte Adresse
</b-badge>
<b-badge v-if="b.count > 1" variant="warning">{{b.count}}
reservierte Adressen
</b-badge>
</td>
<td colspan="2"></td>
</tr>
......@@ -323,12 +340,20 @@
:class="{'table-success': b.type == 'usable', 'table-warning': b.type == 'reserved'}">
<td colspan="4"></td>
<td v-if="b.type=='usable'">
<b-badge v-if="b.count <= 1" variant="success">{{b.count}} nutzbare Adresse</b-badge>
<b-badge v-if="b.count > 1" variant="success">{{b.count}} nutzbare Adressen</b-badge>
<b-badge v-if="b.count <= 1" variant="success">{{b.count}}
nutzbare Adresse
</b-badge>
<b-badge v-if="b.count > 1" variant="success">{{b.count}}
nutzbare Adressen
</b-badge>
</td>
<td v-if="b.type=='reserved'">
<b-badge v-if="b.count <= 1" variant="warning">{{b.count}} reservierte Adresse</b-badge>
<b-badge v-if="b.count > 1" variant="warning">{{b.count}} reservierte Adressen</b-badge>
<b-badge v-if="b.count <= 1" variant="warning">{{b.count}}
reservierte Adresse
</b-badge>
<b-badge v-if="b.count > 1" variant="warning">{{b.count}}
reservierte Adressen
</b-badge>
</td>
<td colspan="2"></td>
</tr>
......@@ -355,9 +380,9 @@
data-target="#reserved"
href="#secReserved">Reservierte Adressen</a></li>
<li v-for="r in possible_rr_types" :key="r" class="nav-item"><a class="nav-link"
:id="'spy_rr_click_'+r"
:data-target="'#'+r"
:href="'#sec'+r">{{ r
:id="'spy_rr_click_'+r"
:data-target="'#'+r"
:href="'#sec'+r">{{ r
}}</a>
</li>
</ul>
......@@ -367,7 +392,7 @@
</template>
<script>
import RangeService from '@/api-services/range.service';
import RangeService from '@/api-services/dns_bcd.service';
import RecordService from '@/api-services.gen/dns.record';
import ipaddress from '@/util/ipaddress';
import debounce from 'v-debounce';
......@@ -388,6 +413,7 @@
editable_rr_types: null,
filter_text: "",
sort_opts: {},
ip_nets: null,
ou: null
}
},
......@@ -467,8 +493,8 @@
},
async sort_by(list, type_name) {
let sort_opts = this.sort_opts[type_name]
if(sort_opts._sorted) {
if(!sort_opts._reversed) {
if (sort_opts._sorted) {
if (!sort_opts._reversed) {
let l = list.reverse()
this.$set(this.sort_opts[type_name], '_reversed', true)
return l
......@@ -518,7 +544,7 @@
_reversed: false
}
this.$set(this.sort_opts, type_name, nobj)
this.sort_by(this.records[type_name], type_name).then((recs)=>this.$set(this.records, type_name, recs))
this.sort_by(this.records[type_name], type_name).then((recs) => this.$set(this.records, type_name, recs))
return
}
let nobj = {
......@@ -528,7 +554,7 @@
_reversed: false
}
this.$set(this.sort_opts, type_name, nobj)
this.sort_by(this.records[type_name], type_name).then((recs)=>this.$set(this.records, type_name, recs))
this.sort_by(this.records[type_name], type_name).then((recs) => this.$set(this.records, type_name, recs))
return
},
},
......@@ -549,18 +575,19 @@
},
},
created() {
RangeService.getDetail(this.$store.state.netdb_axios_config, this.$route.params.name, this.$route.params.suffix).then((response) => {
RangeService.getDetail(this.$store.state.netdb_axios_config, this.$route.params.name).then((response) => {
this.range = response.data[0][0]
this.gateways = this.range.gateway_list
this.domains = response.data[3]
this.ou = response.data[4][0]
this.range_managers = response.data[2]
this.ip_nets = response.data[5]
// this.nat_range = response.data.nat_range
// this.domains = response.data.domains
})
RecordService.list(this.$store.state.netdb_axios_config, {
sorting_params_list: ['fqdn'],
range_list: [this.$route.params.name + '/' + this.$route.params.suffix]
bcd_list: [this.$route.params.name]
}).then((response) => {
//this.possible_rr_types = response.data.possible_rr_types
this.records = ApiUtil.dict_of_lists_by_value_of_array(response.data[0], 'type')
......@@ -579,16 +606,16 @@
_sorted: true
}
}
/*
this.editable_rr_types = response.data.editable_rr_types
*/
/*
this.editable_rr_types = response.data.editable_rr_types
*/
this.editable_rr_types = []
this.reserved_addresses = []
/*
for (let i = 0; i < response.data.reserved_addresses.length; i++) {
this.reserved_addresses.push(response.data.reserved_addresses[i].ip_addr)
}
*/
/*
for (let i = 0; i < response.data.reserved_addresses.length; i++) {
this.reserved_addresses.push(response.data.reserved_addresses[i].ip_addr)
}
*/
Object.freeze(this.reserved_addresses)
})
},
......
......@@ -2,23 +2,23 @@
<div id="dnsvs_entry">
<h1>DNSVS</h1>
<b-nav pills fill justified>
<b-nav-item :active="$route.name == 'ranges'" to="/dnsvs/ranges">Ihre Bereiche</b-nav-item>
<b-nav-item :active="$route.name == 'bcds'" to="/dnsvs/bcds">Ihre Broadcastdomains (BCDs)</b-nav-item>
<b-nav-item :active="$route.name == 'fqdns'" to="/dnsvs/fqdns">Ihre Domains</b-nav-item>
</b-nav>
<range-overview v-if="$route.name == 'ranges'"></range-overview>
<f-q-d-n-overview v-if="$route.name == 'fqdns'"></f-q-d-n-overview>
<bcd-overview v-if="$route.name == 'bcds'"></bcd-overview>
<fqdn-overview v-if="$route.name == 'fqdns'"></fqdn-overview>
</div>
</template>
<script>
import RangeOverview from '@/views/dnsvs/range_overview.vue'
import BCDOverview from '@/views/dnsvs/bcd_overview.vue'
import FQDNOverview from '@/views/dnsvs/fqdn_overview.vue'
export default {
name: "entry",
components: {
RangeOverview,
FQDNOverview
'bcd-overview': BCDOverview,
'fqdn-overview': FQDNOverview
}
}
</script>
......
Supports Markdown
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