From c380817f6b3f24e4393dd77c1ace31055a5531de Mon Sep 17 00:00:00 2001 From: Nagendra Date: Wed, 24 Jan 2024 10:30:56 +0530 Subject: [PATCH] Argo App creation via Isd changes --- .../components/applications-container.tsx | 1 + .../applications-list/applications-list.tsx | 27 +++++++++++++++++-- .../app/shared/components/layout/layout.tsx | 18 +++++++++++-- ui/src/app/sidebar/sidebar.tsx | 7 +++-- ui/src/assets/styles.css | 8 ++++++ 5 files changed, 53 insertions(+), 8 deletions(-) diff --git a/ui/src/app/applications/components/applications-container.tsx b/ui/src/app/applications/components/applications-container.tsx index 37c2181bdc621..883218dbfee7c 100644 --- a/ui/src/app/applications/components/applications-container.tsx +++ b/ui/src/app/applications/components/applications-container.tsx @@ -7,6 +7,7 @@ import {ApplicationsList} from './applications-list/applications-list'; export const ApplicationsContainer = (props: RouteComponentProps) => ( + diff --git a/ui/src/app/applications/components/applications-list/applications-list.tsx b/ui/src/app/applications/components/applications-list/applications-list.tsx index d0498d06d7657..68c685e5da161 100644 --- a/ui/src/app/applications/components/applications-list/applications-list.tsx +++ b/ui/src/app/applications/components/applications-list/applications-list.tsx @@ -297,11 +297,22 @@ const FlexTopBar = (props: {toolbar: Toolbar | Observable}) => { ); }; +const checkUrlIncludesOpsmx = (param: string) => { + let urlSplit = param?.split('/') + if(urlSplit && urlSplit[urlSplit.length-2] == 'opsmx' && urlSplit[urlSplit.length-1] == 'creation'){ + return true; + } + return false; +} + export const ApplicationsList = (props: RouteComponentProps<{}>) => { const query = new URLSearchParams(props.location.search); const appInput = tryJsonParse(query.get('new')); const syncAppsInput = tryJsonParse(query.get('syncApps')); const refreshAppsInput = tryJsonParse(query.get('refreshApps')); + const context = React.useContext(Context); + const locationPath = context.history.location.pathname; + const pathHasOpsmx = checkUrlIncludesOpsmx(locationPath); const [createApi, setCreateApi] = React.useState(null); const clusters = React.useMemo(() => services.clusters.list(), []); const [isAppCreatePending, setAppCreatePending] = React.useState(false); @@ -573,7 +584,11 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => { ctx.navigation.goto('.', {new: null}, {replace: true})} + onClose={() => { + if(pathHasOpsmx){ + window.parent.postMessage({msg:'closeEvent'},'*') + } + ctx.navigation.goto('.', {new: null}, {replace: true})}} header={
{' '} @@ -601,6 +620,10 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => { setAppCreatePending(true); try { await services.applications.create(app); + //iframe msg alert needed + if(pathHasOpsmx){ + window.parent.postMessage({msg:'saveEvent'},'*') + } ctx.navigation.goto('.', {new: null}, {replace: true}); } catch (e) { ctx.notifications.show({ diff --git a/ui/src/app/shared/components/layout/layout.tsx b/ui/src/app/shared/components/layout/layout.tsx index 2b9c448f5150b..733435e8d0201 100644 --- a/ui/src/app/shared/components/layout/layout.tsx +++ b/ui/src/app/shared/components/layout/layout.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import {Sidebar} from '../../../sidebar/sidebar'; import {ViewPreferences} from '../../services'; +import { Context } from '../../context'; require('./layout.scss'); @@ -12,11 +13,24 @@ export interface LayoutProps { isExtension?: boolean; } -export const Layout = (props: LayoutProps) => ( +const checkUrlIncludesOpsmx = (param: string) => { + let urlSplit = param?.split('/') + if(urlSplit && urlSplit[urlSplit.length-2] == 'opsmx' && urlSplit[urlSplit.length-1] == 'creation'){ + return true; + } + return false; +} + +export const Layout = (props: LayoutProps) => { + const context = React.useContext(Context); + const locationPath = context.history.location.pathname; + const pathHasOpsmx = checkUrlIncludesOpsmx(locationPath); + return (
-
+
{props.children}
); +} diff --git a/ui/src/app/sidebar/sidebar.tsx b/ui/src/app/sidebar/sidebar.tsx index 298a156cc3f3d..ce5679e6cfa53 100644 --- a/ui/src/app/sidebar/sidebar.tsx +++ b/ui/src/app/sidebar/sidebar.tsx @@ -29,12 +29,11 @@ export const useSidebarTarget = () => { }; const checkUrlIncludesOpsmx = (param: string) => { - let urlSplit = param.split('/') - if(urlSplit[urlSplit.length-2] == 'opsmx' && urlSplit[urlSplit.length-1] == 'details'){ + let urlSplit = param?.split('/') + if(urlSplit && urlSplit[urlSplit.length-2] == 'opsmx' && (urlSplit[urlSplit.length-1] == 'details' || urlSplit[urlSplit.length-1] == 'creation')){ return true; - }else{ - return false; } + return false; } export const Sidebar = (props: SidebarProps) => { diff --git a/ui/src/assets/styles.css b/ui/src/assets/styles.css index 8c293c817fd44..03145fc8e055a 100644 --- a/ui/src/assets/styles.css +++ b/ui/src/assets/styles.css @@ -171,4 +171,12 @@ input.autocomplete__input.input { } .settings-overview__redirect-panel, .user-info-overview__panel, .argo-table-list__row { box-shadow: 0px 0px 4px 1px rgb(0 0 0 / 10%) !important; +} + +.opsmx_hide .sliding-panel__wrapper{ + width:100% !important +} + +.opsmx_hide .page__top-bar, .opsmx_hide .sidebar { + display: none; } \ No newline at end of file