diff --git a/package-lock.json b/package-lock.json index 184b4fa42..19ffb1444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "czertainly-administrator", - "version": "2.12.1-SNAPSHOT", + "version": "2.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "czertainly-administrator", - "version": "2.12.1-SNAPSHOT", + "version": "2.13.0", "dependencies": { "@openapitools/openapi-generator-cli": "^2.6.0", "@reduxjs/toolkit": "^2.0.0", diff --git a/package.json b/package.json index abb0cb657..afe5c2696 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "czertainly-administrator", - "version": "2.13.0", + "version": "2.13.1", "homepage": ".", "private": true, "dependencies": { diff --git a/src/components/_pages/certificates/CertificateStatus/index.tsx b/src/components/_pages/certificates/CertificateStatus/index.tsx index a010aa69e..d4393cf53 100644 --- a/src/components/_pages/certificates/CertificateStatus/index.tsx +++ b/src/components/_pages/certificates/CertificateStatus/index.tsx @@ -2,6 +2,7 @@ import { Badge } from 'reactstrap'; import { CertificateEventHistoryDtoStatusEnum, CertificateState, + CertificateSubjectType, CertificateValidationStatus, ComplianceRuleStatus, ComplianceStatus, @@ -10,7 +11,13 @@ import { getCertificateStatusColor, useGetStatusText } from 'utils/certificate'; import { capitalize } from 'utils/common-utils'; interface Props { - status: CertificateState | CertificateValidationStatus | CertificateEventHistoryDtoStatusEnum | ComplianceStatus | ComplianceRuleStatus; + status: + | CertificateState + | CertificateValidationStatus + | CertificateEventHistoryDtoStatusEnum + | ComplianceStatus + | ComplianceRuleStatus + | CertificateSubjectType; asIcon?: boolean; } diff --git a/src/components/_pages/certificates/detail/index.tsx b/src/components/_pages/certificates/detail/index.tsx index 6d50a5772..d174f298a 100644 --- a/src/components/_pages/certificates/detail/index.tsx +++ b/src/components/_pages/certificates/detail/index.tsx @@ -26,6 +26,7 @@ import { CertificateFormatEncoding, CertificateRequestFormat, CertificateRevocationReason, + CertificateSubjectType, CertificateValidationStatus, } from '../../../../types/openapi'; @@ -1422,8 +1423,8 @@ export default function CertificateDetail() { ], }, { - id: 'basicConstraint', - columns: ['Basic Constraint', certificate.basicConstraints], + id: 'subjectType', + columns: ['Subject Type', ], }, ]; if (certificate?.state !== CertStatus.Requested) { @@ -1437,7 +1438,7 @@ export default function CertificateDetail() { certDetail.unshift({ id: 'trustedCa', columns: [ - certificate?.basicConstraints?.includes('End Entity') ? 'Trusted Self-Signed' : 'Trusted CA', + certificate?.subjectType == CertificateSubjectType.SelfSignedEndEntity ? 'Trusted Self-Signed' : 'Trusted CA', , ], }); @@ -1468,7 +1469,7 @@ export default function CertificateDetail() { width: 'auto', }, { - content: 'Multiple Entires', + content: 'Multiple Entries', align: 'center', sortable: true, id: 'multiEntries', @@ -1547,7 +1548,7 @@ export default function CertificateDetail() { width: 'auto', }, { - content: 'Multiple Entires', + content: 'Multiple Entries', align: 'center', sortable: true, id: 'multiEntries', diff --git a/src/components/_pages/dashboard/index.tsx b/src/components/_pages/dashboard/index.tsx index eb27d949a..5b3c80e0d 100644 --- a/src/components/_pages/dashboard/index.tsx +++ b/src/components/_pages/dashboard/index.tsx @@ -293,10 +293,26 @@ function Dashboard() { []} + onSetFilter={(index, labels) => { + const certificateSubjectTypeEnum = platformEnums?.CertificateSubjectType; + const certificateSubjectTypeList = Object.keys(certificateSubjectTypeEnum).map( + (key) => certificateSubjectTypeEnum[key], + ); + const selectedCertificateSubjectType = certificateSubjectTypeList.find( + (status) => status.label === labels[index], + ); + return [ + { + fieldSource: FilterFieldSource.Property, + condition: FilterConditionOperator.Equals, + fieldIdentifier: 'SUBJECT_TYPE', + value: selectedCertificateSubjectType?.code ? [selectedCertificateSubjectType?.code] : [''], + }, + ]; + }} redirect="../certificates" /> diff --git a/src/types/openapi/.openapi-generator/FILES b/src/types/openapi/.openapi-generator/FILES index 813a56482..0a457bfdd 100644 --- a/src/types/openapi/.openapi-generator/FILES +++ b/src/types/openapi/.openapi-generator/FILES @@ -120,6 +120,7 @@ models/CertificateRequestFormat.ts models/CertificateResponseDto.ts models/CertificateRevocationReason.ts models/CertificateState.ts +models/CertificateSubjectType.ts models/CertificateType.ts models/CertificateUpdateObjectsDto.ts models/CertificateValidationCheck.ts diff --git a/src/types/openapi/apis/LocationManagementApi.ts b/src/types/openapi/apis/LocationManagementApi.ts index 3707dd38e..622255b24 100644 --- a/src/types/openapi/apis/LocationManagementApi.ts +++ b/src/types/openapi/apis/LocationManagementApi.ts @@ -220,7 +220,7 @@ export class LocationManagementApi extends BaseAPI { getSearchableFieldInformation(opts?: OperationOpts): Observable>> getSearchableFieldInformation(opts?: OperationOpts): Observable | AjaxResponse>> { return this.request>({ - url: '/v1/search', + url: '/v1/locations/search', method: 'GET', }, opts?.responseOpts); }; diff --git a/src/types/openapi/models/CertificateDetailDto.ts b/src/types/openapi/models/CertificateDetailDto.ts index 266933145..62ccbe984 100644 --- a/src/types/openapi/models/CertificateDetailDto.ts +++ b/src/types/openapi/models/CertificateDetailDto.ts @@ -3,7 +3,7 @@ * CZERTAINLY Core API * REST API for CZERTAINLY Core * - * The version of the OpenAPI document: 2.12.1-SNAPSHOT + * The version of the OpenAPI document: 2.13.1-SNAPSHOT * Contact: info@czertainly.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -17,6 +17,7 @@ import type { CertificateProtocolDto, CertificateRequestDto, CertificateState, + CertificateSubjectType, CertificateType, CertificateValidationStatus, ComplianceStatus, @@ -185,11 +186,10 @@ export interface CertificateDetailDto { */ keyUsage: Array; /** - * Basic Constraints - * @type {string} + * @type {CertificateSubjectType} * @memberof CertificateDetailDto */ - basicConstraints: string; + subjectType: CertificateSubjectType; /** * Certificate metadata * @type {Array} diff --git a/src/types/openapi/models/CertificateSubjectType.ts b/src/types/openapi/models/CertificateSubjectType.ts new file mode 100644 index 000000000..87f42d1d8 --- /dev/null +++ b/src/types/openapi/models/CertificateSubjectType.ts @@ -0,0 +1,25 @@ +// tslint:disable +/** + * CZERTAINLY Core API + * REST API for CZERTAINLY Core + * + * The version of the OpenAPI document: 2.13.1-SNAPSHOT + * Contact: info@czertainly.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Certificate subject type + * @export + * @enum {string} + */ +export enum CertificateSubjectType { + EndEntity = 'endEntity', + SelfSignedEndEntity = 'selfSignedEndEntity', + IntermediateCa = 'intermediateCa', + RootCa = 'rootCa' +} + diff --git a/src/types/openapi/models/PlatformEnum.ts b/src/types/openapi/models/PlatformEnum.ts index c79cf24cc..7dbd7228b 100644 --- a/src/types/openapi/models/PlatformEnum.ts +++ b/src/types/openapi/models/PlatformEnum.ts @@ -3,7 +3,7 @@ * CZERTAINLY Core API * REST API for CZERTAINLY Core * - * The version of the OpenAPI document: 2.12.1-SNAPSHOT + * The version of the OpenAPI document: 2.13.1-SNAPSHOT * Contact: info@czertainly.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -37,6 +37,7 @@ export enum PlatformEnum { CertificateRequestFormat = 'CertificateRequestFormat', DiscoveryStatus = 'DiscoveryStatus', CertificateProtocol = 'CertificateProtocol', + CertificateSubjectType = 'CertificateSubjectType', KeyAlgorithm = 'KeyAlgorithm', KeyFormat = 'KeyFormat', KeyState = 'KeyState', diff --git a/src/types/openapi/models/StatisticsDto.ts b/src/types/openapi/models/StatisticsDto.ts index 2d096d232..1152e6ba8 100644 --- a/src/types/openapi/models/StatisticsDto.ts +++ b/src/types/openapi/models/StatisticsDto.ts @@ -3,7 +3,7 @@ * CZERTAINLY Core API * REST API for CZERTAINLY Core * - * The version of the OpenAPI document: 2.12.1-SNAPSHOT + * The version of the OpenAPI document: 2.13.1-SNAPSHOT * Contact: info@czertainly.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -101,11 +101,11 @@ export interface StatisticsDto { */ certificateStatByKeySize?: { [key: string]: number; }; /** - * Map of Certificate count by basic constraints + * Map of Certificate count by subject type * @type {{ [key: string]: number; }} * @memberof StatisticsDto */ - certificateStatByBasicConstraints?: { [key: string]: number; }; + certificateStatBySubjectType?: { [key: string]: number; }; /** * Map of Certificate count by state * @type {{ [key: string]: number; }} diff --git a/src/types/openapi/models/index.ts b/src/types/openapi/models/index.ts index db29c05d5..a5367317f 100644 --- a/src/types/openapi/models/index.ts +++ b/src/types/openapi/models/index.ts @@ -76,6 +76,7 @@ export * from './CertificateRequestFormat'; export * from './CertificateResponseDto'; export * from './CertificateRevocationReason'; export * from './CertificateState'; +export * from './CertificateSubjectType'; export * from './CertificateType'; export * from './CertificateUpdateObjectsDto'; export * from './CertificateValidationCheck'; diff --git a/src/utils/certificate.tsx b/src/utils/certificate.tsx index cefa4d313..0643fd865 100644 --- a/src/utils/certificate.tsx +++ b/src/utils/certificate.tsx @@ -5,6 +5,7 @@ import { CertificateDetailResponseModel } from 'types/certificate'; import { CertificateEventHistoryDtoStatusEnum, CertificateState, + CertificateSubjectType, CertificateType, CertificateValidationStatus, ComplianceRuleStatus, @@ -27,7 +28,7 @@ export const emptyCertificate: CertificateDetailResponseModel = { keySize: -1, keyUsage: [], extendedKeyUsage: [], - basicConstraints: '', + subjectType: CertificateSubjectType.EndEntity, state: CertificateState.PendingIssue, validationStatus: CertificateValidationStatus.NotChecked, fingerprint: '', @@ -70,7 +71,13 @@ export function downloadFile(content: any, fileName: string) { } export function getCertificateStatusColor( - status: CertificateState | CertificateValidationStatus | CertificateEventHistoryDtoStatusEnum | ComplianceStatus | ComplianceRuleStatus, + status: + | CertificateState + | CertificateValidationStatus + | CertificateEventHistoryDtoStatusEnum + | ComplianceStatus + | ComplianceRuleStatus + | CertificateSubjectType, ) { switch (status) { case CertificateState.Requested: @@ -130,6 +137,15 @@ export function getCertificateStatusColor( case CertificateEventHistoryDtoStatusEnum.Success: return '#1ab394'; + case CertificateSubjectType.EndEntity: + return '#6c757d'; + case CertificateSubjectType.SelfSignedEndEntity: + return '#f37d63'; + case CertificateSubjectType.IntermediateCa: + return '#3754a5'; + case CertificateSubjectType.RootCa: + return '#1ab394'; + default: return '#6c757d'; } @@ -140,6 +156,7 @@ export function useGetStatusText() { const certificateValidationStatusEnum = useSelector(enumSelectors.platformEnum(PlatformEnum.CertificateValidationStatus)); const complianceStatusEnum = useSelector(enumSelectors.platformEnum(PlatformEnum.ComplianceStatus)); const complianceRuleStatusEnum = useSelector(enumSelectors.platformEnum(PlatformEnum.ComplianceRuleStatus)); + const certificateSubjectTypeEnum = useSelector(enumSelectors.platformEnum(PlatformEnum.CertificateSubjectType)); return useCallback( ( @@ -148,7 +165,8 @@ export function useGetStatusText() { | CertificateValidationStatus | CertificateEventHistoryDtoStatusEnum | ComplianceStatus - | ComplianceRuleStatus, + | ComplianceRuleStatus + | CertificateSubjectType, ) => { switch (status) { case CertificateValidationStatus.Valid: @@ -187,11 +205,23 @@ export function useGetStatusText() { case ComplianceRuleStatus.Na: return getEnumLabel(complianceRuleStatusEnum, status); + case CertificateSubjectType.EndEntity: + case CertificateSubjectType.SelfSignedEndEntity: + case CertificateSubjectType.IntermediateCa: + case CertificateSubjectType.RootCa: + return getEnumLabel(certificateSubjectTypeEnum, status); + default: return 'Unknown'; } }, - [certificateStatusEnum, certificateValidationStatusEnum, complianceStatusEnum, complianceRuleStatusEnum], + [ + certificateStatusEnum, + certificateValidationStatusEnum, + complianceStatusEnum, + complianceRuleStatusEnum, + certificateSubjectTypeEnum, + ], ); }