Skip to content

Commit

Permalink
Merge pull request #284 from terminusdb/add-change-request-optional
Browse files Browse the repository at this point in the history
Add change request optional
  • Loading branch information
KittyJose committed Jul 17, 2023
2 parents beb1f4a + 4cca077 commit 35d0187
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 137 deletions.
58 changes: 36 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/tdb-access-control-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"repository": {},
"author": "terminusdb group",
"dependencies": {
"@terminusdb/terminusdb-client": "^10.0.29",
"@terminusdb/terminusdb-client": "^10.0.31",
"classnames": "^2.2.5",
"react-bootstrap": "^2.7.0",
"react-icons": "^4.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/tdb-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@graphiql/toolkit": "^0.8.0",
"@stripe/react-stripe-js": "^1.16.4",
"@stripe/stripe-js": "^1.46.0",
"@terminusdb/terminusdb-client": "^10.0.29",
"@terminusdb/terminusdb-client": "^10.0.31",
"allotment": "^1.19.0",
"axios": "^0.21.1",
"classnames": "^2.2.5",
Expand Down
67 changes: 28 additions & 39 deletions packages/tdb-dashboard/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ import {PLANS} from "./routing/constants";
import {GraphqlHandlerbarsPage} from "./pages/GraphqlHandlerbarsPage"
import {FreeTextSearch} from "./pages/FreeTextSearch"
import { IndexingActionMonitor } from "./pages/IndexingActionMonitor"
import {ProductHomePage} from "./pages/ProductHomePage"

export function App (props){
let navigate = useNavigate();
const {connectionError,loadingServer,clientUser,accessControlDashboard,woqlClient} = WOQLClientObj()
const {connectionError,loadingServer,clientUser,accessControlDashboard,useChangeRequest} = WOQLClientObj()
if(!clientUser) return ""
// we have this loading only in terminusX, it is auth0 information/login loading
const {loading} = clientUser
Expand Down Expand Up @@ -69,28 +70,12 @@ export function App (props){

return <div className="container-fluid container-background h-100">
<Routes>
{getRoutes(clientUser,isAdmin, woqlClient)}
{getRoutes(clientUser,isAdmin, useChangeRequest)}
</Routes>
</div>
}
/*
<React.Fragment>
<Route index element={<Home/>} />
{ clientUser.user === "admin" && <Route path="administrator" element={<UserManagement/>}/>}
{ clientUser.user !== "admin" && <Route path="administrator" element={<div><PageNotFound/></div >}/>}
<Route path=":organization" >
<Route index element={<OrganizationHome/>}/>
<Route path="members" element={<UserManagement/>}/>
<Route path=":dataProduct" >
<Route index element={<DataProductsHome/>} />
<Route path={PATH.DOCUMENT_EXPLORER} element={<DocumentExplorer/>} />
</Route>
</Route>
<Route path="*" element={<div><PageNotFound/></div >} />
</React.Fragment>*/

function getRoutes(clientUser, isAdmin, woqlClient){
//const client = createApolloClient()
function getRoutes(clientUser, isAdmin, useChangeRequest){

if(localSettings.connection_type==="LOCAL"){
return <React.Fragment>
Expand All @@ -102,20 +87,20 @@ function getRoutes(clientUser, isAdmin, woqlClient){
{/*<Route path = {PATH.PROFILE} element = {<PrivateRoute component={Profile}/>} /> */}
{clientUser.user === "admin" && <Route path="administrator" element={<UserManagement/>}/>}
{clientUser.user !== "admin" && <Route path="administrator" element={<div><PageNotFound/></div >}/>}

<Route path=":dataProduct" >
<Route index element={<DataProductsHome/>}/>
<Route index element={<ProductHomePage/>}/>
<Route path={PATH.GRAPHIQL} element={<GraphIqlEditor/>} />

<Route path={PATH.OPENAI_CONF} element={<GraphqlHandlerbarsPage/>} />
<Route path={PATH.SEARCH} element={<FreeTextSearch/>} />
<Route path={PATH.ACTIONS} element={<IndexingActionMonitor/>} />


<Route path={PATH.CHANGE_REQUESTS} >
<Route index element={<ChangeRequestsPage/>} />
<Route path=":changeid" element={<ChangeDiff/>} />
</Route>
{useChangeRequest &&
<>
<Route path={PATH.OPENAI_CONF} element={<GraphqlHandlerbarsPage/>} />
<Route path={PATH.SEARCH} element={<FreeTextSearch/>} />
<Route path={PATH.ACTIONS} element={<IndexingActionMonitor/>} />
<Route path={PATH.CHANGE_REQUESTS} >
<Route index element={<ChangeRequestsPage/>} />
<Route path=":changeid" element={<ChangeDiff/>} />
</Route>
</>
}
<Route path={PATH.DOCUMENT_EXPLORER} element={<DocumentTemplate/>}>
<Route index element={<Documents/>} />
<Route path=":type">
Expand Down Expand Up @@ -149,16 +134,20 @@ function getRoutes(clientUser, isAdmin, woqlClient){
<Route path={PATH.MEMBERS} element={<PrivateRoute component={UserManagement}/>}/>

<Route path=":dataProduct" >
<Route path={PATH.OPENAI_CONF} element={<PrivateRoute component={GraphqlHandlerbarsPage}/>} />
<Route path={PATH.SEARCH} element={<PrivateRoute component={FreeTextSearch}/>} />
<Route index element={<PrivateRoute component={DataProductsHome}/>} />
<Route path={PATH.GRAPHIQL} element={<PrivateRoute component={GraphIqlEditor}/>} />
<Route path={PATH.ACTIONS} element={<PrivateRoute component={IndexingActionMonitor}/>} />

<Route path={PATH.CHANGE_REQUESTS} >
<Route index element={<PrivateRoute component={ChangeRequestsPage}/>} />
<Route path=":changeid" element={<PrivateRoute component={ChangeDiff}/>} />
</Route>
{useChangeRequest &&
<>
<Route path={PATH.OPENAI_CONF} element={<PrivateRoute component={GraphqlHandlerbarsPage}/>} />
<Route path={PATH.SEARCH} element={<PrivateRoute component={FreeTextSearch}/>} />
<Route path={PATH.ACTIONS} element={<PrivateRoute component={IndexingActionMonitor}/>} />
<Route path={PATH.CHANGE_REQUESTS} >
<Route index element={<PrivateRoute component={ChangeRequestsPage}/>} />
<Route path=":changeid" element={<PrivateRoute component={ChangeDiff}/>} />
</Route>
</>
}

<Route path={PATH.DOCUMENT_EXPLORER} element={<DocumentTemplate/>}>
<Route index element={<PrivateRoute component={Documents}/>} />
<Route path=":type">
Expand Down
12 changes: 2 additions & 10 deletions packages/tdb-dashboard/src/components/DocumentsWoqlTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ export const DocumentWoqlTable = () => {
setControlledRefresh,
controlledRefresh
} = useTDBDocumentQuery(woqlClient, type, 10)

/*useEffect(() => { // get documents on click of document types
setBarLoading(true)
setTableConfig(false)
setDocumentResults(false)
setControlledRefresh(controlledRefresh+1)
}, [type])*/


function extractDocuments(documentResults) {
var extractedResults=[]
Expand Down Expand Up @@ -104,8 +96,8 @@ export const DocumentWoqlTable = () => {

return <React.Fragment>
<Row className="mt-5 w-100">
{extractedResults.length === 0 && <h3>NO RESULT</h3>}
{extractedResults.length>0 && tableConfig && rowCount &&
{(extractedResults.length === 0 || rowCount===0) && <h3>NO RESULT</h3>}
{extractedResults.length>0 && tableConfig && rowCount!==0 &&
<main className="content mr-3 ml-5 w-100 ">
<Row className="w-100 mb-5">
<Col md={11}>
Expand Down
Loading

0 comments on commit 35d0187

Please sign in to comment.