From 34db3d9588942f01be7b70b7e014265029324580 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 30 May 2020 11:59:06 +0200 Subject: [PATCH] Fixed icons for apps --- frontend/src/Apps.js | 45 ++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/frontend/src/Apps.js b/frontend/src/Apps.js index 30e3ac5b..5994986d 100644 --- a/frontend/src/Apps.js +++ b/frontend/src/Apps.js @@ -19,6 +19,9 @@ import YAML from 'yaml' import {Link} from 'react-router-dom'; import CloudDownload from '@material-ui/icons/CloudDownload'; +import EditIcon from '@material-ui/icons/Edit'; +import DeleteIcon from '@material-ui/icons/Delete'; + import { useAlert } from "react-alert"; import Dialog from '@material-ui/core/Dialog'; @@ -132,7 +135,7 @@ const Apps = (props) => { const downloadApp = (inputdata) => { const id = inputdata.id - alert.info("Preparing download.") + alert.info("Downloading..") fetch(globalUrl+"/api/v1/apps/"+id+"/config", { method: 'GET', headers: { @@ -255,14 +258,15 @@ const Apps = (props) => { - + + + {data.activated && data.private_id !== undefined && data.private_id.length > 0 && data.generated ? {downloadApp(data)}}> - {/* - */} + : null} ) } @@ -295,15 +299,28 @@ const Apps = (props) => { const editUrl = "/apps/edit/"+selectedApp.id const activateUrl = "/apps/new?id="+selectedApp.id + + var downloadButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? + + : null + var editButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? : null var activateButton = selectedApp.generated && !selectedApp.activated ? @@ -312,7 +329,7 @@ const Apps = (props) => { variant="contained" component="label" color="primary" - style={{marginTop: "10px"}} + style={{marginTop: 10}} > Activate App : null @@ -327,7 +344,7 @@ const Apps = (props) => { deleteApp(selectedApp.id) }} > - Delete app + : null var imageline = selectedApp.large_image === undefined || selectedApp.large_image.length === 0 ? @@ -348,6 +365,7 @@ const Apps = (props) => { {activateButton} + {downloadButton} {editButton} {deleteButton} @@ -464,8 +482,8 @@ const Apps = (props) => { ) } - const handleSearchChange = (event) => { - const searchfield = event.target.value.toLowerCase() + const handleSearchChange = (search) => { + const searchfield = search.toLowerCase() const newapps = apps.filter(data => data.name.toLowerCase().includes(searchfield) || data.description.toLowerCase().includes(searchfield)) if ((newapps.length === 0 || searchBackend) && !appSearchLoading) { @@ -495,7 +513,10 @@ const Apps = (props) => { Search OpenAPI - control={ {setSearchBackend(!searchBackend)}} />} + control={ { + handleSearchChange("") + setSearchBackend(!searchBackend)} + } />} />