Browse Source

Misc usability changes

wip-firestore
Atridad Lahiji 1 year ago
parent
commit
003da10ae5
  1. 18
      components/dialog/FinalResultsViewDialog.vue
  2. 16
      components/dialog/LiveResultsViewDialog.vue
  3. 34
      components/dialog/StudentPollViewDialog.vue
  4. 4
      components/session/LiveResults.vue
  5. 82
      components/workflow/HomeScreen.vue
  6. 3
      database.rules.json
  7. 56
      functions/index.js
  8. 31
      functions/package-lock.json
  9. 1
      functions/package.json

18
components/dialog/FinalResultsViewDialog.vue

@ -27,10 +27,14 @@
<v-spacer />
</v-toolbar>
<final-results
:qobj="qobj"
class="mx-auto"
/>
<v-container
class="container"
>
<final-results
:qobj="qobj"
class="mx-auto"
/>
</v-container>
</v-card>
</v-dialog>
</template>
@ -94,3 +98,9 @@ export default {
}
}
</script>
<style lang="scss" scoped>
.container {
max-width: 600px;
}
</style>

16
components/dialog/LiveResultsViewDialog.vue

@ -28,9 +28,13 @@
<v-spacer />
</v-toolbar>
<live-results
:activeQuestion="activeQuestion"
/>
<v-container
class="container"
>
<live-results
:activeQuestion="activeQuestion"
/>
</v-container>
</v-card>
</v-dialog>
</template>
@ -102,3 +106,9 @@ export default {
}
}
</script>
<style lang="scss" scoped>
.container {
max-width: 600px;
}
</style>

34
components/dialog/StudentPollViewDialog.vue

@ -6,27 +6,27 @@
hide-overlay
transition="dialog-bottom-transition"
>
<v-toolbar
:color="mainColor"
<v-card
class="text-center justify-center align-center d-flex"
>
<v-btn
@click="closeStudentPollViewDialog()"
icon
<v-toolbar
:color="mainColor"
>
<v-icon>
mdi-close
</v-icon>
</v-btn>
<v-btn
@click="closeStudentPollViewDialog()"
icon
>
<v-icon>
mdi-close
</v-icon>
</v-btn>
<v-toolbar-title>
Poll {{ sessionid }}
</v-toolbar-title>
<v-toolbar-title>
Poll {{ sessionid }}
</v-toolbar-title>
<v-spacer />
</v-toolbar>
<v-card
class="text-center justify-center align-center d-flex"
>
<v-spacer />
</v-toolbar>
<span
class="container"
>

4
components/session/LiveResults.vue

@ -12,6 +12,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { config } from '~/config.js'
export default {
@ -29,6 +30,9 @@ export default {
}
},
computed: {
...mapGetters([
'GET_DARK_THEME'
]),
optionsList () {
const tempList = []
if (this.activeQuestion.activequestion.qoptions) {

82
components/workflow/HomeScreen.vue

@ -114,48 +114,48 @@ export default {
id: ''
}
},
mounted () {
created () {
// Warm up functions
const createPoll = functions().httpsCallable('createPoll')
const deletePoll = functions().httpsCallable('deletePoll')
const editPoll = functions().httpsCallable('editPoll')
const createQuestion = functions().httpsCallable('createQuestion')
const deleteQuestion = functions().httpsCallable('deleteQuestion')
const editQuestion = functions().httpsCallable('editQuestion')
const createSession = functions().httpsCallable('createSession')
const deleteSession = functions().httpsCallable('deleteSession')
const setActiveQuestion = functions().httpsCallable('setActiveQuestion')
const stopActiveQuestion = functions().httpsCallable('stopActiveQuestion')
createPoll({
ping: 'ping'
})
deletePoll({
ping: 'ping'
})
editPoll({
ping: 'ping'
})
createQuestion({
ping: 'ping'
})
deleteQuestion({
ping: 'ping'
})
editQuestion({
ping: 'ping'
})
createSession({
ping: 'ping'
})
deleteSession({
ping: 'ping'
})
setActiveQuestion({
ping: 'ping'
})
stopActiveQuestion({
ping: 'ping'
})
// const createPoll = functions().httpsCallable('createPoll')
// const deletePoll = functions().httpsCallable('deletePoll')
// const editPoll = functions().httpsCallable('editPoll')
// const createQuestion = functions().httpsCallable('createQuestion')
// const deleteQuestion = functions().httpsCallable('deleteQuestion')
// const editQuestion = functions().httpsCallable('editQuestion')
// const createSession = functions().httpsCallable('createSession')
// const deleteSession = functions().httpsCallable('deleteSession')
// const setActiveQuestion = functions().httpsCallable('setActiveQuestion')
// const stopActiveQuestion = functions().httpsCallable('stopActiveQuestion')
// createPoll({
// ping: 'ping'
// })
// deletePoll({
// ping: 'ping'
// })
// editPoll({
// ping: 'ping'
// })
// createQuestion({
// ping: 'ping'
// })
// deleteQuestion({
// ping: 'ping'
// })
// editQuestion({
// ping: 'ping'
// })
// createSession({
// ping: 'ping'
// })
// deleteSession({
// ping: 'ping'
// })
// setActiveQuestion({
// ping: 'ping'
// })
// stopActiveQuestion({
// ping: 'ping'
// })
},
methods: {
joinSession () {

3
database.rules.json

@ -7,7 +7,8 @@
}
},
"sessions": {
".read": "auth.uid != null"
".read": "auth.uid != null",
".indexOn": ["owneruid", "pollid"]
}
}
}

56
functions/index.js

@ -449,3 +449,59 @@ exports.sendResponse = functions.https.onCall((data, context) => {
return api.session.sendResponse(context, sessionid, response);
})
exports.pingCRON = functions.pubsub.schedule('every 5 minutes').onRun((context) => {
const axios = require('axios');
console.log("RUNNING CRON JOB");
axios.post('https://us-central1-pollo-web.cloudfunctions.net/createPoll', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/deletePoll', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/editPoll', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/createQuestion', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/deleteQuestion', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/editQuestion', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/createSession', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/deleteSession', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/setActiveQuestion', {
"data": {
"ping": "ping"
}
});
axios.post('https://us-central1-pollo-web.cloudfunctions.net/stopActiveQuestion', {
"data": {
"ping": "ping"
}
});
return null;
});

31
functions/package-lock.json

@ -1067,6 +1067,14 @@
"integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==",
"dev": true
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"requires": {
"follow-redirects": "1.5.10"
}
},
"babel-jest": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz",
@ -2681,6 +2689,29 @@
"integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"dev": true
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",

1
functions/package.json

@ -14,6 +14,7 @@
"node": "8"
},
"dependencies": {
"axios": "^0.19.2",
"firebase-admin": "^8.9.2",
"firebase-functions": "^3.3.0"
},