Commit 051e46e6 by Johannes Edmeier

Link sessionId in sessions view and update of route

parent e2566a0b
......@@ -40,7 +40,7 @@
"autoprefixer": "^7.2.5",
"babel-core": "^6.25.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.0.6",
"babel-jest": "^22.1.0",
"babel-loader": "^7.1.1",
"babel-plugin-lodash": "^3.3.2",
"babel-polyfill": "^6.26.0",
......@@ -60,7 +60,7 @@
"html-loader": "^0.5.4",
"html-webpack-plugin": "^2.30.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^22.0.6",
"jest": "^22.1.1",
"jest-vue": "^0.8.2",
"lodash-webpack-plugin": "^0.11.4",
"node-sass": "^4.7.2",
......@@ -74,7 +74,7 @@
"vue-template-compiler": "^2.5.13",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.2",
"webpack-dev-server": "^2.10.1"
"webpack-dev-server": "^2.11.0"
},
"browserslist": [
"> 2%",
......
......@@ -21,7 +21,7 @@
<div class="field has-addons">
<div class="control">
<span class="select">
<select v-model="filtertype">
<select v-model="filterType">
<option value="username">Username</option>
<option value="sessionId">SessionId</option>
</select>
......@@ -63,7 +63,7 @@
components: {sbaSessionsList},
data: () => ({
filter: '',
filtertype: 'username',
filterType: 'username',
sessions: [],
isLoading: false
}),
......@@ -76,14 +76,13 @@
this.isLoading = true;
try {
if (this.filtertype === 'username') {
if (this.filterType === 'username') {
const response = await this.instance.fetchSessions(this.filter);
this.sessions = response.data.sessions.map(session => new Session(session));
} else {
try {
const response = await this.instance.fetchSession(this.filter);
this.sessions = [new Session(response.data)];
} catch (error) {
if (error.response.status === 404) {
this.sessions = [];
......@@ -95,24 +94,51 @@
} finally {
this.isLoading = false;
}
}, 250)
}, 250),
updateFilterfilter() {
if (this.sessionId) {
this.filterType = 'sessionId';
this.filter = this.sessionId;
}
},
updateRoute() {
if (this.filterType === 'username') {
if (this.sessionId) {
this.$router.replace({
name: 'instance/sessions',
params: {'instanceId': this.instance.id}
});
}
} else {
if (this.sessionId !== this.filter) {
this.$router.replace({
name: 'instance/sessions',
params: {'instanceId': this.instance.id, sessionId: this.filter}
});
}
}
}
},
mounted() {
if (this.sessionId) {
this.filtertype = 'sessionId';
this.filter = this.sessionId;
}
this.updateFilterfilter()
},
watch: {
filtertype() {
sessionId() {
this.updateFilterfilter();
},
filterType() {
this.updateRoute();
this.fetchSessions();
},
filter() {
if (this.filter.match(regexUuid) && this.filtertype !== 'sessionId') {
this.filtertype = 'sessionId';
} else {
this.fetchSessions();
const looksLikeSessionId = this.filter.match(regexUuid);
if (looksLikeSessionId && this.filterType !== 'sessionId') {
this.filterType = 'sessionId';
} else if (!looksLikeSessionId && this.filterType !== 'username') {
this.filterType = 'username';
}
this.updateRoute();
this.fetchSessions();
}
}
}
......
......@@ -27,7 +27,7 @@
<th>Attributes</th>
<th>
<sba-confirm-button class="button" :class="{ 'is-loading' : deletingAll }"
:disabled="sessions.length <= 0" @click="deleteAllSessions()">
v-if="sessions.length > 1" @click="deleteAllSessions()">
<font-awesome-icon icon="trash"></font-awesome-icon>&nbsp;Delete
</sba-confirm-button>
</th>
......@@ -37,7 +37,11 @@
<td>
<span v-if="session.expired" class="tag is-info">Expired</span>
</td>
<td v-text="session.id"></td>
<td>
<router-link v-text="session.id"
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id, sessionId : session.id } }">
</router-link>
</td>
<td v-text="session.creationTime.format('L HH:mm:ss.SSS')"></td>
<td v-text="session.lastAccessedTime.format('L HH:mm:ss.SSS')"></td>
<td>
......
......@@ -49,44 +49,50 @@
<td v-text="thread.threadName"></td>
</tr>
<tr>
<td>Blocked count</td>
<td v-text="thread.details.blockedCount"></td>
<td>Thread state</td>
<td v-text="thread.threadState"></td>
</tr>
<tr>
<td>Blocked time</td>
<td v-text="thread.details.blockedTime"></td>
</tr>
<tr>
<td>Waited count</td>
<td v-text="thread.details.waitedCount"></td>
</tr>
<tr>
<td>Waited time</td>
<td v-text="thread.details.waitedTime"></td>
</tr>
<tr>
<td>Lock name</td>
<td v-text="thread.details.lockName"></td>
</tr>
<tr>
<td>Lock owner id</td>
<td v-text="thread.details.lockOwnerId"></td>
</tr>
<tr>
<td>Lock owner name</td>
<td v-text="thread.details.lockOwnerName"></td>
</tr>
<tr v-if="thread.details.stackTrace.length > 0">
<td colspan="2">Stacktrace
<pre><template
v-for="(frame, idx) in thread.details.stackTrace"><span
:key="`frame-${thread.threadId}-${idx}`"
v-text="`${frame.className}.${frame.methodName}(${frame.fileName}:${frame.lineNumber})`"></span> <span
:key="`frame-${thread.threadId}-${idx}-native`"
class="tag is-dark" v-if="frame.nativeMethod">native</span>
<template v-if="thread.details !== null">
<tr>
<td>Blocked count</td>
<td v-text="thread.details.blockedCount"></td>
</tr>
<tr>
<td>Blocked time</td>
<td v-text="thread.details.blockedTime"></td>
</tr>
<tr>
<td>Waited count</td>
<td v-text="thread.details.waitedCount"></td>
</tr>
<tr>
<td>Waited time</td>
<td v-text="thread.details.waitedTime"></td>
</tr>
<tr>
<td>Lock name</td>
<td v-text="thread.details.lockName"></td>
</tr>
<tr>
<td>Lock owner id</td>
<td v-text="thread.details.lockOwnerId"></td>
</tr>
<tr>
<td>Lock owner name</td>
<td v-text="thread.details.lockOwnerName"></td>
</tr>
<tr v-if="thread.details.stackTrace.length > 0">
<td colspan="2">Stacktrace
<pre><template
v-for="(frame, idx) in thread.details.stackTrace"><span
:key="`frame-${thread.threadId}-${idx}`"
v-text="`${frame.className}.${frame.methodName}(${frame.fileName}:${frame.lineNumber})`"></span> <span
:key="`frame-${thread.threadId}-${idx}-native`"
class="tag is-dark" v-if="frame.nativeMethod">native</span>
</template></pre>
</td>
</tr>
</td>
</tr>
</template>
</table>
</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment