The 1000 steps program to MDriven Chapter 16
No edit summary
No edit summary
Tag: 2017 source edit
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Consider the lifecycle of the Car, its created in the Factory, and then sold - to a CarDealer
This is '''Chapter 16'''. If you want to go back to the beginning, [[The 1000 steps program to MDriven Chapter 1|you can find it here: Chapter 1]]. Or go back to [[The_1000_steps_program_to_MDriven_Chapter_15|Chapter 15.]]


We clean up the Main menu and move "New car" into new views for Carfactory
== Video 16: Reworking the Main Menu ==
<html>


The video for chapter 16: https://youtu.be/rmq7Hr3x0uU
<p class="video-warn">
  To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.
</p>


493 Sort the main menu items into menu groups
<div class="video">
  <div class="video__wrapper">
    <iframe src="https://www.youtube.com/embed/rmq7Hr3x0uU?si=AdFtnAj2oouGA22p" title="YouTube video player" frameborder="0" allowfullscreen></iframe>
  </div>
  <div class="video__navigation">
<span data-video="rmq7Hr3x0uU" data-start="00" tabindex="0"> <strong> Steps 493 - 530 </strong> </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="00" tabindex="0"> Introduction </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="92" tabindex="0"> Cleaning up </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="298" tabindex="0"> Ensure servers run </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="617" tabindex="0"> CarFactorySeeker </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="869" tabindex="0"> ShowFactory </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="1012" tabindex="0"> Clean up the view </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="1231" tabindex="0"> Add a NewCar action </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="1664" tabindex="0"> Create a new association </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="1847" tabindex="0"> Upload the model </span>
    <span class="navigation-item" data-video="rmq7Hr3x0uU" data-start="2157" tabindex="0"> Create a few new cars </span>
  </div>
</div>


494 Delete one of the double personseeker actions
</html>


495 Make sure your servers run
== Chapter 16: Cleaning and Sorting the Main Menu ==
<blockquote>'''Consider the lifecycle of the Car. It is created in the Factory and then sold to a CarDealer.''' '''We clean up the Main menu and move "New Car" into new views for CarFactory.''' </blockquote>493. Let’s start cleaning up items.


496 Check if there be changes when you upload model
* Delete the yellow note.
* Go to the Actions editor to sort the main menu items into menu groups.
* Move '''CarSeeker''', '''ShowCarsAndBrands''', and '''ShowCarsAndBrandsSVG''' finto the “Views” menu group.
* Move '''BrandSeeker''' into the “Admin” menu group.
* Move '''PersonSeekerIAmInControl''' into the “Views” menu group. Save.


497 Upload the model to make sure that the Turnkey server sees your menu changes
494. Delete the second '''PersonSeeker''' action (PersonSeekerAgain).


498 Understand why CarSeeker requires login - find the reference to the access group
495. Open Cloudform and make sure your servers are running.


499 Understand the difference between having the access group on the action vs having it on the view - in context of the discussion in the video regarding deep links
496. Check if there are changes when you upload the model. If there are none, go back to the model and save.


500 Create a new car - and verify everything works - you get a registration number fairly quick after save
497. Upload the model to ensure the Turnkey Server sees your menu changes.


501 Create a new CarFactorySeeker - Use the UI-first Copy Seeker auto form to get a suggestion really fast
498. Understand why '''CarSeeker''' requires a login - find the reference to the access group.  


[[File:AfterChapter16.zip|none|thumb]]
499. Understand the difference between having the access group on the action vs. having it on the view in the context of the discussion in the video regarding deep links.
Next chapter: [[The_1000_steps_program_to_MDriven_Chapter_17]]
 
[[Category:1000 Steps Program]]
500. Create a new car and verify everything works. Get a registration number fairly quickly after saving.
 
501. Create a new '''CarFactorySeeker''' and set its class to '''CarFactory'''. Use the '''UI-first''' and click on Copy Seeker Autoform to get a suggestion quickly.
 
502. Clean up the columns you don't want in the Seeker result.
 
* Delete the “AsString”, “ChangeTime”, “CreateTime”, and “Guid” attributes.
* Leave the “Name” attribute.
 
503. Add the Global action that shows the '''CarFactorySeeker''' to the “Views” menu group. The action was created by the "Copy Seeker Autoform" UI-first function.
 
504. Create a ViewModel action called '''CreateFactory''' and set its expression to CarFactory.Create
 
505. Follow the video and update the expression with a "let" construct to also give a name to the new factory. Write:
let f=CarFacory.Create in
(
f.Name:'NewFactory'<br />)
506. Save and upload the model. Verify the CarFactorySeeker shows.
 
* Click on Create Factory to add a NewFactory and save.
 
