diff --git a/frontend/src/components/AppFramework.jsx b/frontend/src/components/AppFramework.jsx index ecff205f..383553fd 100644 --- a/frontend/src/components/AppFramework.jsx +++ b/frontend/src/components/AppFramework.jsx @@ -64,7 +64,7 @@ export const findSpecificApp = (framework, inputcategory) => { description: "", id: "", } - } else if (category === "communication") { + } else if (category === "communication" || category === "comms") { if (framework["Comms"] !== undefined && framework["Comms"].name !== undefined) { return framework["Comms"] } diff --git a/frontend/src/components/AppGrid.jsx b/frontend/src/components/AppGrid.jsx index 2d0e9d3d..5bb08119 100644 --- a/frontend/src/components/AppGrid.jsx +++ b/frontend/src/components/AppGrid.jsx @@ -31,7 +31,7 @@ import { const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") //const searchClient = algoliasearch("L55H18ZINA", "a19be455e7e75ee8f20a93d26b9fc6d6") const AppGrid = props => { - const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, userdata } = props + const { maxRows, showName, showSuggestion, isMobile, globalUrl, parsedXs, userdata, isHeader } = props const isCloud = window.location.host === "localhost:3002" || @@ -167,7 +167,7 @@ const AppGrid = props => { backgroundColor: index === mouseHoverIndex ? "rgba(255,255,255,0.8)" : theme.palette.inputColor, color: index === mouseHoverIndex ? theme.palette.inputColor : "rgba(255,255,255,0.8)", border: `1px solid ${innerColor}`, - padding: 15, + padding: isHeader ? null : 15, cursor: "pointer", position: "relative", minHeight: 116, diff --git a/frontend/src/components/AppSearchButtons.jsx b/frontend/src/components/AppSearchButtons.jsx index 324da856..2c85eb89 100644 --- a/frontend/src/components/AppSearchButtons.jsx +++ b/frontend/src/components/AppSearchButtons.jsx @@ -3,7 +3,7 @@ import theme from '../theme.jsx'; import ReactGA from 'react-ga4'; import { useNavigate, Link } from 'react-router-dom'; -import { Search as Searchicon, CloudQueue as CloudQueueicon, Code as Codeicon, Close as Closeicon, Folder as Foldericon, LibraryBooks as LibraryBooksicon } from '@mui/icons-material'; +import { Search as Searchicon, CloudQueue as CloudQueueicon, Code as Codeicon, Close as Closeicon, Folder as Foldericon, LibraryBooks as LibraryBooksicon, Delete as DeleteIcon, Close as CloseIcon, } from '@mui/icons-material'; import aa from 'search-insights' import Deleteicon from '@mui/icons-material/Delete'; import ShowCharticon from '@mui/icons-material/ShowChart'; @@ -33,16 +33,37 @@ import { ListItem, ListItemAvatar, ListItemText, + IconButton, } from '@mui/material'; const AppSearchButtons = (props) => { - const { userdata, globalUrl, appFramework, finishedApps, appType, totalApps, index, onNodeSelect, setDiscoveryData, appName, AppImage, setDefaultSearch, discoveryData } = props + const { userdata, globalUrl, appFramework, finishedApps, appType, totalApps, index, onNodeSelect, setDiscoveryData, appName, AppImage, setDefaultSearch, discoveryData, checkLogin, setMissing, } = props const ref = useRef() let navigate = useNavigate(); const [isHover, setIsHover] = useState(false); const [localSearchOpen, setLocalSearchOpen] = useState(false) + const [newSelectedApp, setNewSelectedApp] = useState(undefined) + + useEffect(() => { + console.log("AppSearchButtons: newSelectedApp: " + JSON.stringify(newSelectedApp)) + + if (newSelectedApp !== undefined && setMissing != undefined) { + console.log("AppSearchButtons: setMissing is defined!") + + const submitAppFramework = { + "description": newSelectedApp.description, + "id": newSelectedApp.objectID, + "name": newSelectedApp.name, + "type": appType, + "large_image": newSelectedApp.image_url, + } + + setFrameworkItem(submitAppFramework) + setMissing(newSelectedApp) + } + }, [newSelectedApp]) if (appType === undefined) { console.log("Apptype is required in AppSearchButtons") @@ -63,10 +84,54 @@ const AppSearchButtons = (props) => { const foundApp = findSpecificApp(appFramework, appType) if (foundApp === undefined || foundApp === null) { - console.log("AppSearchButtons: App not found in appFramework") + console.log("AppSearchButtons: App not found in appFramework: " + appType) return null } + const setFrameworkItem = (data) => { + + fetch(globalUrl + "/api/v1/apps/frameworkConfiguration", { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + body: JSON.stringify(data), + credentials: "include", + }) + .then((response) => { + if (response.status !== 200) { + console.log("Status not 200 for framework!"); + } + + if (checkLogin !== undefined) { + checkLogin() + } + + return response; + }) + .then((responseJson) => { + if (responseJson.success === false) { + if (responseJson.reason !== undefined) { + toast("Failed updating: " + responseJson.reason) + } else { + toast("Failed to update framework for your org.") + + } + } + //setFrameworkLoaded(true) + //setFrameworkData(responseJson) + }) + .catch((error) => { + if (checkLogin !== undefined) { + checkLogin() + } + + toast(error.toString()); + //setFrameworkLoaded(true) + }) + } + const icon = foundApp.large_image let xsValue = 12; if (index !== undefined && index !== 0) { @@ -86,6 +151,94 @@ const AppSearchButtons = (props) => { onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} > + {localSearchOpen ? ( +