forked from Coreoz/create-plume-react-project
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Evol/log api #6
Open
lucas-amiaud
wants to merge
30
commits into
evol/drawer
Choose a base branch
from
evol/log-api
base: evol/drawer
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Evol/log api #6
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
1364929
start implem log api
lucas-amiaud 4c8c494
start implem log api
lucas-amiaud f7507c6
add route for log API
lucas-amiaud 2623ae9
implem log API filters
lucas-amiaud d0bd4b1
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 8d96127
add log api sorting
lucas-amiaud b22f0aa
add log api js filter
lucas-amiaud 4259ac3
merge evols
lucas-amiaud 467076b
add message and titles
lucas-amiaud 652cd0f
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 4b02b09
merge new libraries
lucas-amiaud 454faad
wip add radio buttons
lucas-amiaud bb4153d
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 347167b
clean single choice filter menu
lucas-amiaud 5c6eed1
clean log API
lucas-amiaud 86bd602
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud dc83335
clean log API
lucas-amiaud 24d5896
add date pickers
lucas-amiaud b1a27df
fix style pickers
lucas-amiaud fb9e326
esling fixes
lucas-amiaud 3170d3e
merge drawer
lucas-amiaud c874a49
merge drawer branch
lucas-amiaud 568b433
add readonly props on inputs
lucas-amiaud e85c71a
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 5abaf91
merge evol/drawer
lucas-amiaud c2be5ea
eslint fix
lucas-amiaud 582811b
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 1f5a056
eslint fix
lucas-amiaud 1919d58
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud 4e81d25
Merge branch 'evol/drawer' into evol/log-api
lucas-amiaud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@forward 'login'; | ||
@forward 'log-api'; |
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,48 @@ | ||
@use 'assets/scss/variables' as *; | ||
|
||
$log-api-ok: #49cc90; | ||
$log-api-warning: #fca130; | ||
$log-api-error: #f93e3e; | ||
|
||
.log-api-tile { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
cursor: pointer; | ||
|
||
* { | ||
flex-shrink: 0; | ||
} | ||
|
||
.log-api-data { | ||
height: 100%; | ||
width: 100%; | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
align-items: flex-start; | ||
font-size: $font-size-normal; | ||
|
||
.data { | ||
display: flex; | ||
width: 15%; | ||
height: 40px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ça doit dépendre de la taille de la police je pense |
||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: center; | ||
padding: 0 $spacer-2; | ||
margin-left: $spacer-3; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
|
||
&--large { | ||
width: 40%; | ||
} | ||
&--small { | ||
width: 30px; | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"@emotion/styled": "^11.10.4", | ||
"@fontsource/roboto": "^4.5.8", | ||
"@mui/icons-material": "^5.10.9", | ||
"@mui/lab": "5.0.0-alpha.49", | ||
"@mui/material": "^5.10.9", | ||
"@mui/styles": "^5.10.9", | ||
"@mui/system": "^5.10.9", | ||
|
@@ -86,7 +87,8 @@ | |
"eslint": "eslint src --ext .ts,.tsx", | ||
"typescript": "tsc --noEmit", | ||
"test": "jest --config jest.config.js", | ||
"coverage": "jest --config jest.config.js --coverage --watchAll=false" | ||
"coverage": "jest --config jest.config.js --coverage --watchAll=false", | ||
"lint": "yarn typescript && yarn eslint" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const HOME: string = '/home'; | ||
export const USERS: string = '/users'; | ||
export const LOG_API: string = '/log-api'; | ||
|
||
export const LOGIN: string = '/login'; |
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 |
---|---|---|
@@ -1,29 +1,36 @@ | ||
import React from 'react'; | ||
import { | ||
Routes, | ||
Route, | ||
Navigate, | ||
} from 'react-router-dom'; | ||
import { getGlobalInstance } from 'plume-ts-di'; | ||
import Home from '../features/Home'; | ||
import React from 'react'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
import LogApi from '../../lib/plume-admin-log-api/pages/LogApi'; | ||
import Users from '../../lib/plume-admin-users/pages/Users'; | ||
import PermissionRoute from '../theme/routes/PermissionRoute'; | ||
import Permission from '../../services/session/Permission'; | ||
import { HOME, USERS } from '../Routes'; | ||
import Home from '../features/Home'; | ||
import { HOME, LOG_API, USERS } from '../Routes'; | ||
import PermissionRoute from '../theme/routes/PermissionRoute'; | ||
|
||
export default function Router() { | ||
const users: Users = getGlobalInstance(Users); | ||
const logApi: LogApi = getGlobalInstance(LogApi); | ||
|
||
return ( | ||
<Routes> | ||
<Route | ||
path={`${USERS}/*`} | ||
element={ | ||
<PermissionRoute permission={Permission.MANAGE_USERS}><users.render /></PermissionRoute> | ||
<PermissionRoute permission={Permission.MANAGE_USERS}> | ||
<users.render /> | ||
</PermissionRoute> | ||
} | ||
/> | ||
<Route | ||
path={`${LOG_API}/*`} | ||
element={ | ||
<PermissionRoute permission={Permission.MANAGE_API_LOGS}> | ||
<logApi.render /> | ||
</PermissionRoute> | ||
} | ||
/> | ||
<Route path={HOME} element={<Home />} /> | ||
<Route path="*" element={<Navigate to={{ pathname: HOME }} />} /> | ||
</Routes> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ import { getGlobalInstance } from 'plume-ts-di'; | |
import useToggle from '../../lib/react-hook-toggle/ReactHookToggle'; | ||
import Permission from '../../services/session/Permission'; | ||
import SessionService from '../../services/session/SessionService'; | ||
import { HOME, USERS } from '../Routes'; | ||
import { HOME, LOG_API, USERS } from '../Routes'; | ||
import LinkListItem from './LinkListItem'; | ||
import NestedListItem from './NestedListItem'; | ||
import plumeLogo from '../../../assets/icons/plume_logo.png'; | ||
|
@@ -55,6 +55,19 @@ export default function Navigation() { | |
</NestedListItem> | ||
) | ||
} | ||
{ | ||
sessionService.hasPermission(Permission.MANAGE_SYSTEM) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. La permission c'est pas plutôt MANAGE_API_LOGS ? Ou les deux ? |
||
&& ( | ||
<NestedListItem icon="settings" label={messages.nav.settings} drawerOpen={isDrawerOpened}> | ||
<LinkListItem | ||
icon="http" | ||
route={LOG_API} | ||
label={messages.nav.log_api} | ||
drawerOpen={isDrawerOpened} | ||
/> | ||
</NestedListItem> | ||
) | ||
} | ||
</List> | ||
</nav> | ||
); | ||
|
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
82 changes: 82 additions & 0 deletions
82
templates/admin/src/components/theme/form/fields/InputDatePicker.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,82 @@ | ||
import { DatePicker, LocalizationProvider } from '@mui/lab'; | ||
import DateAdapter from '@mui/lab/AdapterDayjs'; | ||
import { MuiTextFieldProps } from '@mui/lab/internal/pickers/PureDateInput'; | ||
import { TextField } from '@mui/material'; | ||
import { Dayjs } from 'dayjs'; | ||
import React from 'react'; | ||
import { useController } from 'react-hook-form'; | ||
import useMessages from '../../../../i18n/hooks/messagesHook'; | ||
import { | ||
InputDateProps, | ||
} from '../../../../lib/plume-admin-theme/form/FormInputProps'; | ||
|
||
function InputDatePicker( | ||
{ | ||
placeholder, | ||
label, | ||
name, | ||
id, | ||
useNameAsId, | ||
control, | ||
rules, | ||
disabled, | ||
defaultValue, | ||
onDateChange, | ||
autoComplete, | ||
showTodayButton, | ||
disableFuture, | ||
disableOpenPicker, | ||
locale, | ||
}: InputDateProps) { | ||
const fieldId: string = (useNameAsId ? name : (id ?? name)) || ''; | ||
const { messages } = useMessages(); | ||
|
||
const { field } = useController({ | ||
name: fieldId, | ||
control, | ||
rules, | ||
defaultValue: defaultValue || null, | ||
}); | ||
|
||
const onChangeCombined = (value: Dayjs | null) => { | ||
field.onChange(value); | ||
if (value && onDateChange) { | ||
onDateChange(value); | ||
} | ||
}; | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={DateAdapter} locale={locale}> | ||
<DatePicker | ||
onChange={onChangeCombined} | ||
value={field.value} | ||
disableOpenPicker={disableOpenPicker} | ||
showTodayButton={showTodayButton ?? false} | ||
disableFuture={disableFuture ?? false} | ||
inputFormat={messages.format.date} | ||
mask={messages.format.date_mask} | ||
renderInput={(params: MuiTextFieldProps) => ( | ||
<TextField | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...params} | ||
ref={params.inputRef} | ||
inputRef={field.ref} | ||
id={fieldId} | ||
name={name} | ||
label={label} | ||
inputProps={{ | ||
...params.inputProps, | ||
placeholder: placeholder || messages.format.date, | ||
}} | ||
autoComplete={autoComplete} | ||
disabled={disabled ?? false} | ||
onBlur={field.onBlur} | ||
required | ||
/> | ||
)} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} | ||
|
||
export default (InputDatePicker); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On pourrait reprendre les couleurs qu'on a déjà non ? Et limite eclaircir ou foncer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il faudrait aussi déclarer les variable dans le scope de log api, sinon elles sont globales