Mercurial > gemma
annotate client/src/logs/logs.vue @ 1123:d9e6a1f6f394 store-refactoring
moved all collapse flags for UI elements to store
UI elements can now be expanded/collapsed via the application store
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 06 Nov 2018 13:00:17 +0100 |
parents | 51e42c2e110a |
children | b23622905a3f |
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 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 <style scoped lang="scss"> |
835 | 41 .statuscontainer { |
42 width: 87%; | |
43 position: relative; | |
44 } | |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
45 .logmenu { |
835 | 46 margin-left: 5rem; |
47 min-width: 60vw; | |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
48 } |
818 | 49 #code { |
50 overflow: auto; | |
51 } | |
835 | 52 .refresh { |
53 position: absolute; | |
54 right: 0; | |
55 } | |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
56 .logoutput { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 width: 95%; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 height: 85vh; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 margin-top: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 margin-right: $offset; |
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 text-align: left; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 background-color: white; |
818 | 64 overflow: auto; |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 transition: $transition-fast; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 .spacer { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 margin-left: $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 height: 90vh; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
73 .spacer-collapsed { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
74 min-width: $icon-width + $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 transition: $transition-fast; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
77 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 .spacer-expanded { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 min-width: $sidebar-width + $offset; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 } |
835 | 81 |
82 .statusline { | |
83 position: absolute; | |
84 right: 0; | |
85 margin-top: 0.3rem; | |
86 margin-left: $offset; | |
87 margin-right: 7rem; | |
88 } | |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 </style> |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
92 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
93 * 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
|
94 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
95 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
96 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
97 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
98 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
99 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
100 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
101 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
102 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
103 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
104 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
105 */ |
1123
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1069
diff
changeset
|
106 import { mapState } from "vuex"; |
809 | 107 import { HTTP } from "../application/lib/http.js"; |
880
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
108 import "../../node_modules/highlight.js/styles/paraiso-dark.css"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
109 import Vue from "vue"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
110 import VueHighlightJS from "vue-highlightjs"; |
aa2acb942e55
refac: reduce bundlesize
Thomas Junk <thomas.junk@intevation.de>
parents:
853
diff
changeset
|
111 Vue.use(VueHighlightJS); |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
113 const ACCESSLOG = "accesslog"; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
114 const ERRORLOG = "errorlog"; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
115 |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 export default { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 name: "logs", |
809 | 118 mounted() { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
119 this.fetch("system/log/apache2/access.log", ACCESSLOG); |
809 | 120 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 data() { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 return { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
123 logs: null, |
835 | 124 currentLog: null, |
839 | 125 currentFile: null, |
835 | 126 refreshed: null |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
127 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
128 }, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 methods: { |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
130 fetch(file, type) { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
131 HTTP.get(file, { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
132 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
133 }) |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
134 .then(response => { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
135 this.logs = response.data.content; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
136 this.currentLog = type; |
835 | 137 this.refreshed = new Date().toLocaleString(); |
839 | 138 this.currentFile = file; |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
139 }) |
853 | 140 .catch(); |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
141 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
142 disallow(e) { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
143 e.target.blur(); |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
144 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
145 }, |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
146 computed: { |
1123
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1069
diff
changeset
|
147 ...mapState("application", ["showSidebar"]), |
814
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
148 accesslogStyle() { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
149 return { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
150 active: this.currentLog == ACCESSLOG, |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
151 "nav-link": true |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
152 }; |
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 errorlogStyle() { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
155 return { |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
156 active: this.currentLog == ERRORLOG, |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
157 "nav-link": true |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
158 }; |
d6888d1439e5
error log and access log selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
809
diff
changeset
|
159 }, |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
160 spacer() { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
161 return { |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
162 spacer: true, |
1123
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1069
diff
changeset
|
163 "spacer-expanded": this.showSidebar, |
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1069
diff
changeset
|
164 "spacer-collapsed": !this.showSidebar |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
165 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
166 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
167 } |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 }; |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 </script> |