Entry.vue 2.71 KB
Newer Older
Janis Streib's avatar
Janis Streib committed
1
<template>
2
3
4
5
6
7
8
9
  <div id="dnsvs_Entry">
    <h1>DNSVS</h1>
     <div v-if="$store.state.expert">
      <b-row>
        <b-col><b-button :disabled="!create_record_reducer" variant="outline-success" block @click="$bvModal.show('create_record_entry')">Record anlegen</b-button></b-col>
        <b-col><b-button :disabled="!create_fqdn_reducer" variant="outline-success" block>FQDN anlegen</b-button></b-col>
      </b-row>
      <hr>
Janis Streib's avatar
Janis Streib committed
10
    </div>
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    <b-nav tabs align="center">
      <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>
    <BCDOverview v-if="$route.name === 'bcds'"></BCDOverview>
    <FQDNOverview v-if="$route.name === 'fqdns'"></FQDNOverview>
    <DBEditor :input_reducer="create_record_reducer" modal_id="create_record_entry"
              object_function="create" object_fq_name="dns.record"
              :non_optionals_order="['fqdn', 'type', 'data', 'fqdn_description', 'target_is_singleton', 'target_is_reverse_unique']">
    </DBEditor>
    <DBEditor :input_reducer="create_fqdn_reducer" modal_id="create_fqdn_entry"
              object_function="create" object_fq_name="dns.fqdn"
              :non_optionals_order="['fqdn', 'type', 'data', 'fqdn_description', 'target_is_singleton', 'target_is_reverse_unique']">
    </DBEditor>
  </div>
Janis Streib's avatar
Janis Streib committed
26
27
28
</template>

<script>
Janis Streib's avatar
Janis Streib committed
29
30
import BCDOverview from '@/views/dnsvs/BCDOverview.vue'
import FQDNOverview from '@/views/dnsvs/FQDNOverview.vue'
31
32
import DBEditor from '@/components/DBEditor'
import DNSTypeService from '@/api-services/dns_type.service'
Janis Streib's avatar
Janis Streib committed
33

Janis Streib's avatar
Janis Streib committed
34
35
export default {
  name: 'Entry',
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  components: { BCDOverview, FQDNOverview, DBEditor },
  data() {
    return {
      create_record_reducer: undefined,
      create_fqdn_reducer: undefined
    }
  },
  async created() {
    const typesReq = await DNSTypeService.getTypes(this.$store.state.netdb_axios_config)
    const fqdnSelections = {}
    for (const t of typesReq.data[0]) {
      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.create_fqdn_reducer = {
      type: fqdnSelections
    }
    const selections = {}
    for (const t of typesReq.data[1]) {
      selections[t.record_type] = {display_name: t.record_type}
    }
    const record_fqdn_type_reducer = Object.assign({'': {display_name: 'Automatische Behandlung'}}, this.create_fqdn_reducer.type)
    this.create_record_reducer = {}
    this.create_record_reducer = {
      type: selections,
      fqdn_type: record_fqdn_type_reducer
    }
  }
Janis Streib's avatar
Janis Streib committed
67
}
Janis Streib's avatar
Janis Streib committed
68
69
70
71
72
</script>

<style scoped>

</style>