mirror of https://github.com/status-im/consul.git
ui: Fix up Service filtering by whether a Service is in the mesh or not in the mesh (#8836)
* Add MeshEnabled, InMesh properties and add Proxy back in * Change query param to in-mesh/not-in-mesh * Use new computed properties
This commit is contained in:
parent
1b413b0444
commit
222555c4c9
|
@ -44,8 +44,8 @@
|
|||
<Option @value="mesh-gateway" @selected={{contains 'mesh-gateway' filter.types}}>Mesh Gateway</Option>
|
||||
</Optgroup>
|
||||
<Optgroup @label="Mesh">
|
||||
<Option @value="mesh-enabled" @selected={{contains 'mesh-enabled' filter.types}}>In service mesh</Option>
|
||||
<Option @value="mesh-disabled" @selected={{contains 'mesh-disabled' filter.types}}>Not in service mesh</Option>
|
||||
<Option @value="in-mesh" @selected={{contains 'in-mesh' filter.types}}>In service mesh</Option>
|
||||
<Option @value="not-in-mesh" @selected={{contains 'not-in-mesh' filter.types}}>Not in service mesh</Option>
|
||||
</Optgroup>
|
||||
{{/let}}
|
||||
</BlockSlot>
|
||||
|
|
|
@ -6,8 +6,8 @@ export default () => ({ instances = [], sources = [], statuses = [], types = []
|
|||
'terminating-gateway',
|
||||
'mesh-gateway',
|
||||
'service',
|
||||
'mesh-enabled',
|
||||
'mesh-disabled',
|
||||
'in-mesh',
|
||||
'not-in-mesh',
|
||||
].reduce((prev, item) => {
|
||||
prev[item] = types.includes(item);
|
||||
return prev;
|
||||
|
@ -48,12 +48,16 @@ export default () => ({ instances = [], sources = [], statuses = [], types = []
|
|||
if (typeIncludes['service'] && typeof item.Kind === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
if (typeIncludes['mesh-enabled'] && typeof item.Proxy !== 'undefined') {
|
||||
if (typeIncludes['in-mesh']) {
|
||||
if (item.InMesh) {
|
||||
return true;
|
||||
}
|
||||
if (typeIncludes['mesh-disabled'] && typeof item.Proxy === 'undefined') {
|
||||
}
|
||||
if (typeIncludes['not-in-mesh']) {
|
||||
if (!item.InMesh) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (sources.length > 0) {
|
||||
|
|
|
@ -16,6 +16,7 @@ export default Model.extend({
|
|||
InstanceCount: attr('number'),
|
||||
ConnectedWithGateway: attr(),
|
||||
ConnectedWithProxy: attr(),
|
||||
Proxy: attr(),
|
||||
GatewayConfig: attr(),
|
||||
Kind: attr('string'),
|
||||
ExternalSources: attr(),
|
||||
|
@ -39,6 +40,12 @@ export default Model.extend({
|
|||
SyncTime: attr('number'),
|
||||
meta: attr(),
|
||||
/* Mesh properties involve both the service and the associated proxy */
|
||||
MeshEnabled: computed('ConnectedWithProxy', 'ConnectedWithGateway', function() {
|
||||
return this.ConnectedWithProxy || this.ConnectedWithGateway;
|
||||
}),
|
||||
InMesh: computed('Kind', function() {
|
||||
return this.MeshEnabled || (this.Kind || '').length > 0;
|
||||
}),
|
||||
MeshStatus: computed('MeshChecksPassing', 'MeshChecksWarning', 'MeshChecksCritical', function() {
|
||||
switch (true) {
|
||||
case this.MeshChecksCritical !== 0:
|
||||
|
|
Loading…
Reference in New Issue