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

Add wizard / UI to generate multiple tutorials & users at once #381

Merged
merged 113 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
548ad4d
Add pipe which automatically transform parameter objects.
Dudrie May 29, 2020
028cf60
Add validator for luxon Interval objects.
Dudrie May 29, 2020
8a49aa0
Add /tutorial/generate POST path to generate multiple tutorials.
Dudrie May 29, 2020
ee675ad
Add first part of tests for tutorial generation.
Dudrie May 30, 2020
e2066dd
Add assertion between generation data and generated tutorials.
Dudrie May 31, 2020
bef02dd
Fix generating tutorials without dates.
Dudrie Jun 1, 2020
99b8694
Add more tests related to tutorial generation.
Dudrie Jun 1, 2020
59c9835
Add assertion that generated tutorials have at least one date.
Dudrie Jun 1, 2020
139ee47
Add function to UserService to create multiple users with one request.
Dudrie Jun 1, 2020
7fc2b59
Add path /user/generate (POST) to generate multiple users.
Dudrie Jun 1, 2020
ef90ac3
Add tests for creating multiple users at once.
Dudrie Jun 1, 2020
aa28108
Fix wrong craco config in dev environment.
Dudrie Jun 2, 2020
093e2a8
Add new route to the import component.
Dudrie Jun 2, 2020
208db00
Add a StepperWithButtons component (WIP).
Dudrie Jun 2, 2020
6c72a88
Add more functionality to the StepperWithButtons.
Dudrie Jun 3, 2020
408a1cc
Remove unneccessary usage of "React.useState" with "useState".
Dudrie Jun 4, 2020
7dec09b
Change general layout structure of StepperWithButtons.
Dudrie Jun 4, 2020
c9d61d9
Add general layout of GenerateTutorials component.
Dudrie Jun 4, 2020
ec3d6ef
Add function to disable the next button [StepperWithButtons]
Dudrie Jun 4, 2020
2a1670e
Refactor GenerateTutorials & related components.
Dudrie Jun 4, 2020
5717905
Fix odd layout on GenerateTutorials.
Dudrie Jun 7, 2020
b66f231
Add logic to exclude dates & intervals.
Dudrie Jun 7, 2020
4fcb90d
Remove unused StudentTableRow component.
Dudrie Jun 7, 2020
a06b727
Add logic to edit an excluded date / interval.
Dudrie Jun 7, 2020
759a2b0
Clean up components for excluded date selection.
Dudrie Jun 7, 2020
e559b68
Add logic to support picking time ranges in SelectInterval.
Dudrie Jun 8, 2020
50ac3cb
Change FormikDebugDisplay to use the FormikContext.
Dudrie Jun 8, 2020
4a66226
Add keyboard support for TIME mode of SelectInterval.
Dudrie Jun 8, 2020
f71a8de
Add built-in support for "delete button" into useDialog.
Dudrie Jun 8, 2020
d38da48
Add logic to add / edit / delete time slots for tutorial generation.
Dudrie Jun 8, 2020
2abf0ce
Add general keyboard support for all (!) DatePickers.
Dudrie Jun 8, 2020
d9f984c
Change SelectInterval to only fire onChange on valid Intervals.
Dudrie Jun 9, 2020
312b0ad
Add basic structure to submit the Formik form.
Dudrie Jun 9, 2020
06bc259
Add error to FormikDatePicker if entered day is invalid.
Dudrie Jun 9, 2020
ca1465b
Add first steps towards validation the form of GenerateTutorials.
Dudrie Jun 9, 2020
d304722
Add more validation to the generate tutorial forms.
Dudrie Jun 17, 2020
eaad642
Change SelectInterval to better handle invalid input.
Dudrie Jun 18, 2020
0e8a678
Add error message and enter confirmation to AddSlotForm.
Dudrie Jun 18, 2020
605ea2e
Add missing pieces of validation.
Dudrie Jun 18, 2020
811f6ca
Add disabled prop to FormikDebugDisplay.
Dudrie Jun 18, 2020
4ecb3cf
Add count & error indicator to weekday tabs.
Dudrie Jun 18, 2020
b90b3b9
Change GenerateTutorial layout to improve UI.
Dudrie Jun 18, 2020
362b16d
Fix tutorial generation ignoring enddate if same weekday.
Dudrie Jun 19, 2020
257bbb5
Fix prefix number being resetted per data not per weekday.
Dudrie Jun 19, 2020
1cf5706
Change import-data view to be private and not the landing page.
Dudrie Jun 19, 2020
218bede
Add making the actual request to the server & response handling.
Dudrie Jun 19, 2020
b0b2b52
Change tutorial generation step to be skippable.
Dudrie Jun 19, 2020
d1426ed
Change validation to force that at least one data set is provided.
Dudrie Jun 19, 2020
efecb1a
Add ability to parse CSV to the server.
Dudrie Jun 19, 2020
2b7b2fe
Fix missing hook dependency.
Dudrie Jun 19, 2020
4bf96e9
Add support for 'required' asterix in Label of the CustomSelect.
Dudrie Jun 19, 2020
cc74611
Add first layout of the 2nd step of the user import.
Dudrie Jun 19, 2020
6337caf
Add first iteration of custom user data form state.
Dudrie Jun 20, 2020
bc089d8
Add idx parameter to createRowFromItem function.
Dudrie Jun 21, 2020
bc8e0f5
Add first steps towards the edit dialog in ImportUsers.
Dudrie Jun 21, 2020
b0f0ce5
Merge branch 'v2' into issue-346-Automatically_create_users_tutorials
Dudrie Jun 21, 2020
58af432
Add Formik to EditDialog of ImportUsers.
Dudrie Jun 21, 2020
78a1610
Fix missing helperText on FormikSelect.
Dudrie Jun 21, 2020
30a8f1e
Add ability to show loading spinner in CustomSelect.
Dudrie Jun 21, 2020
7ebdcaf
Add fetching of tutorials to ImportDataContext.
Dudrie Jun 21, 2020
4cb9530
Add functionality to edit form of ImportUsers.
Dudrie Jun 21, 2020
0474672
Move navigation-rail into components/ folder.
Dudrie Jun 21, 2020
7c25d78
Remove Drawer component.
Dudrie Jun 21, 2020
1437d75
Change GenerateTutorials to be part of TutorialManagement view.
Dudrie Jun 21, 2020
03db3fd
Fix AddSlotForm to use onKeyDown.
Dudrie Jun 21, 2020
0973497
Change "Generate"-Button in TutorialManagement.
Dudrie Jun 21, 2020
4e4fbab
Add button to UserManagement to open the import wizard.
Dudrie Jun 21, 2020
f90d371
Add moving back after successful tutorial generation.
Dudrie Jun 21, 2020
794eeb8
Add support for disabled items in CustomSelect.
Dudrie Jun 21, 2020
eddfd58
Add option to make the back button in the Stepper a Link button.
Dudrie Jun 21, 2020
47992a8
Add disabling of already used tutorials in EditUserForm.
Dudrie Jun 21, 2020
705a5fb
Move generate-tutorials into view/ folder.
Dudrie Jun 21, 2020
3381bc1
Change import user component names to better reflect their usage.
Dudrie Jun 21, 2020
b52a233
Add first iteration of ImportUserCSV component.
Dudrie Jun 21, 2020
0143e8d
Remove unused imports.
Dudrie Jun 21, 2020
9c013c2
Fix several things with SnackbarWithList.
Dudrie Jun 21, 2020
179fdc5
Fix error of step not cleared if succesful afterwards.
Dudrie Jun 21, 2020
5ea0458
Fix wrong response code of /excel/parseCSV.
Dudrie Jun 21, 2020
0a2f9b1
Add calling the API endpoint to parse the entered CSV.
Dudrie Jun 21, 2020
fd4bb0c
Remove completed ToDo.
Dudrie Jun 21, 2020
5f1980a
Add function to make the request to create many users.
Dudrie Jun 21, 2020
2bc1b25
Add TextFields to customize tutorial prefixes.
Dudrie Jun 22, 2020
a044b2f
Add validation of prefixes in GenerateTutorial view.
Dudrie Jun 22, 2020
c8af68b
Add intermediary component to map the columns of the imported CSV.
Dudrie Jun 22, 2020
b85c285
Add first steps towards "sending" the MapCSVColumns form.
Dudrie Jun 22, 2020
2305587
Change debug protocol to legacy
Dudrie Jun 23, 2020
393505b
Add validation to the MapCSVColumn form.
Dudrie Jun 23, 2020
d4dc166
Add export of function to generate username & password.
Dudrie Jun 23, 2020
8e11d6a
Add actual request to create the users from the ImportUsers UI.
Dudrie Jun 23, 2020
59405e1
Add showConfirmationDialog to useDialog.
Dudrie Jun 23, 2020
680d146
Add confirmation before resetting the generation datas of one user.
Dudrie Jun 23, 2020
12edbe0
Change FormikFilterableSelect to use useField.
Dudrie Jun 24, 2020
2c868f2
Change "id" in CSVDataRow to "rowNr".
Dudrie Jun 24, 2020
68b8617
Add selection and parsing for tutorials from CSV.
Dudrie Jun 24, 2020
8e1db2c
Refactor EditUserDialog to be it's own component.
Dudrie Jun 24, 2020
e966d75
Add time information to tutorial selection items.
Dudrie Jun 24, 2020
41b6f5a
Change MapCSVColumns UI to clean it up.
Dudrie Jun 24, 2020
51779d2
Add sort button to WeekdayBox to sort slot information by starttime.
Dudrie Jun 24, 2020
6de5c7a
Add upload button to ImportUserCSV.
Dudrie Jun 24, 2020
f5e1d22
Fix tutorials not deleting associated teams.
Dudrie Jun 24, 2020
413fba3
Add shortcut (ctrl+Enter) to ImportUserCSV to call nextStep.
Dudrie Jun 24, 2020
86740ea
Change SheetSelector to actually use the isLoadingSheet prop.
Dudrie Jun 24, 2020
cbba5c1
Add useCustomSnackbar hook.
Dudrie Jun 25, 2020
168e150
Change other components to use useCustomSnackbar hook.
Dudrie Jun 25, 2020
610560a
Change POST:/user/generate to return errors if neccessary.
Dudrie Jun 25, 2020
e900a12
FIx wrong types in UserController and tests.
Dudrie Jun 25, 2020
acbce54
Fix failing test due to obsolete implementation.
Dudrie Jun 25, 2020
73a1eb7
Change POST:/user/generate to throw BadRequestError again.
Dudrie Jun 25, 2020
c484fe9
Change client to also comply to the reverted /user/generate commit.
Dudrie Jun 25, 2020
6bdd6d5
Change helperText on seperator textfield on ImportCSV.
Dudrie Jun 26, 2020
1cdcae1
Remove unused variable.
Dudrie Jun 26, 2020
33142f1
Fix several things regarding invalid intervals.
Dudrie Jun 26, 2020
9f553c4
Merge branch 'v2' into issue-346-Automatically_create_users_tutorials
Dudrie Jun 26, 2020
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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"args": ["start"],
"port": 9229,
"restart": true,
"protocol": "inspector",
"protocol": "legacy",
"console": "integratedTerminal",
"sourceMaps": true
},
Expand Down
2 changes: 1 addition & 1 deletion client/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
(plugin) => !(plugin instanceof ModuleScopePlugin)
);

