Commit 395df77e authored by Janis Streib's avatar Janis Streib 🦉
Browse files

ADD: expert mod and direct buttons for record/fqdn creation (closes #273)

parent 0681975c
import TransactionService from './transaction.service'
export default {
getTypes(config) {
const ta = [
{ 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)
}
}
......@@ -76,6 +76,14 @@
<font-awesome-icon :icon="['fas', 'sign-in-alt']"/>
<span> Anmelden</span>
</b-nav-item>
<b-nav-item-dropdown right title="Lokale Anwendungseinstellungen">
<template slot="button-content">
<font-awesome-icon icon="cog"/>
</template>
<b-dropdown-item @click="$store.commit('toggle_expert')">
<b-checkbox :checked="$store.state.expert">Expertenmodus</b-checkbox>
</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse><!-- /.navbar-collapse -->
</b-navbar>
......
......@@ -55,7 +55,8 @@ import {
faGift,
faPlay,
faThumbsUp,
faThumbsDown
faThumbsDown,
faCog
} from '@fortawesome/free-solid-svg-icons'
import {
......@@ -131,5 +132,6 @@ library.add(
faGift,
faPlay,
faThumbsUp,
faThumbsDown
faThumbsDown,
faCog
)
......@@ -81,9 +81,14 @@ async function init() {
executing_transaction: JSON.parse(window.localStorage.getItem('executing_transaction')) || false,
show_sidebar: JSON.parse(window.localStorage.getItem('show_sidebar')) || false,
reload_count: 0,
db_editor_cache: JSON.parse(window.localStorage.getItem('db_editor_cache')) || {}
db_editor_cache: JSON.parse(window.localStorage.getItem('db_editor_cache')) || {},
expert: JSON.parse(window.localStorage.getItem('expert')) || false
},
mutations: {
toggle_expert(state) {
state.expert = !state.expert
window.localStorage.setItem('expert', JSON.stringify(state.expert))
},
emptyState(state) {
state.ta_list = null
window.localStorage.setItem('ta_list', JSON.stringify(state.ta_list))
......
<template>
<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>
</div>
<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>
</template>
<script>
import BCDOverview from '@/views/dnsvs/BCDOverview.vue'
import FQDNOverview from '@/views/dnsvs/FQDNOverview.vue'
import DBEditor from '@/components/DBEditor'
import DNSTypeService from '@/api-services/dns_type.service'
export default {
name: 'Entry',
components: { BCDOverview, FQDNOverview }
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
}
}
}
</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