Skip to content

Commit

Permalink
feat(topology): group node actions (#906)
Browse files Browse the repository at this point in the history
Signed-off-by: Thuan Vo <[email protected]>
  • Loading branch information
Thuan Vo authored Mar 20, 2023
1 parent 25a0e46 commit 854c966
Show file tree
Hide file tree
Showing 12 changed files with 482 additions and 100 deletions.
2 changes: 1 addition & 1 deletion src/app/Dashboard/JvmDetails/JvmDetailsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import { ServiceContext } from '@app/Shared/Services/Services';
import { FeatureLevel } from '@app/Shared/Services/Settings.service';
import { Target } from '@app/Shared/Services/Target.service';
import { NodeAction } from '@app/Topology/Actions/NodeActions';
import EntityDetails from '@app/Topology/Shared/Entity/EntityDetails';
import { NodeType } from '@app/Topology/typings';
import { useSubscriptions } from '@app/utils/useSubscriptions';
Expand All @@ -47,7 +48,6 @@ import * as React from 'react';
import { DashboardCardDescriptor, DashboardCardProps, DashboardCardSizes } from '../Dashboard';
import { DashboardCard } from '../DashboardCard';
import '@app/Topology/styles/base.css';
import { NodeAction } from '@app/Topology/Actions/NodeActions';

export interface JvmDetailsCardProps extends DashboardCardProps {}

Expand Down
42 changes: 39 additions & 3 deletions src/app/Shared/Services/Api.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ export class ApiService {
method: 'GET',
}).pipe(
concatMap((resp) => resp.json()),
map((body: DiscoveryResponse) => body.data.result as EnvironmentNode),
map((body: DiscoveryResponse) => body.data.result),
first()
);
}
Expand Down Expand Up @@ -1117,6 +1117,42 @@ export class ApiService {
);
}

groupHasRecording(group: EnvironmentNode, recordingName: string): Observable<boolean> {
return this.graphql<any>(
`
query GetRecordingForGroup ($groupFilter: EnvironmentNodeFilterInput, $recordingFilter: ActiveRecordingFilterInput){
environmentNodes(filter: $groupFilter) {
name
descendantTargets {
name
recordings {
active(filter: $recordingFilter) {
data {
name
}
}
}
}
}
}
`,
{
groupFilter: { id: group.id },
recordingFilter: { name: recordingName },
}
).pipe(
first(),
map((body) =>
body.data.environmentNodes[0].descendantTargets.reduce(
(acc: Partial<ActiveRecording>[], curr) => acc.concat(curr.recordings?.active?.data || []),
[] as Partial<ActiveRecording>[]
)
),
catchError((_) => of([])),
map((recs: Partial<ActiveRecording>[]) => recs.length > 0) // At least one
);
}

private downloadFile(url: string, filename: string, download = true): void {
const anchor = document.createElement('a');
anchor.setAttribute('style', 'display: none; visibility: hidden;');
Expand All @@ -1129,7 +1165,7 @@ export class ApiService {
anchor.remove();
}

private stringifyRecordingLabels(labels: RecordingLabel[]): string {
stringifyRecordingLabels(labels: RecordingLabel[]): string {
return JSON.stringify(labels).replace(/"([^"]+)":/g, '$1:');
}

Expand Down Expand Up @@ -1370,7 +1406,7 @@ interface RulesResponse extends ApiV2Response {

interface DiscoveryResponse extends ApiV2Response {
data: {
result: object;
result: EnvironmentNode;
};
}

Expand Down
Loading

0 comments on commit 854c966

Please sign in to comment.