Started drafting medscan extension

This commit is contained in:
Joel Collins 2020-03-31 16:25:04 +01:00
parent 0c695a377c
commit 26086aaea7
14 changed files with 12437 additions and 0 deletions

View file

@ -0,0 +1,2 @@
> 1%
last 2 versions

View file

@ -0,0 +1 @@
dist/* filter=lfs diff=lfs merge=lfs -text

View file

@ -0,0 +1,23 @@
.DS_Store
node_modules
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Override and include dist
!/dist

View file

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ca0e299d383dac9c5ebb630f31c45279a5558c21f44dbb7e803ae0a726526b3
size 237

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b4223dafbec3774d4c7a8421c6156f7f4d3c4fbf43b6ba7bb9c3922d11e41471
size 288126

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dc9afdd76929fb15b40c1f40d9dc64aca8f7243727471b4125a24c057f92bd6e
size 92085

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
{
"name": "openflexure-medscan-element",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "cross-var vue-cli-service build --target wc --inline-vue --name $npm_package_name ./src/components/VueWebComponent.vue"
},
"dependencies": {
"axios": "^0.19.2",
"core-js": "^3.4.4",
"vue": "^2.6.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"cross-var": "^1.1.0",
"vue-template-compiler": "^2.6.10"
}
}

View file

@ -0,0 +1,18 @@
<template>
<div id="app">
<VueWebComponent/>
</div>
</template>
<script>
import VueWebComponent from './components/VueWebComponent.vue'
export default {
name: 'app',
components: {
VueWebComponent
}
}
</script>
<style>
</style>

View file

@ -0,0 +1,133 @@
<template>
<div class="medscan-component-class">
<h1>Sample Scan Wizard</h1>
<div>Base URL: {{ componentBaseURL }}</div>
<p>Host microscope name: {{ hostDeviceName }}</p>
<p>{{ message }}</p>
<br />
<p>This cheeky little counter has all of its logic contained in a server-side component:</p>
<button type="button" v-on:click="decrement()">-</button>
<span>{{ value }}</span>
<button type="button" v-on:click="increment()">+</button>
<hr />
<form v-on:submit.prevent>
<label for="username">Your name:</label>
<input type="text" id="username" name="username" required />
<br />
<label for="patientID">Patient ID:</label>
<input type="text" id="patientID" name="patientID" required />
<br />
<label for="currentTime">Current time (check this is correct):</label>
<input type="datetime-local" id="currentTime" name="currentTime" v-model="currentTimeForm" />
</form>
</div>
</template>
<script>
import axios from "axios";
export default {
props: {
componentBaseURL: {
required: false,
default: "http://localhost:5000/api/v2",
type: String
}
},
data: function() {
return {
value: 0,
message: "",
hostDeviceName: null,
currentTime: this.getLocalDatetimeString()
};
},
mounted: function() {
if (this.componentBaseURL) {
axios
.get(`${this.componentBaseURL}`)
.then(response => {
console.log(response.data);
this.hostDeviceName = response.data.title;
})
.catch(function(error) {
console.log(
"Error reading test json, probabl because of cors or something"
);
});
} else {
this.message = "No componentBaseURL given";
}
},
methods: {
decrement: function() {
this.value = this.value - 1;
},
increment: function() {
this.value = this.value + 1;
},
getLocalDatetimeString: function() {
var dt = new Date();
var tzo = -dt.getTimezoneOffset(),
dif = tzo >= 0 ? "+" : "-",
pad = function(num) {
var norm = Math.floor(Math.abs(num));
return (norm < 10 ? "0" : "") + norm;
};
return (
dt.getFullYear() +
"-" +
pad(dt.getMonth() + 1) +
"-" +
pad(dt.getDate()) +
"T" +
pad(dt.getHours()) +
":" +
pad(dt.getMinutes()) +
":" +
pad(dt.getSeconds()) +
dif +
pad(tzo / 60) +
":" +
pad(tzo % 60)
);
}
},
computed: {
currentTimeForm: {
get() {
// Chop the timezone information from the end
return this.currentTime.substr(0, 19);
},
set(val) {
console.log(val)
// Get timezone
var dt = new Date();
var tzo = -dt.getTimezoneOffset(),
dif = tzo >= 0 ? "+" : "-",
pad = function(num) {
var norm = Math.floor(Math.abs(num));
return (norm < 10 ? "0" : "") + norm;
};
// Stick to the end of the new timestring from the form
this.currentTime =
val + dif + pad(tzo / 60) + ":" + pad(tzo % 60);
}
}
}
};
</script>
<style scoped>
.medscan-component-class {
text-align: left;
}
</style>

View file

@ -0,0 +1,6 @@
import Vue from 'vue';
import App from './App.vue';
new Vue({
render: h => h(App)
}).$mount('#app')

View file

@ -0,0 +1,4 @@
process.env.VUE_APP_NAME = require('./package.json').name
module.exports = {
productionSourceMap: false
};