Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] [v2] Add more node types to topology #1004

Merged
merged 6 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -8642,6 +8642,14 @@
}
}
},
"ModelConnection": {
"type": "object",
"properties": {
"count": { "type": "integer" },
"node_id": { "type": "string" },
"node_name": { "type": "string" }
}
},
"ModelContainer": {
"required": [
"node_id",
Expand Down Expand Up @@ -8865,7 +8873,9 @@
"malware_latest_scan_id",
"compliances_count",
"compliance_scan_status",
"compliance_latest_scan_id"
"compliance_latest_scan_id",
"inbound_connections",
"outbound_connections"
],
"type": "object",
"properties": {
Expand All @@ -8889,6 +8899,11 @@
"cpu_max": { "type": "number" },
"cpu_usage": { "type": "number" },
"host_name": { "type": "string" },
"inbound_connections": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelConnection" },
"nullable": true
},
"instance_id": { "type": "string" },
"instance_type": { "type": "string" },
"interface_ips": { "type": "array", "items": {}, "nullable": true },
Expand All @@ -8906,6 +8921,11 @@
"node_id": { "type": "string" },
"node_name": { "type": "string" },
"os": { "type": "string" },
"outbound_connections": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelConnection" },
"nullable": true
},
"pods": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelPod" },
Expand Down Expand Up @@ -10066,9 +10086,12 @@
"type": "object",
"properties": {
"account_id": { "type": "array", "items": { "type": "string" } },
"container_name": { "type": "array", "items": { "type": "string" } },
"host_name": { "type": "array", "items": { "type": "string" } },
"image_name": { "type": "array", "items": { "type": "string" } },
"kubernetes_cluster_name": { "type": "array", "items": { "type": "string" } },
"masked": { "type": "array", "items": { "type": "boolean" } },
"pod_name": { "type": "array", "items": { "type": "string" } },
"scan_status": { "type": "array", "items": { "type": "string" } }
}
},
Expand All @@ -10085,7 +10108,6 @@
"host",
"container",
"container_image",
"pod",
"linux",
"aws",
"gcp",
Expand Down
3 changes: 3 additions & 0 deletions deepfence_frontend/apps/dashboard/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const configuration = new Configuration({
accessToken: () => {
return storage.getAuth()?.accessToken ?? '';
},
headers: {
'accept-encoding': 'gzip, deflate, br',
},
});

export function getAuthenticationApiClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ models/ModelComplianceScanInfo.ts
models/ModelComplianceScanResult.ts
models/ModelComplianceScanStatusResp.ts
models/ModelComplianceScanTriggerReq.ts
models/ModelConnection.ts
models/ModelContainer.ts
models/ModelContainerImage.ts
models/ModelDownloadReportResponse.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* tslint:disable */
/* eslint-disable */
/**
* Deepfence ThreatMapper
* Deepfence Runtime API provides programmatic control over Deepfence microservice securing your container, kubernetes and cloud deployments. The API abstracts away underlying infrastructure details like cloud provider, container distros, container orchestrator and type of deployment. This is one uniform API to manage and control security alerts, policies and response to alerts for microservices running anywhere i.e. managed pure greenfield container deployments or a mix of containers, VMs and serverless paradigms like AWS Fargate.
*
* The version of the OpenAPI document: 2.0.0
* Contact: community@deepfence.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ModelConnection
*/
export interface ModelConnection {
/**
*
* @type {number}
* @memberof ModelConnection
*/
count?: number;
/**
*
* @type {string}
* @memberof ModelConnection
*/
node_id?: string;
/**
*
* @type {string}
* @memberof ModelConnection
*/
node_name?: string;
}

/**
* Check if a given object implements the ModelConnection interface.
*/
export function instanceOfModelConnection(value: object): boolean {
let isInstance = true;

return isInstance;
}

export function ModelConnectionFromJSON(json: any): ModelConnection {
return ModelConnectionFromJSONTyped(json, false);
}

export function ModelConnectionFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelConnection {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'count': !exists(json, 'count') ? undefined : json['count'],
'node_id': !exists(json, 'node_id') ? undefined : json['node_id'],
'node_name': !exists(json, 'node_name') ? undefined : json['node_name'],
};
}

