-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: create components from xml file (#42)
### [AB#195307](https://dev.azure.com/EquinorASA/bb9bd8cb-74f7-4ffa-b0cb-60eff0a0be58/_workitems/edit/195307) [Pull requests practices for the SSI team](https://github.com/equinor/ssi-infrastructure/blob/main/docs/pr_practices.md) ## Aim of the PR The team is to start using React in the frontend. This PR aims to set up a React project and render the P&ID using the XML file instead of using XSLT to generate an SVG. ## Implementation - A React project is set up using Vite. - TypeScript Interfaces are created to match the structure of the DEXPI Proteus-XML files. - React Components are created to render each element. - Documentation is updated. ## Type of change - [ ] Bug fix - [X] New feature - [ ] Breaking change - [X] This change requires a documentation update ## How Has This Been Tested? Diagram rendering has been tested with the NOAKADEXPI file DISC_EXAMPLE-02-02.xml. Visual confirmation of placement and look of elements. ## Additional Changes - Docker Compose is set up. - Vanilla JavaScript frontend moved to www_old - Boundary setting hotkey changed from ctrl to shift (mac issues) --------- Co-authored-by: Dag Hovland <[email protected]> Co-authored-by: Henriette Lien Rebnor <[email protected]>
- Loading branch information
1 parent
4941121
commit 540f224
Showing
55 changed files
with
7,700 additions
and
83 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,27 +1,28 @@ | ||
# Select boundary in browser | ||
|
||
1) Run the dexpi.rdfox script, the documentation for this script is found [here](../rdfox/README.md) | ||
2) Open the dexpi.html file in a browser | ||
2) Run the frontend as described in [RunGuide.md](./RunGuide.md) | ||
3) Select the boundary points and an internal component | ||
- Ctrl+left click to select or deselect the internal component | ||
1) If the node is not a member of the internal class: | ||
- Add the node to the internal class to indicate that it is selected | ||
- Update rdfox with the following triple :nodeId a :insideBoundary . | ||
2) If the node is a member of the internal class: | ||
- Remove the node from the internal class to indicate that it is deselected | ||
- Update rdfox, delete the following triple :nodeId a :insideBoundary . | ||
3) If the node is not a member of the internal class, but is a member of the boundary class: | ||
- Add the node to the internal class, and remove it from the boundary class. | ||
- Update rdfox, insert the following triple :nodeId a :insideBoundary . | ||
- Update rdfox, delete the following triple :nodeId a :boundary . | ||
- Left click to select or deselect boundary nodes | ||
1) If the node is not a member of the boundary class: | ||
- Add the node to the boundary class to indicate that it is selected | ||
- Update rdfox with the following triple :nodeId a :boundary . | ||
2) If the node is a member of the boundary class: | ||
- Remove the node from the boundary class to indicate that it is deselected | ||
- Update rdfox, delete the following triple :nodeId a :boundary . | ||
3) If the node is not a member of the boundary class, but is a member of the internal class: | ||
- Add the node to the boundary class, and remove it from the internal class. | ||
- Update rdfox, insert the following triple :nodeId a :boundary . | ||
- Update rdfox, delete the following triple :nodeId a :insideBoundary . | ||
- shift+left click to select or deselect the internal component | ||
1) If the node is not a member of the internal class: | ||
- Add the node to the internal class to indicate that it is selected | ||
- Update rdfox with the following triple :nodeId a :insideBoundary . | ||
2) If the node is a member of the internal class: | ||
- Remove the node from the internal class to indicate that it is deselected | ||
- Update rdfox, delete the following triple :nodeId a :insideBoundary . | ||
3) If the node is not a member of the internal class, but is a member of the boundary class: | ||
- Add the node to the internal class, and remove it from the boundary class. | ||
- Update rdfox, insert the following triple :nodeId a :insideBoundary . | ||
- Update rdfox, delete the following triple :nodeId a :boundary . | ||
- Left click to select or deselect boundary nodes | ||
1) If the node is not a member of the boundary class: | ||
- Add the node to the boundary class to indicate that it is selected | ||
- Update rdfox with the following triple :nodeId a :boundary . | ||
2) If the node is a member of the boundary class: | ||
- Remove the node from the boundary class to indicate that it is deselected | ||
- Update rdfox, delete the following triple :nodeId a :boundary . | ||
3) If the node is not a member of the boundary class, but is a member of the internal class: | ||
- Add the node to the boundary class, and remove it from the internal class. | ||
- Update rdfox, insert the following triple :nodeId a :boundary . | ||
- Update rdfox, delete the following triple :nodeId a :insideBoundary . | ||
4) Hit enter to query RDFox for the boundary - the output of the query can be found in the logs. |
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
import tseslint from 'typescript-eslint' | ||
|
||
export default tseslint.config( | ||
{ ignores: ['dist'] }, | ||
{ | ||
extends: [js.configs.recommended, ...tseslint.configs.recommended], | ||
files: ['**/*.{ts,tsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
}, | ||
plugins: { | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...reactHooks.configs.recommended.rules, | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}, | ||
) |
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,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>P&ID</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.