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 @@ ...@@ -76,6 +76,14 @@
<font-awesome-icon :icon="['fas', 'sign-in-alt']"/> <font-awesome-icon :icon="['fas', 'sign-in-alt']"/>
<span> Anmelden</span> <span> Anmelden</span>
</b-nav-item> </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-navbar-nav>
</b-collapse><!-- /.navbar-collapse --> </b-collapse><!-- /.navbar-collapse -->
</b-navbar> </b-navbar>
......
...@@ -55,7 +55,8 @@ import { ...@@ -55,7 +55,8 @@ import {
faGift, faGift,
faPlay, faPlay,
faThumbsUp, faThumbsUp,
faThumbsDown faThumbsDown,
faCog
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { import {
...@@ -131,5 +132,6 @@ library.add( ...@@ -131,5 +132,6 @@ library.add(
faGift, faGift,
faPlay, faPlay,
faThumbsUp, faThumbsUp,
faThumbsDown faThumbsDown,
faCog
) )
...@@ -81,9 +81,14 @@ async function init() { ...@@ -81,9 +81,14 @@ async function init() {
executing_transaction: JSON.parse(window.localStorage.getItem('executing_transaction')) || false, executing_transaction: JSON.parse(window.localStorage.getItem('executing_transaction')) || false,
show_sidebar: JSON.parse(window.localStorage.getItem('show_sidebar')) || false, show_sidebar: JSON.parse(window.localStorage.getItem('show_sidebar')) || false,
reload_count: 0, 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: { mutations: {
toggle_expert(state) {
state.expert = !state.expert
window.localStorage.setItem('expert', JSON.stringify(state.expert))
},
emptyState(state) { emptyState(state) {
state.ta_list = null state.ta_list = null
window.localStorage.setItem('ta_list', JSON.stringify(state.ta_list)) window.localStorage.setItem('ta_list', JSON.stringify(state.ta_list))
......
<template> <template>
<div id="dnsvs_Entry"> <div id="dnsvs_Entry">
<h1>DNSVS</h1> <h1>DNSVS</h1>
<b-nav tabs align="center"> <div v-if="$store.state.expert">
<b-nav-item :active="$route.name === 'bcds'" to="/dnsvs/bcds">Ihre Broadcastdomains (BCDs)</b-nav-item> <b-row>
<b-nav-item :active="$route.name === 'fqdns'" to="/dnsvs/fqdns">Ihre Domains</b-nav-item> <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-nav> <b-col><b-button :disabled="!create_fqdn_reducer" variant="outline-success" block>FQDN anlegen</b-button></b-col>
<BCDOverview v-if="$route.name === 'bcds'"></BCDOverview> </b-row>
<FQDNOverview v-if="$route.name === 'fqdns'"></FQDNOverview> <hr>
</div> </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> </template>
<script> <script>
import BCDOverview from '@/views/dnsvs/BCDOverview.vue' import BCDOverview from '@/views/dnsvs/BCDOverview.vue'
import FQDNOverview from '@/views/dnsvs/FQDNOverview.vue' import FQDNOverview from '@/views/dnsvs/FQDNOverview.vue'
import DBEditor from '@/components/DBEditor'
import DNSTypeService from '@/api-services/dns_type.service'
export default { export default {
name: 'Entry', 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> </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