Skip to content

Commit

Permalink
Issue detail modals: add inactive indicators for resources (#2390)
Browse files Browse the repository at this point in the history
Add vulnerability package scan results endpoint and update models

- Modified various components to filter resources based on their active status, enhancing UI responsiveness.
- Updated API interfaces and generated models accordingly.
  • Loading branch information
manV authored Dec 11, 2024
1 parent 953292a commit e3f014e
Show file tree
Hide file tree
Showing 10 changed files with 580 additions and 108 deletions.
95 changes: 94 additions & 1 deletion deepfence_frontend/apps/dashboard/api-spec-original.json
Original file line number Diff line number Diff line change
Expand Up @@ -7834,6 +7834,60 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/packages": {
"post": {
"tags": ["Vulnerability"],
"summary": "Get Vulnerability Package Scans Results",
"description": "Get Vulnerability Pacakge Scan results on agent or registry",
"operationId": "resultsVulnerablePackagesScans",
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ModelScanResultsReq" }
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelPackageVulnerabilityScanResult"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsBadRequestResponse" }
}
}
},
"401": { "description": "Unauthorized" },
"403": { "description": "Forbidden" },
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
}
},
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/secret": {
"post": {
"tags": ["Secret Scan"],
Expand Down Expand Up @@ -13736,9 +13790,10 @@
}
},
"ModelBasicNode": {
"required": ["node_id", "name", "node_type", "host_name"],
"required": ["node_id", "name", "node_type", "host_name", "active"],
"type": "object",
"properties": {
"active": { "type": "boolean" },
"host_name": { "type": "string" },
"name": { "type": "string" },
"node_id": { "type": "string" },
Expand Down Expand Up @@ -15263,6 +15318,44 @@
}
}
},
"ModelPackageVulnerabilityScanResult": {
"required": [
"docker_container_name",
"docker_image_name",
"host_name",
"kubernetes_cluster_name",
"node_id",
"node_name",
"node_type",
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"packages_vulnerability"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
"host_name": { "type": "string" },
"kubernetes_cluster_name": { "type": "string" },
"node_id": { "type": "string" },
"node_name": { "type": "string" },
"node_type": { "type": "string" },
"packages_vulnerability": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelVulnerability" }
},
"nullable": true
},
"scan_id": { "type": "string" },
"updated_at": { "type": "integer", "format": "int64" }
}
},
"ModelPasswordResetRequest": {
"required": ["email"],
"type": "object",
Expand Down
95 changes: 94 additions & 1 deletion deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7291,6 +7291,60 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/packages": {
"post": {
"tags": ["Vulnerability"],
"summary": "Get Vulnerability Package Scans Results",
"description": "Get Vulnerability Pacakge Scan results on agent or registry",
"operationId": "resultsVulnerablePackagesScans",
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ModelScanResultsReq" }
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelPackageVulnerabilityScanResult"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsBadRequestResponse" }
}
}
},
"401": { "description": "Unauthorized" },
"403": { "description": "Forbidden" },
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
}
},
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/secret": {
"post": {
"tags": ["Secret Scan"],
Expand Down Expand Up @@ -13193,9 +13247,10 @@
}
},
"ModelBasicNode": {
"required": ["node_id", "name", "node_type", "host_name"],
"required": ["node_id", "name", "node_type", "host_name", "active"],
"type": "object",
"properties": {
"active": { "type": "boolean" },
"host_name": { "type": "string" },
"name": { "type": "string" },
"node_id": { "type": "string" },
Expand Down Expand Up @@ -14720,6 +14775,44 @@
}
}
},
"ModelPackageVulnerabilityScanResult": {
"required": [
"docker_container_name",
"docker_image_name",
"host_name",
"kubernetes_cluster_name",
"node_id",
"node_name",
"node_type",
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"packages_vulnerability"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
"host_name": { "type": "string" },
"kubernetes_cluster_name": { "type": "string" },
"node_id": { "type": "string" },
"node_name": { "type": "string" },
"node_type": { "type": "string" },
"packages_vulnerability": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelVulnerability" }
},
"nullable": true
},
"scan_id": { "type": "string" },
"updated_at": { "type": "integer", "format": "int64" }
}
},
"ModelPasswordResetRequest": {
"required": ["email"],
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ models/ModelMalwareScanTriggerReq.ts
models/ModelMessageResponse.ts
models/ModelNodeIdentifier.ts
models/ModelNodesInScanResultRequest.ts
models/ModelPackageVulnerabilityScanResult.ts
models/ModelPasswordResetRequest.ts
models/ModelPasswordResetVerifyRequest.ts
models/ModelPod.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
ApiDocsBadRequestResponse,
ApiDocsFailureResponse,
ModelDownloadReportResponse,
ModelPackageVulnerabilityScanResult,
ModelSbomRequest,
ModelSbomResponse,
ModelScanListReq,
Expand All @@ -39,6 +40,8 @@ import {
ApiDocsFailureResponseToJSON,
ModelDownloadReportResponseFromJSON,
ModelDownloadReportResponseToJSON,
ModelPackageVulnerabilityScanResultFromJSON,
ModelPackageVulnerabilityScanResultToJSON,
ModelSbomRequestFromJSON,
ModelSbomRequestToJSON,
ModelSbomResponseFromJSON,
Expand Down Expand Up @@ -91,6 +94,10 @@ export interface ResultsVulnerabilityScansRequest {
modelScanResultsReq?: ModelScanResultsReq;
}

export interface ResultsVulnerablePackagesScansRequest {
modelScanResultsReq?: ModelScanResultsReq;
}

export interface StartVulnerabilityScanRequest {
modelVulnerabilityScanTriggerReq?: ModelVulnerabilityScanTriggerReq;
}
Expand Down Expand Up @@ -206,6 +213,22 @@ export interface VulnerabilityApiInterface {
*/
resultsVulnerabilityScans(requestParameters: ResultsVulnerabilityScansRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelVulnerabilityScanResult>;

/**
* Get Vulnerability Pacakge Scan results on agent or registry
* @summary Get Vulnerability Package Scans Results
* @param {ModelScanResultsReq} [modelScanResultsReq]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof VulnerabilityApiInterface
*/
resultsVulnerablePackagesScansRaw(requestParameters: ResultsVulnerablePackagesScansRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelPackageVulnerabilityScanResult>>;

/**
* Get Vulnerability Pacakge Scan results on agent or registry
* Get Vulnerability Package Scans Results
*/
resultsVulnerablePackagesScans(requestParameters: ResultsVulnerablePackagesScansRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelPackageVulnerabilityScanResult>;

/**
* Start Vulnerability Scan on agent or registry
* @summary Start Vulnerability Scan
Expand Down Expand Up @@ -494,6 +517,45 @@ export class VulnerabilityApi extends runtime.BaseAPI implements VulnerabilityAp
return await response.value();
}

/**
* Get Vulnerability Pacakge Scan results on agent or registry
* Get Vulnerability Package Scans Results
*/
async resultsVulnerablePackagesScansRaw(requestParameters: ResultsVulnerablePackagesScansRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelPackageVulnerabilityScanResult>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer_token", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/deepfence/scan/results/packages`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ModelScanResultsReqToJSON(requestParameters.modelScanResultsReq),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelPackageVulnerabilityScanResultFromJSON(jsonValue));
}

/**
* Get Vulnerability Pacakge Scan results on agent or registry
* Get Vulnerability Package Scans Results
*/
async resultsVulnerablePackagesScans(requestParameters: ResultsVulnerablePackagesScansRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelPackageVulnerabilityScanResult> {
const response = await this.resultsVulnerablePackagesScansRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Start Vulnerability Scan on agent or registry
* Start Vulnerability Scan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import { exists, mapValues } from '../runtime';
* @interface ModelBasicNode
*/
export interface ModelBasicNode {
/**
*
* @type {boolean}
* @memberof ModelBasicNode
*/
active: boolean;
/**
*
* @type {string}
Expand Down Expand Up @@ -50,6 +56,7 @@ export interface ModelBasicNode {
*/
export function instanceOfModelBasicNode(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "active" in value;
isInstance = isInstance && "host_name" in value;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "node_id" in value;
Expand All @@ -68,6 +75,7 @@ export function ModelBasicNodeFromJSONTyped(json: any, ignoreDiscriminator: bool
}
return {

'active': json['active'],
'host_name': json['host_name'],
'name': json['name'],
'node_id': json['node_id'],
Expand All @@ -84,6 +92,7 @@ export function ModelBasicNodeToJSON(value?: ModelBasicNode | null): any {
}
return {

'active': value.active,
'host_name': value.host_name,
'name': value.name,
'node_id': value.node_id,
Expand Down
Loading

0 comments on commit e3f014e

Please sign in to comment.