Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from odpi/react
Browse files Browse the repository at this point in the history
Merge #react to #main
  • Loading branch information
sarbull authored Sep 23, 2022
2 parents e95f6df + faff0a2 commit de52414
Show file tree
Hide file tree
Showing 67 changed files with 30,944 additions and 20,849 deletions.
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

25 changes: 24 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
/node_modules/
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

src/mockData.ts
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

122 changes: 46 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,46 @@
# happi-graph component

Happi Graph Component using Polymer 3.0.

## Demo

```html
<button id="zoom-in">+</button>
<button id="zoom-out">-</button>
<button id="center-graph">center-graph</button>
<button id="remove-data">remove-data</button>
<button id="add-data">add-data</button>

<happi-graph id="happi-graph"></happi-graph>
```

```js
let propertiesMap = {
SimpleSquare: 'simple-square'
};

let iconsMap = {
'simple-square': `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0H20V20H0V0Z" fill="white"/></svg>`,
};

let happiGraphInstance = document.querySelector('#happi-graph');

let graphData = {
graphDirection: 'VERTICAL',
selectedNodeId: 0,
nodes: [
{ id: 0, properties: {} },
{ id: 1, properties: {} },
{ id: 2, properties: {} },
{ id: 3, properties: {} },
{ id: 4, properties: {} },
],
links: [
{ from: 0, to: 1, connectionFrom: false, connectionTo: true },
{ from: 0, to: 2, connectionFrom: false, connectionTo: true },
{ from: 0, to: 3, connectionFrom: false, connectionTo: true },
{ from: 3, to: 4, connectionFrom: false, connectionTo: true }
]
};

happiGraphInstance.iconsMap = iconsMap;
happiGraphInstance.propertiesMap = propertiesMap;
happiGraphInstance.graphData = { ...graphData };

zoomIn.addEventListener('click', () => {
happiGraphInstance.customZoomIn();
});

zoomOut.addEventListener('click', () => {
happiGraphInstance.customZoomOut();
});

centerGraph.addEventListener('click', () => {
happiGraphInstance.centerGraph();
});

document.querySelector('#remove-data').addEventListener('click', () => {
happiGraphInstance.removeData();
});

document.querySelector('#add-data').addEventListener('click', () => {
happiGraphInstance.graphData = { ...graphData };
});
```

## Example

![3 nodes graph example](./docs/print-screen-happi-graph-3-nodes.png?raw=true "3 nodes graph example")

## License
[Apache-2.0 License](http://www.apache.org/licenses/)
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
Loading

0 comments on commit de52414

Please sign in to comment.