Skip to content

Commit

Permalink
Many properties now are set to required in webconsole.yaml (#70)
Browse files Browse the repository at this point in the history
* Many properties now are set to required in webconsole.yaml

* Remove openapitools.json and regenerate by openapi-generator-cli 7.2.0 according to the review comment

* Since the api.ts, which must be automatically generated, was manually edited, the original file webconsole.yaml is modified and api.ts is regenerated.

* More required properties

* Add comment
  • Loading branch information
ShouheiNishi authored Mar 6, 2024
1 parent 96cbaa2 commit 4782ecc
Show file tree
Hide file tree
Showing 12 changed files with 579 additions and 253 deletions.
458 changes: 249 additions & 209 deletions frontend/src/api/api.ts

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions frontend/src/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';

export const BASE_PATH = "http://localhost:5000".replace(/\/+$/, "");
Expand All @@ -39,7 +39,7 @@ export const COLLECTION_FORMATS = {
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
options: RawAxiosRequestConfig;
}

/**
Expand All @@ -53,7 +53,7 @@ export class BaseAPI {
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
this.basePath = configuration.basePath ?? basePath;
}
}
};
Expand All @@ -70,3 +70,17 @@ export class RequiredError extends Error {
this.name = "RequiredError"
}
}

interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}

/**
*
* @export
*/
export const operationServerMap: ServerMap = {
}
2 changes: 1 addition & 1 deletion frontend/src/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const toPathString = function (url: URL) {
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}
9 changes: 9 additions & 0 deletions frontend/src/api/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ConfigurationParameters {
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
}
Expand Down Expand Up @@ -58,6 +59,13 @@ export class Configuration {
* @memberof Configuration
*/
basePath?: string;
/**
* override server index
*
* @type {number}
* @memberof Configuration
*/
serverIndex?: number;
/**
* base options for axios calls
*
Expand All @@ -80,6 +88,7 @@ export class Configuration {
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
this.serverIndex = param.serverIndex;
this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function ChangePassword() {
return;
}
const newUser: User = {
email: user?.username,
email: user?.username ?? "",
encryptedPassword: password.password,
};
axios.post("/api/change-password", newUser).then((res) => {
Expand Down
52 changes: 43 additions & 9 deletions frontend/src/pages/SubscriberCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export default function SubscriberCreate() {
authenticationManagementField: "8000",
permanentKey: {
permanentKeyValue: "8baf473f2f8fd09487cccbd7097c6862",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
milenage: {
op: {
Expand All @@ -61,6 +63,8 @@ export default function SubscriberCreate() {
},
opc: {
opcValue: "8e27b6af0e692e750f32667a3b14605d",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
AccessAndMobilitySubscriptionData: {
Expand Down Expand Up @@ -236,6 +240,8 @@ export default function SubscriberCreate() {
ChargingDatas: [
{
snssai: "01010203",
dnn: "",
filter: "",
chargingMethod: "Offline",
quota: "100000",
unitCost: "1",
Expand All @@ -251,6 +257,8 @@ export default function SubscriberCreate() {
},
{
snssai: "01112233",
dnn: "",
filter: "",
chargingMethod: "Online",
quota: "100000",
unitCost: "1",
Expand Down Expand Up @@ -417,7 +425,9 @@ export default function SubscriberCreate() {
setData({ ...data });
} else {
data.SessionManagementSubscriptionData.push({
singleNssai: {},
singleNssai: {
sst: 1,
},
dnnConfigurations: {},
});
setData({ ...data });
Expand Down Expand Up @@ -464,7 +474,10 @@ export default function SubscriberCreate() {
},
priorityLevel: 8,
},
sessionAmbr: {},
sessionAmbr: {
uplink: "",
downlink: "",
},
};
setData({ ...data });
dnnName[index] = "";
Expand Down Expand Up @@ -527,7 +540,10 @@ export default function SubscriberCreate() {

const onUpSecurity = (dnn: DnnConfiguration | undefined) => {
if (dnn !== undefined) {
dnn.upSecurity = {};
dnn.upSecurity = {
upIntegr: "NOT_NEEDED",
upConfid: "NOT_NEEDED",
};
}
setData({ ...data });
};
Expand Down Expand Up @@ -726,6 +742,8 @@ export default function SubscriberCreate() {
...data.AuthenticationSubscription,
permanentKey: {
permanentKeyValue: event.target.value,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
});
Expand All @@ -741,10 +759,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: opcValue,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -758,10 +780,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: opcValue,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -783,10 +809,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: event.target.value,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -799,10 +829,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: event.target.value,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand Down Expand Up @@ -831,8 +865,8 @@ export default function SubscriberCreate() {
AccessAndMobilitySubscriptionData: {
...data.AccessAndMobilitySubscriptionData,
subscribedUeAmbr: {
...data.AccessAndMobilitySubscriptionData?.subscribedUeAmbr,
uplink: event.target.value,
downlink: data.AccessAndMobilitySubscriptionData.subscribedUeAmbr?.downlink ?? "",
},
},
});
Expand All @@ -846,7 +880,7 @@ export default function SubscriberCreate() {
AccessAndMobilitySubscriptionData: {
...data.AccessAndMobilitySubscriptionData,
subscribedUeAmbr: {
...data.AccessAndMobilitySubscriptionData?.subscribedUeAmbr,
uplink: data.AccessAndMobilitySubscriptionData.subscribedUeAmbr?.uplink ?? "",
downlink: event.target.value,
},
},
Expand All @@ -858,7 +892,7 @@ export default function SubscriberCreate() {
index: number,
): void => {
if (event.target.value === "") {
data.SessionManagementSubscriptionData![index].singleNssai!.sst = undefined;
data.SessionManagementSubscriptionData![index].singleNssai!.sst = 0;
} else {
data.SessionManagementSubscriptionData![index].singleNssai!.sst! = Number(event.target.value);
}
Expand Down Expand Up @@ -909,7 +943,7 @@ export default function SubscriberCreate() {
def.push(nssai);
}
}
data.AccessAndMobilitySubscriptionData!.nssai!.defaultSingleNssais = def;
data.AccessAndMobilitySubscriptionData!.nssai!.defaultSingleNssais = def ?? [];
data.AccessAndMobilitySubscriptionData!.nssai!.singleNssais = single;
setData({ ...data });
};
Expand Down Expand Up @@ -954,7 +988,7 @@ export default function SubscriberCreate() {
if (event.target.value === "") {
data.SessionManagementSubscriptionData![index].dnnConfigurations![dnn]["5gQosProfile"]![
"5qi"
] = undefined;
] = 8;
} else {
data.SessionManagementSubscriptionData![index].dnnConfigurations![dnn]["5gQosProfile"]![
"5qi"
Expand Down Expand Up @@ -1033,7 +1067,7 @@ export default function SubscriberCreate() {
data.QosFlows![i].qosRef === qosRef
) {
if (event.target.value == "") {
data.QosFlows![i]["5qi"] = undefined;
data.QosFlows![i]["5qi"] = 8;
} else {
data.QosFlows![i]["5qi"] = Number(event.target.value);
}
Expand Down
Loading

0 comments on commit 4782ecc

Please sign in to comment.