From 23600cedee340cc000a4777ac0ed08bbe07ab7b9 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 15 Mar 2020 17:18:40 -0500 Subject: [PATCH] web: Adjust to new API URLs, implement update for Measure. --- .../measure-config/measure-config-form.ts | 10 +++++++++- web/src/services/pm-api-client.ts | 10 +++++----- web/src/views/EditMeasure.vue | 2 +- web/src/views/edit-measure.ts | 15 ++++++++++++++- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/web/src/components/measure-config/measure-config-form.ts b/web/src/components/measure-config/measure-config-form.ts index ad50aab..71c416c 100644 --- a/web/src/components/measure-config/measure-config-form.ts +++ b/web/src/components/measure-config/measure-config-form.ts @@ -12,7 +12,7 @@ import moment from 'moment'; export class MeasureConfigForm extends Vue { @Prop({}) public value!: MeasureConfig; @Prop({}) public disabled: boolean = false; - @Prop({}) public measureExists: boolean = false; + @Prop({}) public measureExists!: boolean; public now = moment(); public formatStrings = [ @@ -47,6 +47,14 @@ export class MeasureConfigForm extends Vue { this.value.timestampDisplayFormat = this.selectedFormat; } } + + private mounted() { + if (this.formatStrings.includes(this.value.timestampDisplayFormat)) { + this.selectedFormat = this.value.timestampDisplayFormat; + } else { + this.selectedFormat = 'custom'; + } + } } export default MeasureConfigForm; diff --git a/web/src/services/pm-api-client.ts b/web/src/services/pm-api-client.ts index 97fff4d..144a054 100644 --- a/web/src/services/pm-api-client.ts +++ b/web/src/services/pm-api-client.ts @@ -136,7 +136,7 @@ export class PmApiClient { public async getMeasurements(measureSlug: string) : Promise>> { - const resp = await this.http.get(`/measure/${measureSlug}`); + const resp = await this.http.get(`/measurements/${measureSlug}`); return resp.data.map(this.fromMeasurementDTO); } @@ -146,7 +146,7 @@ export class PmApiClient { : Promise> { const resp = await this.http.post( - `/measure/${measureSlug}`, + `/measurements/${measureSlug}`, this.toMeasurementDTO(measurement)); return this.fromMeasurementDTO(resp.data); } @@ -157,7 +157,7 @@ export class PmApiClient { : Promise> { const resp = await this.http - .get(`/measure/${measureSlug}/${measurementId}`); + .get(`/measurements/${measureSlug}/${measurementId}`); return this.fromMeasurementDTO(resp.data); } @@ -167,7 +167,7 @@ export class PmApiClient { : Promise> { const resp = await this.http.put( - `/measure/${measureSlug}/${measurement.id}`, + `/measurements/${measureSlug}/${measurement.id}`, this.toMeasurementDTO(measurement)); return this.fromMeasurementDTO(resp.data); } @@ -178,7 +178,7 @@ export class PmApiClient { : Promise { const resp = await this.http - .delete(`/measure/${measureSlug}/${measurementId}`); + .delete(`/measurements/${measureSlug}/${measurementId}`); return true; } diff --git a/web/src/views/EditMeasure.vue b/web/src/views/EditMeasure.vue index 7dbb05f..35bbbea 100644 --- a/web/src/views/EditMeasure.vue +++ b/web/src/views/EditMeasure.vue @@ -1,5 +1,5 @@