Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20929 - Implemented GET involuntary dissolution configurations endpoint #2819

Merged

Conversation

JazzarKarim
Copy link
Collaborator

@JazzarKarim JazzarKarim commented May 13, 2024

Issue #:
bcgov/entity#20929

This PR implements the GET call for now. Next PR will implement the PUT call (the BE is still WIP). I'm doing this now since we're demoing tomorrow and I would like to show this.

Description of changes:

  • Interface Changes for the dissolution
  • Implemented the GET call of the configurations
  • Misc. fixes

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-auth license (Apache 2.0).

@JazzarKarim JazzarKarim self-assigned this May 13, 2024
@JazzarKarim JazzarKarim force-pushed the 20929-involuntary-dissolution-buttons branch from 412cb99 to b29f1b6 Compare May 13, 2024 18:41
Copy link

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

const state = reactive({
menu: false,
numberOfBusinesses: 0,
numberOfBusinessesEdit: 0,
numberOfBusinessesNonEdit: 0,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, this looks weird (having two properties that look similar). I have an explanation though 😆

The idea is, when the edit panel is open, the schedule summary is going to be reactive to what's being typed in the text field. However, when it is not open, it's going to be what the DB is returning of the current job batch size.

So, I decided to separate those fields. One of the biggest reasons is that, in doing so, I can store the current batch size from the GET call into the nonEdit field. This way, I only need to use the GET call once on mount. Otherwise, I have to do the GET call each time cancel or save is clicked which is really not good haha

Also, this provides so much flexibility and it separates of when the edit panel is open or not.

// Get the batch size current value (number of businesses to be dissolved per job run)
const numDissolutions = staffStore.involuntaryDissolutionConfigurations.configurations.find(
config => config.name === 'NUM_DISSOLUTIONS_ALLOWED').value
state.numberOfBusinessesNonEdit = parseInt(numDissolutions)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I mentioned above. Basically, after making the call which will be made ONCE on mount, I'm storing that value here.

/**
* Save button is clicked. Update the dissolution batch size.
* Only save if the inputted number is valid.
* TODO: Implement logic (job) once the BE is done.
*/
const saveBtnClicked = (): void => {
if (state.numberOfBusinessesRef.validate()) {
staffStore.updateDissolutionBatchSize(state.numberOfBusinesses)
// staffStore.updateDissolutionBatchSize(state.numberOfBusinesses)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FUTURE: When I work on the PUT.

function updateDissolutionBatchOnHold (onHold: boolean) {
state.involuntaryDissolutionBatch.onHold = onHold
}
// function updateDissolutionBatchSize (dissolutionBatchSize: number) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented this out for now. Will uncomment next PR.

@@ -45,11 +45,8 @@
badgeText="Paused"
icon="mdi-calendar-clock"
label="Automated Dissolution Schedule"
:showBadge="isOnHold"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all badge logic here as designs have changed. No more badge.

staffStore.updateDissolutionBatchOnHold(!staffStore.isDissolutionBatchOnHold())
}
// Get the batch size current value (number of businesses to be dissolved per job run)
const numDissolutions = staffStore.involuntaryDissolutionConfigurations.configurations.find(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what the BE will return:
config array

So, with minimal code, I thought this is the easiest and most straight forward way to get to the value I need.

@JazzarKarim
Copy link
Collaborator Author

/gcbrun

@bcregistry-sre
Copy link
Collaborator

Temporary Url for review: https://bcregistry-account-dev--pr-2819-b8ecll37.web.app

@JazzarKarim JazzarKarim marked this pull request as ready for review May 13, 2024 19:05
@JazzarKarim JazzarKarim merged commit 5d6e104 into bcgov:main May 13, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants