Skip to content

Commit

Permalink
Merge branch 'dashboard' of https://github.com/unarxiv/CVPM into dash…
Browse files Browse the repository at this point in the history
…board
  • Loading branch information
xzyaoi committed Dec 9, 2018
2 parents 9e907a6 + d84e417 commit 94d7d6a
Show file tree
Hide file tree
Showing 22 changed files with 636 additions and 60 deletions.
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ toml = "*"
requests = "*"
pillow = "*"
numpy = "*"
autoflake = "*"
isort = "*"
yapf = "*"
gevent = "*"

flask-cors="*"

[requires]

Expand Down
5 changes: 5 additions & 0 deletions cvpm/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
from werkzeug.datastructures import ImmutableMultiDict
from werkzeug.utils import secure_filename

# extensions
from flask_cors import CORS

logger = logging.getLogger()
logger.setLevel("INFO")

server = Flask(__name__)
CORS(server)

ALLOWED_EXTENSIONS_TRAIN = set(['zip'])
ALLOWED_EXTENSIONS_INFER = set(['jpg', 'jpeg', 'png'])
Expand Down
24 changes: 12 additions & 12 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.18.0",
"js-base64": "^2.4.9",
"toml": "^2.3.3",
"vue": "^2.5.2",
"vue-i18n": "^8.3.2",
"vue-json-tree-view": "^2.1.4",
"vue-markdown": "^2.2.4",
"vue-router": "^3.0.1",
"vue-socket.io": "^3.0.4",
"vuetify": "^1.0.0"
"axios": "0.18.0",
"js-base64": "2.4.9",
"toml": "2.3.3",
"vue": "2.5.17",
"vue-i18n": "8.4.0",
"vue-json-tree-view": "2.1.4",
"vue-markdown": "2.2.4",
"vue-router": "3.0.2",
"vue-socket.io": "3.0.4",
"vuetify": "^1.3.12"
},
"devDependencies": {
"autoprefixer": "7.2.6",
Expand Down Expand Up @@ -62,15 +62,15 @@
"jest-serializer-vue": "0.3.0",
"nightwatch": "0.9.21",
"node-notifier": "5.3.0",
"node-sass": "^4.10.0",
"node-sass": "4.10.0",
"optimize-css-assets-webpack-plugin": "3.2.0",
"ora": "1.4.0",
"portfinder": "1.0.19",
"postcss-import": "11.1.0",
"postcss-loader": "2.1.6",
"postcss-url": "7.3.2",
"rimraf": "2.6.2",
"sass-loader": "^7.1.0",
"sass-loader": "7.1.0",
"selenium-server": "3.141.59",
"semver": "5.6.0",
"shelljs": "0.7.8",
Expand Down
45 changes: 45 additions & 0 deletions dashboard/src/components/CVPM-Actions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<v-card>
<v-card-title>
<h2>Actions</h2>
</v-card-title>
<v-card-actions>
<v-btn color="indigo darken-1" outline @click="triggerDialog('test')">Test</v-btn>
</v-card-actions>
<v-dialog v-model="enableTest">
<cvpm-request
v-if="enableTest"
v-on:closeDialog="triggerDialog('test')"
:config="config"
:vendor="vendor"
:packageName="packageName"
></cvpm-request>
</v-dialog>
</v-card>
</template>

<script>
import cvpmRequest from '@/components/CVPM-Request'
export default {
data () {
return {
enableTest: false
}
},
methods: {
triggerDialog (name) {
if (name === 'test') {
this.enableTest = !this.enableTest
} else {
}
}
},
components: {
'cvpm-request': cvpmRequest
},
props: ['config', 'vendor', 'packageName']
}
</script>

<style>
</style>
6 changes: 3 additions & 3 deletions dashboard/src/components/CVPM-Git-Import.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
</v-expansion-panel>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="indigo darken-1" flat @click="closeDialog()">Close</v-btn>
<v-btn color="indigo darken-1" flat @click="fetchMeta()">Fetch Meta</v-btn>
<v-btn color="indigo darken-1" flat @click="save()">Install</v-btn>
<v-btn color="indigo darken-1" outline @click="closeDialog()">Close</v-btn>
<v-btn color="indigo darken-1" outline @click="fetchMeta()">Fetch Meta</v-btn>
<v-btn color="indigo darken-1" outline @click="save()">Install</v-btn>
</v-card-actions>
</v-card>
</template>
Expand Down
155 changes: 155 additions & 0 deletions dashboard/src/components/CVPM-Repo-Solver.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<template>
<v-card>
<v-card-title>
<h2>Solvers</h2>
</v-card-title>
<cvpm-solver-selection
:config=config
:vendor=vendor
:packageName=packageName
v-on:finishSelection="onFinishSelection"
>
</cvpm-solver-selection>
<v-flex class="cvpm-solver-run-btn">
<v-btn @click="run()" color="indigo" outline>Run</v-btn>
</v-flex>
<v-expansion-panel>
<v-expansion-panel-content>
<div slot="header">Running</div>
<v-list>
<v-list-tile v-for="(solver, index) in runningSolvers" :key="index">
<v-list-tile-content>
{{solver.SolverName}}
</v-list-tile-content>
<v-list-tile-avatar>
{{solver.Port}}
</v-list-tile-avatar>
</v-list-tile>
</v-list>
</v-expansion-panel-content>
</v-expansion-panel>
<v-dialog persistent v-model="runningConfirmDialog" width="60%">
<v-card>
<v-card-title>
<span
class="headline"
>Running Solver {{selectedVendor}}/{{selectedPackage}}/{{selectedSolver}}</span>
</v-card-title>
<v-card-text>
<v-text-field
label="Running Port"
v-model="runningPort"
:rules="[rules.validPort]"
hint="Keep it empty if you want to run it on any one of open ports"
></v-text-field>
<p v-if="responseRunningPort">This solver is running on {{responseRunningPort}}</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="indigo darken-1" flat @click="triggerDialog()" outline>Close</v-btn>
<v-btn
color="indigo darken-1"
@loading="isRequesting"
flat
@click="confirmedRun()"
outline
>Run!</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card>
</template>

<script>
import { systemService } from '@/services/system'
import cvpmSolverSelection from '@/components/basic/CVPM-Solver-Selection'
export default {
data () {
return {
selectedSolver: '',
selectedVendor: this.vendor[0],
selectedPackage: this.packageName[0],
runningConfirmDialog: false,
runningPort: '',
runningSolvers: [],
responseRunningPort: '',
isRequesting: false,
rules: {
validPort: value => {
if (value === '') {
return true
}
const pattern = /^\+?(0|[1-9]\d*)$/
if (pattern.test(value)) {
if (parseInt(value) > 1024 && parseInt(value) < 65535) {
return true
} else {
return 'Not a Valid Port Number (Must be a postive integer larger than 1024 and less than 65535)'
}
} else {
return 'Not a Valid Port Number (Only numeric value is accepted)'
}
}
}
}
},
components: {
'cvpm-solver-selection': cvpmSolverSelection
},
props: ['config', 'vendor', 'packageName'],
methods: {
fetchRunningSolver () {
let self = this
systemService
.getRunningSolver(this.vendor, this.packageName)
.then(function (res) {
self.runningSolvers = res.data
})
},
onFinishSelection (value) {
this.selectedSolver = value.selectedSolver
this.selectedVendor = value.selectedVendor
this.selectedPackage = value.selectedPackage
},
triggerDialog () {
this.runningConfirmDialog = !this.runningConfirmDialog
},
run () {
if (this.selectedSolver === '') {
alert('no solver specified')
} else {
this.triggerDialog()
}
},
confirmedRun () {
this.isRequesting = true
let self = this
systemService
.runRepoSolver(
this.selectedVendor,
this.selectedPackage,
this.selectedSolver,
this.runningPort
)
.then(function (res) {
self.isRequesting = false
self.responseRunningPort = res.data.port
})
}
},
created () {
this.fetchRunningSolver()
}
}
</script>

<style scoped>
.cvpm-solver-runner-selection {
margin-left: auto;
margin-right: auto;
width: 95%;
}
.cvpm-solver-run-btn {
margin-right: 10%;
}
</style>
93 changes: 89 additions & 4 deletions dashboard/src/components/CVPM-Request.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,98 @@
<template>

<v-card>
<v-card-title>
<h2>Test</h2>
</v-card-title>
<cvpm-solver-selection
:config="config"
:vendor="vendor"
:packageName="packageName"
v-on:finishSelection="onFinishSelection"
></cvpm-solver-selection>
<v-card class="cvpm-test-steps">
<v-stepper v-model="step">
<v-stepper-header>
<v-stepper-step :complete="step > 1" step="1">Choose Image</v-stepper-step>
<v-divider></v-divider>
<v-stepper-step :complete="step > 2" step="2">Complete Parameters</v-stepper-step>
<v-divider></v-divider>
<v-stepper-step step="3">Check Results</v-stepper-step>
</v-stepper-header>

<v-stepper-items class="cvpm-test-content">
<v-stepper-content step="1">
<cvpm-image-upload v-on:fileSelected="onFileSelected"></cvpm-image-upload>
</v-stepper-content>
<v-stepper-content step="2">
<cvpm-parameter-input :file=file v-on:finishInfer="onFinishInfer"></cvpm-parameter-input>
</v-stepper-content>
<v-stepper-content step="3">
<cvpm-json-view :jsonObject="inferResponse"></cvpm-json-view>
</v-stepper-content>
</v-stepper-items>

</v-stepper>
</v-card>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="indigo darken-1" outline @click="closeDialog()">Close</v-btn>
</v-card-actions>
</v-card>
</template>

<script>
import cvpmSolverSelection from '@/components/basic/CVPM-Solver-Selection'
import cvpmImageUpload from '@/components/basic/CVPM-Image-Upload'
import cvpmParameterInput from '@/components/basic/CVPM-Parameter-Input'
import cvpmJSONView from '@/components/basic/CVPM-JSON-View'
export default {
data () {
return {
selectedPackage: '',
selectedVendor: '',
selectedSolver: '',
step: 1,
file: null,
inferResponse: {}
}
},
methods: {
closeDialog () {
this.$emit('closeDialog', true)
},
onFinishSelection (value) {
this.selectedSolver = value.selectedSolver
this.selectedVendor = value.selectedVendor
this.selectedPackage = value.selectedPackage
},
onFileSelected (value) {
this.step = 2
this.file = value
},
onFinishInfer (value) {
this.inferResponse = value.data
this.step = 3
}
},
components: {
'cvpm-solver-selection': cvpmSolverSelection,
'cvpm-image-upload': cvpmImageUpload,
'cvpm-parameter-input': cvpmParameterInput,
'cvpm-json-view': cvpmJSONView
},
props: ['config', 'vendor', 'packageName']
}
</script>

<style>
<style scoped>
.cvpm-test-content {
align-items: center;
justify-content: center;
text-align: center;
}
.cvpm-test-steps {
width: 95%;
margin-left: auto;
margin-right: auto;
}
</style>
1 change: 0 additions & 1 deletion dashboard/src/components/CVPM-Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
methods: {
getStatus () {
this.status = systemService.getStatus()
console.log(this.status)
}
},
created () {
Expand Down
Loading

0 comments on commit 94d7d6a

Please sign in to comment.