#464-Saving-card-content #481

Closed
b24idalu wants to merge 0 commits from #464-Saving-card-content into team_2_week_2
Collaborator

Regarding issues #464, #461 and #462

Problems: 1. Save content from a view to layout, 2. Load content from layout to views.

Solution: These solution has mainly been worked on against the textView since that is one of the few cards that needs to be updated often. 2. To load content from layout to views, it is similar to the process of loading from localstorage. All information gets saved to the localstorage in json format, which gets returned through the getFromLocalStorage function in the SaveGrid.js. 1. Similarly to how solution 2 works, when a layout is created it will be a json object that gets saved to the local storage through functions in the SaveGrid.js. The layout is created when a new view is added, and it contains extra information in a data variable depending on which view it is. To update the layout, the onChange function is used. It references to a updateCardValues function that updates all card values before saving it to local storage. To make the TextView work, other than previously mentioned changes to the layout format by adding the data variable, text is no longer stored in the textview file. Data cannot be stored there if it wants to update and therefore it is always going to be stored in the layout variable in the dashboard. Following the changes to the layout format, the temperatureView was also modified to save its sensorId as a data variable.

Important notes:

  • It has not been tested since the temperatureView does not seem to be working normally either right now.
  • The ScheduleView was not fixed when this was implemented, and it will therefore not work either

Possible improvements:

  • Split up card info (such as texts/urls) and the layout stuff (positions)
Regarding issues [#464](https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/464), [#461](https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/461) and [#462](https://git.webug.se/Andras/BoundlessFlowCampus2K/issues/462) Problems: 1. Save content from a view to layout, 2. Load content from layout to views. Solution: These solution has mainly been worked on against the textView since that is one of the few cards that needs to be updated often. 2. To load content from layout to views, it is similar to the process of loading from localstorage. All information gets saved to the localstorage in json format, which gets returned through the getFromLocalStorage function in the SaveGrid.js. 1. Similarly to how solution 2 works, when a layout is created it will be a json object that gets saved to the local storage through functions in the SaveGrid.js. The layout is created when a new view is added, and it contains extra information in a data variable depending on which view it is. To update the layout, the onChange function is used. It references to a updateCardValues function that updates all card values before saving it to local storage. To make the TextView work, other than previously mentioned changes to the layout format by adding the data variable, text is no longer stored in the textview file. Data cannot be stored there if it wants to update and therefore it is always going to be stored in the layout variable in the dashboard. Following the changes to the layout format, the temperatureView was also modified to save its sensorId as a data variable. Important notes: - It has not been tested since the temperatureView does not seem to be working normally either right now. - The ScheduleView was not fixed when this was implemented, and it will therefore not work either Possible improvements: - Split up card info (such as texts/urls) and the layout stuff (positions)
Saves when stuff is moved, but not when reload page (next fix)
Text saves even when one reloads page. Saves after someone starts typing anything
Added comments and moved the function to saveGrid file.
Saves when enter or blurred out instead now, logic can be copied over to other views as well
Collaborator

Review on #464

Whats done

Tested on Windowns 11 using Chrome

  • App starts
    • A lot of issues with diffrent views, not related to chages in this issue
    • I have refrashed the page witch ganged values on views to see if it stays.
      +TextView works well.
      • doesnt work on mapView(later issue created)
      • sensorViews and others cant be tested as they doent work (later issue)

Inspected following files

  • /Dashboard.js
    • Indentation/code styling follows prittier
      • No indention standard exist in wiki but prittier makes it uniform
    • Naming convention are good
    • Comments
      • Good amount of commens to explain new functionallity
    • General code quality
      • looks good

What needs to be done

  • Dashboard.js
    • Add the same functioallity as texyView have to other view that need saved states
  • exampleView.js
    • Smaller changes in the views might be needed as in textView

Conclusion

  • Ready to merge the changes will be implimented in later states as those afected views also have merges to be made
# Review on #464 ## Whats done ### Tested on Windowns 11 using Chrome + App starts + A lot of issues with diffrent views, not related to chages in this issue + I have refrashed the page witch ganged values on views to see if it stays. +TextView works well. + doesnt work on mapView(later issue created) + sensorViews and others cant be tested as they doent work (later issue) ### Inspected following files + /Dashboard.js + Indentation/code styling follows prittier + No indention standard exist in wiki but prittier makes it uniform + Naming convention are good + Comments + Good amount of commens to explain new functionallity + General code quality + looks good ## What needs to be done + Dashboard.js + Add the same functioallity as texyView have to other view that need saved states + exampleView.js + Smaller changes in the views might be needed as in textView ## Conclusion + Ready to merge the changes will be implimented in later states as those afected views also have merges to be made
Collaborator

Will merge manually!

Will merge manually!
a24vinla closed this pull request 2026-04-22 07:36:43 +00:00
c24danli approved these changes 2026-04-22 07:48:43 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!481
No description provided.