Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argo App creation via Isd changes( https://devopsmx.atlassian.net/browse/OP-21418) #12

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {ApplicationsList} from './applications-list/applications-list';
export const ApplicationsContainer = (props: RouteComponentProps<any>) => (
<Switch>
<Route exact={true} path={`${props.match.path}`} component={ApplicationsList} />
<Route exact={true} path={`${props.match.path}/opsmx/creation`} component={ApplicationsList} />
<Route exact={true} path={`${props.match.path}/:name`} component={ApplicationDetails} />
<Route exact={true} path={`${props.match.path}/:name/opsmx/details`} component={ApplicationDetails} />
<Route exact={true} path={`${props.match.path}/:appnamespace/:name`} component={ApplicationDetails} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,22 @@ const FlexTopBar = (props: {toolbar: Toolbar | Observable<Toolbar>}) => {
);
};

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);
Expand Down Expand Up @@ -573,7 +584,11 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => {
</ObservableQuery>
<SlidingPanel
isShown={!!appInput}
onClose={() => ctx.navigation.goto('.', {new: null}, {replace: true})}
onClose={() => {
if(pathHasOpsmx){
window.parent.postMessage({msg:'closeEvent'},'*')
}
ctx.navigation.goto('.', {new: null}, {replace: true})}}
header={
<div>
<button
Expand All @@ -586,7 +601,11 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => {
</button>{' '}
<button
qe-id='applications-list-button-cancel'
onClick={() => ctx.navigation.goto('.', {new: null}, {replace: true})}
onClick={() => {
if(pathHasOpsmx){
window.parent.postMessage({msg:'closeEvent'},'*')
}
ctx.navigation.goto('.', {new: null}, {replace: true})}}
className='argo-button argo-button--base-o'>
Cancel
</button>
Expand All @@ -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({
Expand Down
18 changes: 16 additions & 2 deletions ui/src/app/shared/components/layout/layout.tsx
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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 (
<div className={props.pref.theme ? 'theme-' + props.pref.theme : 'theme-light'}>
<div className={`cd-layout ${props.isExtension ? 'cd-layout--extension' : ''}`}>
<div className={`cd-layout ${props.isExtension ? 'cd-layout--extension' : ''} ${pathHasOpsmx ? 'opsmx_hide': ''}`}>
<Sidebar onVersionClick={props.onVersionClick} navItems={props.navItems} pref={props.pref} />
<div className={`cd-layout__content ${props.pref.hideSidebar ? 'cd-layout__content--sb-collapsed' : 'cd-layout__content--sb-expanded'}`}>{props.children}</div>
</div>
</div>
);
}
7 changes: 3 additions & 4 deletions ui/src/app/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
8 changes: 8 additions & 0 deletions ui/src/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading