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

Refactor/xd 243 #260

Merged
merged 26 commits into from
Jul 16, 2024
Merged

Refactor/xd 243 #260

merged 26 commits into from
Jul 16, 2024

Conversation

IngoSternberg
Copy link
Contributor

@IngoSternberg IngoSternberg commented Jul 15, 2024

PR for the #243 issue. A summary of what I did:

  1. deleted backbuttondirective and facility.interface in the facility.mocks folder and unused images
  2. renamed pretty much every single file so the naming convention is the same accross the whole frontend
  3. renamed the component selectors
  4. used constructor for dependency injection in the frontend pages/components. Also put the signals below the other variables because they are so long (apart from injection for APP_CONFIG). Not signal values that use signals in their initialization ofc had to stay below the signals
  5. moved all the constant data for the charts on the facility-details.page to a const.ts file because it was like >100 lines of static data
  6. standardized private/protected/readonly usage: always use the most constraining operator possible, standardized naming so private variables start with '_' but not for signals
  7. added custom tailwind class for buttons in the top right
  8. made the icons consistently the same for each facility even after reloading the page grafik
  9. fix text overflowing in the ix-tiles on the create case page because my mocked facilities have long descriptions. Before:
    grafik
    After (still not perfect as the ix-tile can never change its size)
    grafik
  10. simplified code for showing the location of a facility because it never happens that some parts of the location are set and others not
  11. gave every facility a random eco score between 70-100% (before this it was always 80%) and it stays the same even after reloading the page
  12. added the assignedTo attribute in the backend, before this it did not exist but the case-detail page stil showed it but actually just used "createdBy". Also adjusted this when creating a case so you automatically have the creator as "createdBy" and you can specify the "assignedTo"
  13. refactored the case-detail.page: removed //ts-ignore or //eslint-ignore, used the values of the ECasePriority in the error message and not the hard coded string (so if you change the enum the messsge changes too), did better date validation so f.e. the 31th February does not exist. Ordered the validation if multiple things are problematic to be from top to bottom, left to right so it is easier for the user
  14. adjusted date pattern on the case-detail.page.ts because before the date (f.e. 2024-07-20T07:28:40.417Z) had to end with T00:00:00.000Z$ so at midnight with 0 minutes/seconds. This rule does not exist in the backend/anywhere else and did not allow editing my generated cases since my seeding script had randomly generated times
  15. actually showed the asset title that the case is assigned to instead of case.source which is an attribute of a case and is not related to the facility
  16. fixed the tests, the one that took the longest was timeseries.service.spec.ts because there were small differences in the query times leading to a comparison failure.
    it was because it subtracts the current time difference in the timeseries.service.spec.ts:
const timeDifference = dayjs().diff(time, 'millisecond', true);  
  
if (from) {  
    normalizedFromTime = dayjs(from).subtract(timeDifference, 'millisecond').toDate();  
}  

I fixed it by adding a tolerance to the time in one position and just ignoring the time in another position
17. ran nx run-many -t lint to make sure all files pass linting for the final release

@IngoSternberg IngoSternberg linked an issue Jul 15, 2024 that may be closed by this pull request
12 tasks
@IngoSternberg IngoSternberg marked this pull request as draft July 15, 2024 22:34
@IngoSternberg IngoSternberg marked this pull request as ready for review July 16, 2024 15:36
Signed-off-by: Ingo Sternberg <[email protected]>
#243
@IngoSternberg IngoSternberg merged commit 5006322 into develop Jul 16, 2024
4 checks passed
@IngoSternberg IngoSternberg mentioned this pull request Jul 17, 2024
12 tasks
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.

Refactor: Polish frontend code
2 participants