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

Update client list to collapse statuses #5789

Merged
merged 45 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
cf98ad3
Update client list to show combined status
backspace Jun 6, 2019
04c9745
Restore colouring for node status differences
backspace Jun 6, 2019
7416615
Add empty commit
backspace Jun 7, 2019
74e9cda
Remove no-longer-shared function
backspace Jun 7, 2019
1db5d79
Add title to status field to show its components
backspace Jun 7, 2019
fba9fe6
Update name to fully show on hover
backspace Jun 7, 2019
0da1b4e
Add scenario override for demonstration
backspace Jun 10, 2019
6e36a6e
Add border at edge of hover-showing element
backspace Jun 10, 2019
fcdf555
Change overflowed text colour to standard
backspace Jun 10, 2019
27de41a
Merge branch 'master' into f-ui/long-client-names
backspace Jun 10, 2019
6972740
Move flags filters into status list
backspace Jun 10, 2019
0c23494
Restore autofixed line
backspace Jun 10, 2019
afd6716
Remove commented-out tests
backspace Jun 10, 2019
ffac3d7
Rename statuses-only variable
backspace Jun 10, 2019
778af84
Fix padding
backspace Jun 10, 2019
c1cd142
Change name of overflow container
backspace Jun 10, 2019
387de5d
Remove TODO
backspace Jun 10, 2019
0693748
Remove transparency from background
backspace Jun 10, 2019
798b0f8
Rename hover-reveal classes
backspace Jun 11, 2019
c22aa41
Change revealable border to gradient
backspace Jun 11, 2019
4f32c5e
Fix height of revealable shadow
backspace Jun 11, 2019
046f464
Change name of composite status to state
backspace Jun 11, 2019
f6f9197
Update comment to remove historic reference
backspace Jun 11, 2019
0d11c06
Change name width to 300px
backspace Jun 11, 2019
02c1729
Change address column to be truncatable
backspace Jun 11, 2019
980af21
Fix tests for state facet
backspace Jun 11, 2019
80c6f14
Change composite state title to tooltip
backspace Jun 11, 2019
da93869
Change tooltip to be relative only on hover
backspace Jun 11, 2019
3d20925
Change is-revealable to be relative only on hover
backspace Jun 11, 2019
eba33f3
Change Netlify site id
backspace Jun 11, 2019
86f257a
Change Mirage record to use draining trait
backspace Jun 11, 2019
c38b155
Add pseudoelement to cover shadow when narrow
backspace Jun 11, 2019
768fa84
Move width to be near size/position properties
backspace Jun 11, 2019
8cc972a
Move .is-truncatable within .is-300px
backspace Jun 11, 2019
0f531ff
Remove calc
backspace Jun 11, 2019
29aec09
Fix gradient
backspace Jun 11, 2019
23b0075
Change combined column heading
backspace Jun 11, 2019
57c7579
Merge branch 'master' into f-ui/long-client-names
backspace Jun 11, 2019
7344e71
Remove demonstration data
backspace Jun 14, 2019
720ab34
Remove extraneous whitespace
backspace Jun 14, 2019
c2c4d5d
Remove overflow-reveal feature
backspace Jun 14, 2019
a109a9c
Merge branch 'master' into f-ui/long-client-names
backspace Jun 14, 2019
8570b84
Merge branch 'master' into f-ui/long-client-names
backspace Jun 17, 2019
37c4c55
Merge branch 'master' into f-ui/long-client-names
backspace Jun 19, 2019
f23cf56
Add changelog entry
backspace Jun 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions ui/app/controllers/clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ export default Controller.extend(Sortable, Searchable, {
sortProperty: 'sort',
sortDescending: 'desc',
qpClass: 'class',
qpStatus: 'status',
qpState: 'state',
qpDatacenter: 'dc',
qpFlags: 'flags',
},

currentPage: 1,
Expand All @@ -33,14 +32,12 @@ export default Controller.extend(Sortable, Searchable, {
searchProps: computed(() => ['id', 'name', 'datacenter']),

qpClass: '',
qpStatus: '',
qpState: '',
qpDatacenter: '',
qpFlags: '',

selectionClass: selection('qpClass'),
selectionStatus: selection('qpStatus'),
selectionState: selection('qpState'),
selectionDatacenter: selection('qpDatacenter'),
selectionFlags: selection('qpFlags'),

optionsClass: computed('nodes.[]', function() {
const classes = Array.from(new Set(this.nodes.mapBy('nodeClass'))).compact();
Expand All @@ -53,47 +50,42 @@ export default Controller.extend(Sortable, Searchable, {
return classes.sort().map(dc => ({ key: dc, label: dc }));
}),

optionsStatus: computed(() => [
optionsState: computed(() => [
{ key: 'initializing', label: 'Initializing' },
{ key: 'ready', label: 'Ready' },
{ key: 'down', label: 'Down' },
{ key: 'ineligible', label: 'Ineligible' },
{ key: 'draining', label: 'Draining' },
]),

optionsDatacenter: computed('nodes.[]', function() {
const datacenters = Array.from(new Set(this.nodes.mapBy('datacenter'))).compact();

// Remove any invalid datacenters from the query param/selection
scheduleOnce('actions', () => {
this.set(
'qpDatacenter',
serialize(intersection(datacenters, this.selectionDatacenter))
);
this.set('qpDatacenter', serialize(intersection(datacenters, this.selectionDatacenter)));
});

return datacenters.sort().map(dc => ({ key: dc, label: dc }));
}),

optionsFlags: computed(() => [
{ key: 'ineligible', label: 'Ineligible' },
{ key: 'draining', label: 'Draining' },
]),

filteredNodes: computed(
'nodes.[]',
'selectionClass',
'selectionStatus',
'selectionState',
'selectionDatacenter',
'selectionFlags',
function() {
const {
selectionClass: classes,
selectionStatus: statuses,
selectionState: states,
selectionDatacenter: datacenters,
selectionFlags: flags,
} = this;

const onlyIneligible = flags.includes('ineligible');
const onlyDraining = flags.includes('draining');
const onlyIneligible = states.includes('ineligible');
const onlyDraining = states.includes('draining');

// states is a composite of node status and other node states
const statuses = states.without('ineligible').without('draining');

return this.nodes.filter(node => {
if (classes.length && !classes.includes(node.get('nodeClass'))) return false;
Expand Down
2 changes: 1 addition & 1 deletion ui/app/styles/components/tooltip.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.tooltip {
.tooltip:hover {
position: relative;
}

Expand Down
78 changes: 69 additions & 9 deletions ui/app/styles/core/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@
width: 25%;
}

&.is-truncatable {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&.is-narrow {
padding: 1.25em 0 1.25em 0.5em;

Expand All @@ -99,9 +93,75 @@

// Only use px modifiers when text needs to be truncated.
// In this and only this scenario are percentages not effective.
&.is-200px {
width: 200px;
max-width: 200px;
&.is-300px {
width: 300px;
max-width: 300px;

&.is-truncatable {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

&.is-revealable {
.revealed {
display: none;
position: absolute;
top: 0;
left: 0;
bottom: 0;
padding: 1.25em 1.5em;
}

&:hover {
position: relative;

color: transparent;
overflow: visible;

.revealed {
color: $text;
display: block;
background-color: $white;
z-index: $z-zero;

$shadow-width: 8px;

&::before {
content: ' ';

position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 300px;

background: white;
z-index: $z-below;
}

&::after {
content: ' ';

position: absolute;
top: 0;
bottom: 0;
right: -$shadow-width;
width: $shadow-width;

display: inline-block;
z-index: $z-below-below;

background: linear-gradient(
90deg,
$grey-blue 0%,
rgba($grey-blue, 0.72) 10%,
rgba($white, 0) 100%
);
}
}
}
}
}
}

@for $i from 1 through 11 {
Expand Down
4 changes: 4 additions & 0 deletions ui/app/styles/utils/z-indices.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ $z-gutter-backdrop: 219;
$z-subnav: 200;
$z-base: 100;
$z-icon-decorators: 50;

$z-zero: 0;
$z-below: -1;
$z-below-below: -2;
backspace marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 8 additions & 16 deletions ui/app/templates/clients/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,17 @@
selection=selectionClass
onSelect=(action setFacetQueryParam "qpClass")}}
{{multi-select-dropdown
data-test-status-facet
label="Status"
options=optionsStatus
selection=selectionStatus
onSelect=(action setFacetQueryParam "qpStatus")}}
data-test-state-facet
label="State"
options=optionsState
selection=selectionState
onSelect=(action setFacetQueryParam "qpState")}}
{{multi-select-dropdown
data-test-datacenter-facet
label="Datacenter"
options=optionsDatacenter
selection=selectionDatacenter
onSelect=(action setFacetQueryParam "qpDatacenter")}}
{{multi-select-dropdown
data-test-flags-facet
label="Flags"
options=optionsFlags
selection=selectionFlags
onSelect=(action setFacetQueryParam "qpFlags")}}
</div>
</div>
</div>
Expand All @@ -52,11 +46,9 @@
{{#t.head}}
<th class="is-narrow"></th>
{{#t.sort-by prop="id"}}ID{{/t.sort-by}}
{{#t.sort-by class="is-200px is-truncatable" prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="status"}}Status{{/t.sort-by}}
{{#t.sort-by prop="isDraining"}}Drain{{/t.sort-by}}
{{#t.sort-by prop="schedulingEligibility"}}Eligibility{{/t.sort-by}}
<th>Address</th>
{{#t.sort-by class="is-300px is-truncatable" prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="status"}}State{{/t.sort-by}}
<th class="is-300-px is-truncatable">Address</th>
{{#t.sort-by prop="datacenter"}}Datacenter{{/t.sort-by}}
<th># Allocs</th>
{{/t.head}}
Expand Down
32 changes: 17 additions & 15 deletions ui/app/templates/components/client-node-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
{{/if}}
</td>
<td data-test-client-id>{{#link-to "clients.client" node.id class="is-primary"}}{{node.shortId}}{{/link-to}}</td>
<td data-test-client-name class="is-200px is-truncatable" title="{{node.name}}">{{node.name}}</td>
<td data-test-client-status>{{node.status}}</td>
<td data-test-client-drain>
{{#if node.isDraining}}
<span class="status-text is-info">true</span>
{{else}}
false
{{/if}}
<td class="is-300px is-truncatable is-revealable" title="{{node.name}}">
<span data-test-client-name>{{node.name}}</span>
<div class="revealed" aria-hidden>{{node.name}}</div>
</td>
<td data-test-client-eligibility>
{{#if node.isEligible}}
{{node.schedulingEligibility}}
{{else}}
<span class="status-text is-warning">{{node.schedulingEligibility}}</span>
{{/if}}
<td data-test-client-state>
<span class="tooltip" aria-label="{{node.status}} / {{if node.isDraining "draining" "not draining"}} / {{if node.isEligible "eligible" "not eligible"}}">
{{#if node.isDraining}}
<span class="status-text is-info">draining</span>
{{else if (not node.isEligible)}}
<span class="status-text is-warning">ineligible</span>
{{else}}
{{node.status}}
{{/if}}
</span>
</td>
<td class="is-300px is-truncatable is-revealable">
<span data-test-client-address>{{node.httpAddr}}</span>
<div class="revealed" aria-hidden>{{node.httpAddr}}</div>
</td>
<td data-test-client-address>{{node.httpAddr}}</td>
<td data-test-client-datacenter>{{node.datacenter}}</td>
<td data-test-client-allocations>
{{#if node.allocations.isPending}}
Expand Down
35 changes: 34 additions & 1 deletion ui/mirage/scenarios/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,40 @@ export default function(server) {

function smallCluster(server) {
server.createList('agent', 3);
server.createList('node', 5);

// server.createList('node', 5);
// FIXME data to exercise all permutations; remove before merging PR
backspace marked this conversation as resolved.
Show resolved Hide resolved
server.create('node', {
modifyIndex: 4,
status: 'ready',
schedulingEligibility: 'eligible',
drain: false,
});
server.create('node', {
modifyIndex: 3,
status: 'initializing',
schedulingEligibility: 'eligible',
drain: false,
});
server.create('node', {
modifyIndex: 2,
status: 'down',
schedulingEligibility: 'eligible',
drain: false,
});
server.create('node', {
modifyIndex: 1,
status: 'ready',
schedulingEligibility: 'ineligible',
drain: false,
});
server.create('node', {
modifyIndex: 0,
status: 'ready',
schedulingEligibility: 'ineligible',
drain: true,
});

server.createList('job', 5);
}

Expand Down
Loading