From fccd1edbfcf12c5bdec526beda2d4bd2f252d941 Mon Sep 17 00:00:00 2001 From: Alex Derr Date: Wed, 31 Jan 2024 10:31:24 -0500 Subject: [PATCH] Code formatting --- .../nuxt-app/composables/form-methods.ts | 17 ++- .../frontend/nuxt-app/layouts/base-layout.vue | 3 +- mlte/frontend/nuxt-app/pages/index.vue | 24 ++-- .../nuxt-app/pages/negotiation-card.vue | 50 ++++--- mlte/frontend/nuxt-app/pages/report.vue | 129 ++++++++++-------- 5 files changed, 121 insertions(+), 102 deletions(-) diff --git a/mlte/frontend/nuxt-app/composables/form-methods.ts b/mlte/frontend/nuxt-app/composables/form-methods.ts index 57c0f289..d4078fc5 100644 --- a/mlte/frontend/nuxt-app/composables/form-methods.ts +++ b/mlte/frontend/nuxt-app/composables/form-methods.ts @@ -1,7 +1,8 @@ -export function successfulSubmission(artifactType: string, artifactName: string) { - alert( - `Your ${artifactType}, ${artifactName}, has been saved successfully.` - ) +export function successfulSubmission( + artifactType: string, + artifactName: string, +) { + alert(`Your ${artifactType}, ${artifactName}, has been saved successfully.`); } export function cancelFormSubmission(redirect: string) { @@ -26,8 +27,6 @@ export function responseErrorAlert() { ); } -export function conflictErrorAlert(){ - alert( - "Name specified for artifact is already in use." - ) -} \ No newline at end of file +export function conflictErrorAlert() { + alert("Name specified for artifact is already in use."); +} diff --git a/mlte/frontend/nuxt-app/layouts/base-layout.vue b/mlte/frontend/nuxt-app/layouts/base-layout.vue index 4d8c5ed4..55dc88f7 100644 --- a/mlte/frontend/nuxt-app/layouts/base-layout.vue +++ b/mlte/frontend/nuxt-app/layouts/base-layout.vue @@ -49,7 +49,8 @@ target="_blank" rel="noopener noreferrer" href="https://mlte.readthedocs.io/en/latest/using_mlte/" - >User Guide + >User Guide v0.2.2 diff --git a/mlte/frontend/nuxt-app/pages/index.vue b/mlte/frontend/nuxt-app/pages/index.vue index 3eead5b0..e3575f5b 100644 --- a/mlte/frontend/nuxt-app/pages/index.vue +++ b/mlte/frontend/nuxt-app/pages/index.vue @@ -153,9 +153,7 @@ }, }" > - - Edit - + Edit @@ -558,7 +556,9 @@ function populateArtifacts(model: string, version: string, artifactList: any) { if (isValidNegotiation(artifact)) { negotiationCards.value.push({ id: artifact.header.identifier, - timestamp: new Date(artifact.header.timestamp).toLocaleString("en-US"), + timestamp: new Date(artifact.header.timestamp).toLocaleString( + "en-US", + ), model, version, }); @@ -569,7 +569,9 @@ function populateArtifacts(model: string, version: string, artifactList: any) { if (isValidReport(artifact)) { reports.value.push({ id: artifact.header.identifier, - timestamp: new Date(artifact.header.timestamp).toLocaleString("en-US"), + timestamp: new Date(artifact.header.timestamp).toLocaleString( + "en-US", + ), model, version, }); @@ -580,7 +582,9 @@ function populateArtifacts(model: string, version: string, artifactList: any) { if (isValidSpec(artifact)) { specifications.value.push({ id: artifact.header.identifier, - timestamp: new Date(artifact.header.timestamp).toLocaleString("en-US"), + timestamp: new Date(artifact.header.timestamp).toLocaleString( + "en-US", + ), model, version, }); @@ -592,7 +596,9 @@ function populateArtifacts(model: string, version: string, artifactList: any) { validatedSpecs.value.push({ id: artifact.header.identifier, specid: artifact.body.spec_identifier, - timestamp: new Date(artifact.header.timestamp).toLocaleString("en-US"), + timestamp: new Date(artifact.header.timestamp).toLocaleString( + "en-US", + ), model, version, }); @@ -605,7 +611,9 @@ function populateArtifacts(model: string, version: string, artifactList: any) { id: artifact.header.identifier.slice(0, -6), measurement: artifact.body.metadata.measurement_type, type: artifact.body.value.value_type, - timestamp: new Date(artifact.header.timestamp).toLocaleString("en-US"), + timestamp: new Date(artifact.header.timestamp).toLocaleString( + "en-US", + ), model, version, }); diff --git a/mlte/frontend/nuxt-app/pages/negotiation-card.vue b/mlte/frontend/nuxt-app/pages/negotiation-card.vue index 2c00446a..33e77ca2 100644 --- a/mlte/frontend/nuxt-app/pages/negotiation-card.vue +++ b/mlte/frontend/nuxt-app/pages/negotiation-card.vue @@ -206,10 +206,7 @@
-
+
@@ -435,7 +432,9 @@
- Cancel + + Cancel + Save
@@ -661,29 +660,28 @@ async function submit() { version + "/artifact", { - retry: 0, - method: "POST", - body: { - artifact, - force: forceSaveParam.value, - parents: false, - }, - onRequestError() { - requestErrorAlert(); - }, - onResponseError({ response }) { - if (response.status === 409){ - conflictErrorAlert(); - } - else{ - responseErrorAlert(); - } + retry: 0, + method: "POST", + body: { + artifact, + force: forceSaveParam.value, + parents: false, + }, + onRequestError() { + requestErrorAlert(); + }, + onResponseError({ response }) { + if (response.status === 409) { + conflictErrorAlert(); + } else { + responseErrorAlert(); + } + }, }, - }); - successfulSubmission('negotiation card', identifier); + ); + successfulSubmission("negotiation card", identifier); forceSaveParam.value = true; - } - catch(error){ + } catch (error) { console.log("Error in fetch."); console.log(error); } diff --git a/mlte/frontend/nuxt-app/pages/report.vue b/mlte/frontend/nuxt-app/pages/report.vue index 2e8eaec9..69e54f66 100644 --- a/mlte/frontend/nuxt-app/pages/report.vue +++ b/mlte/frontend/nuxt-app/pages/report.vue @@ -20,12 +20,13 @@

