Skip to content

Commit

Permalink
Merge pull request #45 from BBMRI-ERIC/refactor/use_boostrap_features
Browse files Browse the repository at this point in the history
Refactor/use boostrap features
  • Loading branch information
svituz committed Oct 5, 2023
2 parents 4ca0228 + a43a1c0 commit 753c180
Show file tree
Hide file tree
Showing 17 changed files with 544 additions and 624 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ module.exports = {
"never"
],
"key-spacing": [
"error", {
"beforeColon": false
}
"error", { "beforeColon": false }
],
"object-curly-spacing": [
"error",
"always"
]
}
}
2 changes: 1 addition & 1 deletion src/assets/scss/bbmri.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $theme-colors: (
"secondary": #003674,
"danger": #dc3545,
"warning": #e95713,
"info": #017ffd,
"info": #3c3c3d,
"light": #e7e7e7,
"dark": #3c3c3d
);
Expand Down
56 changes: 0 additions & 56 deletions src/components/ConfirmationModal.vue

This file was deleted.

27 changes: 11 additions & 16 deletions src/components/NegotiationCard.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<template>
<div class="card mb-2">
<h5 class="card-header">
{{ negotiationTitle }}
{{ title }}
<span class="badge rounded-pill bg-primary float-end">
{{ negotiationStatus }}
{{ status }}
</span>
</h5>
<div class="card-body">
<h6 class="card-subtitle mb-2 text-muted">
Negotiation ID: {{ negotiationId }}
Negotiation ID: {{ id }}
</h6>
<h6 class="card-subtitle mb-2 text-muted">
Created on: {{ negotiationCreationDate }}
Created on: {{ creationDate }}
</h6>
<h6 class="card-subtitle mb-2 text-muted">
Created by: {{ negotiationSubmitter }}
Created by: {{ submitter }}
</h6>
</div>
</div>
Expand All @@ -25,31 +25,26 @@
export default {
name: "NegotiationCard",
props: {
negotiationId: {
id: {
type: String,
default: ""
},
negotiationTitle: {
title: {
type: String,
default: ""
},
negotiationStatus: {
status: {
type: String,
default: ""
},
negotiationSubmitter: {
submitter: {
type: String,
default: ""
},
negotiationResources: {
type: Object,
default: undefined
},
negotiationCreationDate: {
creationDate: {
type: Date,
default: undefined
},
}
}
}
</script>
76 changes: 35 additions & 41 deletions src/components/NegotiationForm.vue
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
<template>
<button
ref="openModal"
hidden
data-bs-toggle="modal"
data-bs-target="#feedbackModal"
/>
<feedback-modal
id="feedbackModal"
:title="notificationTitle"
:text="notificationText"
dismiss-button-text="Back to HomePage"
@dismiss="backToHomePage"
/>
<div
v-if="loading"
class="d-flex align-items-center justify-content-center"
>
<h4>
Loading
<font-awesome-icon
class="ms-2"
icon="fa fa-spinner"
spin-pulse
/>
<h4 class="me-2">
Loading...
</h4>
<div
class="spinner-border"
role="status"
/>
</div>
<div v-else>
<b-modal
id="negotiation-feedback"
v-model="notificationVisible"
:title="notificationHeader"
hide-footer="true"
:header-bg-variant="notificationVariant"
@hide.prevent
>
<p class="my-4">
{{ notificationBody }}
</p>
<b-button @click="closeNegotiation">
Back to Negotiations
</b-button>
</b-modal>
<form-wizard
v-if="accessCriteria"
:start-index="0"
Expand Down Expand Up @@ -120,15 +117,17 @@
</template>

<script>
import { mapActions } from "vuex"
import FeedbackModal from "@/components/modals/FeedbackModal.vue"
import { FormWizard, TabContent } from "vue3-form-wizard"
import "vue3-form-wizard/dist/style.css"
import { mapActions } from "vuex"
export default {
name: "NegotiationForm",
components: {
FormWizard,
TabContent,
FeedbackModal
},
props: {
requestId: {
Expand All @@ -138,22 +137,18 @@ export default {
},
data() {
return {
notificationVariant: "light",
notificationHeader: "",
notificationBody: "",
notificationTitle: "",
notificationText: "",
negotiationCriteria: {},
accessCriteria: undefined,
}
},
computed: {
notificationVisible() {
return this.notificationHeader !== ""
},
loading() {
if (this.accessCriteria !== undefined) {
this.initNegotiationCriteria()
}
return this.accessCriteria === undefined && !this.notificationVisible
return this.accessCriteria === undefined
},
},
async mounted() {
Expand All @@ -162,13 +157,12 @@ export default {
})
if (result.code) {
if (result.code == 404) {
this.showNotification("danger", "Error", "Request not found")
this.showNotification("Error", "Request not found")
} else {
this.showNotification("danger", "Error", "Error retrieving the request")
this.showNotification("Error", "Cannot contact the server to get request information")
}
} else if (result.negotiationId) {
// if the negotiationId is present it means that the request is already associated to a negotiation
this.showNotification("danger", "Error", "Request already associated to a negotiation")
this.showNotification("Error", "Request already submitted")
} else {
await this.retrieveAccessCriteriaByResourceId({
resourceId: result.resources[0].id
Expand All @@ -187,7 +181,7 @@ export default {
}
}).then((negotiationId) => {
if (negotiationId) {
this.showNotification("light",
this.showNotification(
"Negotiation Created Correctly",
"You can follow the status of this negotiation in your researcher page")
}
Expand All @@ -199,13 +193,13 @@ export default {
handleFileUpload(event, section, criteria) {
this.negotiationCriteria[section][criteria] = event.target.files[0]
},
showNotification(variant, header, body) {
this.notificationVariant = variant
this.notificationHeader = header
this.notificationBody = body
showNotification(header, body) {
this.$refs.openModal.click()
this.notificationTitle = header
this.notificationText = body
},
closeNegotiation() {
this.$router.push("/researcher")
backToHomePage() {
this.$router.push("/")
},
initNegotiationCriteria() {
for (var section of this.accessCriteria.sections) {
Expand Down
Loading

0 comments on commit 753c180

Please sign in to comment.