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

Many properties now are set to required in webconsole.yaml #70

Merged
merged 6 commits into from
Mar 6, 2024
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
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 @@ -509,7 +522,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 @@ -708,6 +724,8 @@ export default function SubscriberCreate() {
...data.AuthenticationSubscription,
permanentKey: {
permanentKeyValue: event.target.value,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
});
Expand All @@ -723,10 +741,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: opcValue,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -740,10 +762,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: opcValue,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -765,10 +791,14 @@ export default function SubscriberCreate() {
milenage: {
op: {
opValue: event.target.value,
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
opc: {
opcValue: "",
encryptionKey: 0,
encryptionAlgorithm: 0,
},
},
};
Expand All @@ -781,10 +811,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 @@ -813,8 +847,8 @@ export default function SubscriberCreate() {
AccessAndMobilitySubscriptionData: {
...data.AccessAndMobilitySubscriptionData,
subscribedUeAmbr: {
...data.AccessAndMobilitySubscriptionData?.subscribedUeAmbr,
uplink: event.target.value,
downlink: data.AccessAndMobilitySubscriptionData.subscribedUeAmbr?.downlink ?? "",
},
},
});
Expand All @@ -828,7 +862,7 @@ export default function SubscriberCreate() {
AccessAndMobilitySubscriptionData: {
...data.AccessAndMobilitySubscriptionData,
subscribedUeAmbr: {
...data.AccessAndMobilitySubscriptionData?.subscribedUeAmbr,
uplink: data.AccessAndMobilitySubscriptionData.subscribedUeAmbr?.uplink ?? "",
downlink: event.target.value,
},
},
Expand All @@ -840,7 +874,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 @@ -891,7 +925,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 @@ -936,7 +970,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 @@ -1015,7 +1049,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
Loading