Skip to content

Commit

Permalink
Merge pull request #658 from qbicsoftware/hotfix/1.0.2
Browse files Browse the repository at this point in the history
1.0.2 (2021-06-07)
------------------

**Added**

**Fixed**

* Update of person entries is no longer blocked by ignored affiliation selection (#654)

* Disable the affiliation attachment during person update if no affiliation is selected (#656)

**Dependencies**

**Deprecated**
  • Loading branch information
KochTobi authored Jun 9, 2021
2 parents 1836a56 + 354bbe7 commit 14583a2
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 19 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ Changelog

This project adheres to `Semantic Versioning <https://semver.org/>`_.

1.0.1 (2020-06-07)
1.0.2 (2021-06-07)
------------------

**Added**

**Fixed**

* Update of person entries is no longer blocked by ignored affiliation selection (`#654 <https://github.com/qbicsoftware/offer-manager-2-portlet/issues/654>`_)

* Disable the affiliation attachment during person update if no affiliation is selected (`#656 <https://github.com/qbicsoftware/offer-manager-2-portlet/issues/656>`_)

**Dependencies**

**Deprecated**

1.0.1 (2021-06-07)
------------------

**Added**
Expand All @@ -19,7 +34,7 @@ This project adheres to `Semantic Versioning <https://semver.org/>`_.

**Deprecated**

1.0.0 (2020-06-04)
1.0.0 (2021-06-04)
------------------

**Added**
Expand Down
4 changes: 2 additions & 2 deletions offer-manager-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>offer-manager</artifactId>
<groupId>life.qbic</groupId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>life.qbic</groupId>
<artifactId>offer-manager-domain</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class CreatePersonView extends VerticalLayout implements Resettable {
organisationComboBox.value = findOrganisation(newValue).get()
addressAdditionComboBox.value = newValue
} else {
refreshAddressAdditions()
addressAdditionComboBox.value = addressAdditionComboBox.emptyValue
organisationComboBox.value = organisationComboBox.emptyValue
}
Expand Down Expand Up @@ -275,6 +276,16 @@ class CreatePersonView extends VerticalLayout implements Resettable {
})
}

/**
* refreshes assuming no organisation is selected
*/
protected void refreshAddressAdditions() {
ListDataProvider<Affiliation> dataProvider = new ListDataProvider<>(new ArrayList<Affiliation>())
this.addressAdditionComboBox.setDataProvider(dataProvider)
this.addressAdditionComboBox.value = addressAdditionComboBox.emptyValue
addressAdditionComboBox.setEnabled(false)
}

protected void refreshAddressAdditions(Organisation organisation) {
addressAdditionComboBox.setEnabled(true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class UpdatePersonView extends CreatePersonView {
submitButton.caption = "Update Person"
abortButton.caption = "Abort Person Update"

// remove required indicator since affiliationValid is no longer required to update
// it is replaced by affiliationsValid
organisationComboBox.setRequiredIndicatorVisible(false)
addressAdditionComboBox.setRequiredIndicatorVisible(false)

//be careful when adding new components to the view
//it is based on the CreatePersonView, you might disrupt the view when adding new components to the wrong position

Expand Down Expand Up @@ -155,13 +160,10 @@ class UpdatePersonView extends CreatePersonView {
}
})

updatePersonViewModel.addPropertyChangeListener("affiliationValid", {
if (updatePersonViewModel.affiliationValid || updatePersonViewModel.affiliationValid == null) {
organisationComboBox.componentError = null
addressAdditionComboBox.componentError = null
addAffiliationButton.setEnabled(true)
} else {
addAffiliationButton.setEnabled(false)
updatePersonViewModel.addPropertyChangeListener({
if (it.propertyName == "affiliation" || it.propertyName == "affiliationValid") {
boolean buttonEnabled = updatePersonViewModel.affiliation && updatePersonViewModel.affiliationValid
addAffiliationButton.setEnabled(buttonEnabled)
}
})

Expand Down Expand Up @@ -201,6 +203,20 @@ class UpdatePersonView extends CreatePersonView {
}
submitButton.enabled = allValuesValid()
}

updatePersonViewModel.affiliationList.addPropertyChangeListener({
//validation
updatePersonViewModel.affiliationsValid = ! updatePersonViewModel.affiliationList.isEmpty()
if(updatePersonViewModel.outdatedPerson) {
List<Affiliation> originalList = updatePersonViewModel.outdatedPerson.affiliations
List<Affiliation> viewModelList = updatePersonViewModel.affiliationList
boolean affiliationsChanged = ! (originalList == viewModelList)
// set the changed needs to be triggered after the validity update
updatePersonViewModel.personUpdated = updatePersonViewModel.affiliationsValid && affiliationsChanged
} else {
log.warn("Tried to check for person affiliation changes. There is no person to update.")
}
})
})
}

Expand All @@ -220,7 +236,11 @@ class UpdatePersonView extends CreatePersonView {
*/
@Override
protected boolean allValuesValid() {
return super.allValuesValid()
&& updatePersonViewModel.personUpdated
return createPersonViewModel.academicTitleValid \
&& createPersonViewModel.firstNameValid \
&& createPersonViewModel.lastNameValid \
&& createPersonViewModel.emailValid \
&& updatePersonViewModel.personUpdated \
&& updatePersonViewModel.affiliationsValid
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import life.qbic.datamodel.dtos.business.Customer
import life.qbic.datamodel.dtos.business.ProjectManager
import life.qbic.datamodel.dtos.general.Person
import life.qbic.portal.offermanager.components.Resettable
import life.qbic.portal.offermanager.dataresources.persons.PersonResourceService
import life.qbic.portal.offermanager.communication.EventEmitter
import life.qbic.portal.offermanager.components.person.create.CreatePersonViewModel
import life.qbic.portal.offermanager.dataresources.ResourcesService
Expand All @@ -32,14 +31,17 @@ class UpdatePersonViewModel extends CreatePersonViewModel implements Resettable{
@Bindable
Boolean personUpdated

@Bindable
Boolean affiliationsValid

UpdatePersonViewModel(ResourcesService<Customer> customerService,
ResourcesService<ProjectManager> managerResourceService,
ResourcesService<Affiliation> affiliationService,
EventEmitter<Person> customerUpdate,
ResourcesService<Person> personResourceService) {
super(customerService, managerResourceService, affiliationService, personResourceService)
this.customerUpdate = customerUpdate
affiliationList = new ArrayList<Affiliation>()
affiliationList = new ObservableList(new ArrayList<Affiliation>())
personUpdated = false

this.customerUpdate.register((Person person) -> {
Expand All @@ -64,8 +66,8 @@ class UpdatePersonViewModel extends CreatePersonViewModel implements Resettable{

@Override
void reset() {
super.reset()
setOutdatedPerson(null)
affiliationList.clear()
setOutdatedPerson(null)
super.reset()
}
}
2 changes: 1 addition & 1 deletion offer-manager-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>offer-manager</artifactId>
<groupId>life.qbic</groupId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<module>offer-manager-app</module>
</modules>
<artifactId>offer-manager</artifactId>
<version>1.0.1-SNAPSHOT</version> <!-- <<QUBE_FORCE_BUMP>> -->
<version>1.0.2-SNAPSHOT</version> <!-- <<QUBE_FORCE_BUMP>> -->
<groupId>life.qbic</groupId>
<name>The new offer manager</name>
<url>http://github.com/qbicsoftware/qOffer_2.0</url>
Expand Down

0 comments on commit 14583a2

Please sign in to comment.