Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
scc-net
netvs
netvs-core
Commits
02066bc8
Commit
02066bc8
authored
Nov 24, 2020
by
Janis Streib
🦉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whoups.. this feature wasn't supposed to be deployed (yet)
parent
b5a660e9
Pipeline
#119390
passed with stages
in 8 minutes and 37 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
183 deletions
+105
-183
frontend/src/views/dnsvs/BCDRecords.vue
frontend/src/views/dnsvs/BCDRecords.vue
+105
-183
No files found.
frontend/src/views/dnsvs/BCDRecords.vue
View file @
02066bc8
...
...
@@ -216,129 +216,80 @@
<b-card-body
body-class=
"p-0"
>
<b-collapse
:id=
"'records-'+record_type+'-collapse'"
v-model=
"collapse_states[2+index]"
>
<FilterInput
v-model=
"filter[record_type]"
></FilterInput>
<b-pagination
v-if=
"(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page"
:per-page=
"per_page"
<b-pagination
v-if=
"(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page"
:per-page=
"per_page"
align=
"center"
v-model=
"current_page[record_type]"
:total-rows=
"records[record_type].length"
></b-pagination>
<b-table-simple
responsive
class=
"table b-table"
>
<b-thead>
<b-th
aria-sort=
"ascending"
>
FQDN
</b-th>
<b-th>
Weitere Info
</b-th>
<b-th>
FQDN-Beschriebung
</b-th>
<b-th>
Record-Daten
</b-th>
<b-th>
TTL
</b-th>
<b-th>
<b-button
block
variant=
"outline-success"
:id=
"'button-create-record-' + record_type"
@
click=
"createItem(record_type)"
v-if=
"user_possible_record_types.includes(record_type)"
>
<font-awesome-icon
:icon=
"['fas', 'plus']"
/>
</b-button>
<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>
<b-tr
:key=
"item.fqdn + '_' + item.data"
>
<b-td>
{{ item.fqdn }}
<b-badge
variant=
"secondary"
v-if=
"item.fqdn_type === 'domain'"
>
Domain
</b-badge>
<b-badge
v-if=
"item.host_is_nws"
variant=
"primary"
<b-table
responsive
:filter=
"filter[record_type]"
:items=
"records[record_type]"
:per-page=
"(!(record_type in filter) || filter[record_type] === '') ? per_page : null"
:current-page=
"current_page[record_type]"
:fields=
"record_list_fields"
>
<
template
v-slot:cell(fqdn)=
"data"
>
{{
data
.
item
.
fqdn
}}
<b-badge
variant=
"secondary"
v-if=
"data.item.fqdn_type === 'domain'"
>
Domain
</b-badge>
<b-badge
v-if=
"data.item.host_is_nws"
variant=
"primary"
: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`"
title="Host besitzt einen NATVS-Eintrag">NATVS
</b-badge>
</b-td
>
<b-td
>
</
template
>
<
template
v-slot:cell(info)=
"data"
>
<b-dropdown
variant=
"light"
>
<template
v-slot:button-content
>
<font-awesome-icon
:icon=
"['fas', 'info-circle']"
></font-awesome-icon>
</
template
>
<b-dropdown-item
:to=
"'/dnsvs/fqdns/' + item.fqdn + '/records'"
>
Records zu FQDN
<b-dropdown-item
:to=
"'/dnsvs/fqdns/' +
data.
item.fqdn + '/records'"
>
Records zu FQDN
</b-dropdown-item>
<b-dropdown-item
:to=
"'/dnsvs/fqdns/' + item.fqdn + '/references'"
>
Referenzen auf FQDN
<b-dropdown-item
:to=
"'/dnsvs/fqdns/' +
data.
item.fqdn + '/references'"
>
Referenzen auf FQDN
</b-dropdown-item>
</b-dropdown>
</b-td>
<b-td>
{{ item.fqdn_description }}
</b-td>
<b-td>
<code>
{{ item.data }}
</code>
<b-badge
v-if=
"!item.target_is_singleton"
variant=
"warning"
>
RR-Set
</b-badge>
<b-badge
v-if=
"item.target_is_reverse_unique"
title=
"Rückwärts-eindeutig"
>
PTR
</b-badge>
</b-td>
<b-td>
<
template
v-if=
"item.ttl != null"
>
{{
item
.
ttl
}}
s
</
template
>
<span
v-else
title=
"Geerbt von Zone"
class=
"text-muted"
>
{{ item.ttl_zone_default }}s
</span>
<span
v-if=
"item.ttl_reset_days"
class=
"text-danger"
><br/>
Reset in {{ item.ttl_reset_days }} Tagen
</span>
</b-td>
<b-td>
</template>
<
template
v-slot:cell(data)=
"data"
>
<code>
{{
data
.
value
}}
</code>
<b-badge
v-if=
"!data.item.target_is_singleton"
variant=
"warning"
>
RR-Set
</b-badge>
<b-badge
v-if=
"data.item.target_is_reverse_unique"
title=
"Rückwärts-eindeutig"
>
PTR
</b-badge>
</
template
>
<
template
v-slot:cell(actions)=
"data"
>
<b-button-group>
<b-dropdown
:id=
"'button-edit-record-' + item.fqdn + '_' + record_type + '_' + item.data"
@
click=
"editItem(item)"
split
variant=
"outline-primary"
>
<b-dropdown
:id=
"'button-edit-record-' + data.item.fqdn + '_' + record_type + '_' + data.item.data"
@
click=
"editItem(data.item)"
split
variant=
"outline-primary"
>
<template
#button-content
>
<font-awesome-icon
:icon=
"['far', 'edit']"
></font-awesome-icon>
</
template
>
<b-dropdown-item
@
click=
"editFQDN(fqdns[item.fqdn])"
>
FQDN Bearbeiten
</b-dropdown-item>
<b-dropdown-item
@
click=
"editFQDN(fqdns[
data.
item.fqdn])"
>
FQDN Bearbeiten
</b-dropdown-item>
</b-dropdown>
<b-dropdown
@
click=
"deleteItem(item, false)"
split
variant=
"outline-danger"
>
<b-dropdown
@
click=
"deleteItem(
data.
item, false)"
split
variant=
"outline-danger"
>
<
template
#button-content
>
<font-awesome-icon
:icon=
"['far', 'trash-alt']"
></font-awesome-icon>
</
template
>
<b-dropdown-item
@
click=
"deleteItem(item, true)"
>
Falls FQDN gelöscht wird: Alle den
<b-dropdown-item
@
click=
"deleteItem(
data.
item, true)"
>
Falls FQDN gelöscht wird: Alle den
FQDN referenzierende Records
mitlöschen
</b-dropdown-item>
</b-dropdown>
</b-button-group>
<b-tooltip
:target=
"'button-edit-record-' + item.fqdn + '_' + record_type + '_' + item.data"
triggers=
"hover"
<b-tooltip
:target=
"'button-edit-record-' + data.item.fqdn + '_' + record_type + '_' + data.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"
<
template
v-slot:cell(ttl)=
"data"
>
<template
v-if=
"data.item.ttl != null"
>
{{
data
.
item
.
ttl
}}
s
</
template
>
<span
v-else
title=
"Geerbt von Zone"
class=
"text-muted"
>
{{ data.item.ttl_zone_default }}s
</span>
<span
v-if=
"data.item.ttl_reset_days"
class=
"text-danger"
><br/>
Reset in {{ data.item.ttl_reset_days }} Tagen
</span>
</template>
<
template
v-slot:head
(
actions
)
>
<b-button
block
variant=
"outline-success"
:id=
"'button-create-record-' + record_type"
@
click=
"createItem(record_type)"
v-if=
"user_possible_record_types.includes(record_type)"
>
<font-awesome-icon
:icon=
"['fas', 'plus']"
/>
</b-button>
<b-tooltip
:target=
"'button-create-record-' + record_type"
triggers=
"hover"
variant=
"success"
placement=
"left"
>
Neuen Record anlegen
</b-tooltip>
</
template
>
</b-table>
<b-pagination
v-if=
"(!(record_type in filter) || filter[record_type] === '')&& loaded && records[record_type].length > per_page"
:per-page=
"per_page"
align=
"center"
v-model=
"current_page[record_type]"
:total-rows=
"records[record_type].length"
></b-pagination>
...
...
@@ -379,16 +330,12 @@ import transactionutil from '@/util/transactionutil'
import
apiutil
from
'
@/util/apiutil
'
import
EVLogViewer
from
'
@/components/EVLogViewer
'
import
FilterInput
from
'
@/components/FilterInput
'
import
ipaddress
from
'
@/util/ipaddress
'
export
default
{
name
:
'
BCDRecords
'
,
components
:
{
FilterInput
,
EVLogViewer
,
Loading
,
DBEditor
},
data
()
{
return
{
asc_v4_blocklist
:
[],
asc_v4_blocklist_by_lower
:
{},
asc_v4_blocklist_by_upper
:
{},
filter
:
{},
vlans
:
null
,
fqdns
:
null
,
...
...
@@ -416,7 +363,6 @@ export default {
ou
:
null
,
parent_ous
:
null
,
reserved_addrs
:
null
,
reserved_addrs_by_ip
:
{},
records
:
null
,
record_types
:
null
,
record_types_by_name
:
null
,
...
...
@@ -428,6 +374,38 @@ export default {
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 {
this
.
ou
=
rangeResponse
.
data
[
1
][
0
]
this
.
subnets
=
rangeResponse
.
data
[
2
]
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
.
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
'
)
...
...
@@ -553,62 +530,7 @@ export default {
type
:
selections
}
// Precalculate blocklists
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
)
for
(
let
i
=
0
;
i
<
this
.
record_types
.
length
;
i
++
)
{
if
(
!
(
this
.
record_types
[
i
]
in
this
.
current_page
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment