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