App.vue 4.52 KB
Newer Older
1
<template>
janis.streib's avatar
FMT    
janis.streib committed
2
3
4
5
6
  <div id="app">
    <Navbar/>
    <div id="wrapper" :class="$store.state.show_sidebar ? 'squished' : null">
      <div id="page-content-wrapper">
        <div class="container">
janis.streib's avatar
janis.streib committed
7
          <b-alert v-if="$sysinfo.host_oper_mode.is_devel" show variant="warning">
janis.streib's avatar
FMT    
janis.streib committed
8
9
10
11
12
            <b-row>
              <b-col cols="1" style="margin-top: auto; margin-bottom: auto" class="vertical-center">
                <font-awesome-icon :icon="['fas', 'dumpster-fire']" size="3x"></font-awesome-icon>
              </b-col>
              <b-col style="margin-top: auto; margin-bottom: auto">
janis.streib's avatar
janis.streib committed
13
14
                      <span><b> WIP!</b>
                        Diese Anwendung befindet sich in aktiver Entwicklung. Einige Features könnten eingeschränkt funktionieren oder unerwartete Ergebnisse liefern.</span>
janis.streib's avatar
FMT    
janis.streib committed
15
16
17
18
19
20
              </b-col>
            </b-row>
          </b-alert>
          <b-breadcrumb :items="breadcrumbs"/>
          <router-view v-bind:key="$store.state.reload_count"/>
          <Footer/>
21
        </div>
janis.streib's avatar
FMT    
janis.streib committed
22
23
24
25
      </div>
      <b-card id="sidebar-wrapper" no-body :class="$store.state.show_sidebar ? 'hide' : null">
        <Sidebar/>
      </b-card>
26
    </div>
janis.streib's avatar
janis.streib committed
27
28
29
30
31
32
33
    <b-modal content-class="text-center" centered id="net-suite-error" hide-footer hide-header size="lg">
      <h1><font-awesome-icon icon="poo-storm" size="3x"></font-awesome-icon></h1>
      <h3>Etwas ist schief gelaufen...</h3>
      <CopyField class="shadow" variant="danger"
                 :text="global_error"
                 multiline/>
    </b-modal>
janis.streib's avatar
FMT    
janis.streib committed
34
  </div>
35
36
37
</template>

<script>
janis.streib's avatar
janis.streib committed
38
import Navbar from './components/Navbar'
janis.streib's avatar
janis.streib committed
39
import CopyField from './components/CopyField'
janis.streib's avatar
janis.streib committed
40
41
import Footer from './components/Footer'
import Sidebar from './components/Sidebar'
janis.streib's avatar
janis.streib committed
42
import {EventBus} from '@/eventbus'
43

janis.streib's avatar
janis.streib committed
44
export default {
janis.streib's avatar
janis.streib committed
45
  components: {Sidebar, Footer, Navbar, CopyField},
janis.streib's avatar
FMT    
janis.streib committed
46
  data() {
janis.streib's avatar
janis.streib committed
47
    return {
janis.streib's avatar
janis.streib committed
48
      global_error: null,
janis.streib's avatar
janis.streib committed
49
50
51
52
      breadcrumbs: []
    }
  },
  watch: {
janis.streib's avatar
FMT    
janis.streib committed
53
    $route() {
janis.streib's avatar
janis.streib committed
54
55
56
57
58
59
      let m = this.$router.currentRoute.matched
      m = m[m.length - 1]
      this.breadcrumbs = this.getBreadcrumbs(m)
    }
  },
  methods: {
janis.streib's avatar
FMT    
janis.streib committed
60
61
    getBreadcrumbs(m) {
      const res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
janis.streib's avatar
janis.streib committed
62
63
64
65
66
67
68
      while ((m.meta && m.meta.resolveParents) || m.parent) {
        if (m.meta && m.meta.resolveParents) {
          const 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
69
            }
janis.streib's avatar
janis.streib committed
70
71
            m = this.$router.resolve(parents[i]).resolved.matched
            m = m[m.length - 1]
janis.streib's avatar
FMT    
janis.streib committed
72
            res.unshift({text: m.meta.resolveName(this.$route.params), to: parents[i]})
janis.streib's avatar
janis.streib committed
73
74
75
          }
        } else {
          m = m.parent
janis.streib's avatar
FMT    
janis.streib committed
76
          res.unshift({text: m.meta.resolveName(this.$route.params), to: m.path})
77
        }
janis.streib's avatar
janis.streib committed
78
79
      }
      return res
80
    }
janis.streib's avatar
janis.streib committed
81
  },
janis.streib's avatar
FMT    
janis.streib committed
82
  mounted() {
janis.streib's avatar
janis.streib committed
83
    window.console.log('%c ', `font-size:0px; padding: 200px; background:url(${window.location.protocol}//${window.location.hostname}:${window.location.port}/important.webp) no-repeat; background-position: center; background-size: contain;`)
janis.streib's avatar
janis.streib committed
84
85
86
87
88
89
90
    const self = this
    EventBus.$on('error', (payload) => {
      window.console.debug('evbus trigger')
      window.console.debug(payload)
      self.global_error = JSON.stringify(payload, null, 4)
      this.$bvModal.show('net-suite-error')
    })
janis.streib's avatar
janis.streib committed
91
92
  }
}
93
</script>
gj4210's avatar
gj4210 committed
94
95

<style lang="scss">
janis.streib's avatar
FMT    
janis.streib committed
96
97
98
99
100
@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';
gj4210's avatar
gj4210 committed
101

janis.streib's avatar
FMT    
janis.streib committed
102
$sidebar-width: 380px;
gj4210's avatar
gj4210 committed
103

janis.streib's avatar
FMT    
janis.streib committed
104
105
106
107
@media screen and (min-width: 981px) {
  #wrapper {
    transition: padding-right .5s;
  }
gj4210's avatar
gj4210 committed
108

janis.streib's avatar
FMT    
janis.streib committed
109
110
111
  #wrapper.squished {
    padding-right: $sidebar-width;
  }
gj4210's avatar
gj4210 committed
112

janis.streib's avatar
FMT    
janis.streib committed
113
114
115
116
117
118
119
120
121
122
123
  #sidebar-wrapper {
    height: 100%;
    width: $sidebar-width;
    position: fixed;
    z-index: 1;
    top: 0;
    right: -$sidebar-width;
    transition: right .5s;
    padding-top: 50px;
    background: #F7F7F7;
  }
gj4210's avatar
gj4210 committed
124

janis.streib's avatar
FMT    
janis.streib committed
125
126
127
128
  #sidebar-wrapper.hide {
    right: 0px;
  }
}
gj4210's avatar
gj4210 committed
129

janis.streib's avatar
FMT    
janis.streib committed
130
131
132
133
134
135
136
137
138
139
140
@media screen and (max-width: 980px) {
  #sidebar-wrapper {
    height: 100%;
    width: 100%;
    position: fixed;
    z-index: 999;
    top: -100%;
    transition: top .5s;
    padding-top: 50px;
    background: #F7F7F7;
  }
gj4210's avatar
gj4210 committed
141

janis.streib's avatar
FMT    
janis.streib committed
142
143
144
145
  #sidebar-wrapper.hide {
    top: 0;
  }
}
146
147
148
149
150
151
152
153
154

.collapse-icon {
  transition: transform;
  transition-duration: 250ms;
}

.not-collapsed > .collapse-icon {
  transform: rotate(-180deg);
}
janis.streib's avatar
janis.streib committed
155
</style>