Skip to content

Tasks 1 and 2 + Style Changes: Adding Audio Input dropdown, AudioVideo, AudioVideoCheck, Video, and VideoCheck components #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 387 additions & 35 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
},
"dependencies": {
"@adapttive/vue-markdown": "^4.0.2",
"axios": "^1.7.4",
"bootstrap-vue": "^2.23.1",
"bowser": "^2.11.0",
Expand All @@ -23,7 +24,6 @@
"msr": "^1.3.4",
"vue": "^2.7.16",
"vue-i18n": "^8.28.2",
"@adapttive/vue-markdown": "^4.0.2",
"vue-multiselect": "^2.1.9",
"vue-router": "^3.6.5",
"vue-slider-component": "^3.2.24",
Expand All @@ -33,6 +33,7 @@
"vuex": "^3.6.2"
},
"devDependencies": {
"@babel/eslint-parser": "^7.24.1",
"@intlify/vue-i18n-loader": "^3.3.0",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-e2e-cypress": "^5.0.8",
Expand All @@ -42,9 +43,9 @@
"@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/test-utils": "^1.0.3",
"@babel/eslint-parser": "^7.24.1",
"eslint": "^7.32.0",
"@vue/vue2-jest": "^27.0.0",
"cypress": "^13.7.2",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^7.20.0",
"vue-cli-plugin-i18n": "^2.3.2",
"vue-template-compiler": "^2.7.16"
Expand Down
164 changes: 84 additions & 80 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,16 @@ export default {
_.map(eachActivityList, (itemObj) => {
const newObj = { ...itemObj };
if (itemObj['@type'] === 'reproschema:Response') {
if (itemObj.value instanceof Blob) {
if (itemObj.value instanceof Blob && itemObj.mimeType == "audio/wav") {
const keyStrings = (itemObj.isAbout.split('/'));
const rId = itemObj['@id'].split('uuid:')[1];
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.wav`, itemObj.value);
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.wav`;
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.wav`, itemObj.value); //changed from wav
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.wav`; //changed from wav
} else if (itemObj.value instanceof Blob && itemObj.mimeType == "video/mp4") {
const keyStrings = (itemObj.isAbout.split('/'));
const rId = itemObj['@id'].split('uuid:')[1];
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.mp4`, itemObj.value); //changed from wav
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.mp4`; //changed from wav
}
}
activityData.push(newObj);
Expand Down Expand Up @@ -552,81 +557,6 @@ export default {
});
},
},
watch: {
$route() {
if (this.$route.params.id !== undefined) {
this.$store.dispatch('setActivityIndex', this.$route.params.id);
}
},
visibilityConditions: {
handler(newC) {
if (!_.isEmpty(newC)) {
this.setVisbility();
}
},
deep: true,
},
},
created() {
const url = this.$route.query.url;
if (url) {
this.protocolUrl = url;
}
this.$store.dispatch('getBaseSchema', url).then(() => this.getPrefLabel());
// this.$store.dispatch('getBaseSchema', url);
},
mounted() {
new EmailDecoder('[data-email]');
this.clientSpecs = JSON.stringify(Bowser.parse(window.navigator.userAgent));
this.browserType = Bowser.parse(window.navigator.userAgent).browser.name;
if (config.checkMediaPermission) {
this.checkPermission();
}
if (this.$route.query.lang) {
this.selected_language = this.$route.query.lang;
i18n.locale = this.selected_language;
} else this.selected_language = 'en';

if (this.$route.query.uid) {
// console.log(407, this.$route.query.uid);
this.$store.dispatch('saveParticipantId', this.$route.query.uid);
} else if (config.generateRandomUid) {
this.$store.dispatch('saveParticipantId', uuidv4());
}
if (this.$route.params.id) {
this.$store.dispatch('setActivityIndex', this.$route.params.id);
}
axios.get('https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json').then((resp) => {
this.langMap = resp.data;
});
this.$store.dispatch('setParticipantUUID', uuidv4()); // set participant UUID for the current user
if (this.$route.query.expiry_time) {
this.$store.dispatch('setExpiryMinutes', this.$route.query.expiry_time);
}
if (this.$route.query.auth_token) {
this.$store.dispatch('setAuthToken', this.$route.query.auth_token);
}
if (!_.isEmpty(this.$route.query)) {
this.$store.dispatch('setQueryParameters', this.$route.query);
}

// const formData = new FormData();
// const TOKEN = this.$store.getters.getAuthToken;
// if (TOKEN) {
// formData.append('file', null);
// formData.append('auth_token', `${TOKEN}`);
// axios.post(`${config.backendServer}/submit`, formData, {
// 'Content-Type': 'multipart/form-data',
// }).then((res) => {
// // console.log('SUCCESS!!', res.status);
// })
// .catch((e) => {
// if (e.response.status === 403) {
// this.invalidToken = true;
// }
// });
// }
},
computed: {
accessDeniedPath() {
let path = require('./assets/403-Access-Forbidden-HTML-Template.gif');
Expand Down Expand Up @@ -704,6 +634,7 @@ export default {
if (!_.isEmpty(this.$store.state.schema)) {
const order = _.map(this.$store.state.schema['http://schema.repronim.org/order'][0]['@list'],
u => u['@id']);
console.log(order)
return order;
}
return [];
Expand Down Expand Up @@ -817,6 +748,81 @@ export default {
return this.$store.getters.getParticipantId;
},
},
mounted() {
new EmailDecoder('[data-email]');
this.clientSpecs = JSON.stringify(Bowser.parse(window.navigator.userAgent));
this.browserType = Bowser.parse(window.navigator.userAgent).browser.name;
if (config.checkMediaPermission) {
this.checkPermission();
}
if (this.$route.query.lang) {
this.selected_language = this.$route.query.lang;
i18n.locale = this.selected_language;
} else this.selected_language = 'en';

if (this.$route.query.uid) {
// console.log(407, this.$route.query.uid);
this.$store.dispatch('saveParticipantId', this.$route.query.uid);
} else if (config.generateRandomUid) {
this.$store.dispatch('saveParticipantId', uuidv4());
}
if (this.$route.params.id) {
this.$store.dispatch('setActivityIndex', this.$route.params.id);
}
axios.get('https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json').then((resp) => {
this.langMap = resp.data;
});
this.$store.dispatch('setParticipantUUID', uuidv4()); // set participant UUID for the current user
if (this.$route.query.expiry_time) {
this.$store.dispatch('setExpiryMinutes', this.$route.query.expiry_time);
}
if (this.$route.query.auth_token) {
this.$store.dispatch('setAuthToken', this.$route.query.auth_token);
}
if (!_.isEmpty(this.$route.query)) {
this.$store.dispatch('setQueryParameters', this.$route.query);
}

// const formData = new FormData();
// const TOKEN = this.$store.getters.getAuthToken;
// if (TOKEN) {
// formData.append('file', null);
// formData.append('auth_token', `${TOKEN}`);
// axios.post(`${config.backendServer}/submit`, formData, {
// 'Content-Type': 'multipart/form-data',
// }).then((res) => {
// // console.log('SUCCESS!!', res.status);
// })
// .catch((e) => {
// if (e.response.status === 403) {
// this.invalidToken = true;
// }
// });
// }
},
watch: {
$route() {
if (this.$route.params.id !== undefined) {
this.$store.dispatch('setActivityIndex', this.$route.params.id);
}
},
visibilityConditions: {
handler(newC) {
if (!_.isEmpty(newC)) {
this.setVisbility();
}
},
deep: true,
},
},
created() {
const url = this.$route.query.url;
if (url) {
this.protocolUrl = url;
}
this.$store.dispatch('getBaseSchema', url).then(() => this.getPrefLabel());
// this.$store.dispatch('getBaseSchema', url);
}
};
</script>

Expand Down Expand Up @@ -943,5 +949,3 @@ export default {


</style>


108 changes: 105 additions & 3 deletions src/components/InputSelector/InputSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>

<div v-else-if="inputType === 'audioCheck'">
<AudioRecord
<AudioCheck
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
Expand Down Expand Up @@ -82,6 +82,99 @@
mode="audioRecordNoStop" />
</div>

<div v-else-if="inputType === 'audioVideoCheck'">
<AudioVideoCheck
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>

<!-- If type is audioVideoRecord -->
<div v-else-if="inputType === 'audioVideoRecord'">
<AudioVideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>

<div v-else-if="inputType === 'audioVideoPassageRecord'">
<AudioVideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>

<!-- If type is audioVideoImageRecord -->
<div v-else-if="inputType === 'audioVideoImageRecord'">
<AudioVideoRecord
:constraints="valueConstraints"
:fieldData="fieldData"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
mode="audioVideoImageRecord" />
</div>

<!-- If type is audioRecordNumberTask -->
<div v-else-if="inputType === 'audioVideoRecordNumberTask'">
<AudioVideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
mode="audioVideoRecordNumberTask" />
</div>

<!-- If type is audioRecordAudioTask -->
<div v-else-if="inputType === 'audioVideoRecordAudioTask'">
<AudioVideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
:fieldData="fieldData"
mode="audioVideoRecordAudioTask" />
</div>

<!-- If type is audioVideoRecordNoStop -->
<div v-else-if="inputType === 'audioVideoRecordNoStop'">
<AudioVideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
mode="audioVideoRecordNoStop" />
</div>

<div v-else-if="inputType === 'videoCheck'">
<VideoCheck
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>

<!-- If type is VideoRecord -->
<div v-else-if="inputType === 'videoRecord'">
<VideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>

<!-- If type is videoRecordVideoTask -->
<div v-else-if="inputType === 'videoRecordVideoTask'">
<VideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
:fieldData="fieldData"
mode="videoRecordVideoTask" />
</div>

<!-- If type is videoRecordNoStop -->
<div v-else-if="inputType === 'videoRecordNoStop'">
<VideoRecord
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"
mode="videoRecordNoStop" />
</div>

<!-- If type is text -->
<div v-else-if="inputType === 'text'">
Expand Down Expand Up @@ -153,7 +246,7 @@
:constraints="valueConstraints"
:selected_language="selected_language"
:init="init" v-on:valueChanged="sendData"/>
</div>
</div>

<!-- If type is date -->
<div v-else-if="inputType === 'date' || inputType === 'year'">
Expand Down Expand Up @@ -249,6 +342,8 @@
<script>
import Radio from '../Inputs/WebRadio/';
import AudioRecord from '../Inputs/WebAudioRecord/';
import AudioVideoRecord from '../Inputs/WebAudioVideoRecord/';
import VideoRecord from '../Inputs/WebVideoRecord/';
import TextInput from '../Inputs/WebTextInput/';
import TextArea from '../Inputs/TextArea/';
import IntegerInput from '../Inputs/WebIntegerInput/';
Expand All @@ -260,7 +355,9 @@ import MultiTextInput from '../Inputs/MultiTextInput';
import SliderInput from '../Inputs/SliderInput';
import TimeRange from '../Inputs/TimeRange';
import SelectInput from '../Inputs/SelectInput';
// import AudioCheck from '../Inputs/AudioCheck';
import AudioCheck from '../Inputs/AudioCheck/';
import VideoCheck from '../Inputs/VideoCheck/';
import AudioVideoCheck from '../Inputs/AudioVideoCheck/';
import StaticReadOnly from '../Inputs/StaticReadOnly';
import SaveData from '../Inputs/SaveData/SaveData';
import StudySign from '../StudySign/StudySign';
Expand Down Expand Up @@ -315,6 +412,11 @@ export default {
SaveData,
Radio,
AudioRecord,
AudioVideoRecord,
VideoRecord,
AudioCheck,
VideoCheck,
AudioVideoCheck,
TextInput,
TextArea,
EmailInput,
Expand Down
Loading