mirror of https://github.com/status-im/consul.git
ui: add peers to node search (#13875)
* Make nodes searchable by peer * fix only surface peer filter on service search when feature is on
This commit is contained in:
parent
dfd50d68ed
commit
f7f26220ba
|
@ -0,0 +1,16 @@
|
|||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class PeeredResourceController extends Controller {
|
||||
@service abilities;
|
||||
|
||||
get _searchProperties() {
|
||||
const { searchProperties } = this;
|
||||
|
||||
if (!this.abilities.can('use peers')) {
|
||||
return searchProperties.filter(propertyName => propertyName !== 'PeerName');
|
||||
} else {
|
||||
return searchProperties;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import PeeredResourceController from 'consul-ui/controllers/_peered-resource';
|
||||
|
||||
export default class DcNodesController extends PeeredResourceController {}
|
|
@ -0,0 +1,3 @@
|
|||
import PeeredResourceController from 'consul-ui/controllers/_peered-resource';
|
||||
|
||||
export default class DcServicesController extends PeeredResourceController {}
|
|
@ -1,5 +1,6 @@
|
|||
export default {
|
||||
Node: item => item.Node,
|
||||
Address: item => item.Address,
|
||||
PeerName: item => item.PeerName,
|
||||
Meta: item => Object.entries(item.Meta || {}).reduce((prev, entry) => prev.concat(entry), []),
|
||||
};
|
||||
|
|
|
@ -44,10 +44,10 @@ as |route|>
|
|||
searchproperty=(hash
|
||||
value=(if (not-eq searchproperty undefined)
|
||||
(split searchproperty ',')
|
||||
searchProperties
|
||||
this._searchProperties
|
||||
)
|
||||
change=(action (mut searchproperty) value="target.selectedItems")
|
||||
default=searchProperties
|
||||
default=this._searchProperties
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ as |route|>
|
|||
searchproperty=(hash
|
||||
value=(if (not-eq searchproperty undefined)
|
||||
(split searchproperty ',')
|
||||
searchProperties
|
||||
this._searchProperties
|
||||
)
|
||||
change=(action (mut searchproperty) value="target.selectedItems")
|
||||
default=searchProperties
|
||||
default=this._searchProperties
|
||||
)
|
||||
|
||||
)
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
status: 'status',
|
||||
searchproperty: {
|
||||
as: 'searchproperty',
|
||||
empty: [['Node', 'Address', 'Meta']],
|
||||
empty: [['Node', 'Address', 'Meta', 'PeerName']],
|
||||
},
|
||||
search: {
|
||||
as: 'filter',
|
||||
|
|
Loading…
Reference in New Issue