Commit e94370bc by Johannes Edmeier

fix eslint config and fix missing Jolokia reference

fixes #646
parent 807de8af
......@@ -18,8 +18,8 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
ecmaVersion: '2017'
},
......@@ -28,11 +28,12 @@ module.exports = {
},
extends: [
'eslint:recommended',
'plugin:vue-libs/recommended'
'plugin:vue/essential'
],
rules: {
quotes: ['error', 'single']
'quotes': ['error', 'single'],
'no-console': ["error", {allow: ["warn"]}]
},
// required to lint *.vue files
plugins: ['html']
plugins: ['vue']
};
\ No newline at end of file
......@@ -486,13 +486,13 @@
"dev": true
},
"autoprefixer": {
"version": "7.2.6",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-7.2.6.tgz",
"integrity": "sha512-Iq8TRIB+/9eQ8rbGhcP7ct5cYb/3qjNYAR2SnzLCEcwF6rvVOax8+9+fccgXk4bEhQGjOZd5TLhsksmAdsbGqQ==",
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-8.0.0.tgz",
"integrity": "sha512-XBEqAoESCyGu3daYmWcTC37Dwmjvs0y40UtUO3MMX+Pd/w7jwNFfUKNtxoMFu0u0wcotP+arDpU3JVH54UV79Q==",
"dev": true,
"requires": {
"browserslist": "2.11.3",
"caniuse-lite": "1.0.30000807",
"browserslist": "3.0.0",
"caniuse-lite": "1.0.30000808",
"normalize-range": "0.1.2",
"num2fraction": "1.2.2",
"postcss": "6.0.17",
......@@ -500,41 +500,30 @@
},
"dependencies": {
"browserslist": {
"version": "2.11.3",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz",
"integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.0.0.tgz",
"integrity": "sha512-5ArwxNIJxmBTUUTe+F7P2AM8wNf6zFa9mb3/o0JCrhGdd042PuVgAZg4M+A29NUpqFEYl+H3kQQYoZUXfuRS9g==",
"dev": true,
"requires": {
"caniuse-lite": "1.0.30000807",
"caniuse-lite": "1.0.30000808",
"electron-to-chromium": "1.3.33"
}
},
"caniuse-lite": {
"version": "1.0.30000807",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000807.tgz",
"integrity": "sha512-8Dff3cZA8nUOdzGsb7BOzwAv69jzzpx8/MS9YMM169sCxIV+80rRiMWggbu1UTO1HR7qf+cxg4ERRF60JhX3/g==",
"version": "1.0.30000808",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000808.tgz",
"integrity": "sha512-vT0JLmHdvq1UVbYXioxCXHYdNw55tyvi+IUWyX0Zeh1OFQi2IllYtm38IJnSgHWCv/zUnX1hdhy3vMJvuTNSqw==",
"dev": true
},
"chalk": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.1.tgz",
"integrity": "sha512-QUU4ofkDoMIVO7hcx1iPTISs88wsO8jA92RQIm4JAwZvFGGAV2hSAA1NX7oVj2Ej2Q6NDTcRDjPTFrMCRZoJ6g==",
"dev": true,
"requires": {
"ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
},
"dependencies": {
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"dev": true,
"requires": {
"has-flag": "2.0.0"
}
}
"supports-color": "5.2.0"
}
},
"electron-to-chromium": {
......@@ -543,24 +532,30 @@
"integrity": "sha1-vwBwPWKnxlI4E2V4w1LWxcBCpUU=",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"postcss": {
"version": "6.0.17",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.17.tgz",
"integrity": "sha512-Bl1nybsSzWYbP8O4gAVD8JIjZIul9hLNOPTGBIlVmZNUnNAGL+W0cpYWzVwfImZOwumct4c1SDvSbncVWKtXUw==",
"dev": true,
"requires": {
"chalk": "2.3.0",
"chalk": "2.3.1",
"source-map": "0.6.1",
"supports-color": "5.1.0"
"supports-color": "5.2.0"
}
},
"supports-color": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.1.0.tgz",
"integrity": "sha512-Ry0AwkoKjDpVKK4sV4h6o3UJmNRbjYm2uXhwfj3J56lMVdvnUNqzQVRztOOMGQ++w1K/TjNDFvpJk0F/LoeBCQ==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.2.0.tgz",
"integrity": "sha512-F39vS48la4YvTZUPVeTqsjsFNrvcMwrV3RLZINsmHo+7djCvuUzSIeXOnZ5hmjef4bajL1dNccN+tg5XAliO5Q==",
"dev": true,
"requires": {
"has-flag": "2.0.0"
"has-flag": "3.0.0"
}
}
}
......@@ -3763,6 +3758,19 @@
}
}
},
"eslint-loader": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/eslint-loader/-/eslint-loader-1.9.0.tgz",
"integrity": "sha512-40aN976qSNPyb9ejTqjEthZITpls1SVKtwguahmH1dzGCwQU/vySE+xX33VZmD8csU0ahVNCtFlsPgKqRBiqgg==",
"dev": true,
"requires": {
"loader-fs-cache": "1.0.1",
"loader-utils": "1.1.0",
"object-assign": "4.1.1",
"object-hash": "1.2.0",
"rimraf": "2.6.2"
}
},
"eslint-plugin-html": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-4.0.2.tgz",
......@@ -3772,13 +3780,13 @@
"htmlparser2": "3.9.2"
}
},
"eslint-plugin-vue-libs": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-vue-libs/-/eslint-plugin-vue-libs-2.1.0.tgz",
"integrity": "sha512-FFiJJ3apqnXkb3+mIgr4juPKWXL/Bo4jORbW8qYpY78+iRzOLBDcOJGyD6z52h2kO5EqMRfzrfo4Q/28CUPuJw==",
"eslint-plugin-vue": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-4.2.2.tgz",
"integrity": "sha1-Y+VcYVdK+O+YMyjd0miNY4mgIUs=",
"dev": true,
"requires": {
"eslint-plugin-html": "4.0.2"
"vue-eslint-parser": "2.0.2"
}
},
"eslint-scope": {
......@@ -6969,6 +6977,57 @@
"strip-bom": "2.0.0"
}
},
"loader-fs-cache": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/loader-fs-cache/-/loader-fs-cache-1.0.1.tgz",
"integrity": "sha1-VuC/CL2XCLJqdltoUJhAyN7J/bw=",
"dev": true,
"requires": {
"find-cache-dir": "0.1.1",
"mkdirp": "0.5.1"
},
"dependencies": {
"find-cache-dir": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz",
"integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=",
"dev": true,
"requires": {
"commondir": "1.0.1",
"mkdirp": "0.5.1",
"pkg-dir": "1.0.0"
}
},
"find-up": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"requires": {
"path-exists": "2.1.0",
"pinkie-promise": "2.0.1"
}
},
"path-exists": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"requires": {
"pinkie-promise": "2.0.1"
}
},
"pkg-dir": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",
"integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",
"dev": true,
"requires": {
"find-up": "1.1.2"
}
}
}
},
"loader-runner": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz",
......@@ -7821,6 +7880,12 @@
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"object-hash": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-1.2.0.tgz",
"integrity": "sha512-smRWXzkvxw72VquyZ0wggySl7PFUtoDhvhpdwgESXxUrH7vVhhp9asfup1+rVLrhsl7L45Ee1Q/l5R2Ul4MwUg==",
"dev": true
},
"object-keys": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz",
......@@ -12052,6 +12117,31 @@
"loose-envify": "1.3.1"
}
},
"vue-eslint-parser": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-2.0.2.tgz",
"integrity": "sha512-MQE1Tl4kYhp51opFMtRcZuyrFru/erpRI82w96tPiSnhcwK3QjJejAEJ5RlLcLU07Ua7A1WvhXG3i2KFveeGsA==",
"dev": true,
"requires": {
"debug": "3.1.0",
"eslint-scope": "3.7.1",
"eslint-visitor-keys": "1.0.0",
"espree": "3.5.3",
"esquery": "1.0.0",
"lodash": "4.17.5"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
}
}
},
"vue-hot-reload-api": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.2.4.tgz",
......
......@@ -37,7 +37,7 @@
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.11",
"autoprefixer": "^7.2.6",
"autoprefixer": "^8.0.0",
"babel-core": "^6.25.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.2.2",
......@@ -52,8 +52,9 @@
"css-loader": "^0.28.9",
"css-mqpacker": "^6.0.2",
"eslint": "^4.17.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-vue-libs": "^2.1.0",
"eslint-plugin-vue": "^4.2.2",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.6",
"glob": "^7.1.2",
......
......@@ -42,8 +42,15 @@
}
}
.card-list .card {
margin-bottom: 0;
.card {
&.is-hoverable .card-header:hover {
background-color: $white-bis;
}
&.is-active {
margin: $column-gap (-$column-gap);
max-width: unset;
}
}
//Badge
......
......@@ -17,6 +17,7 @@
const components = [];
// eslint-disable-next-line no-undef
const context = require.context('.', false, /^(?:(?!.*\.spec\.(js|vue)$).)*\.(js|vue)$/);
context.keys().forEach(function (key) {
const name = /^(.\/)+(.*)\.(vue|js)$/.exec(key)[2];
......
......@@ -167,8 +167,19 @@ class Instance {
});
}
async readMBeanAttributes(domain, mBean) {
const body = {
type: 'read',
mbean: `${domain}:${mBean}`,
config: {ignoreErrors: true}
};
return axios.post(`instances/${this.id}/actuator/jolokia/`, body, {
headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}
});
}
static async fetchEvents() {
return axios.get(`instances/events`);
return axios.get('instances/events');
}
static getEventStream() {
......
......@@ -63,7 +63,7 @@ Observable.prototype.listen = function (callbackFn) {
callbackFn('completed');
},
error: (error) => {
console.warn("Operation failed:", error);
console.warn('Operation failed:', error);
handle && clearTimeout(handle);
callbackFn('failed');
}
......
......@@ -74,6 +74,7 @@
<script>
const component = {
data: () => ({
// eslint-disable-next-line no-undef
version: __PROJECT_VERSION__
})
};
......
......@@ -65,7 +65,7 @@
<span class="applications-list-item__text">
<a v-text="instance.registration.serviceUrl || instance.registration.healthUrl"
:href="instance.registration.serviceUrl || instance.registration.healthUrl"
@click.stop=""></a>
@click.stop></a>
<span v-text="instance.id"
class="applications-list-item__secondary"></span>
</span>
......@@ -88,15 +88,11 @@
import {directive as onClickaway} from 'vue-clickaway';
export default {
directives: {
onClickaway
},
directives: {onClickaway},
data: () => ({
selected: null,
errors: []
}),
methods: {
select(name) {
this.selected = name;
......
......@@ -70,13 +70,11 @@ export default router => {
}, {
path: 'loggers', component: sbaInstancesLoggers, props: true, name: 'instance/loggers'
}, {
path: 'jolokia', component: sbaInstancesJolokia, props: true, name: 'instance/jolokia'
}, {
path: 'httptrace', component: sbaInstancesTrace, props: true, name: 'instance/httptrace'
}, {
path: 'auditevents', component: sbaInstancesAuditevents, props: true, name: 'instance/auditevents'
}, {
path: 'sessions/:sessionId?', component: sbaInstancesSessions, props: true, name: 'instance/sessions'
path: 'sessions', component: sbaInstancesSessions, props: true, name: 'instance/sessions'
}, {
path: 'liquibase', component: sbaInstancesLiquibase, props: true, name: 'instance/liquibase'
}, {
......
......@@ -35,11 +35,16 @@
<span v-text="event.type" class="tag"
:class="{ 'is-success' : event.isSuccess(), 'is-danger' : event.isFailure() }"></span>
</td>
<td v-text="event.principal"></td>
<td v-if="hasSessionEndpoint && event.principal">
<router-link v-text="event.principal"
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id }, query: { username : event.principal} }">
</router-link>
</td>
<td v-else v-text="event.principal"></td>
<td v-text="event.remoteAddress"></td>
<td v-if="hasSessionEndpoint && event.sessionId">
<router-link v-text="event.sessionId"
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id, sessionId : event.sessionId } }">
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id }, query: { sessionId : event.sessionId } }">
</router-link>
</td>
<td v-else v-text="event.sessionId"></td>
......
......@@ -68,7 +68,7 @@
//draw axis
vm.xAxis.call(d3.axisBottom(x)
.ticks(5)
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
vm.yAxis.call(d3.axisLeft(y)
......
......@@ -67,7 +67,7 @@
//draw axis
vm.xAxis.call(d3.axisBottom(x)
.ticks(5)
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
vm.yAxis.call(d3.axisLeft(y)
......
......@@ -51,7 +51,7 @@
};
export default {
name: "health-default",
name: 'health-default',
components: {healthDiskspace},
props: {
......@@ -62,19 +62,17 @@
computed: {
details() {
if (this.health.details) {
return _.entries(this.health.details).filter(([name, value]) => !isChildHealth(value)).map(([name, value]) => ({
name,
value
}));
return _.entries(this.health.details)
.filter(([, value]) => !isChildHealth(value))
.map(([name, value]) => ({name, value}));
}
return [];
},
childHealth() {
if (this.health.details) {
return _.entries(this.health.details).filter(([name, value]) => isChildHealth(value)).map(([name, value]) => ({
name,
value
}));
return _.entries(this.health.details)
.filter(([, value]) => isChildHealth(value))
.map(([name, value]) => ({name, value}));
}
return [];
}
......
......@@ -91,7 +91,7 @@
//draw axis
vm.xAxis.call(d3.axisBottom(x)
.ticks(5)
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
vm.yAxis.call(d3.axisLeft(y)
......
......@@ -68,7 +68,7 @@
//draw axis
vm.xAxis.call(d3.axisBottom(x)
.ticks(5)
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
vm.yAxis.call(d3.axisLeft(y)
......
......@@ -31,7 +31,7 @@
</div>
<div class="field">
<div class="control has-icons-right" :class="{'is-loading' : prop.status === 'executing'}">
<input class="input" type="text" placeholder="Value" s v-model="prop.input"
<input class="input" type="text" placeholder="Value" v-model="prop.input"
@input="prop.status = null">
<span class="icon is-right has-text-success" v-if="prop.status === 'completed'">
<font-awesome-icon icon="check"></font-awesome-icon>
......
......@@ -26,7 +26,7 @@
</div>
</div>
<div class="field is-grouped is-grouped-multiline" v-if="env && env.activeProfiles.length > 0">
<div class="control" v-for="profile in env.activeProfiles">
<div class="control" v-for="profile in env.activeProfiles" :key="profile">
<div class="tags has-addons">
<span class="tag is-medium">Profile</span>
<span class="tag is-medium is-info" v-text="profile"></span>
......@@ -42,12 +42,12 @@
<input class="input" type="search" placeholder="name / value filter" v-model="filter">
</p>
</div>
<sba-panel v-if="env" class="property-source"
<sba-panel class="property-source"
v-for="propertySource in propertySources" :key="propertySource.name"
:title="propertySource.name">
<table class="table is-fullwidth"
v-if="Object.keys(propertySource.properties).length > 0">
<tr v-for="(value, name) in propertySource.properties">
<tr v-for="(value, name) in propertySource.properties" :key="`${propertySource-name}-${name}`">
<td>
<span v-text="name"></span><br>
<small class="is-muted" v-if="value.origin" v-text="value.origin"></small>
......@@ -91,6 +91,9 @@
}),
computed: {
propertySources() {
if (!this.env) {
return [];
}
if (!this.filter) {
return this.env.propertySources;
}
......
......@@ -42,7 +42,7 @@
</tr>
</thead>
<tbody>
<tr v-for="migration in report.migrations">
<tr v-for="migration in report.migrations" :key="migration.checksum">
<td v-text="migration.type"></td>
<td v-text="migration.checksum"></td>
<td v-text="migration.version"></td>
......
......@@ -169,7 +169,7 @@
//draw axis
vm.xAxis.call(d3.axisBottom(x)
.ticks(10)
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
vm.yAxis.call(d3.axisRight(y)
......
......@@ -70,7 +70,7 @@
<tr v-if="changeSet.labels && changeSet.labels.length > 0">
<td>Labels</td>
<td>
<span v-for="label in changeSet.labels" class="tag is-info" v-text="label"></span>
<span v-for="label in changeSet.labels" :key="label" class="tag is-info" v-text="label"></span>
</td>
</tr>
</table>
......
......@@ -44,7 +44,7 @@
},
methods: {
selectLevel(level) {
this.$emit("input", level);
this.$emit('input', level);
},
cssClass(level) {
return {
......
......@@ -17,6 +17,19 @@
<template>
<section class="section">
<div class="container">
<div class="field has-addons">
<div class="control">
<span class="select">
<select v-model="filter.type">
<option value="username">Username</option>
<option value="sessionId">SessionId</option>
</select>
</span>
</div>
<div class="control is-expanded">
<input class="input" type="text" v-model="filter.value" @keyup.enter="fetchSessions()">
</div>
</div>
<div v-if="error" class="message is-danger">
<div class="message-body">
<strong>
......@@ -25,19 +38,6 @@
</strong>
</div>
</div>
<div class="field has-addons">
<div class="control">
<span class="select">
<select v-model="filterType">
<option value="username">Username</option>
<option value="sessionId">SessionId</option>
</select>
</span>
</div>
<div class="control is-expanded">
<input class="input" type="text" v-model="filter" @keyup.enter="fetchSessions()">
</div>
</div>
<sba-sessions-list :instance="instance" :sessions="sessions"
@deleted="fetch()"></sba-sessions-list>
</div>
......@@ -45,9 +45,9 @@
</template>
<script>
import _ from 'lodash';
import moment from 'moment';
import sbaSessionsList from './sessions-list';
import _ from 'lodash'
import moment from 'moment'
import sbaSessionsList from './sessions-list'
const regexUuid = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/;
......@@ -55,102 +55,91 @@
constructor({creationTime, lastAccessedTime, ...session}) {
Object.assign(this, session);
this.creationTime = moment(creationTime);
this.lastAccessedTime = moment(lastAccessedTime);
this.lastAccessedTime = moment(lastAccessedTime)
}
}
export default {
props: ['instance', 'sessionId'],
props: ['instance'],
components: {sbaSessionsList},
data: () => ({
error: null,
filter: '',
filterType: 'username',
filter: {value: '', type: null},
sessions: [],
isLoading: false
}),
methods: {
fetch: _.debounce(async function () {
this.error = null;
if (!this.filter) {
if (!this.filter.value) {
this.sessions = [];
return;
}
this.isLoading = true;
try {
if (this.filterType === 'username') {
this.sessions = await this.fetchSessions();
if (this.filter.type === 'sessionId') {
this.sessions = await this.fetchSession()
} else {
this.sessions = await this.fetchSession();
this.sessions = await this.fetchSessions()
}
} catch (error) {
console.warn('Fetching sessions failed:', error);
this.error = error;
this.error = error
} finally {
this.isLoading = false;
this.isLoading = false
}
}, 250),
async fetchSession() {
try {
const response = await this.instance.fetchSession(this.filter);
return [new Session(response.data)];
const response = await this.instance.fetchSession(this.filter.value);
return [new Session(response.data)]
} catch (error) {
if (error.response.status === 404) {
return [];
return []
} else {
throw error;
throw error
}
}
},
async fetchSessions() {
const response = await this.instance.fetchSessions(this.filter);
return response.data.sessions.map(session => new Session(session));
const response = await this.instance.fetchSessions(this.filter.value);
return response.data.sessions.map(session => new Session(session))
},
updateFilter() {
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}
});
}
}
this.filter = _.entries(this.$route.query)
.reduce((acc, [name, value]) => {
acc.type = name;
acc.value = value;
return acc;
}, {type: null, value: ''});
}
},
mounted() {
this.updateFilter()
this.updateFilter();
},
watch: {
sessionId() {
'$route.query'() {
this.updateFilter();
},
filterType() {
this.updateRoute();
this.fetch();
},
filter() {
const looksLikeSessionId = this.filter.match(regexUuid);
if (looksLikeSessionId && this.filterType !== 'sessionId') {
this.filterType = 'sessionId';
} else if (!looksLikeSessionId && this.filterType !== 'username') {
this.filterType = 'username';
filter: {
deep: true,
handler() {
if (this.filter.type === null) {
const looksLikeSessionId = this.filter.value.match(regexUuid);
this.filter.type = looksLikeSessionId ? 'sessionId' : 'username';
}
const query = {[this.filter.type]: this.filter.value};
if (!_.isEqual(query, !this.$route.query)) {
this.$router.replace({
name: 'instance/sessions',
query: query
});
}
this.fetch();
}
this.updateRoute();
this.fetch();
}
}
}
......
......@@ -43,7 +43,7 @@
</td>
<td>
<router-link v-text="session.id"
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id, sessionId : session.id } }">
:to="{ name: 'instance/sessions', params: { 'instanceId' : instance.id}, query: { sessionId : session.id } }">
</router-link>
</td>
<td v-text="session.creationTime.format('L HH:mm:ss.SSS')"></td>
......@@ -66,7 +66,7 @@
</button>
</td>
</tr>
<tr v-if="sessions.length=== 0">
<tr v-if="sessions.length === 0">
<td class="is-muted" colspan="7 ">No sessions found.</td>
</tr>
</table>
......@@ -95,7 +95,7 @@
vm.deletingAll = 'deleted';
vm.$emit('deleted', '*');
},
error: error => {
error: () => {
vm.deletingAll = 'failed';
},
});
......
......@@ -29,7 +29,7 @@
<div class="level-right">
<nav class="tabs is-boxed is-right">
<ul>
<li v-if="instance" v-for="view in activeViews"
<li v-if="instance" v-for="view in activeViews" :key="view.name"
:class="{'is-active' : $route.name === view.name}">
<a v-if="view.href" :href="view.href({ 'instanceId' : instance.id })"
target="_blank">
......
......@@ -60,7 +60,8 @@
const now = moment.now().valueOf();
vm.threads = vm.threads || {};
//initialize with all known live threads, which will be removed from the list if still alive
const terminatedThreads = _.entries(vm.threads).filter(([threadId, value]) => value.threadState !== 'TERMINATED')
const terminatedThreads = _.entries(vm.threads)
.filter(([, value]) => value.threadState !== 'TERMINATED')
.map(([threadId]) => parseInt(threadId));
threads.forEach(
......
......@@ -131,7 +131,7 @@
},
methods: {
getTimeExtent(timelines) {
return _.entries(timelines).map(([threadId, value]) => value.timeline)
return _.entries(timelines).map(([, value]) => value.timeline)
.map(timeline => ({
start: timeline[0].start,
end: timeline[timeline.length - 1].end
......@@ -157,7 +157,7 @@
.attr('width', width)
.call(d3.axisBottom(x)
.ticks(Math.max(2, Math.floor(width / 50)))
.tickFormat(d => moment(d).format("HH:mm:ss"))
.tickFormat(d => moment(d).format('HH:mm:ss'))
);
_.entries(timelines).forEach(([threadId, value]) => {
......
......@@ -58,6 +58,11 @@ const config = {
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre'
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
......
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