mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
Fix show objects info (#388)
This commit is contained in:
parent
a42d5ff26c
commit
693b90fb1f
@ -51,8 +51,16 @@ export class DomainStoreService {
|
||||
map(([s]) => s?.domain),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
private objects$ = this.rawDomain$.pipe(
|
||||
map((domain) => new Map(Array.from(domain).map(([r, d]) => [createObjectHash(r), d]))),
|
||||
private objects$ = combineLatest([this.rawDomain$, this.domain$]).pipe(
|
||||
map(
|
||||
([rawDomain, domain]) =>
|
||||
new Map(
|
||||
Array.from(rawDomain).map(([ref, raw]) => [
|
||||
createObjectHash(ref),
|
||||
{ raw, reduced: domain.get(ref) },
|
||||
]),
|
||||
),
|
||||
),
|
||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
@ -69,10 +77,7 @@ export class DomainStoreService {
|
||||
|
||||
getObject(ref: Reference, raw = false): Observable<DomainObject> {
|
||||
return this.objects$.pipe(
|
||||
map((objects) => {
|
||||
const res = objects.get(createObjectHash(ref));
|
||||
return raw || !this.domainSecretService.isExcludedObject(res) ? res : undefined;
|
||||
}),
|
||||
map((objects) => objects.get(createObjectHash(ref))?.[raw ? 'raw' : 'reduced']),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ import { CommonModule } from '@angular/common';
|
||||
import { Component, DestroyRef, Input, OnChanges } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { Router } from '@angular/router';
|
||||
import { Reference } from '@vality/domain-proto/internal/domain';
|
||||
import { ComponentChanges, DialogService } from '@vality/ng-core';
|
||||
import { isEqualThrift } from '@vality/ng-thrift';
|
||||
@ -50,7 +49,6 @@ export class DomainObjectCardComponent implements OnChanges {
|
||||
private domainStoreService: DomainStoreService,
|
||||
private destroyRef: DestroyRef,
|
||||
private dialogService: DialogService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnChanges(changes: ComponentChanges<DomainObjectCardComponent>) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Domain, DomainObject } from '@vality/domain-proto/domain';
|
||||
import { getUnionKey } from '@vality/ng-thrift';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import cloneDeep from 'lodash-es/cloneDeep';
|
||||
import isNil from 'lodash-es/isNil';
|
||||
@ -22,10 +21,6 @@ export class DomainSecretService {
|
||||
|
||||
constructor(private keycloakService: KeycloakService) {}
|
||||
|
||||
isExcludedObject(obj: DomainObject) {
|
||||
return !this.hasDominantSecretRole && EXCLUDE_OBJECTS.includes(getUnionKey(obj));
|
||||
}
|
||||
|
||||
reduceDomain(domain: Domain): Domain {
|
||||
if (this.hasDominantSecretRole) {
|
||||
return domain;
|
||||
|
Loading…
Reference in New Issue
Block a user