From c2d0914f14b4357e995cd3239c05a12030c0c0d0 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 12 Jul 2024 15:56:23 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20modals=20for=20confir?= =?UTF-8?q?mation=20of=20PRs=20(#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/pages/add/code-metadata/[identifier].vue | 35 ++- ui/pages/add/license/[identifier].vue | 283 +++++++++++--------- ui/pages/fairsoftware.vue | 2 +- 3 files changed, 192 insertions(+), 128 deletions(-) diff --git a/ui/pages/add/code-metadata/[identifier].vue b/ui/pages/add/code-metadata/[identifier].vue index 4178dee6..a9e9055a 100644 --- a/ui/pages/add/code-metadata/[identifier].vue +++ b/ui/pages/add/code-metadata/[identifier].vue @@ -129,6 +129,9 @@ const rules = ref({ const submitLoading = ref(false); +const showSuccessModal = ref(false); +const pullRequestURL = ref(""); + const { identifier } = route.params as { identifier: string }; const { data, error } = await useFetch(`/api/codeMetadata/${identifier}`, { @@ -254,7 +257,8 @@ const pushToRepository = (e: MouseEvent) => { message: "Review the changes in the repository", }); - window.open(response.prUrl, "_blank"); + showSuccessModal.value = true; + pullRequestURL.value = response.prUrl; } else { console.error( "Failed to push code metadata to repository:", @@ -305,6 +309,11 @@ const handleApplicationCategoryChange = (value: string) => { const handleDevelopmentStatusChange = (value: string) => { formValue.value.developmentStatus = value; }; + +const navigateToPR = () => { + showSuccessModal.value = false; + window.open(pullRequestURL.value, "_blank"); +}; diff --git a/ui/pages/add/license/[identifier].vue b/ui/pages/add/license/[identifier].vue index ca1e801a..9c4a83e4 100644 --- a/ui/pages/add/license/[identifier].vue +++ b/ui/pages/add/license/[identifier].vue @@ -43,6 +43,9 @@ const displayLicenseEditor = ref(false); const getLicenseLoading = ref(false); const submitLoading = ref(false); +const showSuccessModal = ref(false); +const pullRequestURL = ref(""); + const { data, error } = await useFetch(`/api/license/${identifier}`, { headers: useRequestHeaders(["cookie"]), }); @@ -163,7 +166,8 @@ const saveLicenseAndPush = async () => { message: "Review the changes in the repository", }); - window.open(response.prUrl, "_blank"); + showSuccessModal.value = true; + pullRequestURL.value = response.prUrl; } else { push.error({ title: "Failed to push license to repository", @@ -182,138 +186,165 @@ const saveLicenseAndPush = async () => { submitLoading.value = false; }); }; + +const navigateToPR = () => { + showSuccessModal.value = false; + window.open(pullRequestURL.value, "_blank"); +}; diff --git a/ui/pages/fairsoftware.vue b/ui/pages/fairsoftware.vue index 7d99a580..7808a51c 100644 --- a/ui/pages/fairsoftware.vue +++ b/ui/pages/fairsoftware.vue @@ -26,7 +26,7 @@

The commonly accepted definition of research software is “Any software created during the research process or for a research - purpose”. It can come in many format and could be developed for + purpose”. It can come in many formats and could be developed for different applications such as artificial intelligence (AI)/machine learning (ML) models with Python, data visualization tools with Jupyter notebook, or data analysis code with R.