Last sync for onprem

This commit is contained in:
Frikky
2025-02-03 11:32:37 +01:00
parent 4b8c860569
commit 68a4652da3
4 changed files with 378 additions and 62 deletions
+60 -14
View File
@@ -95,6 +95,10 @@ const ApiExplorerWrapper = (props) => {
};
useEffect(() => {
if (openapi?.id === "HTTP") {
selectedAppData.name = "HTTP"
}
if (selectedAppData !== undefined && selectedAppData !== null && Object.getOwnPropertyNames(selectedAppData).length > 0) {
HandleAppAuthentication(selectedAppData?.name)
}
@@ -136,7 +140,10 @@ const ApiExplorerWrapper = (props) => {
const runAlgoliaAppSearch = (appname) => {
const index = searchClient.initIndex("appsearch");
console.log("Running appsearch for: ", appname);
if (appname === "HTTP" || appname === "http") {
navigate("/apis")
return
}
index
.search(appname)
@@ -151,6 +158,7 @@ const ApiExplorerWrapper = (props) => {
if (newname?.includes(appsearchname)) {
found = true
getAppData(hit.objectID)
break
}
@@ -160,6 +168,7 @@ const ApiExplorerWrapper = (props) => {
toast.error(`Failed to get API data for '${appname}' (1). Contact support@shuffler.io if this persists.`, {
"autoClose": 10000,
})
setTimeout(()=>{
navigate("/search?tab=apps");
},3000)
@@ -181,11 +190,29 @@ const ApiExplorerWrapper = (props) => {
// Fetch data when appid is available
const getAppData = useCallback((appid) => {
if (appid === undefined || appid === null || appid.length === 0) {
toast.error("No API data to load (4). Please contact support@shuffler.io if this persists.")
toast.warning("No app ID loaded. Showing default API testing window. ")
setOpenapi({
"id": "HTTP",
"servers": [
{"url": "https://shuffler.io"},
],
"info": {
"title": "HTTP",
"x-logo": theme.palette?.defaultImage,
},
"paths": {
"/api/v1/workflows/usecases": {
"get": {
"summary": "Custom Action",
}
}
}
})
setAppLoaded(true)
setTimeout(() => {
navigate("/search?tab=apps")
}, 3000)
//setTimeout(() => {
// navigate("/search?tab=apps")
//}, 3000)
return
}
@@ -413,6 +440,13 @@ const ApiExplorerWrapper = (props) => {
selectedAppData.name = appname
}
console.log("APPNAME: ", appname, openapi.id)
if (openapi?.id === "HTTP" || appname === "HTTP" || appname === "http") {
setAppAuthentication(data)
setSelectedAuthentication({})
return
}
const filteredData = data.filter((appAuth) => appAuth?.app?.id === appid || appAuth?.app?.name?.replaceAll(" ", "_").toLowerCase() === selectedAppData?.name?.replaceAll(" ", "_").toLowerCase());
if (filteredData.length === 0) {
setAppAuthentication([])
@@ -505,7 +539,7 @@ const ApiExplorerWrapper = (props) => {
}else if (openapi?.id?.length > 0) {
appid = openapi?.id;
}else{
toast.error("App id is missing. Please try again.");
toast.error("App id is missing and we can't run the API. Please contact support@shuffler.io if this persists.");
return;
}
@@ -692,6 +726,7 @@ const ApiExplorerWrapper = (props) => {
'& .MuiList-root': {
backgroundColor: "#1f1f1f",
},
maxWidth: 500,
},
}
}}
@@ -723,6 +758,7 @@ const ApiExplorerWrapper = (props) => {
No Selection
</MenuItem>
<Divider />
{appAuthentication?.length > 0 ? appAuthentication.map((appAuth) => (
<div
key={appAuth?.id}
@@ -732,13 +768,13 @@ const ApiExplorerWrapper = (props) => {
backgroundColor: '#1f1f1f',
color: 'white',
padding: '5px',
textAlign: "left",
}}
>
<MenuItem
value={appAuth?.id}
sx={{
display: 'flex',
justifyContent: 'space-between',
color: 'white',
}}
onClick={(e) => {
@@ -746,6 +782,11 @@ const ApiExplorerWrapper = (props) => {
setAuthenticationName(appAuth.app?.name)
}}
>
{appAuth?.app?.large_image !== undefined && appAuth?.app?.large_image !== null && appAuth?.app?.large_image.length > 0 ?
<Tooltip title={appAuth?.app?.name} placement="top">
<img src={appAuth?.app?.large_image} alt={appAuth?.app?.name} style={{ maxWidth: 20, maxHeight: 20, marginRight: 10, borderRadius: 5 }} />
</Tooltip>
: null}
{appAuth?.validation?.valid === true ?
<Tooltip title="Validated" placement="top">
<CheckCircleIcon style={{ color: green, marginRight: 10, }} />
@@ -1645,7 +1686,9 @@ const ApiExplorerWrapper = (props) => {
>
<div style={{display: "flex", }}>
<div style={{width: 600, margin: "auto", display: "flex", }}>
{isLoggedIn === true ?
{openapi?.id === "HTTP" ?
null
: isLoggedIn === true ?
<Button
variant={authHighlighted ? "contained" : "outlined"}
style={{
@@ -1681,17 +1724,20 @@ const ApiExplorerWrapper = (props) => {
}
{appAuthentication?.length > 0 ?
<div style={{display: "flex", flex: 2, }}>
<Typography style={{textAlign: "center", flex: 1, color: "white", marginTop: 15, }} variant="body1">
or use
</Typography>
<div style={{display: "flex", flex: 2, textAlign: "center", }}>
{openapi?.id === "HTTP" ? null :
<Typography style={{textAlign: "center", flex: 1, color: "white", marginTop: 15, }} variant="body1">
or use
</Typography>
}
<div style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
marginLeft: 'auto',
margin: 'auto',
maxWidth: 200,
}}>
<AuthenticationList />
</div>
@@ -1804,7 +1850,7 @@ const Wrapper = ({children, isLoaded,isLoggedIn})=>{
return(
<div className="api-explorer-wrapper" style={{ zoom: 0.8, paddingLeft: (isLoggedIn && isLoaded) ? leftSideBarOpenByClick ? 280 : 100 : 0, transition: 'padding-left 0.3s ease' }}>
<div className="api-explorer-wrapper" style={{ paddingLeft: (isLoggedIn && isLoaded) ? leftSideBarOpenByClick ? 280 : 100 : 0, transition: 'padding-left 0.3s ease' }}>
{children}
</div>
)
+6
View File
@@ -3167,6 +3167,12 @@ const AppCreator = (defaultprops) => {
setOauth2Scopes(chips)
setUpdate(Math.random())
}}
onBlur={(e) => {
var newchips = oauth2Scopes
newchips.push(e.target.value)
setOauth2Scopes(newchips)
setUpdate(Math.random())
}}
/>
</div>
) : null;