Mercurial > gemma
annotate client/src/logs/logs.vue @ 1019:ca628dce90dd
Licensing information added
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 24 Oct 2018 09:42:32 +0200 |
parents | aa2acb942e55 |
children | 51e42c2e110a |
rev | line source |
---|---|
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div class="main d-flex flex-column"> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <div class="d-flex flex-row"> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 <div :class="spacer"></div> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <div class="logoutput shadow"> |
818 | 6 <pre id="code" v-highlightjs="logs"><code class="bash"></code></pre> |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 </div> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 </div> |
835 | 9 <div class="d-flex flex-row logmenu"> |
10 <div class="d-flex align-self-center"> | |
11 <ul class="nav nav-pills"> | |
12 <li class="nav-item"> | |
13 <a @click="fetch('system/log/apache2/access.log', 'accesslog')" :class="accesslogStyle" href="#">Accesslog</a> | |
14 </li> | |
15 <li class="nav-item"> | |
16 <a @click="fetch('system/log/apache2/error.log', 'errorlog')" :class="errorlogStyle" href="#">Errorlog</a> | |
17 </li> | |
18 </ul> | |
19 </div> | |
20 <div class="statuscontainer d-flex flex-row"> | |
21 <div class="statusline align-self-center"> | |
22 <h3>Last refresh: {{refreshed}}</h3> | |
23 </div> | |
24 <div class="refresh"> | |
839 | 25 <button class="btn btn-dark" @click="fetch(currentFile, currentLog)">Refresh</button> |
835 | 26 </div> |
27 </div> | |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
28 </div> |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 </div> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 </template> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 <style scoped lang="scss"> |
835 | 33 .statuscontainer { |
34 width: 87%; | |
35 position: relative; | |
36 } | |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
37 .logmenu { |
835 | 38 margin-left: 5rem; |
39 min-width: 60vw; | |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
40 } |
818 | 41 #code { |
42 overflow: auto; | |
43 } | |
835 | 44 .refresh { |
45 position: absolute; | |
46 right: 0; | |
47 } | |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 .logoutput { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 width: 95%; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 height: 85vh; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 margin-top: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 margin-right: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 margin-left: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 text-align: left; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 background-color: white; |
818 | 56 overflow: auto; |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 transition: $transition-fast; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 .spacer { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 margin-left: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 height: 90vh; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
64 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 .spacer-collapsed { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 min-width: $icon-width + $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 transition: $transition-fast; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 .spacer-expanded { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 min-width: $sidebar-width + $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 } |
835 | 73 |
74 .statusline { | |
75 position: absolute; | |
76 right: 0; | |
77 margin-top: 0.3rem; | |
78 margin-left: $offset; | |
79 margin-right: 7rem; | |
80 } | |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 </style> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
84 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
85 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
86 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
87 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
88 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
89 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
90 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
91 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
92 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
93 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
94 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
95 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
96 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
97 */ |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 import { mapGetters } from "vuex"; |
809 | 99 import { HTTP } from "../application/lib/http.js"; |
880
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
100 import "../../node_modules/highlight.js/styles/paraiso-dark.css"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
101 import Vue from "vue"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
102 import VueHighlightJS from "vue-highlightjs"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
103 Vue.use(VueHighlightJS); |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
105 const ACCESSLOG = "accesslog"; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
106 const ERRORLOG = "errorlog"; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
107 |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 export default { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 name: "logs", |
809 | 110 mounted() { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
111 this.fetch("system/log/apache2/access.log", ACCESSLOG); |
809 | 112 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 data() { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 return { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
115 logs: null, |
835 | 116 currentLog: null, |
839 | 117 currentFile: null, |
835 | 118 refreshed: null |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 }, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 methods: { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
122 fetch(file, type) { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
123 HTTP.get(file, { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
124 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
125 }) |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
126 .then(response => { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
127 this.logs = response.data.content; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
128 this.currentLog = type; |
835 | 129 this.refreshed = new Date().toLocaleString(); |
839 | 130 this.currentFile = file; |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
131 }) |
853 | 132 .catch(); |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
133 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 disallow(e) { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 e.target.blur(); |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 }, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
138 computed: { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 ...mapGetters("application", ["sidebarCollapsed", "isUsermenuCollapsed"]), |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
140 accesslogStyle() { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
141 return { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
142 active: this.currentLog == ACCESSLOG, |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
143 "nav-link": true |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
144 }; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
145 }, |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
146 errorlogStyle() { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
147 return { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
148 active: this.currentLog == ERRORLOG, |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
149 "nav-link": true |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
150 }; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
151 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
152 spacer() { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
153 return { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
154 spacer: true, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
155 "spacer-expanded": !this.sidebarCollapsed, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
156 "spacer-collapsed": this.sidebarCollapsed |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
157 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
158 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
159 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
160 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
161 </script> |