diff --git a/client/src/app/api/models.ts b/client/src/app/api/models.ts index a3a3fea085..ac742d4c46 100644 --- a/client/src/app/api/models.ts +++ b/client/src/app/api/models.ts @@ -158,11 +158,11 @@ export interface ApplicationDependency { export interface ApplicationAdoptionPlan { applicationId: number; applicationName: string; - positionX: number; - positionY: number; - effort: number; decision: ProposedAction; effortEstimate: string; + effort: number; + positionX: number; + positionY: number; } export interface ApplicationImportSummary { @@ -190,18 +190,17 @@ export type IdentityKind = export interface Identity { id: number; + createUser?: string; + updateUser?: string; + createTime?: string; + + kind: IdentityKind; name: string; description?: string; - kind?: IdentityKind; - createUser?: string; - encrypted?: string; - key?: string; - keyFilename?: string; - password?: string; user?: string; - updateUser?: string; + password?: string; + key?: string; settings?: string; - settingsFilename?: string; } export interface Proxy { diff --git a/client/src/app/api/rest.ts b/client/src/app/api/rest.ts index dc525e6bb6..5f49ddb2a9 100644 --- a/client/src/app/api/rest.ts +++ b/client/src/app/api/rest.ts @@ -1,5 +1,4 @@ import axios, { AxiosPromise } from "axios"; -import { APIClient } from "@app/axios-config"; import { AnalysisDependency, @@ -136,7 +135,7 @@ export const getApplicationDependencies = ( return axios .get(`${APPLICATION_DEPENDENCY}`, { params, - headers: jsonHeaders, + headers: jsonHeaders.headers, }) .then((response) => response.data); }; @@ -179,21 +178,17 @@ export const deleteReview = (id: number): Promise => { return axios.delete(`${REVIEWS}/${id}`); }; -export const getApplicationAdoptionPlan = ( - applicationIds: number[] -): AxiosPromise => { - return APIClient.post( +export const getApplicationAdoptionPlan = (applicationIds: number[]) => { + return axios.post( `${REPORT}/adoptionplan`, - applicationIds.map((f) => ({ - applicationId: f, - })) + applicationIds.map((f) => ({ applicationId: f })) ); }; -export const getApplicationSummaryCSV = (id: string): AxiosPromise => { - return APIClient.get(`${APP_IMPORT_CSV}?importSummaryId=${id}`, { +export const getApplicationSummaryCSV = (id: string) => { + return axios.get(`${APP_IMPORT_CSV}?importSummary.id=${id}`, { responseType: "arraybuffer", - headers: { Accept: "text/csv", responseType: "blob" }, + headers: { Accept: "text/csv" }, }); }; @@ -241,28 +236,26 @@ export const getAssessmentById = (id: number | string): Promise => { return axios.get(`${ASSESSMENTS}/${id}`).then((response) => response.data); }; -export const deleteAssessment = (id: number): AxiosPromise => { - return APIClient.delete(`${ASSESSMENTS}/${id}`); +export const deleteAssessment = (id: number) => { + return axios.delete(`${ASSESSMENTS}/${id}`); }; -export const getIdentities = (): AxiosPromise> => { - return APIClient.get(`${IDENTITIES}`, jsonHeaders); +export const getIdentities = () => { + return axios.get(`${IDENTITIES}`, jsonHeaders); }; -export const createIdentity = (obj: New): AxiosPromise => { - return APIClient.post(`${IDENTITIES}`, obj); +export const createIdentity = (obj: New) => { + return axios.post(`${IDENTITIES}`, obj); }; -export const updateIdentity = (obj: Identity): AxiosPromise => { - return APIClient.put(`${IDENTITIES}/${obj.id}`, obj); +export const updateIdentity = (obj: Identity) => { + return axios.put(`${IDENTITIES}/${obj.id}`, obj); }; -export const deleteIdentity = (identity: Identity): AxiosPromise => { - return APIClient.delete(`${IDENTITIES}/${identity.id}`); +export const deleteIdentity = (identity: Identity) => { + return axios.delete(`${IDENTITIES}/${identity.id}`); }; -// Axios direct - // success with code 201 and created entity as response data export const createApplication = (application: New) => axios diff --git a/client/src/app/axios-config/apiClient.tsx b/client/src/app/axios-config/apiClient.tsx deleted file mode 100644 index 711e033d31..0000000000 --- a/client/src/app/axios-config/apiClient.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import axios, { AxiosPromise } from "axios"; - -export class APIClient { - public static request( - path: string, - body: any = null, - method: - | "get" - | "post" - | "put" - | "delete" - | "options" - | "patch" - | undefined = "get", - config = {} - ): AxiosPromise { - return axios.request( - Object.assign( - {}, - { - url: path, - method, - data: body, - }, - config - ) - ); - } - - public static post(path: string, body: any, config = {}): AxiosPromise { - return this.request(path, body, "post", config); - } - - public static put(path: string, body: any, config = {}): AxiosPromise { - return this.request(path, body, "put", config); - } - - public static patch( - path: string, - body: any, - config = {} - ): AxiosPromise { - return this.request(path, body, "patch", config); - } - - public static get(path: string, config = {}): AxiosPromise { - return this.request(path, null, "get", config); - } - - public static delete(path: string, config = {}) { - return this.request(path, null, "delete", config); - } -} diff --git a/client/src/app/axios-config/index.ts b/client/src/app/axios-config/index.ts index e1312cec0f..98b6062d18 100644 --- a/client/src/app/axios-config/index.ts +++ b/client/src/app/axios-config/index.ts @@ -1,2 +1 @@ -export { APIClient } from "./apiClient"; export { initInterceptors } from "./apiInit"; diff --git a/client/src/app/pages/identities/components/identity-form/identity-form.tsx b/client/src/app/pages/identities/components/identity-form/identity-form.tsx index 33ad84a30c..bd70578e22 100644 --- a/client/src/app/pages/identities/components/identity-form/identity-form.tsx +++ b/client/src/app/pages/identities/components/identity-form/identity-form.tsx @@ -40,7 +40,7 @@ type UserCredentials = "userpass" | "source"; interface IdentityFormValues { name: string; description: string; - kind?: IdentityKind; + kind: IdentityKind; settings: string; settingsFilename: string; userCredentials?: UserCredentials;