OK so I am working on a dashboard type web project and wanted to know what the best workflow is in terms of coding and designing a page. Apologies for possible rambling...
I am aware that you need to split the design/layout from the interaction. Hence making extensive use of CSS.
The web project is an unattended dashboard type site that will display live telemetry data. I have split the data into 2 parts. Page metadata (static) that provides all the info (JSON) to construct the static page and layout. Page live data (JSON) that represents the data to be presented. All data originate from WebAPIs (metadata & live data via polling) or realtime (live data via websockets).
The page is based on MVC i.e. controllers etc and Razor marked up cshtml pages. On the front end I use Bootstrap/jQuery.
As far as I understand there are 2 ways of rendering the page (with metadata) and content (live data):
1: Controller & CSHTML
Get metadata and initial live data from WebAPI in Controller and then use model binding and CSHTML file to render the page and required structure. The div ids and classes are coded in the CSHTML file (can be dynamic based on model). Subsequent live data updates are then via polling the WebAPI on the page or a websocket subscription.
2: AJAX
(1) Render a basic page with an empty content div. (2) Then use AJAX to fetch the metadata from the WebAPI and build the page structure. (3) After that, use AJAX to fetch the live data populate the divs. Subsequent live data updates just reuses (3) on a timeout.
I understand that the designer will design the data elements, layout, fonts etc. I assume the dev will then take that and edit the .CSS to get the desired effect? Do you use the CSHTML file and then edit the CSS file continually while refreshing the page. Or do you use a sample HTML and CSS with a tool like Brackets to tweak the HTML/CSS combo?
I am aware that you need to split the design/layout from the interaction. Hence making extensive use of CSS.
The web project is an unattended dashboard type site that will display live telemetry data. I have split the data into 2 parts. Page metadata (static) that provides all the info (JSON) to construct the static page and layout. Page live data (JSON) that represents the data to be presented. All data originate from WebAPIs (metadata & live data via polling) or realtime (live data via websockets).
The page is based on MVC i.e. controllers etc and Razor marked up cshtml pages. On the front end I use Bootstrap/jQuery.
As far as I understand there are 2 ways of rendering the page (with metadata) and content (live data):
1: Controller & CSHTML
Get metadata and initial live data from WebAPI in Controller and then use model binding and CSHTML file to render the page and required structure. The div ids and classes are coded in the CSHTML file (can be dynamic based on model). Subsequent live data updates are then via polling the WebAPI on the page or a websocket subscription.
- The issue I have here is that if the WebAPI takes long to return the data the first time, the initial page render takes long. The WebAPI is on Azure so sometimes it takes about 10 secs to spin up.
- The structure/layout of the page is static. E.g. If I display lists and the lists change it would require a page reload
2: AJAX
(1) Render a basic page with an empty content div. (2) Then use AJAX to fetch the metadata from the WebAPI and build the page structure. (3) After that, use AJAX to fetch the live data populate the divs. Subsequent live data updates just reuses (3) on a timeout.
- The advantage is that the page is responsive in the sense that it is rendered fully with only a progress type animation and that the structure and content will render when ready.
- The disadvantage is that if you dynamically create the structure it is harder to make changes.
I understand that the designer will design the data elements, layout, fonts etc. I assume the dev will then take that and edit the .CSS to get the desired effect? Do you use the CSHTML file and then edit the CSS file continually while refreshing the page. Or do you use a sample HTML and CSS with a tool like Brackets to tweak the HTML/CSS combo?