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

Plugin test investigation #115

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1754d1f
Front: Add translation to plugins view
MathieuAndrade Aug 23, 2023
cba8aa1
Front: Add Modal component
MathieuAndrade Aug 25, 2023
2c7a94d
Back: Manage plugin uninstallation
MathieuAndrade Aug 25, 2023
cc0e1c2
Front: Add possibility to uninstall a plugin
MathieuAndrade Aug 25, 2023
abc477c
Add "parallel" flag on start command
MathieuAndrade Sep 9, 2023
751930d
Shared: V1.0.7
MathieuAndrade Sep 9, 2023
d7a7260
Docker: Adding new feature "GetContainerState"
MathieuAndrade Sep 9, 2023
f30a0db
Server: Fix old state update
MathieuAndrade Sep 9, 2023
0fbd705
Server: Ensure only last state of plugin was retrieved
MathieuAndrade Sep 9, 2023
9811b64
Server: Plugin api improvement
MathieuAndrade Sep 9, 2023
987e87a
Front: Fix typos
MathieuAndrade Sep 9, 2023
b5b5771
Front: Use correct type for websocket payload
MathieuAndrade Sep 9, 2023
48c71a2
Front: Plugin view work
MathieuAndrade Sep 9, 2023
050c352
Docker: Adding test to new feature "GetContainerSate"
MathieuAndrade Sep 9, 2023
6c115db
Back: Add new tests for plugins
MathieuAndrade Sep 19, 2023
1986d66
Project: Add possibility to restart/stop all plugins of given satellite
MathieuAndrade Sep 23, 2023
899a381
Front: Add a gradient to background (for design purpose ;) )
MathieuAndrade Sep 23, 2023
7e2d021
Back: Add new test for satellites
MathieuAndrade Oct 14, 2023
535c9a9
Investigation 1
MathieuAndrade Oct 14, 2023
8099be3
Investigation 2
MathieuAndrade Oct 14, 2023
cc6b1d2
Enable all plugins test
MathieuAndrade Oct 14, 2023
1af0f43
Check if solution works
MathieuAndrade Oct 14, 2023
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
1 change: 1 addition & 0 deletions apps/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"prettier": "../../packages/tools/prettier.config.js",
"dependencies": {
"@ebay/nice-modal-react": "^1.2.10",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@friday-ai/shared": "workspace:*",
Expand Down
33 changes: 33 additions & 0 deletions apps/front/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,39 @@
"settings": "Settings",
"title": "User Menu"
}
},
"satellites": {
"areYouSure": "Are you sure ?",
"configPlugin": "Config plugin",
"deletePluginMessage": "This action <b>cannot</b> be undone. This will permanently delete the plugin :",
"installedPlugins": "Plugins installed",
"installPlugin": "Install plugin",
"ipAddress": "IP address",
"lastHeartbeat": "Last eartbeat",
"location": "Location",
"name": "Name",
"noDataFound": "No Data found",
"pluginsStates": "Plugins states",
"resetFilters": "Try installing a plugin or change yours filters",
"restartAllPlugins": "Restart all plugins",
"restartPlugin": "Restart plugin",
"restartSatellite": "Restart satellite",
"satellite": "Satellite",
"state": "State",
"stateConnected": "Connected",
"stateDisconnected": "Disconnected",
"stateErrored": "Error",
"stateInstalled": "Installed",
"stateRunning": "Running",
"stateStandby": "Stanby",
"stateStopped": "Stopped",
"stateWaitingConfig": "Waiting config",
"stateWaitingInstallation": "Waiting install",
"stopAllPlugins": "Stop all plugins",
"stopPlugin": "Stop plugin",
"stopSatellite": "Stop satellite",
"uninstallPlugin": "Uninstall plugin",
"uptime": "Uptime"
}
},
"errors": {
Expand Down
33 changes: 33 additions & 0 deletions apps/front/src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,39 @@
"settings": "Paramètres",
"title": "Menu utilisateur"
}
},
"satellites": {
"areYouSure": "Êtes-vous sûr ?",
"configPlugin": "Configurer le plugin",
"deletePluginMessage": "Cette action <b>ne peut pas</b> être annulée. Cela supprimera définitivement le plugin :",
"installedPlugins": "Plugins installés",
"installPlugin": "Installer un plugin",
"ipAddress": "Adresse IP",
"lastHeartbeat": "Dernier signal",
"location": "Emplacement",
"name": "Nom",
"noDataFound": "Aucune donnée disponible",
"pluginsStates": "Status des plugins",
"resetFilters": "Essayez d'installer un plugin ou modifiez vos filtres",
"restartAllPlugins": "Redémarrer tous les plugins",
"restartPlugin": "Redémarrer le plugin",
"restartSatellite": "Redémarrer le satellite",
"satellite": "Satellite",
"state": "Etat",
"stateConnected": "Connecté",
"stateDisconnected": "Déconnecté",
"stateErrored": "Erreur",
"stateInstalled": "Installé",
"stateRunning": "Démarré",
"stateStandby": "Stanby",
"stateStopped": "Arreté",
"stateWaitingConfig": "En attente de config",
"stateWaitingInstallation": "En attente d'install",
"stopAllPlugins": "Arrêter tous les plugins",
"stopPlugin": "Arrêter le plugin",
"stopSatellite": "Arrêter le satellite",
"uninstallPlugin": "Désinstaller le plugin",
"uptime": "Démarré"
}
},
"errors": {
Expand Down
6 changes: 4 additions & 2 deletions apps/front/src/components/App/DashboardLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Container from '@mui/material/Container';
import Paper from '@mui/material/Paper';
import React from 'react';
import { Outlet } from 'react-router-dom';

Expand All @@ -7,12 +8,13 @@ import AnimationLayout from './AnimationLayout';

export default function DashboardLayout() {
return (
<Container sx={{ padding: 2, paddingTop: 0 }}>
<Container sx={{ paddingTop: 0 }}>
<AppBar />
<Container sx={{ paddingTop: 2 }}>
<Container sx={{ padding: 2, paddingTop: 2 }}>
<AnimationLayout>
<Outlet />
</AnimationLayout>
<Paper className="primary-gradient"></Paper>
</Container>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/components/AppBar/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function App() {

return (
<AppBar position="static">
<Toolbar>
<Toolbar sx={{ marginX: 2 }}>
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' }, mr: 3 }}>
<Menu id="pages-menu" title="Pages menu" ariaLabel="pages menu" ariaControls="pages-menu-appbar" buttonType="icon" icon={<MenuIcon />}>
<MenuItem onClick={() => handleNavigation(null, 'devices')}>
Expand Down
6 changes: 4 additions & 2 deletions apps/front/src/components/Charts/Pie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { useTheme } from '@mui/material/styles';

import { useTranslation } from 'react-i18next';
import { colorToRGBA } from '../../utils/color';

const margin = 20;
Expand Down Expand Up @@ -43,6 +44,7 @@ type PieProps = {

export default withTooltip<PieProps, PieData>((props) => {
const { data, totalCount, totalLabel, tooltipOpen, tooltipData, tooltipLeft, tooltipTop, showTooltip, hideTooltip } = props;
const { t } = useTranslation();

const ordinalColorScale = scaleOrdinal({
domain: data.map((d) => d.label),
Expand Down Expand Up @@ -148,7 +150,7 @@ export default withTooltip<PieProps, PieData>((props) => {
<rect fill={colorToRGBA(label.value || '', colorOpacity)} width={legendGlyphSize} height={legendGlyphSize} />
</svg>
<LegendLabel align="left" margin="0 0 0 4px">
{label.text}
{t(label.text)}
</LegendLabel>
</LegendItem>
))}
Expand All @@ -171,7 +173,7 @@ export default withTooltip<PieProps, PieData>((props) => {
<svg width={legendGlyphSize} height={legendGlyphSize}>
<rect fill={colorToRGBA(tooltipData.color || '', colorOpacity)} width={legendGlyphSize} height={legendGlyphSize} />
</svg>
<span>{tooltipData.label}</span> :<strong>{tooltipData.value}</strong>
<span>{t(tooltipData.label)}</span> :<strong>{tooltipData.value}</strong>
</Stack>
</VisxTooltip>
)}
Expand Down
47 changes: 47 additions & 0 deletions apps/front/src/components/Modal/Confirm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';

import Button from '@mui/material/Button';
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';

import NiceModal, { useModal } from '@ebay/nice-modal-react';
import { Typography } from '@mui/material';

export interface ConfirmationDialogProps {
title: string;
content: string;
onClose: (confirm: boolean) => Promise<void>;
}

export default NiceModal.create(({ title, content, onClose }: ConfirmationDialogProps) => {
const modal = useModal();

const handleClose = (confirm: boolean) => {
onClose(confirm);
modal.hide();

// Wait close animation before removing component
setTimeout(() => {
modal.remove();
}, 1000);
};

return (
<Dialog open={modal.visible} onClose={() => handleClose(false)} fullWidth maxWidth={'xs'}>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<Typography dangerouslySetInnerHTML={{ __html: content }}></Typography>
</DialogContent>
<DialogActions>
<Button autoFocus onClick={() => handleClose(false)} variant={'contained'}>
Cancel
</Button>
<Button onClick={() => handleClose(true)} variant={'outlined'}>
Ok
</Button>
</DialogActions>
</Dialog>
);
});
12 changes: 12 additions & 0 deletions apps/front/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ body > #root > div {
height: 100%;
}

.primary-gradient {
background: linear-gradient(350deg, rgb(6 70 245 / 30%) 0%, rgb(18 28 66 / 0%) 100%);
filter: blur(200px);
width: 30%;
height: 30%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: -1;
}

::-webkit-scrollbar {
width: 6px;
height: 6px;
Expand Down
13 changes: 8 additions & 5 deletions apps/front/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import NiceModal from '@ebay/nice-modal-react';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { domAnimation, LazyMotion } from 'framer-motion';
Expand All @@ -9,8 +10,8 @@ import { registerSW } from 'virtual:pwa-register';

import './index.css';
import Root from './routes/Root';
import theme from './utils/theme';
import './utils/i18n';
import theme from './utils/theme';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -31,10 +32,12 @@ if (rootContainer !== null) {
<LazyMotion features={domAnimation}>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<CssBaseline />
<BrowserRouter>
<Root />
</BrowserRouter>
<NiceModal.Provider>
<CssBaseline />
<BrowserRouter>
<Root />
</BrowserRouter>
</NiceModal.Provider>
</ThemeProvider>
</QueryClientProvider>
</LazyMotion>
Expand Down
Loading