2020-11-09 17:29:12 +00:00
|
|
|
import Model, { attr } from '@ember-data/model';
|
2021-04-12 13:19:49 +00:00
|
|
|
import { computed } from '@ember/object';
|
2020-10-05 17:07:35 +00:00
|
|
|
|
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
|
|
export const SLUG_KEY = 'ServiceName';
|
2020-11-09 17:29:12 +00:00
|
|
|
|
|
|
|
export default class Topology extends Model {
|
|
|
|
@attr('string') uid;
|
|
|
|
@attr('string') ServiceName;
|
|
|
|
|
|
|
|
@attr('string') Datacenter;
|
|
|
|
@attr('string') Namespace;
|
|
|
|
@attr('string') Protocol;
|
|
|
|
@attr('boolean') FilteredByACLs;
|
2021-04-08 18:08:57 +00:00
|
|
|
@attr('boolean') TransparentProxy;
|
|
|
|
@attr('boolean') DefaultAllow;
|
|
|
|
@attr('boolean') WildcardIntention;
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr() Upstreams; // Service[]
|
|
|
|
@attr() Downstreams; // Service[],
|
|
|
|
@attr() meta; // {}
|
2021-04-12 13:19:49 +00:00
|
|
|
|
|
|
|
@computed('Upstreams', 'Downstreams')
|
|
|
|
get undefinedIntention() {
|
|
|
|
let undefinedUpstream = false;
|
|
|
|
let undefinedDownstream = false;
|
|
|
|
|
|
|
|
undefinedUpstream =
|
|
|
|
this.Upstreams.filter(
|
|
|
|
item =>
|
|
|
|
item.Source === 'specific-intention' && !item.TransparentProxy && item.Intention.Allowed
|
|
|
|
).length !== 0;
|
|
|
|
|
|
|
|
undefinedDownstream =
|
|
|
|
this.Downstreams.filter(
|
|
|
|
item =>
|
|
|
|
item.Source === 'specific-intention' && !item.TransparentProxy && item.Intention.Allowed
|
|
|
|
).length !== 0;
|
|
|
|
|
|
|
|
return undefinedUpstream || undefinedDownstream;
|
|
|
|
}
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|