export function ModelConnectionToJSON(value?: ModelConnection | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'count': value.count,
'node_id': value.node_id,
'node_name': value.node_name,
};
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
*/

import { exists, mapValues } from '../runtime';
import type { ModelConnection } from './ModelConnection';
import {
ModelConnectionFromJSON,
ModelConnectionFromJSONTyped,
ModelConnectionToJSON,
} from './ModelConnection';
import type { ModelContainer } from './ModelContainer';
import {
ModelContainerFromJSON,
Expand Down Expand Up @@ -116,6 +122,12 @@ export interface ModelHost {
* @memberof ModelHost
*/
host_name: string;
/**
*
* @type {Array<ModelConnection>}
* @memberof ModelHost
*/
inbound_connections: Array<ModelConnection> | null;
/**
*
* @type {string}
Expand Down Expand Up @@ -218,6 +230,12 @@ export interface ModelHost {
* @memberof ModelHost
*/
os: string;
/**
*
* @type {Array<ModelConnection>}
* @memberof ModelHost
*/
outbound_connections: Array<ModelConnection> | null;
/**
*
* @type {Array<ModelPod>}
Expand Down Expand Up @@ -315,6 +333,7 @@ export function instanceOfModelHost(value: object): boolean {
isInstance = isInstance && "cpu_max" in value;
isInstance = isInstance && "cpu_usage" in value;
isInstance = isInstance && "host_name" in value;
isInstance = isInstance && "inbound_connections" in value;
isInstance = isInstance && "instance_id" in value;
isInstance = isInstance && "instance_type" in value;
isInstance = isInstance && "interface_ips" in value;
Expand All @@ -332,6 +351,7 @@ export function instanceOfModelHost(value: object): boolean {
isInstance = isInstance && "node_id" in value;
isInstance = isInstance && "node_name" in value;
isInstance = isInstance && "os" in value;
isInstance = isInstance && "outbound_connections" in value;
isInstance = isInstance && "pods" in value;
isInstance = isInstance && "private_ip" in value;
isInstance = isInstance && "processes" in value;
Expand Down Expand Up @@ -371,6 +391,7 @@ export function ModelHostFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'cpu_max': json['cpu_max'],
'cpu_usage': json['cpu_usage'],
'host_name': json['host_name'],
'inbound_connections': (json['inbound_connections'] === null ? null : (json['inbound_connections'] as Array<any>).map(ModelConnectionFromJSON)),
'instance_id': json['instance_id'],
'instance_type': json['instance_type'],
'interface_ips': json['interface_ips'],
Expand All @@ -388,6 +409,7 @@ export function ModelHostFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'node_id': json['node_id'],
'node_name': json['node_name'],
'os': json['os'],
'outbound_connections': (json['outbound_connections'] === null ? null : (json['outbound_connections'] as Array<any>).map(ModelConnectionFromJSON)),
'pods': (json['pods'] === null ? null : (json['pods'] as Array<any>).map(ModelPodFromJSON)),
'private_ip': json['private_ip'],
'processes': (json['processes'] === null ? null : (json['processes'] as Array<any>).map(ModelProcessFromJSON)),
Expand Down Expand Up @@ -425,6 +447,7 @@ export function ModelHostToJSON(value?: ModelHost | null): any {
'cpu_max': value.cpu_max,
'cpu_usage': value.cpu_usage,
'host_name': value.host_name,
'inbound_connections': (value.inbound_connections === null ? null : (value.inbound_connections as Array<any>).map(ModelConnectionToJSON)),
'instance_id': value.instance_id,
'instance_type': value.instance_type,
'interface_ips': value.interface_ips,
Expand All @@ -442,6 +465,7 @@ export function ModelHostToJSON(value?: ModelHost | null): any {
'node_id': value.node_id,
'node_name': value.node_name,
'os': value.os,
'outbound_connections': (value.outbound_connections === null ? null : (value.outbound_connections as Array<any>).map(ModelConnectionToJSON)),
'pods': (value.pods === null ? null : (value.pods as Array<any>).map(ModelPodToJSON)),
'private_ip': value.private_ip,
'processes': (value.processes === null ? null : (value.processes as Array<any>).map(ModelProcessToJSON)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@ export interface UtilsAdvancedReportFilters {
* @memberof UtilsAdvancedReportFilters
*/
account_id?: Array<string>;
/**
*
* @type {Array<string>}
* @memberof UtilsAdvancedReportFilters
*/
container_name?: Array<string>;
/**
*
* @type {Array<string>}
* @memberof UtilsAdvancedReportFilters
*/
host_name?: Array<string>;
/**
*
* @type {Array<string>}
* @memberof UtilsAdvancedReportFilters
*/
image_name?: Array<string>;
/**
*
* @type {Array<string>}
Expand All @@ -43,6 +55,12 @@ export interface UtilsAdvancedReportFilters {
* @memberof UtilsAdvancedReportFilters
*/
masked?: Array<boolean>;
/**
*
* @type {Array<string>}
* @memberof UtilsAdvancedReportFilters
*/
pod_name?: Array<string>;
/**
*
* @type {Array<string>}
Expand Down Expand Up @@ -71,9 +89,12 @@ export function UtilsAdvancedReportFiltersFromJSONTyped(json: any, ignoreDiscrim
return {

'account_id': !exists(json, 'account_id') ? undefined : json['account_id'],
'container_name': !exists(json, 'container_name') ? undefined : json['container_name'],
'host_name': !exists(json, 'host_name') ? undefined : json['host_name'],
'image_name': !exists(json, 'image_name') ? undefined : json['image_name'],
'kubernetes_cluster_name': !exists(json, 'kubernetes_cluster_name') ? undefined : json['kubernetes_cluster_name'],
'masked': !exists(json, 'masked') ? undefined : json['masked'],
'pod_name': !exists(json, 'pod_name') ? undefined : json['pod_name'],
'scan_status': !exists(json, 'scan_status') ? undefined : json['scan_status'],
};
}
Expand All @@ -88,9 +109,12 @@ export function UtilsAdvancedReportFiltersToJSON(value?: UtilsAdvancedReportFilt
return {

'account_id': value.account_id,
'container_name': value.container_name,
'host_name': value.host_name,
'image_name': value.image_name,
'kubernetes_cluster_name': value.kubernetes_cluster_name,
'masked': value.masked,
'pod_name': value.pod_name,
'scan_status': value.scan_status,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const UtilsReportFiltersNodeTypeEnum = {
Host: 'host',
Container: 'container',
ContainerImage: 'container_image',
Pod: 'pod',
Linux: 'linux',
Aws: 'aws',
Gcp: 'gcp',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export * from './ModelComplianceScanInfo';
export * from './ModelComplianceScanResult';
export * from './ModelComplianceScanStatusResp';
export * from './ModelComplianceScanTriggerReq';
export * from './ModelConnection';
export * from './ModelContainer';
export * from './ModelContainerImage';
export * from './ModelDownloadReportResponse';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { SlidingModal, SlidingModalCloseButton } from 'ui-components';

import { ConfigureScanModalProps } from '@/components/ConfigureScanModal';
import { Container } from '@/features/topology/data-components/node-details/Container';
import { ContainerImage } from '@/features/topology/data-components/node-details/ContainerImage';
import { Host } from '@/features/topology/data-components/node-details/Host';
import { Process } from '@/features/topology/data-components/node-details/Process';

export const NodeDetailsStackedModal = ({
open,
Expand Down Expand Up @@ -48,6 +50,29 @@ export const NodeDetailsStackedModal = ({
) : null}
{lastNode.nodeType === 'container' ? (
<Container
onStartScanClick={onStartScanClick}
nodeId={lastNode.nodeId}
showBackBtn={showBackBtn}
onGoBack={onGoBack}
onNodeClick={(nodeId, nodeType) => {
setStack((prevStack) => [...prevStack, { nodeId, nodeType }]);
}}
/>
) : null}
{lastNode.nodeType === 'process' ? (
<Process
onStartScanClick={onStartScanClick}
nodeId={lastNode.nodeId}
showBackBtn={showBackBtn}
onGoBack={onGoBack}
onNodeClick={(nodeId, nodeType) => {
setStack((prevStack) => [...prevStack, { nodeId, nodeType }]);
}}
/>
) : null}
{lastNode.nodeType === 'container_image' ? (
<ContainerImage
onStartScanClick={onStartScanClick}
nodeId={lastNode.nodeId}
showBackBtn={showBackBtn}
onGoBack={onGoBack}
Expand Down
Loading