From 34b79118a15da3df5b69b5ea422799d44c9e43ac Mon Sep 17 00:00:00 2001 From: Alex Derr Date: Wed, 24 Jan 2024 16:10:05 -0500 Subject: [PATCH 01/11] Update nuxt, enable report fields, make form cancel a composable --- .../nuxt-app/composables/form-methods.ts | 9 +++ mlte/frontend/nuxt-app/package.json | 2 +- mlte/frontend/nuxt-app/pages/index.vue | 17 +---- .../nuxt-app/pages/negotiation-card.vue | 2 +- mlte/frontend/nuxt-app/pages/report.vue | 73 +++++++++---------- 5 files changed, 46 insertions(+), 57 deletions(-) create mode 100644 mlte/frontend/nuxt-app/composables/form-methods.ts diff --git a/mlte/frontend/nuxt-app/composables/form-methods.ts b/mlte/frontend/nuxt-app/composables/form-methods.ts new file mode 100644 index 00000000..97072b78 --- /dev/null +++ b/mlte/frontend/nuxt-app/composables/form-methods.ts @@ -0,0 +1,9 @@ +export function cancelFormSubmission(redirect: string) { + if ( + confirm( + "Are you sure you want to leave this page? All changes will be lost.", + ) + ) { + location.href = redirect; + } +} \ No newline at end of file diff --git a/mlte/frontend/nuxt-app/package.json b/mlte/frontend/nuxt-app/package.json index a21ab860..8240fafa 100644 --- a/mlte/frontend/nuxt-app/package.json +++ b/mlte/frontend/nuxt-app/package.json @@ -18,7 +18,7 @@ "eslint-plugin-n": "^16.0.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-vue": "^9.15.1", - "nuxt": "^3.9.3" + "nuxt": "^3.7.4" }, "dependencies": { "@babel/eslint-parser": "^7.22.9", diff --git a/mlte/frontend/nuxt-app/pages/index.vue b/mlte/frontend/nuxt-app/pages/index.vue index 335e7405..89d6d63d 100644 --- a/mlte/frontend/nuxt-app/pages/index.vue +++ b/mlte/frontend/nuxt-app/pages/index.vue @@ -153,26 +153,11 @@ }, }" > - + Edit - - - View - - diff --git a/mlte/frontend/nuxt-app/pages/negotiation-card.vue b/mlte/frontend/nuxt-app/pages/negotiation-card.vue index 8ecf6756..6eff2c7d 100644 --- a/mlte/frontend/nuxt-app/pages/negotiation-card.vue +++ b/mlte/frontend/nuxt-app/pages/negotiation-card.vue @@ -435,7 +435,7 @@
- Cancel + Cancel Save
diff --git a/mlte/frontend/nuxt-app/pages/report.vue b/mlte/frontend/nuxt-app/pages/report.vue index 32494b33..4f4bb6dd 100644 --- a/mlte/frontend/nuxt-app/pages/report.vue +++ b/mlte/frontend/nuxt-app/pages/report.vue @@ -7,10 +7,10 @@

Model Summary

A summary of the model under evaluation.

- + - + @@ -27,19 +27,19 @@ >

Goal {{ goalIndex + 1 }}

- +

Metrics

- +
- +
@@ -73,10 +73,10 @@

Intended Use

A description of how the model is intended to be used.

- + @@ -290,8 +287,6 @@ import { responseErrorAlert, } from "../composables/error-handling"; -import { isValidReport } from "../composables/artifact-validation.ts"; - const path = ref([ { href: "/", From cfb8ac301ae0f7ba1973e409631ede4f66602a73 Mon Sep 17 00:00:00 2001 From: Alex Derr Date: Thu, 25 Jan 2024 14:43:01 -0500 Subject: [PATCH 02/11] Valid report default format and submission - Add selects for the classification and problem type - Add data manipulation for loading and submission - Remove unused methods --- .../nuxt-app/pages/negotiation-card.vue | 31 +- mlte/frontend/nuxt-app/pages/report.vue | 278 ++++++++++++++---- 2 files changed, 236 insertions(+), 73 deletions(-) diff --git a/mlte/frontend/nuxt-app/pages/negotiation-card.vue b/mlte/frontend/nuxt-app/pages/negotiation-card.vue index 6eff2c7d..2720b589 100644 --- a/mlte/frontend/nuxt-app/pages/negotiation-card.vue +++ b/mlte/frontend/nuxt-app/pages/negotiation-card.vue @@ -54,7 +54,7 @@ From 56d252f3e82e05db6b7b1d3f7e0610be65dd5b7f Mon Sep 17 00:00:00 2001 From: Alex Derr Date: Thu, 25 Jan 2024 15:54:20 -0500 Subject: [PATCH 04/11] Update force parameter to overwrite already saved artifacts --- mlte/frontend/nuxt-app/pages/negotiation-card.vue | 3 +-- mlte/frontend/nuxt-app/pages/report.vue | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mlte/frontend/nuxt-app/pages/negotiation-card.vue b/mlte/frontend/nuxt-app/pages/negotiation-card.vue index 57478dc9..3fa2bc87 100644 --- a/mlte/frontend/nuxt-app/pages/negotiation-card.vue +++ b/mlte/frontend/nuxt-app/pages/negotiation-card.vue @@ -663,8 +663,7 @@ async function submit() { method: "POST", body: { artifact, - // TODO Find out what these values should be - force: false, + force: useRoute().query.artifactId != undefined, parents: false, }, onRequestError() { diff --git a/mlte/frontend/nuxt-app/pages/report.vue b/mlte/frontend/nuxt-app/pages/report.vue index 64a0de66..dcf31078 100644 --- a/mlte/frontend/nuxt-app/pages/report.vue +++ b/mlte/frontend/nuxt-app/pages/report.vue @@ -654,8 +654,7 @@ async function submit(){ method: "POST", body: { artifact, - // TODO Find out what these values should be - force: false, + force: useRoute().query.artifactId != undefined, parents: false, }, onRequestError() { From b87c2b6cf1741ccc1b3a338e0074530a66f62e81 Mon Sep 17 00:00:00 2001 From: Alex Derr Date: Thu, 25 Jan 2024 16:29:57 -0500 Subject: [PATCH 05/11] Bug fix on useFetch - useFetch apparently was used incorrectly causing it to run several times in error. Should be fixed --- mlte/frontend/nuxt-app/pages/negotiation-card.vue | 2 +- mlte/frontend/nuxt-app/pages/report.vue | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/mlte/frontend/nuxt-app/pages/negotiation-card.vue b/mlte/frontend/nuxt-app/pages/negotiation-card.vue index 3fa2bc87..a105672a 100644 --- a/mlte/frontend/nuxt-app/pages/negotiation-card.vue +++ b/mlte/frontend/nuxt-app/pages/negotiation-card.vue @@ -650,7 +650,7 @@ async function submit() { }; if (isValidNegotiation(artifact)) { - await useFetch( + await $fetch( "http://localhost:8080/api/namespace/" + namespace + "/model/" + diff --git a/mlte/frontend/nuxt-app/pages/report.vue b/mlte/frontend/nuxt-app/pages/report.vue index dcf31078..e6963397 100644 --- a/mlte/frontend/nuxt-app/pages/report.vue +++ b/mlte/frontend/nuxt-app/pages/report.vue @@ -396,11 +396,6 @@