Added switch for searching backend
This commit is contained in:
+11
-15
@@ -12,6 +12,8 @@ import TextField from '@material-ui/core/TextField';
|
|||||||
import FormControl from '@material-ui/core/FormControl';
|
import FormControl from '@material-ui/core/FormControl';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
import Tooltip from '@material-ui/core/Tooltip';
|
||||||
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||||
|
import Switch from '@material-ui/core/Switch';
|
||||||
import Input from '@material-ui/core/Input';
|
import Input from '@material-ui/core/Input';
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
@@ -43,6 +45,7 @@ const Apps = (props) => {
|
|||||||
const [isLoading, setIsLoading] = React.useState(false)
|
const [isLoading, setIsLoading] = React.useState(false)
|
||||||
const [appSearchLoading, setAppSearchLoading] = React.useState(false)
|
const [appSearchLoading, setAppSearchLoading] = React.useState(false)
|
||||||
const [selectedAction, setSelectedAction] = React.useState({})
|
const [selectedAction, setSelectedAction] = React.useState({})
|
||||||
|
const [searchBackend, setSearchBackend] = React.useState(false)
|
||||||
|
|
||||||
const [openApi, setOpenApi] = React.useState("")
|
const [openApi, setOpenApi] = React.useState("")
|
||||||
const [openApiData, setOpenApiData] = React.useState("")
|
const [openApiData, setOpenApiData] = React.useState("")
|
||||||
@@ -454,7 +457,8 @@ const Apps = (props) => {
|
|||||||
const searchfield = event.target.value.toLowerCase()
|
const searchfield = event.target.value.toLowerCase()
|
||||||
const newapps = apps.filter(data => data.name.toLowerCase().includes(searchfield) || data.description.toLowerCase().includes(searchfield))
|
const newapps = apps.filter(data => data.name.toLowerCase().includes(searchfield) || data.description.toLowerCase().includes(searchfield))
|
||||||
|
|
||||||
if (newapps.length === 0 && !appSearchLoading) {
|
if ((newapps.length === 0 || searchBackend) && !appSearchLoading) {
|
||||||
|
|
||||||
setAppSearchLoading(true)
|
setAppSearchLoading(true)
|
||||||
runAppSearch(searchfield)
|
runAppSearch(searchfield)
|
||||||
} else {
|
} else {
|
||||||
@@ -477,19 +481,11 @@ const Apps = (props) => {
|
|||||||
<h2>Available integrations</h2>
|
<h2>Available integrations</h2>
|
||||||
</div>
|
</div>
|
||||||
{isLoading ? <CircularProgress style={{marginTop: 13, marginRight: 15}} /> : null}
|
{isLoading ? <CircularProgress style={{marginTop: 13, marginRight: 15}} /> : null}
|
||||||
{/*
|
<FormControlLabel
|
||||||
<Button
|
style={{color: "white", marginBottom: "0px", marginTop: "10px"}}
|
||||||
variant="outlined"
|
label=<div style={{color: "white"}}>Search OpenAPI</div>
|
||||||
component="label"
|
control={<Switch checked={searchBackend} onChange={() => {setSearchBackend(!searchBackend)}} />}
|
||||||
color="primary"
|
/>
|
||||||
style={{margin: 5, maxHeight: 50, marginTop: 10}}
|
|
||||||
onClick={() => {
|
|
||||||
getSpecificApps(baseRepository)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Load apps
|
|
||||||
</Button>
|
|
||||||
*/}
|
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
component="label"
|
component="label"
|
||||||
@@ -534,7 +530,7 @@ const Apps = (props) => {
|
|||||||
:
|
:
|
||||||
<Paper square style={uploadViewPaperStyle}>
|
<Paper square style={uploadViewPaperStyle}>
|
||||||
<h4>
|
<h4>
|
||||||
Try a broader search term, e.g. "http", "alert", "ticket" etc.
|
Try a broader search term, e.g. "http", "alert", "ticket" etc.
|
||||||
</h4>
|
</h4>
|
||||||
<div/>
|
<div/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user