summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-20 10:51:39 +0200
committerGitHub <noreply@github.com>2021-07-20 10:51:39 +0200
commit51c759e74b088d405b63fdb3e374822308d21366 (patch)
tree3094cb874872d932d278d98d60f79902bf08b1a0 /opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js
parentdb1d2c2f8c18850dedf34b5d690b6cd6a1d1f6b5 (diff)
parent28d6d13844db28745bc2813e87a367131f862070 (diff)
merge: Address technical dept in topology view (#162)
This pull request aims to address some of the technical debt in the topology view of the OpenDC frontend. * Add support for panning of the datacenter topology * Isolate world coordinate space (world objects do not depend on camera scale or position) * Split transpiled modules into a separate chunk to reduce deduplication * Encode state in topology actions to reduce global state * Restructure components per page * Enable more ESLint rules through `eslint:recommended` ruleset * Move page components in separate files.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js')
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js69
1 files changed, 0 insertions, 69 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js
deleted file mode 100644
index ececd07b..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/sidebars/topology/NameComponent.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import PropTypes from 'prop-types'
-import React, { useRef, useState } from 'react'
-import { Button, TextInput } from '@patternfly/react-core'
-import { PencilAltIcon, CheckIcon, TimesIcon } from '@patternfly/react-icons'
-
-function NameComponent({ name, onEdit }) {
- const [isEditing, setEditing] = useState(false)
- const nameInput = useRef(null)
-
- const onCancel = () => {
- nameInput.current.value = name
- setEditing(false)
- }
-
- const onSubmit = (event) => {
- if (event) {
- event.preventDefault()
- }
-
- const name = nameInput.current.value
- if (name) {
- onEdit(name)
- }
-
- setEditing(false)
- }
-
- return (
- <form
- className={`pf-c-inline-edit ${isEditing ? 'pf-m-inline-editable' : ''} pf-u-display-inline-block`}
- onSubmit={onSubmit}
- >
- <div className="pf-c-inline-edit__group">
- <div className="pf-c-inline-edit__value" id="single-inline-edit-example-label">
- {name}
- </div>
- <div className="pf-c-inline-edit__action pf-m-enable-editable">
- <Button className="pf-u-py-0" variant="plain" aria-label="Edit" onClick={() => setEditing(true)}>
- <PencilAltIcon />
- </Button>
- </div>
- </div>
- <div className="pf-c-inline-edit__group">
- <div className="pf-c-inline-edit__input">
- <TextInput type="text" defaultValue={name} ref={nameInput} aria-label="Editable text input" />
- </div>
- <div className="pf-c-inline-edit__group pf-m-action-group pf-m-icon-group">
- <div className="pf-c-inline-edit__action pf-m-valid">
- <Button className="pf-u-py-0" variant="plain" aria-label="Save edits" onClick={onSubmit}>
- <CheckIcon />
- </Button>
- </div>
- <div className="pf-c-inline-edit__action">
- <Button className="pf-u-py-0" variant="plain" aria-label="Cancel edits" onClick={onCancel}>
- <TimesIcon />
- </Button>
- </div>
- </div>
- </div>
- </form>
- )
-}
-
-NameComponent.propTypes = {
- name: PropTypes.string,
- onEdit: PropTypes.func,
-}
-
-export default NameComponent