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

Updates to desktop dashboard grid layout #3670

Merged
merged 1 commit into from
May 15, 2020

Conversation

scottopherson
Copy link
Contributor

🔩 Description: What code changed, and why?

This commit contains an incremental style update to the layout skeleton of the Desktop dashboard view and to the components displayed within it. It utilizes the Carbon grid system and some generic components already available within Automate to bring the functionality and styling of this view a little bit closer to the final production implementation.

More screenshots

⛓️ Related Resources

https://github.com/chef/chef-design-system/issues/11
#3517

👟 How to Build and Test the Change

  • npm install if you haven't updated from master recently to get new Carbon grid dep
  • Have some data to look at in the dashboard:
# From hab studio
for _ in {1..50}; do m=$((RANDOM % 4)); n=$((RANDOM % 4)); generate_chef_run_failure_example | jq --arg msg "Error $n occurred" --arg type "Chef::ExampleError$m" '.error.message = $msg | .error.class = $type' | send_chef_data_raw; done
  • Start UI and navigate to a2-dev.test/desktop

✅ Checklist

Copy link

@vjeffrey vjeffrey left a comment

Choose a reason for hiding this comment

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

working great for me locally!!

Comment on lines +20 to +34
<h3>Check-in History <span *ngIf="showCheckinDebug">(debug)</span></h3>
<div class="heading-actions">
<chef-button secondary (click)="showCheckinDebug = !showCheckinDebug">
<chef-icon>settings</chef-icon>
</chef-button>
<chef-button secondary (click)="checkinNumDays = (checkinNumDays === 14 ? 28 : 14)">
<span>Last {{ (checkinNumDays === 14 ? 2 : 4) }} Weeks</span>
<chef-icon>expand_more</chef-icon>
</chef-button>
<chef-button secondary>
<span>Download</span>
<chef-icon>expand_more</chef-icon>
</chef-button>
</div>
</div>
<div class="debug-actions" *ngIf="showCheckinDebug">
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if these are related

  1. Theres some debug action going on here. Good chance you left it here on purpose since development is ongoing.

  2. There's also some console logging coming from desktop-detail.component.ts

console logs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh could've sworn I deleted that .log. But yea, I did want to leave in the rest of the bits for demo and debugging purposes while the final checkin graph area is still being worked on.

Comment on lines +18 to +22
<chef-td [ngSwitch]="day.daysAgo">
<ng-container *ngSwitchCase="0">Today</ng-container>
<ng-container *ngSwitchCase="1">Yesterday</ng-container>
<ng-container *ngSwitchDefault>{{ day.daysAgo }} days ago</ng-container>
</chef-td>
Copy link
Contributor

Choose a reason for hiding this comment

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

never seen ngSwitchCase before - this is sweet 🥇

}

.dashboard-grid {
@extend .bx--grid;
Copy link
Contributor

Choose a reason for hiding this comment

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

extend rules 👍

for anyone looking for more info: https://css-tricks.com/the-extend-concept/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. This pattern is pretty much required for this view anyway. The first iterations I had used the grid classNames directly in the HTML. It quickly became a bit unwieldy to have chunks of code like [ngClass]="{'bx--col-lg-8': !insightVisible, 'bx--col-lg-16': insightVisible}" all over the place

Comment on lines +36 to +55
<div class="button-toggle">
<chef-button secondary (click)="checkinTableType = 'grid'">
<chef-icon>view_module</chef-icon>
</chef-button>
<chef-button secondary (click)="checkinTableType = 'list'">
<chef-icon>view_list</chef-icon>
</chef-button>
<chef-button secondary (click)="checkinTableType = 'json'">
<chef-icon>code</chef-icon>
</chef-button>
<span>{{ checkinTableType }}</span>
</div>

<div class="button-toggle">
<span>{{ checkinGridFlexType }}</span>
<chef-button secondary (click)="checkinGridFlexType = 'wrap'">
<chef-icon>wrap_text</chef-icon>
</chef-button>
<chef-button secondary (click)="checkinGridFlexType = 'stretch'">
<chef-icon>dehaze</chef-icon>
</chef-button>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this in the mockup but this is rad and I hope becomes a feature.

Comment on lines +5 to +16
const historyTypes = [
{ text: 'converged', icon: 'check_box' },
{ text: 'unchanged', icon: 'indeterminate_check_box' },
{ text: 'error', icon: 'error' },
{ text: 'unknown', icon: 'help' }
];

const checkinHistory = Array.from(new Array(29)).map((_v, i) => {
const historyType = historyTypes[Math.floor(Math.random() * historyTypes.length)];
const date = new Date();
return { ...historyType, date: new Date(date.setDate(date.getDate() - i)) };
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this pr is more about the Grid - but maybe add some Types if for this, unless this is planning to change later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just for demo purposes. I'm not sure yet what the API responses are/will be for the desktop checkin history graph. Most of the code changes made in .component.ts files are either to be replaced by ngrx related stuff and/or only for demo purposes.

Choose a reason for hiding this comment

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

#3639 -- just linking that here as a reference for the future work

Copy link
Contributor

@SEAjamieD SEAjamieD left a comment

Choose a reason for hiding this comment

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

This is coming together so amazing. Left a few comments but nothing serious - Mostly just some debugger/commented out code left behind that may still be there on purpose.

Copy link
Contributor

@susanev susanev left a comment

Choose a reason for hiding this comment

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

@scottopherson can you make the card headings h2's instead of divs? also it would be rad if we can get those big filter buttons to be tabbable along with the table rows that you can select to open the additional cards.

Copy link
Contributor

@SEAjamieD SEAjamieD left a comment

Choose a reason for hiding this comment

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

Looking Sharp!

Copy link
Contributor

@tarablack01 tarablack01 left a comment

Choose a reason for hiding this comment

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

Looks Awesome 🙌🏻

@scottopherson scottopherson force-pushed the sc/desktop-dashboard-layout branch 2 times, most recently from a272325 to bb8a74b Compare May 15, 2020 21:27
@scottopherson
Copy link
Contributor Author

@susanev made those heading updates and made the various selectable filters/rows keyboard selectable. Though I believe there's probably some more details to work out with the focus behavior between the opened/closed panels but I'd like to address those in later iterations.

@scottopherson scottopherson force-pushed the sc/desktop-dashboard-layout branch 2 times, most recently from c2c1565 to 8460d5c Compare May 15, 2020 21:52
Copy link
Contributor

@susanev susanev left a comment

Choose a reason for hiding this comment

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

thanks for all of ur work on this!!!

This commit contains an incremental update to the layout skeleton of the Desktop dashboard view and to the components displayed within it. It utilizes the Carbon grid system and some generic components already available within Automate to bring the functionality and styling of this view a little bit closer to the final production implementation.

Signed-off-by: Scott Christopherson <scott@chef.io>
@scottopherson scottopherson merged commit d8d6d95 into master May 15, 2020
@scottopherson scottopherson deleted the sc/desktop-dashboard-layout branch May 15, 2020 23:33
@scottopherson
Copy link
Contributor Author

Shoutout @lancewf it has been easy and low-friction to build on top of his work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants