From 8515052e1a6de2de56effbc61c73d3aa80169a93 Mon Sep 17 00:00:00 2001
From: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Date: Mon, 15 Feb 2021 18:22:28 +0100
Subject: Add OAuth support to odlux

Extend odlux to support oauth, support external login provider for sign-in

Issue-ID: CCSDK-3167
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: Id5772e0026fa7ebda22c41c2620a7868598f41aa
---
 .../src/views/configurationApplication.tsx               | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx')

diff --git a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
index 45b3081c2..dbaa77874 100644
--- a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
+++ b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
@@ -33,6 +33,7 @@ import { ViewSpecification, isViewElementString, isViewElementNumber, isViewElem
 
 import Fab from '@material-ui/core/Fab';
 import AddIcon from '@material-ui/icons/Add';
+import PostAdd from '@material-ui/icons/PostAdd';
 import ArrowBack from '@material-ui/icons/ArrowBack';
 import RemoveIcon from '@material-ui/icons/RemoveCircleOutline';
 import SaveIcon from '@material-ui/icons/Save';
@@ -545,8 +546,11 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
            );
     };
 
-    private renderUIViewList(listSpecification: ViewSpecification, listKeyProperty: string, listData: { [key: string]: any }[]) {
+    private renderUIViewList(listSpecification: ViewSpecification, listKeyProperty: string, apiDocPath: string, listData: { [key: string]: any }[]) {
         const listElements = listSpecification.elements;
+        const apiDocPathCreate = apiDocPath ? `${location.origin}${apiDocPath
+          .replace("$$$standard$$$","topology-netconfnode%20resources%20-%20RestConf%20RFC%208040")
+          .replace("$$$action$$$","put")}_${listKeyProperty.replace(/[\/=\-\:]/g,'_')}_` : undefined;
 
         const navigate = (path: string) => {
             this.props.history.push(`${this.props.match.url}${path}`);
@@ -558,6 +562,12 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
             }
         };
 
+        const addWithApiDocElementAction = {
+            icon: PostAdd, tooltip: 'Add', onClick: () => {
+                window.open(apiDocPathCreate, '_blank');
+            }
+        };
+
         const { classes, removeElement } = this.props;
 
         const DeleteIconWithConfirmation: React.FC<{ rowData: { [key: string]: any }, onReload: () => void }> = (props) => {
@@ -580,7 +590,7 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
         }
 
         return (
-            <SelectElementTable stickyHeader idProperty={listKeyProperty} rows={listData} customActionButtons={[addNewElementAction]} columns={
+            <SelectElementTable stickyHeader idProperty={listKeyProperty} rows={listData} customActionButtons={apiDocPathCreate ? [addNewElementAction, addWithApiDocElementAction] : [addNewElementAction]} columns={
                 Object.keys(listElements).reduce<ColumnModel<{ [key: string]: any }>[]>((acc, cur) => {
                     const elm = listElements[cur];
                     if (elm.uiType !== "object" && listData.every(entry => entry[elm.label] != null)) {
@@ -790,7 +800,7 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
                 {ds.displayMode === DisplayModeType.doNotDisplay
                     ? null
                     : ds.displayMode === DisplayModeType.displayAsList && viewData instanceof Array
-                        ? this.renderUIViewList(ds.viewSpecification, ds.keyProperty!, viewData)
+                        ? this.renderUIViewList(ds.viewSpecification, ds.keyProperty!, ds.apidocPath!, viewData)
                         : ds.displayMode === DisplayModeType.displayAsRPC
                             ? this.renderUIViewRPC(ds.inputViewSpecification, viewData!, outputData, undefined, true, false)
                             : this.renderUIViewSelector(ds.viewSpecification, viewData!, ds.keyProperty, editMode, isNew)
-- 
cgit 1.2.3-korg

