From ce9f35acb574bd45dc90599bf511cbb1714a3c76 Mon Sep 17 00:00:00 2001 From: David Radley Date: Wed, 19 Jan 2022 15:33:58 +0000 Subject: [PATCH] git325 fix quick terms Signed-off-by: David Radley --- cra-client/src/app.scss | 30 ++++ .../components/GlossaryQuickTerms.js | 138 +++++++++++++----- .../components/authoringforms/NodeInput.js | 81 ++++++++-- .../components/properties/NodeTypes.js | 8 + .../properties/RelationshipTypes.js | 1 + .../components/update/UpdateNode.js | 57 ++++---- 6 files changed, 240 insertions(+), 75 deletions(-) diff --git a/cra-client/src/app.scss b/cra-client/src/app.scss index 11baa9f4..e745b114 100644 --- a/cra-client/src/app.scss +++ b/cra-client/src/app.scss @@ -78,3 +78,33 @@ body { .time-picker__width { width: 18rem; } + +// body { +// font-size: 14px; +// font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, +// Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; +// } + +.auto-grow-input { +} + +.auto-grow-input:focus-within { + outline: -webkit-focus-ring-color auto 1px; +} + +textarea { + outline: 0; + width: auto; + min-width: 1em; + // font-size: 14px; + // font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, + // Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + padding: 0; + margin: 0; + resize: none; + background: none; + appearance: none; + border: none; +} + + diff --git a/cra-client/src/components/GlossaryAuthor/components/GlossaryQuickTerms.js b/cra-client/src/components/GlossaryAuthor/components/GlossaryQuickTerms.js index de6db14a..e8f471e3 100644 --- a/cra-client/src/components/GlossaryAuthor/components/GlossaryQuickTerms.js +++ b/cra-client/src/components/GlossaryAuthor/components/GlossaryQuickTerms.js @@ -6,14 +6,32 @@ import { IdentificationContext } from "../../../contexts/IdentificationContext"; import getPathTypesAndGuids from "./properties/PathAnalyser"; import Add32 from "../../../images/carbon/Egeria_add_32"; import getNodeType from "./properties/NodeTypes.js"; -import { Button, Form, FormGroup, TextInput, Loading } from "carbon-components-react"; +import { + Button, + Form, + FormGroup, + TextInput, + TextArea, + Loading, + DataTable, + TableContainer, + Table, + TableHead, + TableRow, + TableCell, + TableHeader, + TableBody, +} from "carbon-components-react"; import { issueRestCreate } from "../../common/RestCaller"; import { useHistory, withRouter } from "react-router-dom"; function GlossaryQuickTerms(props) { const identificationContext = useContext(IdentificationContext); - const glossaryNodeType = getNodeType(identificationContext.getRestURL("glossary-author"), "glossary"); + const glossaryNodeType = getNodeType( + identificationContext.getRestURL("glossary-author"), + "glossary" + ); const [terms, setTerms] = useState([]); const [termsWithStatus, setTermsWithStatus] = useState([]); const [errorMsg, setErrorMsg] = useState(); @@ -30,6 +48,21 @@ function GlossaryQuickTerms(props) { }); + const headerData = [ + { + text: "Term Name ", + key: "name", + }, + { + text: "Term Description", + key: "description", + }, + { + text: "Status", + key: "status", + }, + ]; + function getUrl() { return glossaryNodeType.url + "/" + glossaryGuid + "/terms"; } @@ -74,6 +107,7 @@ function GlossaryQuickTerms(props) { } else { workingTermWithStatus.status = "Error"; } + workingTermWithStatus.id=i; workingTermsWithStatus[i] = workingTermWithStatus; } setTermsWithStatus(workingTermsWithStatus); @@ -113,7 +147,12 @@ function GlossaryQuickTerms(props) { Back - {restCallInProgress && } + {restCallInProgress && ( + + )} {!restCallInProgress && termsWithStatus.length === 0 && (
@@ -136,7 +175,7 @@ function GlossaryQuickTerms(props) { setTermName(index, e.target.value); }} /> -
)} - {!restCallInProgress && termsWithStatus.length > 0 && ( + {!restCallInProgress && termsWithStatus.length > 0 && (

Terms Added.

-
+
+ ( + + + + + {headers.map((header) => ( + + {header.text} + + ))} + + + + {rows.map((row) => ( + + {row.cells.map((cell) => ( + {cell.value} + ))} + + ))} + +
+
+ )} + /> +
+ + {/*
- - + + - +
{termsWithStatus.map((item, index) => { return (
- - + + ); + } else { + return ( + setAttribute(item, e.target.value)} + placeholder={item.label} + > + ); + } + }; return (
@@ -142,8 +175,28 @@ export default function NodeInput(props) { } return allow; }) - .map((item) => { - return ( + .map((item) => + item.type === "longtext" ? ( +
+ +
+ +
+
+ ) : (
- setAttribute(item, e.target.value)} - placeholder={item.label} - > + setAttribute(item, e.target.value)} + placeholder={item.label} + >
- ); - })} + ) + )} { { key: "description", label: "Description", + type:"longtext" }, { key: "qualifiedName", @@ -45,6 +46,7 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "description", label: "Description", + type:"longtext" }, { key: "qualifiedName", @@ -53,6 +55,7 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "summary", label: "Summary", + type:"longtext" }, { key: "abbreviation", @@ -61,10 +64,12 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "examples", label: "Examples", + type:"longtext" }, { key: "usage", label: "Usage", + type:"longtext" }, { key: "isSpineObject", @@ -116,6 +121,7 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "description", label: "Description", + type:"longtext" }, { key: "qualifiedName", @@ -143,6 +149,7 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "description", label: "Description", + type:"longtext" }, { key: "qualifiedName", @@ -181,6 +188,7 @@ const getNodeType = (GlossaryAuthorURL, key) => { { key: "description", label: "Description", + type:"longtext" }, { key: "qualifiedName", diff --git a/cra-client/src/components/GlossaryAuthor/components/properties/RelationshipTypes.js b/cra-client/src/components/GlossaryAuthor/components/properties/RelationshipTypes.js index aff06a72..8b8fbf8e 100644 --- a/cra-client/src/components/GlossaryAuthor/components/properties/RelationshipTypes.js +++ b/cra-client/src/components/GlossaryAuthor/components/properties/RelationshipTypes.js @@ -6,6 +6,7 @@ const getRelationshipType = (GlossaryAuthorURL, key) => { { key: "description", label: "Description", + type:"longtext" }, { key: "steward", diff --git a/cra-client/src/components/GlossaryAuthor/components/update/UpdateNode.js b/cra-client/src/components/GlossaryAuthor/components/update/UpdateNode.js index 6f1500c7..3d4459d1 100644 --- a/cra-client/src/components/GlossaryAuthor/components/update/UpdateNode.js +++ b/cra-client/src/components/GlossaryAuthor/components/update/UpdateNode.js @@ -4,6 +4,7 @@ import React, { useState, useContext, useEffect } from "react"; import getPathTypesAndGuids from "../properties/PathAnalyser"; import { IdentificationContext } from "../../../../contexts/IdentificationContext"; import getNodeType from "../properties/NodeTypes.js"; +import UpdateNodePropertiesWizard from "./UpdateNodePropertiesWizard"; import { Accordion, AccordionItem, @@ -288,7 +289,6 @@ export default function UpdateNode(props) { return rows; }; const renderRelationships = () => { - return Object.entries(relationshipsMap).map(([key], i) => { return ( @@ -340,31 +340,37 @@ export default function UpdateNode(props) { // go back history.goBack(); }; + // const onUpdated = (payLoad) => { + // setUpdateBody(payLoad); + // // if (payLoad.node !== undefined) { + // // const nodeTypeName = payLoad.node.nodeType.toLowerCase(); + // // const nodeType = getNodeType( + // // identificationContext.getRestURL("glossary-author"), + // // nodeTypeName + // // ); + // // instancesContext.updateNodeInstance(payLoad.node, nodeType); + // // } + // // if (payLoad.relationship !== undefined) { + // // const relationshipTypeName = + // // payLoad.relationship.relationshipType.toLowerCase(); + // // instancesContext.updateRelationshipInstance( + // // payLoad.relationship, + // // payLoad.relationship.relationshipTypeName + // // ); + // // } + // }; return (
- {/* the useEffect will run after the render and set the nodeType, allowing the initalGet to run and set currentNode */} {currentNode === undefined && nodeType && initialGet()} - {currentNode !== undefined && - nodeType.attributes.map((item) => { - return ( -
- - setAttribute(item, e.target.value)} - placeholder={item.label} - > -
- ); - })} - {/* {currentNode !== undefined && ( + {currentNode !== undefined && ( + + )} + {/* )} + {currentNode !== undefined && ( @@ -383,7 +389,7 @@ export default function UpdateNode(props) { - )} */} + )} (*/} {currentNode !== undefined && ( @@ -424,6 +430,7 @@ export default function UpdateNode(props) { )} + ) {currentNode !== undefined && ( @@ -451,9 +458,7 @@ export default function UpdateNode(props) { )} -
{errorMsg}
-