Skip to content

Commit 7ab5d07

Browse files
authored
Merge pull request #137 from fleetbase/dev-v0.3.36
v0.3.36
2 parents 402fd42 + a1d9f48 commit 7ab5d07

10 files changed

Lines changed: 94 additions & 13 deletions

File tree

addon/components/layout/resource/tabular-actions.hbs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
@buttonWrapperClass={{@filterPickerButtonClass}}
2626
@gridCols={{@filterPickerGridCols}}
2727
@width={{@filterPickerWidth}}
28+
@size={{@filterPickerSize}}
2829
@iconOnly={{true}}
2930
/>
3031
{{#unless @hideColumnsPicker}}
31-
<VisibleColumnPicker @columns={{@columns}} @onChange={{fn (mut @columns)}} @iconOnly={{true}} class={{@columnPickerButtonClass}} />
32+
<VisibleColumnPicker @columns={{@columns}} @onChange={{fn (mut @columns)}} @iconOnly={{true}} @size={{@columnPickerSize}} class={{@columnPickerButtonClass}} />
3233
{{/unless}}
3334
{{#if (safe-has @table "selectedRows")}}
3435
<DropdownButton
@@ -68,8 +69,14 @@
6869
@icon={{actionButton.icon}}
6970
@size={{actionButton.size}}
7071
@iconPrefix={{actionButton.prefix}}
72+
@buttonClass={{actionButton.buttonClass}}
73+
@buttonWrapperClass={{actionButton.wrapperClass}}
7174
@triggerClass={{actionButton.triggerClass}}
72-
@renderInPlace={{or actionButton.renderInPlace true}}
75+
@renderInPlace={{actionButton.renderInPlace}}
76+
@isLoading={{actionButton.isLoading}}
77+
@disabled={{actionButton.disabled}}
78+
@helpText={{actionButton.helpText}}
79+
@tooltipPlacement={{actionButton.tooltipPlacement}}
7380
as |dd|
7481
>
7582
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
@@ -150,4 +157,4 @@
150157
{{/if}}
151158
{{#if (has-block "end")}}
152159
{{yield to="end"}}
153-
{{/if}}
160+
{{/if}}

addon/components/layout/resource/tabular.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
@paginationMeta={{@data.meta}}
163163
@page={{@page}}
164164
@onPageChange={{@onPageChange}}
165+
@wrapperClass={{@tableWrapperClass}}
165166
@tfootVerticalOffset={{@tfootVerticalOffset}}
166167
@tfootVerticalOffsetElements={{@tfootVerticalOffsetElements}}
167168
@onSort={{this.handleSort}}

addon/components/table/cell/dropdown.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ export default class TableCellDropdownComponent extends Component {
5656
}
5757
}
5858

59-
@action calculatePosition(trigger) {
60-
let { width } = trigger.getBoundingClientRect();
59+
@action calculatePosition(trigger, content) {
60+
const triggerRect = trigger.getBoundingClientRect();
61+
const contentRect = content?.getBoundingClientRect?.();
62+
const contentWidth = contentRect?.width || 224;
6163

6264
let style = {
65+
position: 'fixed',
6366
marginTop: '0px',
64-
right: width + 3,
65-
top: 0,
67+
left: `${triggerRect.left - contentWidth - 3}px`,
68+
top: `${triggerRect.top}px`,
6669
};
6770

6871
return { style };

addon/services/sidebar-navigator.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ export default class SidebarNavigatorService extends Service {
106106
}
107107

108108
isActive(item = {}, routeName = this.router?.currentRouteName, currentURL = this.router?.currentURL) {
109+
if (typeof item.activeWhen === 'function') {
110+
try {
111+
if (item.activeWhen({ routeName, currentURL, router: this.router })) {
112+
return true;
113+
}
114+
} catch (_) {
115+
// Fall back to normal route/url matching below.
116+
}
117+
}
118+
109119
if (item.route && routeName?.startsWith(item.route)) {
110120
return true;
111121
}

addon/styles/addon.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/** Layout */
22
@import 'layout/reset.css';
3+
@import "ember-basic-dropdown/vendor/ember-basic-dropdown.css";
4+
@import 'ember-power-select/vendor/ember-power-select.css';
5+
@import 'air-datepicker/air-datepicker.css';
36
@import 'layout/next.css';
47
@import 'layout/legacy.css';
58
@import 'layout/mobile.css';
@@ -57,10 +60,6 @@
5760
@import 'components/template-builder.css';
5861
@import 'components/fleetbase-attribution.css';
5962

60-
/** Third party */
61-
@import "ember-basic-dropdown/vendor/ember-basic-dropdown.css";
62-
@import 'ember-power-select/vendor/ember-power-select.css';
63-
@import 'air-datepicker/air-datepicker.css';
6463
.fleetbase-docs-panel-body {
6564
position: relative;
6665
height: 100%;

addon/styles/components/basic-dropdown.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ body.fleetbase-console .ember-basic-dropdown-content {
5555
margin: 0 !important;
5656
}
5757

58+
.ember-basic-dropdown-content-wormhole-origin {
59+
display: contents;
60+
}
61+
5862
body.fleetbase-console .ember-power-select-trigger {
5963
padding: 0.5rem 2.5rem 0.5rem 0.75rem;
60-
}
64+
}

addon/styles/components/table.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@
153153
@apply bg-blue-700;
154154
}
155155

156+
.next-table-wrapper.no-table-extra-spacing.has-floating-pagination {
157+
padding-bottom: 0;
158+
}
159+
160+
.next-table-wrapper.no-table-extra-spacing > table > tbody:after {
161+
height: 0;
162+
}
163+
156164
.next-table-wrapper table tbody tr td .next-table-empty-state span.btn-wrapper > button.btn {
157165
height: auto;
158166
min-height: unset;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fleetbase/ember-ui",
3-
"version": "0.3.35",
3+
"version": "0.3.36",
44
"description": "Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.",
55
"keywords": [
66
"fleetbase-ui",

tests/integration/components/layout/resource/tabular-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,19 @@ module('Integration | Component | layout/resource/tabular', function (hooks) {
2323

2424
assert.dom().hasText('template block text');
2525
});
26+
27+
test('it forwards table wrapper class to the table component', async function (assert) {
28+
this.set('columns', [{ label: 'Name', valuePath: 'name' }]);
29+
this.set('rows', [{ name: 'Ada' }]);
30+
31+
await render(hbs`
32+
<Layout::Resource::Tabular
33+
@data={{this.rows}}
34+
@columns={{this.columns}}
35+
@tableWrapperClass="no-table-extra-spacing"
36+
/>
37+
`);
38+
39+
assert.dom('.next-table-wrapper').hasClass('no-table-extra-spacing');
40+
});
2641
});

tests/integration/components/layout/sidebar/navigator-test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,40 @@ module('Integration | Component | layout/sidebar/navigator', function (hooks) {
106106
assert.dom('.next-sidebar-navigator-back').includesText('Settings');
107107
});
108108

109+
test('it uses item activeWhen callbacks for nested route sync and active state', async function (assert) {
110+
class RouterStub extends Service {
111+
currentRouteName = 'console.virtual';
112+
currentURL = '/fleet-ops/management/contracts';
113+
114+
on() {}
115+
off() {}
116+
}
117+
118+
this.owner.register('service:router', RouterStub);
119+
this.set('items', [
120+
{
121+
label: 'Resources',
122+
children: [
123+
{
124+
label: 'Contracts',
125+
activeWhen: ({ routeName, currentURL }) => routeName === 'console.virtual' && currentURL === '/fleet-ops/management/contracts',
126+
onClick: () => this.set('selected', 'contracts'),
127+
},
128+
],
129+
},
130+
{
131+
label: 'Settings',
132+
route: 'console.settings',
133+
},
134+
]);
135+
136+
await render(hbs`<Layout::Sidebar::Navigator @items={{this.items}} />`);
137+
138+
assert.dom('.next-sidebar-navigator-back').includesText('Resources');
139+
assert.dom('.next-sidebar-navigator-view-in .next-sidebar-navigator-item').includesText('Contracts');
140+
assert.dom('.next-sidebar-navigator-view-in .next-sidebar-navigator-item').hasClass('is-active');
141+
});
142+
109143
test('it yields nested footer state', async function (assert) {
110144
await render(hbs`
111145
<Layout::Sidebar::Navigator @items={{this.items}}>

0 commit comments

Comments
 (0)