Commit 068498d8 authored by Janis Streib's avatar Janis Streib 🦉
Browse files

FIX: consistent record views (closes #184)

parent 63b86a4a
Pipeline #117498 passed with stages
in 4 minutes and 44 seconds
......@@ -11,7 +11,18 @@ export default {
getRecrodsByTargetFQDN(config, fqdn) {
const ta = [
{ name: 'dns.fqdn.list', old: { value: fqdn } },
{ name: 'dns.record.list', join: { 0: 'api_fkey_dns_record_target_fqdn' } }
{ name: 'dns.record.list', join: { 0: 'api_fkey_dns_record_target_fqdn' } },
{ name: 'dnscfg.fqdn_type.list', old: { sorting_params_list: ['position'] } },
{ name: 'dnscfg.record_inttype.list', old: { is_own: true, sorting_params_list: ['record_type'] } }
]
return TransactionService.execute(config, ta)
},
getRecordsByFQDN(config, fqdn) {
const ta = [
{ name: 'dns.record.list', old: { fqdn_list: [fqdn], sorting_params_list: ['type', 'fqdn'] } },
{ name: 'dnscfg.fqdn_type.list', old: { sorting_params_list: ['position'] } },
{ name: 'dns.fqdn.list', old: { value: fqdn } },
{ name: 'dnscfg.record_inttype.list', old: { is_own: true, sorting_params_list: ['record_type'] } }
]
return TransactionService.execute(config, ta)
}
......
......@@ -17,9 +17,12 @@
</template>
<template v-slot:cell(actions)="data">
<b-button-group>
<b-button variant="outline-primary" @click="editItem(data.item)">
<font-awesome-icon :icon="['far', 'edit']"></font-awesome-icon>
</b-button>
<b-dropdown @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(fqdn)">FQDN Bearbeiten</b-dropdown-item>
</b-dropdown>
<b-dropdown @click="deleteItem(data.item, false)" split variant="outline-danger">
<template #button-content>
<font-awesome-icon :icon="['far', 'trash-alt']"></font-awesome-icon>
......@@ -42,13 +45,17 @@
:object_function="db_editor_function" object_fq_name="dns.record" :old_data="db_editor_old_data"
:non_optionals_order="['fqdn', 'type', 'data', 'fqdn_description', 'target_is_singleton', 'target_is_reverse_unique']"
></DBEditor>
<DBEditor :presets="db_editor_presets" modal_id="edit_fqdn"
:object_title="object_title" :input_reducer="full_edit_fqdn_reducer"
object_function="update" object_fq_name="dns.fqdn" :old_data="db_editor_old_data"
:non_optionals_order="['value', 'description']">
</DBEditor>
</Loading>
</div>
</template>
<script>
import DBEditor from './DBEditor'
import RecordTypeService from '@/api-services.gen/dnscfg.record_type'
import RecordService from '@/api-services.gen/dns.record'
import Loading from './Loading'
import transactionutil from '../util/transactionutil'
......@@ -62,9 +69,10 @@ export default {
DBEditor
},
props: {
full_edit_fqdn_reducer: Object,
create_record_reducer: Object,
fqdn_rrs: Array,
fqdn: {
type: String,
required: true
}
},
......@@ -111,19 +119,7 @@ export default {
key: 'actions',
sortable: false
}
],
create_record_reducer: undefined
}
},
async created() {
const response = await RecordTypeService.list(this.$store.state.netdb_axios_config, {is_intern: false})
const types = response.data[0]
const selections = {}
for (const t of types) {
selections[t.name] = {display_name: t.name}
}
self.create_record_reducer = {
type: selections
]
}
},
methods: {
......@@ -150,8 +146,15 @@ export default {
createItem: function () {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
this.db_editor_presets = {fqdn: this.fqdn}
this.db_editor_presets = {fqdn: this.fqdn.value}
this.$root.$emit('bv::show::modal', 'create_record')
},
editFQDN: function (item) {
this.db_editor_function = 'update'
this.db_editor_old_data = item
this.db_editor_presets = item
this.object_title = 'FQDN ' + item.value
this.$root.$emit('bv::show::modal', 'edit_fqdn')
}
}
}
......
<template>
<div class="FQDNReferences">
<h1>Records zum FQDN '<span v-if="$route.params.fqdn === '$'">.</span><span v-if="$route.params.fqdn !== '$'">{{$route.params.fqdn}}</span>'
</h1>
<FQDNRecordTable :fqdn_rrs="records" :fqdn="$route.params.fqdn"></FQDNRecordTable>
</div>
<div class="FQDNReferences">
<h1>Records zum FQDN '<span v-if="$route.params.fqdn === '$'">.</span><span
v-if="$route.params.fqdn !== '$'">{{ $route.params.fqdn }}</span>'
</h1>
<FQDNRecordTable :full_edit_fqdn_reducer="full_edit_fqdn_reducer" :create_record_reducer="create_record_reducer"
:fqdn_rrs="records" :fqdn="fqdn"></FQDNRecordTable>
</div>
</template>
<script>
import FQDNRecordTable from '@/components/FQDNRecordTable.vue'
import RRService from '@/api-services.gen/dns.record'
import FQDNRRService from '@/api-services/dns_fqdn.service'
export default {
name: 'FQDNReferences',
data () {
data() {
return {
records: null
records: null,
fqdn: null,
full_edit_fqdn_reducer: null,
create_record_reducer: null
}
},
components: { FQDNRecordTable },
watch: {
$route () {
methods: {
async fetchData() {
this.records = null
RRService.list(this.$store.state.netdb_axios_config, { fqdn_list: [this.$route.params.fqdn] }).then((response) => {
this.records = response.data[0]
Object.freeze(this.fqdns)
})
const response = await FQDNRRService.getRecordsByFQDN(this.$store.state.netdb_axios_config, this.$route.params.fqdn)
this.records = response.data[0]
const fqdnSelections = {}
for (const t of response.data[1]) {
let disp_name = t.description
disp_name += ' ['
disp_name += t.is_nonterminal ? 'nicht-terminal' : 'terminal'
disp_name += ']'
fqdnSelections[t.name] = {display_name: disp_name}
}
this.full_edit_fqdn_reducer = {
type: fqdnSelections
}
const selections = {}
for (const t of response.data[3]) {
selections[t.record_type] = {display_name: t.record_type}
}
this.create_record_reducer = {
type: selections
}
this.fqdn = response.data[2][0]
}
},
created () {
RRService.list(this.$store.state.netdb_axios_config, { fqdn_list: [this.$route.params.fqdn] }).then((response) => {
this.records = response.data[0]
Object.freeze(this.fqdns)
})
components: {
FQDNRecordTable
},
watch: {
$route() {
this.fetchData()
}
},
created() {
this.fetchData()
}
}
</script>
......
......@@ -3,7 +3,10 @@
<h1>Referenzen zum FQDN '<span v-if="$route.params.fqdn === '$'">.</span><span
v-if="$route.params.fqdn !== '$'">{{ $route.params.fqdn }}</span>'
</h1>
<FQDNRecordTable :fqdn_rrs="records" :fqdn="$route.params.fqdn"></FQDNRecordTable>
<FQDNRecordTable :fqdn_rrs="records" :fqdn="fqdn"
:full_edit_fqdn_reducer="full_edit_fqdn_reducer"
:create_record_reducer="create_record_reducer"
></FQDNRecordTable>
</div>
</template>
......@@ -15,20 +18,46 @@ export default {
name: 'FQDNReferences',
data() {
return {
records: null
records: null,
fqdn: null,
full_edit_fqdn_reducer: null,
create_record_reducer: null
}
},
components: {FQDNRecordTable},
watch: {
async $route() {
await this.fetchData()
}
},
methods: {
async fetchData() {
this.records = null
const response = await RRService.getRecrodsByTargetFQDN(this.$store.state.netdb_axios_config, this.$route.params.fqdn)
this.fqdn = response.data[0][0]
this.records = response.data[1]
const fqdnSelections = {}
for (const t of response.data[2]) {
let disp_name = t.description
disp_name += ' ['
disp_name += t.is_nonterminal ? 'nicht-terminal' : 'terminal'
disp_name += ']'
fqdnSelections[t.name] = {display_name: disp_name}
}
this.full_edit_fqdn_reducer = {
type: fqdnSelections
}
const selections = []
for (const t of response.data[3]) {
selections[t.record_type] = {display_name: t.record_type}
}
this.create_record_reducer = {
type: selections
}
}
},
async created() {
const response = await RRService.getRecrodsByTargetFQDN(this.$store.state.netdb_axios_config, this.$route.params.fqdn)
this.records = response.data[1]
await this.fetchData()
}
}
</script>
......
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