From 58e57ed7076fe3ef6f2f63377b529efe3f09ee2d Mon Sep 17 00:00:00 2001 From: hevp Date: Wed, 29 Apr 2020 11:29:54 +0200 Subject: [PATCH] Support units in metadata schemas and display them --- webui/src/components/editrecord.jsx | 12 ++++++++++-- webui/src/components/record.jsx | 4 +++- webui/src/components/schema.jsx | 27 ++++++++++++--------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/webui/src/components/editrecord.jsx b/webui/src/components/editrecord.jsx index 2a024b6b18..c9ffcfb556 100644 --- a/webui/src/components/editrecord.jsx +++ b/webui/src/components/editrecord.jsx @@ -384,8 +384,16 @@ const EditRecord = React.createClass({
{!title ? false : }
diff --git a/webui/src/components/record.jsx b/webui/src/components/record.jsx index f6543cd673..9f912afc39 100644 --- a/webui/src/components/record.jsx +++ b/webui/src/components/record.jsx @@ -445,7 +445,9 @@ const Record = React.createClass({ }
- {inner}
+ {inner} + {schema.get('unit') ? { schema.get('unit') } : false } +
); }, diff --git a/webui/src/components/schema.jsx b/webui/src/components/schema.jsx index 09cbc13446..62267c4425 100644 --- a/webui/src/components/schema.jsx +++ b/webui/src/components/schema.jsx @@ -67,23 +67,20 @@ export const Schema = React.createClass({ inner = {inner} } - const leftcolumn = !id ? false : -
-

- {title} - - {title?" :: ":""} - {id} - {schema.get('isRequired') ? " (required)":false} - -

-

{schema.get('description')}

-
; - const rightcolumnsize = leftcolumn ? "col-sm-6" : "col-sm-12"; return (
  • - {leftcolumn} -
    {inner}
    +
    +

    + {title} {schema.get('unit') ? ' [' + schema.get('unit') + ']' : false } + + {title ? " :: " : ""} + {id} + {schema.get('isRequired') ? " (required)" : false} + +

    +

    {schema.get('description')}

    +
    +
    {inner}
  • ); },