App.vue 7.13 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
41
42
                    </b-nav-item>
                    <b-nav-item-dropdown>
                        <template slot="button-content">
43
                            <font-awesome-icon :icon="['far', 'user']"></font-awesome-icon>
44
45
                            <span v-if="session"> {{session.user.login_name}}</span>
                            <span v-if="!session"> Anmelden</span>
janis.streib's avatar
janis.streib committed
46
47
48
                        </template>
                            <b-dropdown-item to="/logout">Abmelden</b-dropdown-item>
                    </b-nav-item-dropdown>
49

janis.streib's avatar
janis.streib committed
50
                </b-navbar-nav>
51
52
53
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
            </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>
95
96
    import SessionService from '@/api-services/session.service'

97
98
99
    export default {
        data() {
            return {
100
101
                breadcrumbs: [],
                session: null,
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
            }
        },
        watch: {
            $route(to, from) {
                var m = this.$router.currentRoute.matched
                m = m[m.length - 1]
                var res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
                while ((m.meta && m.meta.resolveParent) || m.parent) {
                    if (m.meta && m.meta.resolveParent) {
                        m = this.$router.resolve(m.meta.resolveParent(this.$route.params)).resolved.matched
                        m = m[m.length-1]
                    } else {
                        m = m.parent
                    }
                    res.unshift({text: m.meta.resolveName(this.$route.params), to: m.path})
                }
                this.breadcrumbs = res
            }
        },
        methods: {
            upd_bread() {
                var m = this.$router.currentRoute.matched
                var res = []
                for (var i = 0; i < m.length; i++) {
                    res.push({text: m.name, to: m.path})
                }
                this.breadcrumbs = res
            }
130
131
132
133
134
        },
        created() {
            SessionService.get().then((res) =>{
                this.session = res.data
            })
135
136
137
        }
    }
</script>