507. In the ViewModel editor, add a new Class action called '''ShowFactory'''. This action should bring a Document form showing a specific factory.
 
508. Add a new '''CarFactoryView''' ViewModel. Set its class to CarFactory and tick the checkbox on the ViewModel - it requires a root.


502 Clean up the columns you dont want in the seeker result
509. Back to the action '''ShowFactory''' - set Bring Up ViewModel to '''CarFactoryView''' and set the ViewModel RootObject to '''self'''. Save.


503 Add the Global action that shows the CarFactorySeeker to the Views menu group. The action was created by the "Copy Seeker auto form" ui first function
510. Back to the '''CarFactoryView''' ViewModel, click on '''UI-First''' and select '''Copy Document Auto Form'''.


504 Add a ViewModel-action NewCar and set its expression to CarFactory.Create
511. Clean up the view to remove things we don't want by following the video.


505 Follow the video and update the expression with a "let" construct to also give a name to the new factory
512. Understand the different ways to remove ViewModel columns and widgets.


506 Save and Upload the model - verify the CarFactorySeeker
513. Check the actions on the '''CarSeeker''' ViewModel. Follow along with the video and delete the '''NewCar''' action from this view.


507 Add a new Class-action ShowFactory - this action should bring a Document-form - showing a specific factory
514. In the '''CarFactoryView''', add a ViewModel action for '''NewCar'''.


508 Add a new CarFactory viewmodel - set its class and set the checkbox - requires root.
515. In the Execute expression, create a new car. Use a let construct and set the '''CarOwner''' to the current factory. Write and save:
let c=Car.Create in
(
c.CarOwner:=vCurrent_CarFactoryView<br />)
516. Clean up the columns in '''CurrentlyOwnedCars''' as shown in the video.


509 Back to the aciton - set the viewmodel and set rootobject to self
* Delete the “AsString”, “ChangeTime”, “CreateTime”, and “Guid” attributes.
* Leave the “RegistrationNumber” and “State” attributes.


510 BAck to the Viewmodel - UI-First - Copy Document form.
517. Save and upload the model.


511 Clean up the view to remove things we dont want by following the video.
518. Verify that the '''CarFactorySeeker''' brings up the '''CarFactoryView''' for the selected CarFactory.


512 Understand the different ways to remove ViewModel columns and widgets
519. Test the '''NewCar''' action and save. Verify that you get a new registration number.


513 Check the actions on CarSeeker viewmodel - delete the NewCar action from this view
520. A factory is tied to a specific brand - but our model does not yet reflect this fact.


514 In the CarFactoryView add a NewCar action.
521. In the main class diagram, create a new association between CarFactory and BrandOfCar.
The CarFactory has 0..1 BrandOfCar and the BrandOfCar has 0 to many (0..*) CarFactories (there can be many BMW factories, but a BMW factory can only make one brand of cars - BMW).
* Right-click on '''Car''' and search for “Changed by – Cross Reference”.
* Select “VMAction:CarFactoryView:NewCar


515 In the Execute expression create a new car , use a let contstruct and set the CarOwner to the current factory
522. Now, amend the '''NewCar''' action in the '''CarFactoryView''' to also assign the '''BrandOfCar''' for the created car to the value of BrandOfCar on the factory. In the Execute Expression box, write:
let c=Car.Create in
(
c.CarOwner:=vCurrent_CarFactoryView<br />c.BrandOfCar:=vCurrent_CarFactoryView.BrandOfCar)
Click “Ok” and save.


516 Clean up the columns as in the video.
523. In the '''CarFactoryView''' ViewModel, we also want to set what '''BrandOfCar''' this factory produces.


517 Save and upload the model
* Right-click to add a ComboBox (Singlelinks with setter) that lists all '''BrandOfCar'''(s) and assigns to the '''CarFactory''' a '''BrandOfCar''' single association.
* Drag the '''BrandOfCar''' widget into place on the grid.


518 Verify that the CarFactorySeeker brings up the CarFactoryView for the selected CarFactory
524. Save the model and go to the Cloud dialog. Click the "Changes" button. Now, we should see that the DB schema must be updated to reflect the new foreign key in '''CarFactory''' to hold the '''BrandOfCar''' key.


519 Test the NewCar action - save - verify that you get a new registration number
525. Upload the model. Verify that the database has been evolved by "Check Server Status".


