-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
6245f70 OS-7838. Fixes for manual data source report reimport 4120b0b OS-7838. Add support for manual data source billing reimport d918331 OS-7945. Updated SQLAlchemy version a443b52 OS-7938: Added recommendation filtering by cloud services
- Loading branch information
Showing
58 changed files
with
501 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
ngui/ui/src/components/SideModalManager/SideModals/DataSourceBillingReimportModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import DataSourceBillingReimportContainer from "containers/DataSourceBillingReimportContainer/DataSourceBillingReimportContainer"; | ||
import BaseSideModal from "./BaseSideModal"; | ||
|
||
class DataSourceBillingReimportModal extends BaseSideModal { | ||
headerProps = { | ||
messageId: "billingReimportTitle", | ||
color: "primary", | ||
dataTestIds: { | ||
title: "lbl_reimport_data_source_expenses", | ||
closeButton: "btn_close" | ||
} | ||
}; | ||
|
||
dataTestId = "smodal_reimport_data_source_expenses"; | ||
|
||
get content() { | ||
return <DataSourceBillingReimportContainer dataSourceId={this.payload?.id} onSuccess={this.closeSideModal} />; | ||
} | ||
} | ||
|
||
export default DataSourceBillingReimportModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...src/components/forms/DataSourceBillingReimportForm/DataSourceBillingReimportForm.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createRoot } from "react-dom/client"; | ||
import TestProvider from "tests/TestProvider"; | ||
import DataSourceBillingReimportForm from "./DataSourceBillingReimportForm"; | ||
|
||
it("renders without crashing", () => { | ||
const div = document.createElement("div"); | ||
const root = createRoot(div); | ||
root.render( | ||
<TestProvider> | ||
<DataSourceBillingReimportForm onSubmit={vi.fn} /> | ||
</TestProvider> | ||
); | ||
root.unmount(); | ||
}); |
29 changes: 29 additions & 0 deletions
29
ngui/ui/src/components/forms/DataSourceBillingReimportForm/DataSourceBillingReimportForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Stack } from "@mui/material"; | ||
import { FormProvider, useForm } from "react-hook-form"; | ||
import InlineSeverityAlert from "components/InlineSeverityAlert"; | ||
import { SPACING_1 } from "utils/layouts"; | ||
import { FormButtons, ReimportFromDatePicker } from "./FormElements"; | ||
import { DataSourceBillingReimportFormProps, FormValues } from "./types"; | ||
import { getDefaultValues } from "./utils"; | ||
|
||
const DataSourceBillingReimportForm = ({ onSubmit, isSubmitLoading = false }: DataSourceBillingReimportFormProps) => { | ||
const methods = useForm<FormValues>({ | ||
defaultValues: getDefaultValues() | ||
}); | ||
|
||
const { handleSubmit } = methods; | ||
|
||
return ( | ||
<FormProvider {...methods}> | ||
<form onSubmit={handleSubmit(onSubmit)} noValidate> | ||
<Stack spacing={SPACING_1}> | ||
<ReimportFromDatePicker /> | ||
<InlineSeverityAlert messageId="billingReimportWarning" severity="warning" /> | ||
</Stack> | ||
<FormButtons isLoading={isSubmitLoading} /> | ||
</form> | ||
</FormProvider> | ||
); | ||
}; | ||
|
||
export default DataSourceBillingReimportForm; |
15 changes: 15 additions & 0 deletions
15
ngui/ui/src/components/forms/DataSourceBillingReimportForm/FormElements/FormButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import FormButtonsWrapper from "components/FormButtonsWrapper"; | ||
import SubmitButtonLoader from "components/SubmitButtonLoader"; | ||
|
||
const FormButtons = ({ isLoading = false }) => ( | ||
<FormButtonsWrapper> | ||
<SubmitButtonLoader | ||
messageId="scheduleImport" | ||
isLoading={isLoading} | ||
dataTestId="btn_confirm" | ||
loaderDataTestId="btn_confirm_loader" | ||
/> | ||
</FormButtonsWrapper> | ||
); | ||
|
||
export default FormButtons; |
56 changes: 56 additions & 0 deletions
56
...rc/components/forms/DataSourceBillingReimportForm/FormElements/ReimportFromDatePicker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Controller, useFormContext } from "react-hook-form"; | ||
import { useIntl } from "react-intl"; | ||
import IntervalTimePicker from "components/IntervalTimePicker"; | ||
import { EN_FORMAT, startOfMonth, subDays, subYears } from "utils/datetime"; | ||
import { FIELD_NAMES } from "../constants"; | ||
|
||
const FIELD_NAME = FIELD_NAMES.IMPORT_FROM; | ||
|
||
const ReimportFromDatePicker = () => { | ||
const intl = useIntl(); | ||
|
||
const { | ||
control, | ||
formState: { errors } | ||
} = useFormContext(); | ||
|
||
return ( | ||
<Controller | ||
name={FIELD_NAME} | ||
control={control} | ||
rules={{ | ||
required: { | ||
value: true, | ||
message: intl.formatMessage({ id: "thisFieldIsRequired" }) | ||
} | ||
}} | ||
render={({ field: { value, onChange } }) => ( | ||
<IntervalTimePicker | ||
labelMessageId="importFrom" | ||
value={value} | ||
required | ||
notSetMessageId="notSet" | ||
onApply={onChange} | ||
fullWidth | ||
format={EN_FORMAT} | ||
margin="dense" | ||
minDate={+subYears(new Date(), 1)} | ||
maxDate={+subDays(startOfMonth(new Date()), 1)} | ||
validation={{ | ||
dataTestId: `input_${FIELD_NAME}`, | ||
error: !!errors[FIELD_NAME], | ||
helperText: errors[FIELD_NAME]?.message | ||
}} | ||
dataTestIds={{ | ||
field: { | ||
input: `input_${FIELD_NAME}`, | ||
iconButton: "btn_select_date" | ||
} | ||
}} | ||
/> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default ReimportFromDatePicker; |
4 changes: 4 additions & 0 deletions
4
ngui/ui/src/components/forms/DataSourceBillingReimportForm/FormElements/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import FormButtons from "./FormButtons"; | ||
import ReimportFromDatePicker from "./ReimportFromDatePicker"; | ||
|
||
export { ReimportFromDatePicker, FormButtons }; |
3 changes: 3 additions & 0 deletions
3
ngui/ui/src/components/forms/DataSourceBillingReimportForm/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const FIELD_NAMES = Object.freeze({ | ||
IMPORT_FROM: "importFrom" | ||
}); |
3 changes: 3 additions & 0 deletions
3
ngui/ui/src/components/forms/DataSourceBillingReimportForm/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import DataSourceBillingReimportForm from "./DataSourceBillingReimportForm"; | ||
|
||
export default DataSourceBillingReimportForm; |
10 changes: 10 additions & 0 deletions
10
ngui/ui/src/components/forms/DataSourceBillingReimportForm/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FIELD_NAMES } from "./constants"; | ||
|
||
export type FormValues = { | ||
[FIELD_NAMES.IMPORT_FROM]: number; | ||
}; | ||
|
||
export type DataSourceBillingReimportFormProps = { | ||
onSubmit: (data: FormValues) => void; | ||
isSubmitLoading?: boolean; | ||
}; |
Oops, something went wrong.