config.output.publicPath = isEnvProduction ? '#{ROUTE_PREFIX}' : '';
config.output.publicPath = isEnvProduction ? '/#{ROUTE_PREFIX}' : '/';
config.plugins = config.plugins.map((plugin) => {
if (!(plugin instanceof HtmlWebpackPlugin)) {
return plugin;
Expand Down
38 changes: 30 additions & 8 deletions client/src/components/CustomSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Checkbox,
Chip,
CircularProgress,
FormControl,
FormHelperText,
InputLabel,
Expand Down Expand Up @@ -30,20 +31,29 @@ const useStyles = makeStyles((theme: Theme) =>
})
);

type ItemToString<T> = (item: T) => string;
export interface ItemDisabledInformation {
isDisabled: boolean;
reason?: string;
}

export type ItemToString<T> = (item: T) => string;
export type ItemToBoolean<T> = (item: T) => boolean;
export type IsItemDisabledFunction<T> = (item: T) => ItemDisabledInformation;

export interface CustomSelectProps<T>
extends Omit<SelectProps, 'variant' | 'input' | 'children' | 'renderValue'> {
name?: string;
label: string;
emptyPlaceholder: string;
emptyPlaceholder?: string;
nameOfNoneItem?: string;
helperText?: React.ReactNode;
items: T[];
itemToString: ItemToString<T>;
itemToValue: ItemToString<T>;
isItemSelected?: (item: T) => boolean;
isItemDisabled?: IsItemDisabledFunction<T>;
isItemSelected?: ItemToBoolean<T>;
FormControlProps?: Omit<FormControlProps, 'variant' | 'className'>;
showLoadingIndicator?: boolean;
}

export type OnChangeHandler = CustomSelectProps<{}>['onChange'];
Expand Down Expand Up @@ -93,14 +103,16 @@ function CustomSelect<T>({
itemToString,
itemToValue,
nameOfNoneItem,
isItemDisabled,
isItemSelected,
multiple,
FormControlProps,
classes: classesFromProps,
showLoadingIndicator,
...other
}: CustomSelectProps<T>): JSX.Element {
if (multiple && !isItemSelected) {
console.error(
console.warn(
`[CustomSelect] -- You have set the Select '${name}' to allow multiple selections but you have not passed an isItemSelected function via props. Therefore Checkboxes won't be shown for the items.`
);
}
Expand Down Expand Up @@ -128,9 +140,16 @@ function CustomSelect<T>({

return (
<FormControl {...FormControlProps} className={className} variant='outlined' error={error}>
<InputLabel ref={inputLabel}>{label}</InputLabel>
<InputLabel required={other.required} ref={inputLabel}>
{label}
</InputLabel>
<Select
fullWidth
IconComponent={
showLoadingIndicator
? (props: any) => <CircularProgress {...props} size={24} />
: undefined
}
{...other}
name={name}
onChange={onChange}
Expand Down Expand Up @@ -163,13 +182,16 @@ function CustomSelect<T>({

const itemString: string = itemToString(item);
const itemValue: string = itemToValue(item);
const { isDisabled, reason }: ItemDisabledInformation = isItemDisabled?.(item) ?? {
isDisabled: false,
};

return (
<MenuItem key={itemValue} value={itemValue}>
<MenuItem key={itemValue} value={itemValue} disabled={isDisabled}>
{multiple ? (
<>
{isItemSelected && <Checkbox checked={isItemSelected(item)} />}
<ListItemText primary={itemString} />
<ListItemText primary={itemString} secondary={isDisabled ? reason : undefined} />
</>
) : (
itemString
Expand All @@ -180,7 +202,7 @@ function CustomSelect<T>({

{items.length === 0 && (
<MenuItem value='' disabled>
<ListItemText primary={emptyPlaceholder} />
<ListItemText primary={emptyPlaceholder ?? 'Keine Items verfügbar'} />
</MenuItem>
)}
</Select>
Expand Down
97 changes: 0 additions & 97 deletions client/src/components/StudentTableRow.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions client/src/components/TableWithPadding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useStyles = makeStyles((theme: Theme) =>

export interface TableWithPaddingProps<T> extends TableProps {
items: T[];
createRowFromItem: (item: T) => React.ReactNode;
createRowFromItem: (item: T, idx: number) => React.ReactNode;
placeholder?: string;
}

Expand All @@ -50,7 +50,7 @@ function TableWithPadding<T>({
<React.Fragment key={idx}>
{idx !== 0 && <TableRow className={classes.spacingRow} />}

{createRowFromItem(item)}
{createRowFromItem(item, idx)}
</React.Fragment>
))}
</TableBody>
Expand Down
35 changes: 35 additions & 0 deletions client/src/components/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { KeyboardDatePicker, KeyboardDatePickerProps } from '@material-ui/pickers';
import { DateTimeFormatOptions, DateTime } from 'luxon';

const DATE_FORMAT: DateTimeFormatOptions = {
weekday: 'short',
day: '2-digit',
month: '2-digit',
year: 'numeric',
};

export type CustomDatePickerProps = KeyboardDatePickerProps;

function CustomDatePicker(props: CustomDatePickerProps): JSX.Element {
const labelFunc = (date: DateTime | null, invalidLabel: string) => {
if (!date || !date.isValid) {
return invalidLabel;
}

return date.toLocaleString(DATE_FORMAT);
};

return (
<KeyboardDatePicker
variant='inline'
format='dd.MM.yyyy'
labelFunc={labelFunc}
fullWidth
inputVariant='outlined'
{...props}
/>
);
}

export default CustomDatePicker;
Loading