Add demo function to site settings
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
site:
|
site:
|
||||||
demo: true
|
demo: true
|
||||||
|
agreeExpire: 3
|
||||||
regions:
|
regions:
|
||||||
- thorax
|
- thorax
|
||||||
- abdomen
|
- abdomen
|
||||||
- limbs
|
- limbs
|
||||||
|
useExternal: false
|
||||||
external:
|
external:
|
||||||
address: "10.188.0.98"
|
address: "10.188.0.98"
|
||||||
port: 9001
|
port: 9001
|
||||||
17
site_settings.md
Normal file
17
site_settings.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
Configuring aspects of the hosted ALVINN PWA is done through the `conf.yaml` file in the `conf` folder.
|
||||||
|
Settings are divided into the top level categories: `site`, `external`.
|
||||||
|
### Site settings
|
||||||
|
Site settings configure aspects of this specific ALVINN instance.
|
||||||
|
| name | description | default |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| agreeExpire | number of months before users are shown the site agreement dialog again | 3 |
|
||||||
|
| demo | set to true to enable demo mode by default | false
|
||||||
|
| regions | array of regions names to enable | [thorax, abdomen, limbs, head] |
|
||||||
|
| useExternal | set to true to enable use of external detection server by default | false |
|
||||||
|
|
||||||
|
### External settings
|
||||||
|
ALVINN can use an external object detection server instead of the built in models; settings for that external server are configured here.
|
||||||
|
| name | description | default |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| address | ip or url of external server | *none* |
|
||||||
|
| port | port to access on external server | 9001 |
|
||||||
@@ -73,13 +73,12 @@
|
|||||||
siteConf: {}
|
siteConf: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
async created () {
|
||||||
fetch(`${!!window.cordova ? 'https://localhost' : '.'}/conf/conf.yaml`)
|
var confText = await fetch(`${!!window.cordova ? 'https://localhost' : '.'}/conf/conf.yaml`)
|
||||||
.then((mod) => { return mod.text() })
|
.then((mod) => { return mod.text() })
|
||||||
.then((confText) => {
|
|
||||||
this.siteConf = YAML.parse(confText)
|
this.siteConf = YAML.parse(confText)
|
||||||
console.log(this.siteConf)
|
store().set('enabledRegions',this.siteConf?.site?.regions)
|
||||||
})
|
store().set('siteDemo',this.siteConf?.site?.demo)
|
||||||
var loadSiteSettings = localStorage.getItem('siteSettings')
|
var loadSiteSettings = localStorage.getItem('siteSettings')
|
||||||
if (loadSiteSettings) {
|
if (loadSiteSettings) {
|
||||||
var loadedSettings = JSON.parse(loadSiteSettings)
|
var loadedSettings = JSON.parse(loadSiteSettings)
|
||||||
@@ -88,7 +87,8 @@
|
|||||||
this.dateAgreement = loadedSettings.dateAgreement && new Date(loadedSettings.dateAgreement)
|
this.dateAgreement = loadedSettings.dateAgreement && new Date(loadedSettings.dateAgreement)
|
||||||
}
|
}
|
||||||
var curDate = new Date ()
|
var curDate = new Date ()
|
||||||
var agreeStillValid = this.dateAgreement && (curDate < this.dateAgreement.setMonth(this.dateAgreement.getMonth() + 3))
|
var expireMonth = this.dateAgreement.getMonth() + (this.siteConf?.site?.agreeExpire || 3)
|
||||||
|
var agreeStillValid = this.dateAgreement && (curDate < this.dateAgreement.setMonth(expireMonth))
|
||||||
if (this.siteAgreement && this.rememberAgreement && agreeStillValid) {
|
if (this.siteAgreement && this.rememberAgreement && agreeStillValid) {
|
||||||
this.showDisclaimer = false
|
this.showDisclaimer = false
|
||||||
store().agree()
|
store().agree()
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ const state = reactive({
|
|||||||
disclaimerAgreement: false,
|
disclaimerAgreement: false,
|
||||||
enabledRegions: ['thorax','abdomen','limbs'],
|
enabledRegions: ['thorax','abdomen','limbs'],
|
||||||
version: '0.5.0-rc',
|
version: '0.5.0-rc',
|
||||||
siteConfig: {}
|
useExternal: false,
|
||||||
|
siteDemo: false,
|
||||||
|
externalServer: {}
|
||||||
})
|
})
|
||||||
|
|
||||||
const setConfig = (confObj) => {
|
const set = (config, confObj) => {
|
||||||
state.siteConfig = confObj
|
if (confObj === undefined) { return }
|
||||||
|
state[config] = confObj
|
||||||
}
|
}
|
||||||
|
|
||||||
const agree = () => {
|
const agree = () => {
|
||||||
@@ -17,9 +20,11 @@ const agree = () => {
|
|||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
isAgreed: computed(() => state.disclaimerAgreement),
|
isAgreed: computed(() => state.disclaimerAgreement),
|
||||||
|
demoMode: computed(() => state.siteDemo),
|
||||||
|
defaultExternal: computed(() => state.useExternal),
|
||||||
getRegions: computed(() => state.enabledRegions),
|
getRegions: computed(() => state.enabledRegions),
|
||||||
getVersion: computed(() => state.version),
|
getVersion: computed(() => state.version),
|
||||||
getConfig: computed(() => state.siteConfig),
|
getServer: computed(() => state.externalServer),
|
||||||
setConfig,
|
set,
|
||||||
agree
|
agree
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
<f7-button style="height: auto; width: auto;" popover-close="#capture-popover" @click="selectImage('file')">
|
<f7-button style="height: auto; width: auto;" popover-close="#capture-popover" @click="selectImage('file')">
|
||||||
<SvgIcon icon="photo_library" />
|
<SvgIcon icon="photo_library" />
|
||||||
</f7-button>
|
</f7-button>
|
||||||
<f7-button v-if="otherSettings.demo" style="height: auto; width: auto;" popover-close="#capture-popover" @click="selectImage('sample')">
|
<f7-button v-if="demoEnabled" style="height: auto; width: auto;" popover-close="#capture-popover" @click="selectImage('sample')">
|
||||||
<SvgIcon icon="photo_sample"/>
|
<SvgIcon icon="photo_sample"/>
|
||||||
</f7-button>
|
</f7-button>
|
||||||
</f7-segmented>
|
</f7-segmented>
|
||||||
@@ -120,6 +120,7 @@
|
|||||||
import submitMixin from './submit-mixin'
|
import submitMixin from './submit-mixin'
|
||||||
import detectionMixin from './detection-mixin'
|
import detectionMixin from './detection-mixin'
|
||||||
import cameraMixin from './camera-mixin'
|
import cameraMixin from './camera-mixin'
|
||||||
|
import { Conv2DBackpropFilter } from '@tensorflow/tfjs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [submitMixin, detectionMixin, cameraMixin],
|
mixins: [submitMixin, detectionMixin, cameraMixin],
|
||||||
@@ -252,6 +253,9 @@
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
demoEnabled () {
|
||||||
|
return this.otherSettings.demo || this.demoMode
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user