-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support package module and view.
- Loading branch information
1 parent
b2aa068
commit 320a7dc
Showing
31 changed files
with
670 additions
and
38 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
...latform/opencti-dev/Backend start.run.xml → ...ackend start dev (first platform).run.xml
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,10 +1,15 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Backend start" type="js.build_tools.npm"> | ||
<configuration default="false" name="1 - Backend start dev (first platform)" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/opencti-platform/opencti-graphql/package.json" /> | ||
<command value="start" /> | ||
<command value="run" /> | ||
<scripts> | ||
<script value="start" /> | ||
</scripts> | ||
<node-interpreter value="project" /> | ||
<package-manager value="yarn" /> | ||
<envs /> | ||
<envs> | ||
<env name="APP__PORT" value="4000" /> | ||
</envs> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
2 changes: 1 addition & 1 deletion
2
...atform/opencti-dev/Frontend start.run.xml → ...ontend start dev (first platform).run.xml
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
26 changes: 26 additions & 0 deletions
26
opencti-platform/opencti-dev/1 - worker for dev (first dev platform).run.xml
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,26 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="1 - worker for dev (first dev platform)" type="PythonConfigurationType" factoryName="Python"> | ||
<module name="opencti" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<envs> | ||
<env name="PYTHONUNBUFFERED" value="1" /> | ||
<env name="OPENCTI_URL" value="http://localhost:3000" /> | ||
</envs> | ||
<option name="SDK_HOME" value="" /> | ||
<option name="SDK_NAME" value="Python 3.10 (opencti)" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/opencti-worker/src" /> | ||
<option name="IS_MODULE_SDK" value="false" /> | ||
<option name="ADD_CONTENT_ROOTS" value="true" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | ||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/opencti-worker/src/worker.py" /> | ||
<option name="PARAMETERS" value="" /> | ||
<option name="SHOW_COMMAND_LINE" value="false" /> | ||
<option name="EMULATE_TERMINAL" value="false" /> | ||
<option name="MODULE_MODE" value="false" /> | ||
<option name="REDIRECT_INPUT" value="false" /> | ||
<option name="INPUT_FILE" value="" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
16 changes: 16 additions & 0 deletions
16
opencti-platform/opencti-dev/2 - Backend start cluster (second platform).run.xml
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,16 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="2 - Backend start cluster (second platform)" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/opencti-platform/opencti-graphql/package.json" /> | ||
<command value="run" /> | ||
<scripts> | ||
<script value="start:cluster" /> | ||
</scripts> | ||
<node-interpreter value="project" /> | ||
<package-manager value="yarn" /> | ||
<envs> | ||
<env name="NODE_ENV" value="dev" /> | ||
<env name="APP__PORT" value="4001" /> | ||
</envs> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
13 changes: 13 additions & 0 deletions
13
opencti-platform/opencti-dev/2 - Frontend start cluster (second platform).run.xml
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,13 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="2 - Frontend start cluster (second platform)" type="js.build_tools.npm"> | ||
<package-json value="$PROJECT_DIR$/opencti-platform/opencti-front/package.json" /> | ||
<command value="start" /> | ||
<node-interpreter value="project" /> | ||
<package-manager value="yarn" /> | ||
<envs> | ||
<env name="BACK_END_URL" value="http://localhost:4001" /> | ||
<env name="FRONT_END_URL" value="3001" /> | ||
</envs> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
26 changes: 26 additions & 0 deletions
26
opencti-platform/opencti-dev/2 - worker for cluster (second dev platform).run.xml
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,26 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="2 - worker for cluster (second dev platform)" type="PythonConfigurationType" factoryName="Python"> | ||
<module name="opencti" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<envs> | ||
<env name="PYTHONUNBUFFERED" value="1" /> | ||
<env name="OPENCTI_URL" value="http://localhost:3001" /> | ||
</envs> | ||
<option name="SDK_HOME" value="" /> | ||
<option name="SDK_NAME" value="Python 3.10 (opencti)" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/opencti-worker/src" /> | ||
<option name="IS_MODULE_SDK" value="false" /> | ||
<option name="ADD_CONTENT_ROOTS" value="true" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> | ||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/opencti-worker/src/worker.py" /> | ||
<option name="PARAMETERS" value="" /> | ||
<option name="SHOW_COMMAND_LINE" value="false" /> | ||
<option name="EMULATE_TERMINAL" value="false" /> | ||
<option name="MODULE_MODE" value="false" /> | ||
<option name="REDIRECT_INPUT" value="false" /> | ||
<option name="INPUT_FILE" value="" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
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,13 @@ | ||
# Development tools in this folder | ||
|
||
- **Backend start dev**: | ||
- start one instance of the backend platform on http://localhost:4000 | ||
- requires a development.json file in `opencti-graphql/config` folder or environment variables (except for port) | ||
- **Backend start cluster**: start a second instance of opencti, using port 4001 on http://localhost:4001 | ||
- requires a cluster.json file in `opencti-graphql/config` folder or environment variables (except for port) | ||
- **Frontend start dev**: | ||
- start one instance of the frontend with port `3000` using backend on http://localhost:4000 | ||
- **Frontend start cluster**: | ||
- start a second instance of the frontend with port `3001` using backend on http://localhost:4001 | ||
|
||
For day to day development you can only start the "dev" pair (`Backend start dev` and `Frontend start dev`), if you want to have a cluster locally, add the "cluster" pair. |
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
16 changes: 16 additions & 0 deletions
16
opencti-platform/opencti-front/src/private/components/settings/support/Root.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,16 @@ | ||
// TODO Remove this when V6 | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck | ||
import React from 'react'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import SupportPackages from '@components/settings/support/SupportPackages'; | ||
|
||
const RootSupportPackage = () => { | ||
return ( | ||
<Switch> | ||
<Route path="" component={SupportPackages} /> | ||
</Switch> | ||
); | ||
}; | ||
|
||
export default RootSupportPackage; |
64 changes: 64 additions & 0 deletions
64
opencti-platform/opencti-front/src/private/components/settings/support/SupportPackages.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,64 @@ | ||
import React from 'react'; | ||
import CustomizationMenu from '@components/settings/CustomizationMenu'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import Button from '@mui/material/Button'; | ||
import { graphql, useMutation } from 'react-relay'; | ||
import { useFormatter } from '../../../../components/i18n'; | ||
import Breadcrumbs from '../../../../components/Breadcrumbs'; | ||
import type { Theme } from '../../../../components/Theme'; | ||
import { handleError, MESSAGING$ } from '../../../../relay/environment'; | ||
|
||
const useStyles = makeStyles<Theme>(() => ({})); | ||
|
||
export const supportPackageAddMutation = graphql` | ||
mutation SupportPackagesMutation( | ||
$input: SupportPackageAddInput! | ||
) { | ||
supportPackageAdd(input: $input) { | ||
id | ||
} | ||
} | ||
`; | ||
|
||
const SupportPackages = () => { | ||
const { t_i18n, nsdt } = useFormatter(); | ||
const classes = useStyles(); | ||
|
||
const generateSupportPackage = () => { | ||
alert('Go !'); | ||
const [commitSupportPackageAdd] = useMutation(supportPackageAddMutation); | ||
const supportPackageName = `support-package-${nsdt(new Date())}`; | ||
commitSupportPackageAdd({ | ||
variables: { | ||
input: { | ||
name: supportPackageName, | ||
}, | ||
}, | ||
onCompleted: () => { | ||
MESSAGING$.notifySuccess( | ||
`Support package request send for ${supportPackageName}.`, | ||
); | ||
}, | ||
onError: (error) => { | ||
handleError(error); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className={classes.container}> | ||
<CustomizationMenu /> | ||
<Breadcrumbs variant="list" elements={[{ label: t_i18n('Settings') }, { label: t_i18n('Customization') }, { label: t_i18n('Support packages'), current: true }]} /> | ||
<Button | ||
aria-label="Generate support package" | ||
className={classes.createButton} | ||
onClick={generateSupportPackage} | ||
size="large" | ||
color="primary" | ||
>Generate support package | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SupportPackages; |
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
Oops, something went wrong.