Model Summary

A summary of the model under evaluation.

- + @@ -110,9 +111,24 @@ - {{ finding.status }} - {{ finding.status }} - {{ finding.status }} + + {{ finding.status }} + + + {{ finding.status }} + + + {{ finding.status }} + {{ finding.status }} {{ finding.property }} {{ finding.measurement }} @@ -247,10 +263,7 @@
-
+
@@ -385,13 +398,14 @@

No quantitative analysis included with this report.

- Cancel - + + Cancel + + Export Save
- @@ -423,9 +437,9 @@ const form = ref({ { description: "", baseline: "", - } - ] - } + }, + ], + }, ], findings: null, }, @@ -463,8 +477,8 @@ const form = ref({ labels: [ { description: "", - percentage: 0 - } + percentage: 0, + }, ], fields: [ { @@ -473,18 +487,18 @@ const form = ref({ type: "", expected_values: "", missing_values: "", - special_values: "" - } + special_values: "", + }, ], rights: "", policies: "", - identifiable_information: "" - } + identifiable_information: "", + }, ], comments: [ { - content: "" - } + content: "", + }, ], quantitative_analysis: {}, validated_spec_id: null, @@ -544,7 +558,7 @@ if (useRoute().query.artifactId !== undefined) { requestErrorAlert(); }, async onResponse({ response }) { - if (isValidReport(response._data)){ + if (isValidReport(response._data)) { form.value.summary = response._data.body.summary; form.value.performance.goals = response._data.body.performance.goals; form.value.intended_use.context = @@ -586,7 +600,8 @@ if (useRoute().query.artifactId !== undefined) { response._data.body.validated_spec_id !== undefined && response._data.body.validated_spec_id !== "" ) { - form.value.validated_spec_id = response._data.body.validated_spec_id; + form.value.validated_spec_id = + response._data.body.validated_spec_id; const validatedSpec = await fetchArtifact( namespace, model, @@ -604,7 +619,7 @@ if (useRoute().query.artifactId !== undefined) { ); } -async function submit(){ +async function submit() { const namespace = useRoute().query.namespace; const model = useRoute().query.model; const version = useRoute().query.version; @@ -631,11 +646,11 @@ async function submit(){ data: form.value.data, comments: form.value.comments, analysis: form.value.quantitative_analysis, - validated_spec_id: form.value.validated_spec_id - } - } + validated_spec_id: form.value.validated_spec_id, + }, + }; - if (isValidReport(artifact)){ + if (isValidReport(artifact)) { try { await $fetch( "http://localhost:8080/api/namespace/" + @@ -646,35 +661,33 @@ async function submit(){ version + "/artifact", { - retry: 0, - method: "POST", - body: { - artifact, - force: forceSaveParam.value, - parents: false, - }, - onRequestError() { - requestErrorAlert(); - }, - onResponseError({ response }) { - if (response.status === 409){ - conflictErrorAlert(); - } - else{ - responseErrorAlert(); - } + retry: 0, + method: "POST", + body: { + artifact, + force: forceSaveParam.value, + parents: false, + }, + onRequestError() { + requestErrorAlert(); + }, + onResponseError({ response }) { + if (response.status === 409) { + conflictErrorAlert(); + } else { + responseErrorAlert(); + } + }, }, - }); - successfulSubmission('report', identifier); + ); + successfulSubmission("report", identifier); forceSaveParam.value = true; - } - catch(error){ - console.log("Error in fetch.") + } catch (error) { + console.log("Error in fetch."); console.log(error); - }; - } - else{ - console.log("Invalid report.") + } + } else { + console.log("Invalid report."); } }