520 A factory is tied to a specific brand - but our model does not yet reflect this fact.
526. In the '''CarFactory'''<nowiki/>'s list of cars, add the column to show the '''BrandOfCar'''.


521 In the main class diagram create a new association between CarFactory and BrandOfCar. The CarFactory has 0..1 BrandOfCar and the BrandOfCar has 0 to many (0..*) CarFactories (there can be many BMW factories - but a BMW factory can only do one brand of cars - BMW)
* Go to '''CarFactoryView''' Viewmodel, scroll down to '''CurrentlyOwnedCars''', and right-click. Choose “Add column”, select “BrandOfCar”, then “BrandOfCar.Name : String”.
* Edit the display name to show as “Brand”.
* Save and check your app.


522 Now amend the NewCar action in the CarFactoryView to also assign the BrandOfCar for the created car to the value of BrandOfCar on the factory
527. In the video, I mistakenly deleted the factory - this was due to the action "Delete This" being close to the "New Car" so I assumed that the delete was for the car - but it was for the factory.


523 In the CarFactoryView we also want to be able to set what BrandOfCar this factory is producing. Add a combobox that list all BrandOfCars and assign to the CarFactory.BrandOfCar single association.
* Return to the '''Car FactoryView''' ViewModel and double-click on “Delete This” in the actions.
* Give the "Delete this" action a better name like "Delete This Factory". Save and check the web.
* Note the changes are not showing. Go to the Cloud dialog and upload the model. Check the app again.


524 Save model and go the cloud dialog - click the "changes" button - now we should see that the db-schema must be updated to reflect the new foreign key in CarFactory to hold the BrandOfCar key.
528. Find the CarFactoryView's action '''ShowFactory''' and follow the discussion in the video on why this is worthless here - but necessary in other places - and do an opt-out in this position to clean the options up a bit.


525 Upload the model - verify that the database has been evolved with by "check server status"
529. Create a few (5) new cars in the app. Save with them getting unique registration numbers.


526 In the CarFactory's list of cars - add the column to show the brandofcar
530. Since the factory creates cars, it will not actually purchase any cars, so we can remove the "DocumentForSales" grid and the controls that belong to it from the view.


527 In the video I by mistake delete the factory - this was due to the action "Delete this" was close to the "New Car" so I assumed that delete was for the car - but it was for the factory. Give the "Delete this" action a better name like "Delete this factory"
* Save and upload the model.
* Follow the discussion on why '''InitiateSale''' is not possible at this time.  


528 Find the CarFactoryView's action ShowFactory and follow the discussion in the video on whay this is worthless here - but necessary in other places - and do an opt-out in this position to clean the options up a bit
[[File:AfterChapter16.zip|none|thumb]]


529 Create a few (5) new cars, save what them getting unique registrations numbers
'''Next Chapter'''


530 Since the factory Create cars it will not actully purchase any cars so we can remove the "DocumentForSales" grid and controls that belongs to it from view
[[The_1000_steps_program_to_MDriven_Chapter_17]]
[[Category:1000 Steps Program]]

Latest revision as of 05:06, 29 April 2024

This is Chapter 16. If you want to go back to the beginning, you can find it here: Chapter 1. Or go back to Chapter 15.

Video 16: Reworking the Main Menu

To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.

Steps 493 - 530 Introduction Cleaning up Ensure servers run CarFactorySeeker ShowFactory Clean up the view Add a NewCar action Create a new association Upload the model Create a few new cars

Chapter 16: Cleaning and Sorting the Main Menu

Consider the lifecycle of the Car. It is created in the Factory and then sold to a CarDealer. We clean up the Main menu and move "New Car" into new views for CarFactory.

493. Let’s start cleaning up items.

  • Delete the yellow note.
  • Go to the Actions editor to sort the main menu items into menu groups.
  • Move CarSeeker, ShowCarsAndBrands, and ShowCarsAndBrandsSVG finto the “Views” menu group.
  • Move BrandSeeker into the “Admin” menu group.
  • Move PersonSeekerIAmInControl into the “Views” menu group. Save.

494. Delete the second PersonSeeker action (PersonSeekerAgain).

495. Open Cloudform and make sure your servers are running.

496. Check if there are changes when you upload the model. If there are none, go back to the model and save.

497. Upload the model to ensure the Turnkey Server sees your menu changes.

498. Understand why CarSeeker requires a login - find the reference to the access group.  

499. Understand the difference between having the access group on the action vs. having it on the view in the context of the discussion in the video regarding deep links.

500. Create a new car and verify everything works. Get a registration number fairly quickly after saving.

501. Create a new CarFactorySeeker and set its class to CarFactory. Use the UI-first and click on Copy Seeker Autoform to get a suggestion quickly.

502. Clean up the columns you don't want in the Seeker result.

  • Delete the “AsString”, “ChangeTime”, “CreateTime”, and “Guid” attributes.
  • Leave the “Name” attribute.

503. Add the Global action that shows the CarFactorySeeker to the “Views” menu group. The action was created by the "Copy Seeker Autoform" UI-first function.

504. Create a ViewModel action called CreateFactory and set its expression to CarFactory.Create

505. Follow the video and update the expression with a "let" construct to also give a name to the new factory. Write:

let f=CarFacory.Create in
(
f.Name:'NewFactory'
)

506. Save and upload the model. Verify the CarFactorySeeker shows.

  • Click on Create Factory to add a NewFactory and save.

507. In the ViewModel editor, add a new Class action called ShowFactory. This action should bring a Document form showing a specific factory.

508. Add a new CarFactoryView ViewModel. Set its class to CarFactory and tick the checkbox on the ViewModel - it requires a root.

509. Back to the action ShowFactory - set Bring Up ViewModel to CarFactoryView and set the ViewModel RootObject to self. Save.

510. Back to the CarFactoryView ViewModel, click on UI-First and select Copy Document Auto Form.

511. Clean up the view to remove things we don't want by following the video.

512. Understand the different ways to remove ViewModel columns and widgets.

513. Check the actions on the CarSeeker ViewModel. Follow along with the video and delete the NewCar action from this view.

514. In the CarFactoryView, add a ViewModel action for NewCar.

515. In the Execute expression, create a new car. Use a let construct and set the CarOwner to the current factory. Write and save:

let c=Car.Create in
(
c.CarOwner:=vCurrent_CarFactoryView
)

516. Clean up the columns in CurrentlyOwnedCars as shown in the video.

  • Delete the “AsString”, “ChangeTime”, “CreateTime”, and “Guid” attributes.
  • Leave the “RegistrationNumber” and “State” attributes.

517. Save and upload the model.

518. Verify that the CarFactorySeeker brings up the CarFactoryView for the selected CarFactory.

519. Test the NewCar action and save. Verify that you get a new registration number.

520. A factory is tied to a specific brand - but our model does not yet reflect this fact.

521. In the main class diagram, create a new association between CarFactory and BrandOfCar.

The CarFactory has 0..1 BrandOfCar and the BrandOfCar has 0 to many (0..*) CarFactories (there can be many BMW factories, but a BMW factory can only make one brand of cars - BMW).
  • Right-click on Car and search for “Changed by – Cross Reference”.
  • Select “VMAction:CarFactoryView:NewCar

522. Now, amend the NewCar action in the CarFactoryView to also assign the BrandOfCar for the created car to the value of BrandOfCar on the factory. In the Execute Expression box, write:

let c=Car.Create in
(
c.CarOwner:=vCurrent_CarFactoryView
c.BrandOfCar:=vCurrent_CarFactoryView.BrandOfCar)

Click “Ok” and save.

523. In the CarFactoryView ViewModel, we also want to set what BrandOfCar this factory produces.

  • Right-click to add a ComboBox (Singlelinks with setter) that lists all BrandOfCar(s) and assigns to the CarFactory a BrandOfCar single association.
  • Drag the BrandOfCar widget into place on the grid.

524. Save the model and go to the Cloud dialog. Click the "Changes" button. Now, we should see that the DB schema must be updated to reflect the new foreign key in CarFactory to hold the BrandOfCar key.

525. Upload the model. Verify that the database has been evolved by "Check Server Status".

526. In the CarFactory's list of cars, add the column to show the BrandOfCar.

  • Go to CarFactoryView Viewmodel, scroll down to CurrentlyOwnedCars, and right-click. Choose “Add column”, select “BrandOfCar”, then “BrandOfCar.Name : String”.
  • Edit the display name to show as “Brand”.
  • Save and check your app.

527. In the video, I mistakenly deleted the factory - this was due to the action "Delete This" being close to the "New Car" so I assumed that the delete was for the car - but it was for the factory.

  • Return to the Car FactoryView ViewModel and double-click on “Delete This” in the actions.
  • Give the "Delete this" action a better name like "Delete This Factory". Save and check the web.
  • Note the changes are not showing. Go to the Cloud dialog and upload the model. Check the app again.

528. Find the CarFactoryView's action ShowFactory and follow the discussion in the video on why this is worthless here - but necessary in other places - and do an opt-out in this position to clean the options up a bit.

529. Create a few (5) new cars in the app. Save with them getting unique registration numbers.

530. Since the factory creates cars, it will not actually purchase any cars, so we can remove the "DocumentForSales" grid and the controls that belong to it from the view.

  • Save and upload the model.
  • Follow the discussion on why InitiateSale is not possible at this time.

File:AfterChapter16.zip

Next Chapter

The_1000_steps_program_to_MDriven_Chapter_17

This page was edited 19 days ago on 04/29/2024. What links here