Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 8cad027

Browse files
Merge pull request #53 from solace-iot-team/ep2-3
Ep2 3
2 parents 9d93c9b + e57a102 commit 8cad027

File tree

20 files changed

+266
-90
lines changed

20 files changed

+266
-90
lines changed

ReleaseNotes.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
Solace Async API Management.
44

5+
## Version 0.4.3
6+
7+
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.4.3
8+
* [API-M Server OpenAPI](https://github.com/solace-iot-team/async-apim/blob/main/apim-server/server/common/api.yml): 0.4.0
9+
* [API-M Server](https://github.com/solace-iot-team/async-apim/tree/main/apim-server): 0.4.1
10+
* [API-M Connector OpenAPI](https://github.com/solace-iot-team/platform-api): 0.15.0
11+
12+
**New Features:**
13+
- **App Credentials**
14+
- display of array of credentials
15+
- Note: management of array of credentials not supported. will always use the first entry in the array instead.
16+
- **Organization Settings**
17+
- added service registry type to general settings
18+
19+
520
## Version 0.4.2
621

722
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.4.2

apim-portal/package-lock.json

+37-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apim-portal/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "async-apim-portal",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"description": "Solace Async API Management Portal",
55
"repository": {
66
"type": "git",
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@asyncapi/react-component": "1.0.0-next.33",
27-
"@solace-iot-team/apim-connector-openapi-browser": "^0.13.1",
27+
"@solace-iot-team/apim-connector-openapi-browser": "^0.15.0",
2828
"async-mutex": "^0.3.2",
2929
"base-64": "^1.0.0",
3030
"dompurify": "^2.3.8",

apim-portal/src/admin-portal/components/ManageApps/ManageAccess/EditExternalCredentialsForm.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,27 @@ export interface IEditExternalCredentialsFormProps {
2323
}
2424

2525
export const EditExternalCredentialsForm: React.FC<IEditExternalCredentialsFormProps> = (props: IEditExternalCredentialsFormProps) => {
26-
// const ComponentName = 'EditExternalCredentialsForm';
26+
const ComponentName = 'EditExternalCredentialsForm';
2727

2828
type TManagedObject = TAPAppDisplay_Credentials;
2929
type TManagedObjectFormData = {
3030
consumerKey: string;
3131
consumerSecret: string;
32-
};
32+
};
3333
type TManagedObjectFormDataEnvelope = {
3434
formData: TManagedObjectFormData;
3535
}
3636

3737
const transform_ManagedObject_To_FormDataEnvelope = (mo: TManagedObject): TManagedObjectFormDataEnvelope => {
38+
const funcName = 'transform_ManagedObject_To_FormDataEnvelope';
39+
const logName = `${ComponentName}.${funcName}()`;
40+
// TODO deal with array
41+
if(mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList.length === 0) throw new Error(`${logName}: mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList.length === 0`);
42+
const consumerKey = mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList[0].secret.consumerKey;
43+
const consumerSecret = mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList[0].secret.consumerSecret;
3844
const fd: TManagedObjectFormData = {
39-
consumerKey: mo.apAppCredentials.secret.consumerKey,
40-
consumerSecret: mo.apAppCredentials.secret.consumerSecret ? mo.apAppCredentials.secret.consumerSecret : '',
45+
consumerKey: consumerKey,
46+
consumerSecret: consumerSecret ? consumerSecret : '',
4147
};
4248
return {
4349
formData: fd
@@ -49,8 +55,9 @@ export const EditExternalCredentialsForm: React.FC<IEditExternalCredentialsFormP
4955
}): TManagedObject => {
5056
const mo: TManagedObject = props.apAppDisplay_Credentials;
5157
const fd: TManagedObjectFormData = formDataEnvelope.formData;
52-
mo.apAppCredentials.secret.consumerKey = fd.consumerKey;
53-
mo.apAppCredentials.secret.consumerSecret = fd.consumerSecret;
58+
// TODO deal with array
59+
mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList[0].secret.consumerKey = fd.consumerKey;
60+
mo.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList[0].secret.consumerSecret = fd.consumerSecret;
5461
return mo;
5562
}
5663

apim-portal/src/admin-portal/components/ManageApps/ManageAccess/EditInternalCredentialsForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const EditInternalCredentialsForm: React.FC<IEditInternalCredentialsFormP
107107
<div className="p-mb-4"><b>Current Credentials</b></div>
108108
<div className="p-mb-6">
109109
<APDisplayDeveloperPortalAppCredentials
110-
appCredentials={mo.apAppCredentials}
110+
apAppCredentialsDisplayEnvelope={mo.apAppCredentialsDisplayEnvelope}
111111
// className={props.contentClassName}
112112
/>
113113
</div>

apim-portal/src/admin-portal/components/ManageApps/ViewApp.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const ViewApp: React.FC<IViewAppProps> = (props: IViewAppProps) => {
157157
<TabPanel header='General'>
158158

159159
<APDisplayDeveloperPortalAppCredentialsPanel
160-
appCredentials={managedObject.apAppCredentials}
160+
apAppCredentialsDisplayEnvelope={managedObject.apAppCredentialsDisplayEnvelope}
161161
componentTitle="Credentials"
162162
collapsed={true}
163163
/>

apim-portal/src/admin-portal/components/ManageOrganizations/DisplayOrganization/DisplayOrganization.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from "react";
44
import { TabPanel, TabView } from "primereact/tabview";
55

66
import { APComponentHeader } from "../../../../components/APComponentHeader/APComponentHeader";
7-
import { DisplaySectionHeader_ApiProducts, DisplaySectionHeader_Apps, DisplaySectionHeader_AssetManagement, DisplaySectionHeader_EventPortalServices, DisplaySectionHeader_SempV2Auth, DisplaySectionHeader_SolaceCloudServices, E_DISPLAY_ORGANIZATION_SCOPE } from "../ManageOrganizationsCommon";
7+
import { DisplaySectionHeader_ApiProducts, DisplaySectionHeader_Apps, DisplaySectionHeader_AssetManagement, DisplaySectionHeader_EventPortalServices, DisplaySectionHeader_SempV2Auth, DisplaySectionHeader_ServiceRegistry, DisplaySectionHeader_SolaceCloudServices, E_DISPLAY_ORGANIZATION_SCOPE } from "../ManageOrganizationsCommon";
88
import { IAPSingleOrganizationDisplay } from "../../../../displayServices/APOrganizationsDisplayService/APSingleOrganizationDisplayService";
99
import { IAPSystemOrganizationDisplay } from "../../../../displayServices/APOrganizationsDisplayService/APSystemOrganizationsDisplayService";
1010
import APOrganizationsDisplayService, {
@@ -34,6 +34,7 @@ import { TApiCallState } from "../../../../utils/ApiCallState";
3434

3535
import '../../../../components/APComponents.css';
3636
import "../ManageOrganizations.css";
37+
import { ServiceRegistryType } from "@solace-iot-team/apim-connector-openapi-browser";
3738

3839
export interface IDisplayOrganizationProps {
3940
apOrganizationDisplay: IAPSystemOrganizationDisplay | IAPSingleOrganizationDisplay;
@@ -266,6 +267,11 @@ export const DisplayOrganization: React.FC<IDisplayOrganizationProps> = (props:
266267
const logName = `${ComponentName}.${funcName}()`;
267268
if(managedObject === undefined) throw new Error(`${logName}: managedObject === undefined`);
268269

270+
const renderServiceRegistryType = (serviceRegistryType: ServiceRegistryType): string => {
271+
// TODO: switch and translate e-num values to displayValues
272+
return serviceRegistryType;
273+
}
274+
269275
const renderAssetIncVersionStrategy = (apsAssetIncVersionStrategy: APSAssetIncVersionStrategy): string => {
270276
// TODO: switch and translate e-num values to displayValues
271277
return apsAssetIncVersionStrategy;
@@ -289,6 +295,10 @@ export const DisplayOrganization: React.FC<IDisplayOrganizationProps> = (props:
289295
const jsxTabPanelList: Array<JSX.Element> = [];
290296
jsxTabPanelList.push(
291297
<TabPanel header='General' key={Globals.getUUID()}>
298+
<div className="p-mb-2 p-mt-4 ap-display-component-header">{DisplaySectionHeader_ServiceRegistry}:</div>
299+
<div className="p-ml-4">
300+
<p><b>Service Registry Type: </b>{renderServiceRegistryType(managedObject.apServiceRegistry)}</p>
301+
</div>
292302
<div className="p-mb-2 p-mt-4 ap-display-component-header">{DisplaySectionHeader_AssetManagement}:</div>
293303
<div className="p-ml-4">
294304
<p><b>Version Increment Strategy: </b>{renderAssetIncVersionStrategy(managedObject.apAssetIncVersionStrategy)}</p>

apim-portal/src/admin-portal/components/ManageOrganizations/EditNewOrganization/EditNewGeneralForm.tsx

+44-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ import { Dropdown } from "primereact/dropdown";
1111
import { ApiCallState, TApiCallState } from "../../../../utils/ApiCallState";
1212
import APDisplayUtils from "../../../../displayServices/APDisplayUtils";
1313
import { APClientConnectorOpenApi } from "../../../../utils/APClientConnectorOpenApi";
14-
import { DisplaySectionHeader_ApiProducts, DisplaySectionHeader_Apps, DisplaySectionHeader_AssetManagement, EAction, E_CALL_STATE_ACTIONS } from "../ManageOrganizationsCommon";
14+
import { DisplaySectionHeader_ApiProducts, DisplaySectionHeader_Apps, DisplaySectionHeader_AssetManagement, DisplaySectionHeader_ServiceRegistry, EAction, E_CALL_STATE_ACTIONS } from "../ManageOrganizationsCommon";
1515
import { IAPSingleOrganizationDisplay_General } from "../../../../displayServices/APOrganizationsDisplayService/APSingleOrganizationDisplayService";
1616
import { IAPSystemOrganizationDisplay_General } from "../../../../displayServices/APOrganizationsDisplayService/APSystemOrganizationsDisplayService";
1717
import APOrganizationsDisplayService from "../../../../displayServices/APOrganizationsDisplayService/APOrganizationsDisplayService";
1818
import { APSOpenApiFormValidationRules } from "../../../../utils/APSOpenApiFormValidationRules";
1919
import { APSAssetIncVersionStrategy } from "../../../../_generated/@solace-iot-team/apim-server-openapi-browser";
20+
import { APConnectorFormValidationRules } from "../../../../utils/APConnectorOpenApiFormValidationRules";
21+
import { ServiceRegistryType } from "@solace-iot-team/apim-connector-openapi-browser";
22+
import { ConfigHelper } from "../../../../components/APContextProviders/ConfigContextProvider/ConfigHelper";
23+
import { ConfigContext } from "../../../../components/APContextProviders/ConfigContextProvider/ConfigContextProvider";
2024

2125
import '../../../../components/APComponents.css';
2226
import "../ManageOrganizations.css";
23-
import { APConnectorFormValidationRules } from "../../../../utils/APConnectorOpenApiFormValidationRules";
2427

2528
export interface IEditNewGeneralFormProps {
2629
action: EAction;
@@ -39,6 +42,8 @@ export const EditNewGeneralForm: React.FC<IEditNewGeneralFormProps> = (props: IE
3942
id: string;
4043
displayName: string;
4144

45+
serviceRegistryType: ServiceRegistryType;
46+
4247
assetIncVersionStrategy: APSAssetIncVersionStrategy;
4348

4449
is_Configured_MaxNumEnvs_Per_ApiProduct: boolean;
@@ -63,6 +68,8 @@ export const EditNewGeneralForm: React.FC<IEditNewGeneralFormProps> = (props: IE
6368
id: mo.apEntityId.id,
6469
displayName: mo.apEntityId.displayName,
6570

71+
serviceRegistryType: mo.apServiceRegistry,
72+
6673
assetIncVersionStrategy: mo.apAssetIncVersionStrategy,
6774

6875
is_Configured_MaxNumEnvs_Per_ApiProduct: mo.apMaxNumEnvs_Per_ApiProduct > APOrganizationsDisplayService.get_DefaultMaxNumEnvs_Per_ApiProduct(),
@@ -89,6 +96,7 @@ export const EditNewGeneralForm: React.FC<IEditNewGeneralFormProps> = (props: IE
8996
const fd: TManagedObjectFormData = formDataEnvelope.formData;
9097
if(isNewManagedObject()) mo.apEntityId.id = fd.id;
9198
mo.apEntityId.displayName = fd.displayName;
99+
mo.apServiceRegistry = fd.serviceRegistryType;
92100
mo.apAssetIncVersionStrategy = fd.assetIncVersionStrategy;
93101
mo.apMaxNumEnvs_Per_ApiProduct = fd.is_Configured_MaxNumEnvs_Per_ApiProduct ? fd.maxNumEnvs_Per_ApiProduct : APOrganizationsDisplayService.get_DefaultMaxNumEnvs_Per_ApiProduct();
94102
mo.apMaxNumApis_Per_ApiProduct = fd.is_Configured_MaxNumApis_Per_ApiProduct ? fd.maxNumApis_Per_ApiProduct : APOrganizationsDisplayService.get_DefaultMaxNumApis_Per_ApiProduct();
@@ -103,6 +111,8 @@ export const EditNewGeneralForm: React.FC<IEditNewGeneralFormProps> = (props: IE
103111
const [managedObjectFormDataEnvelope, setManagedObjectFormDataEnvelope] = React.useState<TManagedObjectFormDataEnvelope>();
104112
const [apiCallStatus, setApiCallStatus] = React.useState<TApiCallState | null>(null);
105113
const managedObjectUseForm = useForm<TManagedObjectFormDataEnvelope>();
114+
const [configContext] = React.useContext(ConfigContext);
115+
106116

107117
// * Api Calls *
108118

@@ -358,6 +368,38 @@ export const EditNewGeneralForm: React.FC<IEditNewGeneralFormProps> = (props: IE
358368
{APDisplayUtils.displayFormFieldErrorMessage(managedObjectUseForm.formState.errors.formData?.displayName)}
359369
</div>
360370

371+
<div className="p-mb-4 p-mt-4 ap-display-component-header">{DisplaySectionHeader_ServiceRegistry}:</div>
372+
<div className="p-ml-4">
373+
{/* service registry */}
374+
<div className="p-field">
375+
<span className="p-float-label">
376+
<Controller
377+
control={managedObjectUseForm.control}
378+
name="formData.serviceRegistryType"
379+
rules={APConnectorFormValidationRules.isRequired('Select Service Registry Type.', true)}
380+
render={( { field, fieldState }) => {
381+
return(
382+
<Dropdown
383+
id={field.name}
384+
{...field}
385+
options={Object.values(ServiceRegistryType)}
386+
onChange={(e) => {
387+
field.onChange(e.value);
388+
managedObjectUseForm.clearErrors();
389+
}}
390+
className={classNames({ 'p-invalid': fieldState.invalid })}
391+
// leave it fixed at patch
392+
disabled={!ConfigHelper.isEventPortal20(configContext)}
393+
/>
394+
);
395+
}}
396+
/>
397+
<label className={classNames({ 'p-error': managedObjectUseForm.formState.errors.formData?.assetIncVersionStrategy })}>Service Registry Type*</label>
398+
</span>
399+
{APDisplayUtils.displayFormFieldErrorMessage(managedObjectUseForm.formState.errors.formData?.assetIncVersionStrategy)}
400+
</div>
401+
</div>
402+
361403
<div className="p-mb-4 p-mt-4 ap-display-component-header">{DisplaySectionHeader_AssetManagement}:</div>
362404
<div className="p-ml-4">
363405
{/* asset inc version strategy */}

apim-portal/src/admin-portal/components/ManageOrganizations/ManageOrganizationsCommon.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TAPEntityId } from "../../../utils/APEntityIdsService";
22

3+
export const DisplaySectionHeader_ServiceRegistry = "Service Registry";
34
export const DisplaySectionHeader_AssetManagement = "Asset Management";
45
export const DisplaySectionHeader_ApiProducts = "API Products";
56
export const DisplaySectionHeader_Apps = "Apps";

apim-portal/src/components/APDisplayDeveloperPortalApp/APDisplayDeveloperPortalApp_Credentials.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import React from "react";
44
import { DataTable } from "primereact/datatable";
55
import { Column } from "primereact/column";
66

7-
import APAppsDisplayService, { TAPAppCredentialsDisplay } from "../../displayServices/APAppsDisplayService/APAppsDisplayService";
7+
import APAppsDisplayService, {
8+
TAPAppCredentialsDisplay,
9+
TAPAppCredentialsDisplayEnvelope
10+
} from "../../displayServices/APAppsDisplayService/APAppsDisplayService";
811

912
import "../APComponents.css";
1013

1114
export interface IAPDisplayDeveloperPortalApp_CredentialsProps {
12-
appCredentials: TAPAppCredentialsDisplay;
15+
apAppCredentialsDisplayEnvelope: TAPAppCredentialsDisplayEnvelope;
1316
className?: string;
1417
}
1518

@@ -60,7 +63,7 @@ export const APDisplayDeveloperPortalAppCredentials: React.FC<IAPDisplayDevelope
6063
<DataTable
6164
className="p-datatable-sm"
6265
ref={componentDataTableRef}
63-
value={[props.appCredentials]}
66+
value={props.apAppCredentialsDisplayEnvelope.apAppCredentialsDisplayList}
6467
autoLayout={true}
6568
resizableColumns={true}
6669
columnResizeMode="fit"

0 commit comments

Comments
 (0)