Change the appearance of `*` for intention listings

1. Use 'All Services (*)' as opposed to '*'
2. Set 'Destination' in teh same bold font as 'Source'
3. Ensure you can search for all services by using '*' or 'All Services
(*)'
This commit is contained in:
John Cowen 2018-06-22 14:29:18 +01:00 committed by Jack Pearkes
parent a76f652fd2
commit 5ac19b164e
3 changed files with 28 additions and 13 deletions

View File

@ -32,13 +32,15 @@ export default Controller.extend(WithFiltering, {
});
}),
filter: function(item, { s = '', action = '' }) {
const source = get(item, 'SourceName').toLowerCase();
const destination = get(item, 'DestinationName').toLowerCase();
const sLower = s.toLowerCase();
const allLabel = 'All Services (*)'.toLowerCase();
return (
(get(item, 'SourceName')
.toLowerCase()
.indexOf(s.toLowerCase()) !== -1 ||
get(item, 'DestinationName')
.toLowerCase()
.indexOf(s.toLowerCase()) !== -1) &&
(source.indexOf(sLower) !== -1 ||
destination.indexOf(sLower) !== -1 ||
(source === '*' && allLabel.indexOf(sLower) !== -1) ||
(destination === '*' && allLabel.indexOf(sLower) !== -1)) &&
(action === '' || get(item, 'Action') === action)
);
},

View File

@ -1,8 +1,11 @@
td.intent-allow strong {
html.template-intention.template-list td.intent-allow strong {
@extend %with-allow;
visibility: hidden;
}
td.intent-deny strong {
html.template-intention.template-list td.intent-deny strong {
@extend %with-deny;
visibility: hidden;
}
html.template-intention.template-list td.destination {
font-weight: $weight-semibold;
}

View File

@ -26,16 +26,26 @@
<th>Precedence</th>
{{/block-slot}}
{{#block-slot 'row'}}
<td data-test-intention="{{item.ID}}">
<a href={{href-to 'dc.intentions.edit' item.ID}}>{{item.SourceName}}</a>
<td class="source" data-test-intention="{{item.ID}}">
<a href={{href-to 'dc.intentions.edit' item.ID}}>
{{#if (eq item.SourceName '*') }}
All Services (*)
{{else}}
{{item.SourceName}}
{{/if}}
</a>
</td>
<td class="intent-{{item.Action}}">
<strong>{{item.Action}}</strong>
</td>
<td>
{{item.DestinationName}}
<td class="destination">
{{#if (eq item.DestinationName '*') }}
All Services (*)
{{else}}
{{item.DestinationName}}
{{/if}}
</td>
<td>
<td class="precedence">
{{item.Precedence}}
</td>
{{/block-slot}}