mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
incremental work on ui
This commit is contained in:
parent
ae2e0ee115
commit
579efb767a
61
docsys/src/main/node/docsys/components/AppSelector.vue
Normal file
61
docsys/src/main/node/docsys/components/AppSelector.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-menu offset-y>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn title="App Selector" v-bind="attrs" v-on="on">APPS</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-btn to="/ui/run" title="Run a workload">Run</v-btn>
|
||||
<v-btn to="/ui/build" title="Build a workload from a schema" >Build</v-btn>
|
||||
<v-btn to="/ui/status" title="See running workloads" >Status</v-btn>
|
||||
<v-btn to="/ui/workspaces" title="Run a workload">Workspaces</v-btn>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<!-- <v-select dense-->
|
||||
<!-- hide-details="auto"-->
|
||||
<!-- label="app"-->
|
||||
<!-- v-model="thisapp"-->
|
||||
<!-- :items="empty"-->
|
||||
<!-- @select="selected(thisapp)"-->
|
||||
<!-- @change="selected(thisapp)"-->
|
||||
<!-- >-->
|
||||
<!-- <template v-slot:append-item>-->
|
||||
<!-- <v-list-item><nuxt-link to="/ui/run">Run</nuxt-link></v-list-item>-->
|
||||
<!-- <v-list-item><nuxt-link to="/ui/build">Build</nuxt-link></v-list-item>-->
|
||||
<!-- <v-list-item><nuxt-link to="/ui/status">Status</nuxt-link></v-list-item>-->
|
||||
<!-- <v-list-item><nuxt-link to="/ui/workspaces">Workspaces</nuxt-link></v-list-item>-->
|
||||
<!-- </template>-->
|
||||
<!-- </v-select>-->
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'app-selector',
|
||||
data() {
|
||||
let data = {
|
||||
empty: [],
|
||||
apps: ['build','run','status','workspaces'],
|
||||
thisapp: 'build'
|
||||
};
|
||||
return data;
|
||||
},
|
||||
computed: {
|
||||
current: {
|
||||
get: function() {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selected(evt) {
|
||||
console.log("selected:" + JSON.stringify(evt))
|
||||
let selected_path = "/ui/" + evt;
|
||||
if (!this.$route.fullPath.includes(selected_path)) {
|
||||
// this.$router.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-text-field dense
|
||||
full-width
|
||||
label="Name of new workspace"
|
||||
v-if="mode=='adding'"
|
||||
v-if="mode==='adding'"
|
||||
v-model="new_workspace"
|
||||
ref="new_workspace_input"
|
||||
hint="workspace name"
|
||||
@ -10,8 +11,9 @@
|
||||
@keydown.enter="commitWorkspace(new_workspace)"
|
||||
></v-text-field>
|
||||
<v-select dense
|
||||
hide-details="auto"
|
||||
label="workspace"
|
||||
v-if="mode=='showing'"
|
||||
v-if="mode==='showing'"
|
||||
v-model="workspace"
|
||||
:items="workspaces"
|
||||
item-text="name"
|
||||
@ -29,63 +31,83 @@
|
||||
|
||||
export default {
|
||||
name: 'workspace-selector',
|
||||
data(context) {
|
||||
let data = {
|
||||
new_workspace: "",
|
||||
mode: "showing",
|
||||
workspaces: [{name: 'default'}],
|
||||
workspace: {name: 'default'},
|
||||
enabled: false
|
||||
};
|
||||
return data;
|
||||
data() {
|
||||
let mode = "showing";
|
||||
let new_workspace = "";
|
||||
return {mode, new_workspace}
|
||||
},
|
||||
methods: {
|
||||
addWorkspace: function (evt) {
|
||||
this.mode = "adding";
|
||||
setTimeout(() => {
|
||||
this.$refs.new_workspace_input.$el.focus()
|
||||
});
|
||||
console.log("add evt:" + JSON.stringify(evt));
|
||||
computed: {
|
||||
workspace: {
|
||||
get() {
|
||||
return this.$store.getters["workspaces/getWorkspace"]
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch("workspaces/setWorkspace", val)
|
||||
}
|
||||
},
|
||||
commitWorkspace: function (evt) {
|
||||
console.log("commit evt:" + JSON.stringify(evt));
|
||||
let committed = this.$axios.$get("/services/workspaces/" + evt)
|
||||
.then(res => {
|
||||
return res;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("create: error: " + e)
|
||||
});
|
||||
console.log("committed: " + JSON.stringify(committed))
|
||||
this.workspaces = this.$axios.$get("/services/workspaces/")
|
||||
.then(res => {
|
||||
console.log("workspaces async:" + JSON.stringify(res));
|
||||
return res;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("refresh error: " + e)
|
||||
});
|
||||
this.workspace = evt;
|
||||
this.mode = "showing"
|
||||
this.$forceUpdate();
|
||||
workspaces: {
|
||||
get() {
|
||||
return this.$store.getters["workspaces/getWorkspaces"]
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch("workspaces/setWorkspaces", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
async asyncData({$axios, store}) {
|
||||
let enabled = await $axios.$get("/services/status")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
let workspaces = await $axios.$get("/services/workspaces/")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
return {enabled, workspaces}
|
||||
methods: {
|
||||
addWorkspace: function () {
|
||||
this.mode = "adding";
|
||||
},
|
||||
commitWorkspace: function ({$store}) {
|
||||
console.log("commit:" + JSON.stringify(this.new_workspace));
|
||||
this.$store.dispatch("workspaces/activateWorkspace", this.new_workspace);
|
||||
this.mode = "showing";
|
||||
//
|
||||
//
|
||||
// WorkspaceService.getWorkspace({'name': this.new_workspace})
|
||||
// .then(res => {
|
||||
// console.log("async create workspace: " + JSON.stringify(res));
|
||||
// })
|
||||
// .then(res => {
|
||||
// return WorkspaceService.getWorkspaces();
|
||||
// })
|
||||
// .then(res => {
|
||||
// console.log("get workspaces: " + JSON.stringify(res));
|
||||
// this.setWorkspaces(res)
|
||||
// this.setWorkspace(this.new_workspace)
|
||||
// this.new_workspace = "";
|
||||
// this.mode = "showing"
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// console.log("error in commitWorkspaces: " + e)
|
||||
// })
|
||||
}
|
||||
// async getWorkspaces() {
|
||||
// const response = await WorkspaceService.getWorkspaces()
|
||||
// this.setWorkspaces()
|
||||
// },
|
||||
// setWorkspaces: function (workspaces) {
|
||||
// this.workspaces = workspaces;
|
||||
// this.$store.commit('workspaces/setWorkspaces', this.workspaces);
|
||||
// },
|
||||
// selectWorkspace: function (selected) {
|
||||
// this.workspace = selected;
|
||||
// this.$store.commit('workspaces/setWorkspace', this.workspace);
|
||||
// }
|
||||
},
|
||||
created() {
|
||||
console.log("created component...");
|
||||
// this.$store.subscribe((mutation, state) => {
|
||||
// console.log("mutation type " + mutation.type);
|
||||
// if (mutation.type === 'workspaces/setWorkspace') {
|
||||
// this.workspace = this.$store.state.workspaces.workspace;
|
||||
// } else if (mutation.type === 'workspaces/setWorkspaces') {
|
||||
// this.workspacaes = this.$store.state.workspaces.workspaces;
|
||||
// } else {
|
||||
// console.error("Unrecognized mutation", mutation)
|
||||
// }
|
||||
// })
|
||||
this.$store.dispatch('workspaces/initWorkspaces', "selector load");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -3,7 +3,11 @@
|
||||
<nuxt />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DefaultLayout"
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
html {
|
||||
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
||||
|
@ -46,7 +46,9 @@ export default {
|
||||
'@nuxtjs/axios'
|
||||
],
|
||||
axios: {
|
||||
baseURL: "http://localhost:12345/",
|
||||
port: 12345,
|
||||
browserBaseURL: 'http://localhost:12345/services/',
|
||||
progress: true
|
||||
},
|
||||
/*
|
||||
** vuetify module configuration
|
||||
|
@ -47,8 +47,9 @@ export default {
|
||||
'@nuxtjs/axios'
|
||||
],
|
||||
axios: {
|
||||
port: 12345
|
||||
|
||||
port: 12345,
|
||||
browserBaseURL: 'http://localhost:12345/services/',
|
||||
progress: true
|
||||
},
|
||||
/*
|
||||
** vuetify module configuration
|
||||
|
@ -5,6 +5,7 @@
|
||||
<v-toolbar-title>NoSQLBench - Worlkoad Generator</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<app-selector></app-selector>
|
||||
<workspace-selector></workspace-selector>
|
||||
<v-btn text href="https://github.com/nosqlbench/nosqlbench/wiki/Submitting-Feedback">SUBMIT FEEDBACK</v-btn>
|
||||
</v-toolbar-items>
|
||||
@ -72,10 +73,12 @@
|
||||
import defaultYaml from '~/assets/default.yaml';
|
||||
import basictypes from '~/assets/basictypes.yaml';
|
||||
import WorkspaceSelector from "~/components/WorkspaceSelector";
|
||||
import AppSelector from "@/components/AppSelector";
|
||||
|
||||
export default {
|
||||
mixins: [get_data],
|
||||
components: {
|
||||
AppSelector,
|
||||
WorkspaceSelector
|
||||
},
|
||||
computed: {
|
||||
@ -251,7 +254,7 @@
|
||||
return data;
|
||||
},
|
||||
async asyncData({ $axios, store }) {
|
||||
let enabled = await $axios.$get("/services/status")
|
||||
let enabled = await $axios.$get("/status")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
|
@ -5,6 +5,7 @@
|
||||
<v-toolbar-title>NoSQLBench</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<app-selector></app-selector>
|
||||
<workspace-selector></workspace-selector>
|
||||
<v-btn text href="https://github.com/nosqlbench/nosqlbench/wiki/Submitting-Feedback">SUBMIT FEEDBACK</v-btn>
|
||||
</v-toolbar-items>
|
||||
@ -81,16 +82,19 @@
|
||||
<script>
|
||||
import get_data from '~/mixins/get_data.js';
|
||||
import WorkspaceSelector from "~/components/WorkspaceSelector";
|
||||
import AppSelector from "@/components/AppSelector";
|
||||
|
||||
export default {
|
||||
name: 'app-run',
|
||||
mixins: [get_data],
|
||||
components: {
|
||||
AppSelector,
|
||||
WorkspaceSelector
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
async getTemplates() {
|
||||
const data = await this.$axios.$get('/services/workloads/parameters?workloadName=' + this.workloadName)
|
||||
const data = await this.$axios.$get('/workloads/parameters?workloadName=' + this.workloadName)
|
||||
if (!data.err) {
|
||||
this.$data.templates = data;
|
||||
}
|
||||
@ -106,21 +110,21 @@ export default {
|
||||
return data;
|
||||
},
|
||||
async asyncData({$axios, store}) {
|
||||
let enabled = await $axios.$get("/services/status")
|
||||
let enabled = await $axios.$get("/status")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
let workloadNames = await $axios.$get("/services/workloads")
|
||||
let workloadNames = await $axios.$get("/workloads")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
let workspaces = await $axios.$get("/services/workspaces")
|
||||
let workspaces = await $axios.$get("/workspaces")
|
||||
.then(res => {
|
||||
return res
|
||||
}).catch((e) => {
|
||||
|
153
docsys/src/main/node/docsys/pages/ui/status/index.vue
Normal file
153
docsys/src/main/node/docsys/pages/ui/status/index.vue
Normal file
@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<v-app-bar app dark color="secondary">
|
||||
<v-toolbar-title>NoSQLBench - Scenario Status</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<app-selector></app-selector>
|
||||
<workspace-selector></workspace-selector>
|
||||
<v-btn text href="https://github.com/nosqlbench/nosqlbench/wiki/Submitting-Feedback">SUBMIT FEEDBACK</v-btn>
|
||||
</v-toolbar-items>
|
||||
</v-app-bar>
|
||||
|
||||
<!--
|
||||
{
|
||||
"summary": {
|
||||
"total_bytes": 24,
|
||||
"total_files": 1,
|
||||
"last_change": 1597293397043,
|
||||
"last_file_changed": "README.md"
|
||||
},
|
||||
"name": "default",
|
||||
"modified": 1597293397043,
|
||||
"changed": "README.md (1H17M27S ago)"
|
||||
}
|
||||
]
|
||||
-->
|
||||
|
||||
<v-main justify-start align-start class="d-inline-block pa-4 ma-10">
|
||||
<div class="row no-gutters">
|
||||
<v-card min-width="300" max-width="300" max-height="400" raised elevation="5"
|
||||
v-for="(invocation,w) in invocations" :key="w"
|
||||
class="pa-4 ma-4" :loading="is_loading(invocation)">
|
||||
<v-row>
|
||||
<v-card-title title="running scenario name">{{ invocation.scenario_name }}</v-card-title>
|
||||
<!-- <v-icon v-if="workspace === cardspace.name">mdi-check-bold</v-icon>-->
|
||||
</v-row>
|
||||
<v-card-subtitle :title="sdf">sdf</v-card-subtitle>
|
||||
<v-card-subtitle title="started at">{{invocation.started_at}}</v-card-subtitle>
|
||||
|
||||
|
||||
<!-- <v-card-subtitle title="last change">{{ abbrev(invocation.summary.last_changed_filename) }}</v-card-subtitle>-->
|
||||
<!-- <v-divider></v-divider>-->
|
||||
<!-- <v-list align-start>-->
|
||||
<!-- <v-simple-table>-->
|
||||
<!-- <tbody>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td>Bytes</td>-->
|
||||
<!-- <td>{{ invocation.summary.total_bytes }}</td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td>Files</td>-->
|
||||
<!-- <td>{{ invocation.summary.total_files }}</td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- </tbody>-->
|
||||
<!-- </v-simple-table>-->
|
||||
<!-- <v-divider></v-divider>-->
|
||||
|
||||
<!-- <v-list-item>-->
|
||||
<!-- <v-btn title="view details of workspace">-->
|
||||
<!-- <v-icon>mdi-magnify</v-icon>-->
|
||||
<!-- </v-btn>-->
|
||||
|
||||
<!-- <!– <v-btn title="use this workspace">–>-->
|
||||
<!-- <!– <v-icon>mdi-play</v-icon>–>-->
|
||||
<!-- <!– </v-btn>–>-->
|
||||
|
||||
<!-- <v-spacer></v-spacer>-->
|
||||
|
||||
<!-- <v-btn title="download zipped workspace">-->
|
||||
<!-- <v-icon>mdi-folder-download</v-icon>-->
|
||||
<!-- </v-btn>-->
|
||||
|
||||
<!-- <v-spacer></v-spacer>-->
|
||||
|
||||
<!-- <v-btn title="purge workspace">-->
|
||||
<!-- <v-icon @click="purgeWorkspace(cardspace.name)">mdi-trash-can</v-icon>-->
|
||||
<!-- </v-btn>-->
|
||||
|
||||
<!-- </v-list-item>-->
|
||||
<!-- </v-list>-->
|
||||
</v-card>
|
||||
</div>
|
||||
</v-main>
|
||||
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import WorkspaceSelector from "~/components/WorkspaceSelector";
|
||||
import {mapActions, mapGetters, mapMutations} from "vuex";
|
||||
import AppSelector from "@/components/AppSelector";
|
||||
|
||||
export default {
|
||||
name: "workspaces.vue",
|
||||
components: {
|
||||
AppSelector,
|
||||
WorkspaceSelector
|
||||
},
|
||||
data(context) {
|
||||
let data = {
|
||||
invocations: [
|
||||
{
|
||||
"scenario_name": "mytestscenario",
|
||||
"progress": [
|
||||
{
|
||||
"name": "/tmp/nosqlbench/mytestscenario3888869514662003808file1.yaml",
|
||||
"state": "Running",
|
||||
"details": "min=0 cycle=1692 max=10000000",
|
||||
"completed": 1.692E-4
|
||||
}
|
||||
],
|
||||
"started_at": 1597749369800,
|
||||
"ended_at": -1,
|
||||
"activity_states": [
|
||||
{
|
||||
"completion": "1.692E-4",
|
||||
"name": "/tmp/nosqlbench/mytestscenario3888869514662003808file1.yaml",
|
||||
"state": "Running"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
return data;
|
||||
},
|
||||
computed: {
|
||||
invocations: {
|
||||
get() {
|
||||
return this.$store.getters["invocations/getInvocations"]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
is_loading(invocation) {
|
||||
let found = invocation.progress.find(p => {p.state==='Running'});
|
||||
return !!found;
|
||||
},
|
||||
abbrev(name) {
|
||||
return name;
|
||||
}
|
||||
},
|
||||
// created() {
|
||||
// console.log("created component...");
|
||||
// this.$store.dispatch("invocations/loadInvocations", "status panel load");
|
||||
// }
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -4,11 +4,13 @@
|
||||
<v-toolbar-title>NoSQLBench - Workspaces</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<app-selector></app-selector>
|
||||
<workspace-selector></workspace-selector>
|
||||
<!-- <workspace-selector @changed="seenChange(workspace)"></workspace-selector>-->
|
||||
|
||||
<v-btn title="start a new workspace" @click="startNewWorkspace()">
|
||||
<v-icon>mdi-folder-plus-outline</v-icon>
|
||||
</v-btn>
|
||||
<!-- <v-btn title="start a new workspace" @click="startNewWorkspace()">-->
|
||||
<!-- <v-icon>mdi-folder-plus-outline</v-icon>-->
|
||||
<!-- </v-btn>-->
|
||||
<v-btn title="upload a workspace zip file">
|
||||
<v-icon>mdi-folder-upload</v-icon>
|
||||
</v-btn>
|
||||
@ -18,7 +20,7 @@
|
||||
<v-btn title="upload workspaces.zip">
|
||||
<v-icon>mdi-briefcase-upload</v-icon>
|
||||
</v-btn>
|
||||
<!-- <v-btn text href="https://github.com/nosqlbench/nosqlbench/wiki/Submitting-Feedback">SUBMIT FEEDBACK</v-btn>-->
|
||||
<!-- <v-btn text href="https://github.com/nosqlbench/nosqlbench/wiki/Submitting-Feedback">SUBMIT FEEDBACK</v-btn>-->
|
||||
</v-toolbar-items>
|
||||
</v-app-bar>
|
||||
|
||||
@ -37,17 +39,28 @@
|
||||
]
|
||||
-->
|
||||
|
||||
<v-main justify-start align-start class="d-flex pa-4 ma-4">
|
||||
<v-main>
|
||||
<v-card max-width="344" v-for="(workspace,w) in workspaces" :key="w" class="pa-4 ma-4">
|
||||
<v-card-title title="workspace name">{{ workspace.name }}</v-card-title>
|
||||
<v-card-subtitle title="last change">{{ abbrev(workspace.summary.last_changed_filename) }}</v-card-subtitle>
|
||||
<v-main justify-start align-start class="d-inline-block pa-4 ma-10">
|
||||
<div class="row no-gutters">
|
||||
<v-card min-width="300" max-width="300" max-height="400" raised elevation="5" v-for="(cardspace,w) in workspaces" :key="w"
|
||||
class="pa-4 ma-4">
|
||||
<v-row>
|
||||
<v-card-title title="workspace name">{{ cardspace.name }}</v-card-title>
|
||||
<v-icon v-if="workspace === cardspace.name">mdi-check-bold</v-icon>
|
||||
</v-row>
|
||||
|
||||
<v-card-subtitle title="last change">{{ abbrev(cardspace.summary.last_changed_filename) }}</v-card-subtitle>
|
||||
<v-divider></v-divider>
|
||||
<v-list align-start>
|
||||
<v-simple-table>
|
||||
<tbody>
|
||||
<tr><td>Bytes</td><td>{{ workspace.summary.total_bytes}}</td></tr>
|
||||
<tr><td>Files</td><td>{{ workspace.summary.total_files}}</td></tr>
|
||||
<tr>
|
||||
<td>Bytes</td>
|
||||
<td>{{ cardspace.summary.total_bytes }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Files</td>
|
||||
<td>{{ cardspace.summary.total_files }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-simple-table>
|
||||
<v-divider></v-divider>
|
||||
@ -57,9 +70,11 @@
|
||||
<v-icon>mdi-magnify</v-icon>
|
||||
</v-btn>
|
||||
|
||||
<v-btn title="use this workspace">
|
||||
<v-icon>mdi-play</v-icon>
|
||||
</v-btn>
|
||||
<!-- <v-btn title="use this workspace">-->
|
||||
<!-- <v-icon>mdi-play</v-icon>-->
|
||||
<!-- </v-btn>-->
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn title="download zipped workspace">
|
||||
<v-icon>mdi-folder-download</v-icon>
|
||||
@ -68,13 +83,13 @@
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn title="purge workspace">
|
||||
<v-icon @click="purgeWorkspace(workspace.name)">mdi-trash-can</v-icon>
|
||||
<v-icon @click="purgeWorkspace(cardspace.name)">mdi-trash-can</v-icon>
|
||||
</v-btn>
|
||||
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</v-main>
|
||||
</div>
|
||||
</v-main>
|
||||
|
||||
</v-app>
|
||||
@ -83,57 +98,89 @@
|
||||
<script>
|
||||
|
||||
import WorkspaceSelector from "~/components/WorkspaceSelector";
|
||||
import {mapActions, mapGetters, mapMutations} from "vuex";
|
||||
import AppSelector from "@/components/AppSelector";
|
||||
|
||||
export default {
|
||||
name: "workspaces.vue",
|
||||
components: {
|
||||
AppSelector,
|
||||
WorkspaceSelector
|
||||
},
|
||||
data(context) {
|
||||
let data = {
|
||||
workspaces: [
|
||||
{
|
||||
"name": "test"
|
||||
}
|
||||
]
|
||||
// workspace: this.$store.state.workspaces.workspace,
|
||||
// workspaces: [
|
||||
// {
|
||||
// "name": "test"
|
||||
// }
|
||||
// ]
|
||||
};
|
||||
return data;
|
||||
},
|
||||
computed: {
|
||||
workspace: {
|
||||
get() {
|
||||
return this.$store.getters["workspaces/getWorkspace"]
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch("workspaces/setWorkspace", val)
|
||||
}
|
||||
},
|
||||
workspaces: {
|
||||
get() {
|
||||
return this.$store.getters["workspaces/getWorkspaces"]
|
||||
},
|
||||
set(val) {
|
||||
this.$store.dispatch("workspaces/setWorkspaces", val)
|
||||
}
|
||||
},
|
||||
// workspace: {
|
||||
// get: function () {
|
||||
// return this.$store.getters.workspaces.workspace;
|
||||
// },
|
||||
// set: function (val) {
|
||||
// return this.$store.dispatch('workspaces/getWorkspace')
|
||||
// }
|
||||
// },
|
||||
// workspaces: {
|
||||
// get: function () {
|
||||
// return this.$store.getters.workspaces.workspaces;
|
||||
// },
|
||||
// set: function (val) {
|
||||
// return this.$store.dispatch('workspaces/getWorkspaces');
|
||||
// }
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
// ...mapActions({
|
||||
// workspaces: "workspaces/setWorkspaces",
|
||||
// // workspace: "workspaces/setWorkspace"
|
||||
// }),
|
||||
abbrev(name) {
|
||||
return name;
|
||||
},
|
||||
purgeWorkspace: function(ws) {
|
||||
purgeWorkspace: function (ws) {
|
||||
console.log("purging " + ws);
|
||||
this.$axios.$delete("/services/workspaces/" + ws)
|
||||
.then(res => { return res })
|
||||
.catch((e) => {
|
||||
console.log("error: " + e)
|
||||
});
|
||||
this.$forceUpdate();
|
||||
this.$store.dispatch('workspaces/purgeWorkspace', ws);
|
||||
},
|
||||
startNewWorkspace() {
|
||||
console.log("starting new workspace");
|
||||
}
|
||||
},
|
||||
async asyncData({$axios, store}) {
|
||||
let enabled = await $axios.$get("/services/status")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
let workspaces = await $axios.$get("/services/workspaces/")
|
||||
.then(res => {
|
||||
return res
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("back-end not found");
|
||||
})
|
||||
return {enabled, workspaces}
|
||||
created() {
|
||||
console.log("created component...");
|
||||
// this.$store.subscribe((mutation, state) => {
|
||||
// console.log("mutation type " + mutation.type);
|
||||
// if (mutation.type === 'workspaces/setWorkspace') {
|
||||
// this.workspace = this.$store.state.workspaces.workspace;
|
||||
// } else if (mutation.type === 'workspaces/setWorkspaces') {
|
||||
// this.workspacaes = this.$store.state.workspaces.workspaces;
|
||||
// } else {
|
||||
// console.error("Unrecognized mutation", mutation)
|
||||
// }
|
||||
// })
|
||||
this.$store.dispatch('workspaces/initWorkspaces', "workspace panel load");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -1,5 +0,0 @@
|
||||
export const state = () => ({
|
||||
|
||||
})
|
||||
|
||||
export const getters = {}
|
33
docsys/src/main/node/docsys/store/invocations.js
Normal file
33
docsys/src/main/node/docsys/store/invocations.js
Normal file
@ -0,0 +1,33 @@
|
||||
// https://www.mikestreety.co.uk/blog/vue-js-using-localstorage-with-the-vuex-store
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export const state = () => ({
|
||||
invocations: []
|
||||
});
|
||||
|
||||
export const getters = {
|
||||
getInvocations: (state, getters) => {
|
||||
return state.invocations;
|
||||
}
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
setInvocations(state, invocations) {
|
||||
state.invocations = invocations;
|
||||
}
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
async loadInvocations({commit, state, dispatch}, reason) {
|
||||
console.log("initializing scenarios because '" + reason + "'")
|
||||
this.$axios.$get("/executor/scenarios/")
|
||||
.then(res => {
|
||||
console.log("axios/vuex invocations async get:" + JSON.stringify(res));
|
||||
console.log("committing setInvocations:" + JSON.stringify(res));
|
||||
commit('setInvocations', res)
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("axios/nuxt invocations async error:", e);
|
||||
})
|
||||
}
|
||||
};
|
98
docsys/src/main/node/docsys/store/workspaces.js
Normal file
98
docsys/src/main/node/docsys/store/workspaces.js
Normal file
@ -0,0 +1,98 @@
|
||||
// https://www.mikestreety.co.uk/blog/vue-js-using-localstorage-with-the-vuex-store
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export const state = () => ({
|
||||
workspace: 'default',
|
||||
workspaces: []
|
||||
});
|
||||
|
||||
export const getters = {
|
||||
getWorkspace: (state, getters) => {
|
||||
return state.workspace;
|
||||
},
|
||||
getWorkspaces: (state, getters) => {
|
||||
return state.workspaces;
|
||||
}
|
||||
|
||||
// ...mapGetters(['workspace','workspaces'])
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
setWorkspace(state, workspace) {
|
||||
state.workspace = workspace;
|
||||
},
|
||||
setWorkspaces(state, workspaces) {
|
||||
state.workspaces = workspaces;
|
||||
}
|
||||
// initializeStore(state) {
|
||||
// if(localStorage.getItem('store')) {
|
||||
// this.replaceState(
|
||||
// Object.assign(state,JSON.parse(localStorage.getItem('store')))
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The base url is already set for the API by this point
|
||||
* @type {{getWorkspaces({commit: *}): void, return: ([]|[{name: string}]|[{name: string}]|default.computed.workspaces)}}
|
||||
*/
|
||||
export const actions = {
|
||||
async setWorkspace({commit, state, dispatch}, val) {
|
||||
console.log("committing setWorkspace:" + JSON.stringify(val));
|
||||
commit('setWorkspace', val);
|
||||
},
|
||||
async setWorkspaces({commit, state, dispatch}, val) {
|
||||
console.log("committing setWorkspaces:" + JSON.stringify(val));
|
||||
commit('setWorkspaces', val);
|
||||
},
|
||||
async initWorkspaces({commit, state, dispatch}, reason) {
|
||||
console.log("initializing workspaces because '" + reason + "'")
|
||||
this.$axios.$get("/workspaces/")
|
||||
.then(res => {
|
||||
console.log("axios/vuex workspaces async get:" + JSON.stringify(res));
|
||||
console.log("committing setWorkspaces:" + JSON.stringify(res));
|
||||
commit('setWorkspaces', res)
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("axios/nuxt workspaces async error:", e);
|
||||
})
|
||||
},
|
||||
async activateWorkspace({commit, state, dispatch}, workspace) {
|
||||
const fresh_workspace = await this.$axios.$get("/workspaces/" + workspace)
|
||||
.then(res => {
|
||||
console.log("axios/vuex workspace async get:" + JSON.stringify(res))
|
||||
return res;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("axios/nuxt getWorkspace async error:", e)
|
||||
})
|
||||
await dispatch('initWorkspaces',"workspace '" + workspace + "' added");
|
||||
// await dispatch.initWorkspaces({commit, state, dispatch}, "workspace '" + workspace + "' added")
|
||||
// await this.$store.dispatch("workspaces/initWorkspaces", "workspace '" + workspace + "' added")
|
||||
// await this.initWorkspaces({commit}, "workspace added");
|
||||
commit('setWorkspace', fresh_workspace)
|
||||
return workspace;
|
||||
},
|
||||
async purgeWorkspace({commit, state, dispatch}, workspace) {
|
||||
await this.$axios.$delete("/workspaces/" + workspace)
|
||||
.then(res => {
|
||||
console.log("purged workspace:" + res)
|
||||
return res;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("axios/nuxt purgeWorkspace error:", e)
|
||||
})
|
||||
await dispatch('initWorkspaces',"workspace '" + workspace + "' purged");
|
||||
// dispatch.dispatch('initWorkspaces',"workspace '" + workspace + "' purged");
|
||||
// dispatch.initWorkspaces({commit, state, dispatch}, "workspace '" + workspace + "' purged")
|
||||
const found = this.state.workspaces.workspaces.find(w => {w.name === workspace});
|
||||
if (!found) {
|
||||
console.log("setting active workspace to 'default' since the previous workspace '" + workspace + "' is not found")
|
||||
await dispatch.activateWorkspace({commit, state, dispatch}, "default");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
@ -10,7 +10,7 @@ import io.nosqlbench.engine.core.script.Scenario;
|
||||
import io.nosqlbench.engine.core.script.ScenariosExecutor;
|
||||
import io.nosqlbench.engine.rest.services.WorkspaceService;
|
||||
import io.nosqlbench.engine.rest.transfertypes.RunScenarioRequest;
|
||||
import io.nosqlbench.engine.rest.transfertypes.ScenarioInfo;
|
||||
import io.nosqlbench.engine.rest.transfertypes.LiveScenarioView;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -171,12 +171,12 @@ public class ScenarioExecutorEndpoint implements WebServiceObject {
|
||||
@GET
|
||||
@Path("scenario/{scenarioName}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public synchronized ScenarioInfo getScenario(@PathParam("scenarioName") String scenarioName) {
|
||||
public synchronized LiveScenarioView getScenario(@PathParam("scenarioName") String scenarioName) {
|
||||
Optional<Scenario> pendingScenario = executor.getPendingScenario(scenarioName);
|
||||
|
||||
if (pendingScenario.isPresent()) {
|
||||
Optional<ScenarioResult> pendingResult = executor.getPendingResult(scenarioName);
|
||||
return new ScenarioInfo(pendingScenario.get(),pendingResult.orElse(null));
|
||||
return new LiveScenarioView(pendingScenario.get(),pendingResult.orElse(null));
|
||||
} else {
|
||||
throw new RuntimeException("Scenario name '" + scenarioName + "' not found.");
|
||||
}
|
||||
@ -185,16 +185,16 @@ public class ScenarioExecutorEndpoint implements WebServiceObject {
|
||||
@GET
|
||||
@Path("scenarios")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public synchronized List<ScenarioInfo> getScenarios() {
|
||||
public synchronized List<LiveScenarioView> getScenarios() {
|
||||
|
||||
List<ScenarioInfo> scenarioInfos = new ArrayList<>();
|
||||
List<LiveScenarioView> liveScenarioViews = new ArrayList<>();
|
||||
List<String> pendingScenarios = executor.getPendingScenarios();
|
||||
|
||||
for (String pendingScenario : pendingScenarios) {
|
||||
ScenarioInfo scenarioInfo = getScenario(pendingScenario);
|
||||
scenarioInfos.add(scenarioInfo);
|
||||
LiveScenarioView liveScenarioView = getScenario(pendingScenario);
|
||||
liveScenarioViews.add(liveScenarioView);
|
||||
}
|
||||
return scenarioInfos;
|
||||
return liveScenarioViews;
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,12 +10,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ScenarioInfo {
|
||||
public class LiveScenarioView {
|
||||
|
||||
private final Scenario scenario;
|
||||
private final ScenarioResult result;
|
||||
|
||||
public ScenarioInfo(Scenario scenario, ScenarioResult result) {
|
||||
public LiveScenarioView(Scenario scenario, ScenarioResult result) {
|
||||
this.scenario = scenario;
|
||||
this.result = result;
|
||||
}
|
@ -38,16 +38,15 @@ public class AutoDocsWebService implements WebServiceObject {
|
||||
@JacksonFeatures(serializationEnable = {SerializationFeature.INDENT_OUTPUT})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("details")
|
||||
public List<DocFuncData> getAutoDocsDetails(@QueryParam("function") String fname) {
|
||||
if (fname == null || fname.isEmpty()) {
|
||||
return _docs;
|
||||
}
|
||||
|
||||
public List<DocFuncDataView> getAutoDocsDetails(@QueryParam("function") String fname) {
|
||||
return _docs.stream()
|
||||
.filter(d -> {
|
||||
String fullname = d.getPackageName() + "." + d.getClassName();
|
||||
return fullname.contains(fname);
|
||||
}).collect(Collectors.toList());
|
||||
.filter(d -> {
|
||||
if (fname == null || fname.isEmpty()) return true;
|
||||
String fullname = d.getPackageName() + "." + d.getClassName();
|
||||
return fullname.contains(fname);
|
||||
})
|
||||
.map(DocFuncDataView::new)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package io.nosqlbench.virtdata.userlibs.apps.docsapp;
|
||||
|
||||
import io.nosqlbench.virtdata.api.processors.DocCtorData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DocCtorDataView implements DocCtorData {
|
||||
private final DocCtorData dcd;
|
||||
|
||||
public DocCtorDataView(DocCtorData dcd) {
|
||||
this.dcd = dcd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return dcd.getClassName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCtorJavaDoc() {
|
||||
return dcd.getCtorJavaDoc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getArgs() {
|
||||
return dcd.getArgs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<List<String>> getExamples() {
|
||||
return dcd.getExamples();
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package io.nosqlbench.virtdata.userlibs.apps.docsapp;
|
||||
|
||||
import io.nosqlbench.virtdata.api.annotations.Category;
|
||||
import io.nosqlbench.virtdata.api.processors.DocFuncData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DocFuncDataView {
|
||||
|
||||
private final DocFuncData dfd;
|
||||
|
||||
public DocFuncDataView(DocFuncData dfd) {
|
||||
this.dfd = dfd;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return dfd.getPackageName();
|
||||
}
|
||||
|
||||
public Category[] getCategories() {
|
||||
return dfd.getCategories();
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return dfd.getClassName();
|
||||
}
|
||||
|
||||
public String getClassJavadoc() {
|
||||
return dfd.getClassJavadoc();
|
||||
}
|
||||
|
||||
public String getInType() {
|
||||
return dfd.getInType();
|
||||
}
|
||||
|
||||
public String getOutType() {
|
||||
return dfd.getOutType();
|
||||
}
|
||||
|
||||
public List<DocCtorDataView> getCtors() {
|
||||
return dfd.getCtors().stream()
|
||||
.map(DocCtorDataView::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user