App.vue 7.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
<template>
    <div id="app">
        <b-navbar toggleable="lg" fixed="top" :type="$sysinfo.host_oper_mode.is_prod?'light':'dark'" :variant="$sysinfo.host_oper_mode.is_prod?'light':'dark'" :class="`bg-${$sysinfo.host_oper_mode.mode}`">
            <!-- Brand and toggle get grouped for better mobile display -->
            <b-navbar-brand to="/">
                <img class="d-inline-block align-top scc-img" alt="SCC" src="@/assets/img/scc_logo_small.png"/>
                <span v-if="!$sysinfo.host_oper_mode.is_prod"> Instanz: {{$sysinfo.host_oper_mode.mode}}</span>
            </b-navbar-brand>
            <b-navbar-toggle target="navbarNavDropdown">
                <font-awesome-icon icon="bars"></font-awesome-icon>
            </b-navbar-toggle>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <b-collapse is-nav id="navbarNavDropdown">
janis.streib's avatar
janis.streib committed
14
15
16
17
18
19
20
21
22
                <b-navbar-nav>
                    <b-nav-item v-if="$sysinfo_mods_by_name['dnsvs']" to="/dnsvs/" :active="$route.path.startsWith('/dnsvs/')">DNSVS</b-nav-item>
                    <b-nav-item v-if="$sysinfo_mods_by_name['dhcp_leases']" to="/dhcp-leases/" :active="$route.path.startsWith('/dhcp-leases/')">DHCP-Leases</b-nav-item>
                    <b-nav-item href="https://www-net.scc.kit.edu/~netadmin/natvs/user/wrapper.cgi/" target="_blank">NATVS+</b-nav-item>
                    <b-nav-item href="https://www-net.scc.kit.edu/~netadmin/netdoc/user/wrapper.cgi/" target="_blank">NETDOC</b-nav-item>
                </b-navbar-nav>
                <b-navbar-nav class="ml-auto">
                    <b-nav-form>
                        <div class="input-group mr-sm-2">
23

janis.streib's avatar
janis.streib committed
24
25
26
27
28
29
30
31
32
                            <div id="scope_filter_display" class="input-group-prepend">
                                <span class="input-group-text">DNSVS</span>
                            </div>
                            <input class="form-control" type="search" id="nav-search" name="search"
                                   placeholder="Suchbegriff"
                                   aria-label="Search">
                            <div class="input-group-append">
                                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Suchen</button>
                            </div>
33
                        </div>
janis.streib's avatar
janis.streib committed
34
35
36
                    </b-nav-form>
                    <b-nav-item><span class="d-none d-xl-inline">Erweiterte </span>Suche</b-nav-item>
                    <b-nav-item>
37
38
39
                            <i class="fas fa-tasks" aria-hidden="true"></i> Transaktion <span
                                class="badge badge-pill badge-success"
                                id="trans_count">0</span>
janis.streib's avatar
janis.streib committed
40
                    </b-nav-item>
41
                    <b-nav-item-dropdown v-if="$store.state.user">
janis.streib's avatar
janis.streib committed
42
                        <template slot="button-content">
43
                            <font-awesome-icon :icon="['far', 'user']"></font-awesome-icon>
44
                            <span v-if="$store.state.user"> {{$store.state.user.login_name}}</span>
janis.streib's avatar
janis.streib committed
45
                        </template>
46
                        <b-dropdown-item v-if="$store.state.user" to="/logout">Abmelden</b-dropdown-item>
janis.streib's avatar
janis.streib committed
47
                    </b-nav-item-dropdown>
48
49
50
51
                    <b-nav-item v-if="!$store.state.user">
                            <font-awesome-icon :icon="['far', 'user']"></font-awesome-icon>
                            <span> Anmelden</span>
                    </b-nav-item>
52

janis.streib's avatar
janis.streib committed
53
                </b-navbar-nav>
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
            </b-collapse><!-- /.navbar-collapse -->
        </b-navbar>
        <div id="wrapper">
            <div id="page-content-wrapper">
                <div class="container">
                    <b-breadcrumb :items="breadcrumbs"/>
                    <router-view/>
                    <footer>
                        <hr>
                        <p class="pull-right d-print-none">
                            <a target="_blank" href="https://www-net-doku.scc.kit.edu/webapi/release/dnscfg-perms/"><font-awesome-icon :icon="['far', 'life-ring']"></font-awesome-icon> Hilfe/Dokumentation</a> |
                            <a target="_blank" href="https://www-net-devel-doku.scc.kit.edu/webapi/release/intro/"><font-awesome-icon icon="code"></font-awesome-icon> API</a> |
                            <a target="_blank" href="https://git.scc.kit.edu/scc-net/net-suite/net-suite/issues"><font-awesome-icon icon="bug"></font-awesome-icon> Fehler melden</a> |
                            Kontakt: <a href="mailto:dns-betrieb@scc.kit.edu">dns-betrieb∂scc.kit.edu</a>
                        </p>
                        <p class="pull-left">Instanz: {{$sysinfo.host_oper_mode.mode}} | <b-link v-b-modal.net-suite-version>Version</b-link></p>
                            <b-modal class="text-center" id="net-suite-version" hide-footer hide-header>
                                <img alt="SCC" src="@/assets/img/scc_logo_small.png"/>
                                <h3>NET-Suite</h3>
                                <p>
                                Version <a :href="`https://git.scc.kit.edu/scc-net/net-suite/net-suite/commit/${$sysinfo.version}`" target="_blank">{{$sysinfo.version}}</a>
                                </p>
                                Module:
                                <ul>
                                    <li v-for="m in $sysinfo.mods" :key="m.mod_path">MOD_{{m.mod_path}}:
                                        <a target="_blank" :href="`${m.gitlab_url}/commit/${m.version}`">{{m.version}}</a></li>
                                </ul>
                            </b-modal>
                    </footer>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="scss">
    @import '../node_modules/bootstrap/scss/bootstrap.scss';
    @import '../node_modules/bootstrap-vue/dist/bootstrap-vue.css';
    @import 'assets/css/net-suite.css';
    @import 'assets/css/net-suite-devel.css';
    @import 'assets/css/net-suite-test.css';
</style>

<script>
    export default {
        data() {
            return {
101
                breadcrumbs: [],
102
103
104
            }
        },
        watch: {
105
            $route() {
106
107
                var m = this.$router.currentRoute.matched
                m = m[m.length - 1]
108
109
110
111
112
                this.breadcrumbs = this.gen_bread(m)
            }
        },
        methods: {
            gen_bread(m) {
113
                var res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
114
115
116
117
118
119
120
121
122
123
124
125
                while ((m.meta && m.meta.resolveParents) || m.parent) {
                    if (m.meta && m.meta.resolveParents) {
                        let parents = m.meta.resolveParents(this.$route.params)
                        for(let i=0;i<parents.length;i++) {
                            if(typeof parents[i] === 'object' && 'text' in parents[i] && 'to' in parents[i]) {
                                res.unshift(parents[i])
                                continue
                            }
                            m = this.$router.resolve(parents[i]).resolved.matched
                            m = m[m.length - 1]
                            res.unshift({text: m.meta.resolveName(this.$route.params), to: parents[i]})
                        }
126
127
                    } else {
                        m = m.parent
128
                        res.unshift({text: m.meta.resolveName(this.$route.params), to: m.path})
129
130
                    }
                }
131
132
                return res

133
134
135
136
            }
        }
    }
</script>