Skip to content
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
37 changes: 23 additions & 14 deletions src/components/pages/Neutral.vue
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ import axios from "axios";
import { mapMutations, mapActions, mapState } from "vuex";
import { apiError, apiSuccess, apiErrorRes, apiWarning, apiInfo, clearToastMessages } from "@/util/ErrorMessage.js";
import { playNeutralFinishedSound } from "@/util/SoundMessage.js";
import { axiosGetWithRetry } from "@/util/network.js";
import MainLayout from "@/layout/MainLayout";
import ExampleImage from "@/components/ui/ExampleImage";
import DialogComponent from '@/components/ui/SubjectDialog.vue'
Expand Down Expand Up @@ -645,7 +646,7 @@ export default {
if (this.isMonocularMode) {
this.n_calibrated_cameras = 1
} else {
const res = await axios.get(`/sessions/${this.$route.params.id}/get_n_calibrated_cameras/`, {})
const res = await axiosGetWithRetry(`/sessions/${this.$route.params.id}/get_n_calibrated_cameras/`, {})
this.n_calibrated_cameras = res.data.data
}
this.loadSubjectsList(false)
Expand Down Expand Up @@ -790,7 +791,7 @@ export default {
async saveAdvancedSettings() {
this.savingAdvancedSettings = true
try {
await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_metadata/`,
{
params: this.getAdvancedSettingsMetadataParams(),
Expand All @@ -817,7 +818,7 @@ export default {
if (this.hasSavedAdvancedSettingsMetadata) return

try {
await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_metadata/`,
{
params: this.getAdvancedSettingsMetadataParams(),
Expand Down Expand Up @@ -973,7 +974,7 @@ export default {
filter_frequency: this.filter_frequency,
});
try {
await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_metadata/`,
{
params: {
Expand All @@ -983,7 +984,7 @@ export default {
}
);

await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_subject/`,
{
params: {
Expand All @@ -992,7 +993,7 @@ export default {
}
)

const res = await axios.get(
const res = await axiosGetWithRetry(
`/sessions/${this.session.id}/record/`,
{
params: {
Expand All @@ -1005,20 +1006,27 @@ export default {
subject_data_sharing: this.data_sharing,
subject_pose_model: this.pose_model,
},
},
{
retries: 2,
backoffFactor: 0.2,
maxJitterMs: 100,
timeout: 4500,
}
);
this.setTrialId(res.data.id);
this.pollStatus();
} catch (error) {
apiError(error);
this.busy = false;
}
}
}
}
},
async pollStatus() {
try {
const res = await axios.get(
const res = await axiosGetWithRetry(
`/sessions/${this.session.id}/neutral_img/`
);
switch (res.data.status) {
Expand All @@ -1034,17 +1042,17 @@ export default {
break;
}
case "error": {
const resTrial = await axios.get(`/trials/${this.trialId}/`);
const resTrial = await axiosGetWithRetry(`/trials/${this.trialId}/`);
clearToastMessages();
apiErrorRes(resTrial, "Error in processing neutral pose");
this.busy = false;

const resStatus = await axios.get(`/sessions/${this.$route.params.id}/status/`, {})
const resStatus = await axiosGetWithRetry(`/sessions/${this.$route.params.id}/status/`, {})

this.n_cameras_connected = resStatus.data.n_cameras_connected
this.n_videos_uploaded = resStatus.data.n_videos_uploaded

const resCalibratedCameras = await axios.get(`/sessions/${this.$route.params.id}/get_n_calibrated_cameras/`, {})
const resCalibratedCameras = await axiosGetWithRetry(`/sessions/${this.$route.params.id}/get_n_calibrated_cameras/`, {})

this.n_calibrated_cameras = resCalibratedCameras.data.data

Expand All @@ -1056,7 +1064,7 @@ export default {
break;
}
default: {
const resStatus = await axios.get(`/sessions/${this.$route.params.id}/status/`, {})
const resStatus = await axiosGetWithRetry(`/sessions/${this.$route.params.id}/status/`, {})

this.n_videos_uploaded = resStatus.data.n_videos_uploaded

Expand All @@ -1077,14 +1085,15 @@ export default {
}
} catch (error) {
apiError(error);
this.busy = false;
}
},
openAdvancedSettings() {
this.advancedSettingsDialog = true;
this.getAvailableFramerates()
},
async getAvailableFramerates() {
const session_settings = await axios.get(`/sessions/${this.session.id}/get_session_settings/`)
const session_settings = await axiosGetWithRetry(`/sessions/${this.session.id}/get_session_settings/`)
if('data' in session_settings && 'framerates' in session_settings.data) {
this.framerates_available = []
session_settings.data.framerates.forEach(element => {
Expand Down Expand Up @@ -1140,7 +1149,7 @@ export default {
if (await this.$refs.observer.validate()) {
this.busy = true;
try {
await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_metadata/`,
{
params: {
Expand All @@ -1157,7 +1166,7 @@ export default {
}
);

await axios.get(
await axiosGetWithRetry(
`/sessions/${this.session.id}/set_subject/`,
{
params: {
Expand Down
Loading