Skip to content

Commit

Permalink
fix:Event loader moved to create page (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
NagendraOpsmx authored Feb 1, 2024
1 parent ac8d1da commit 8ec1668
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ export const ApplicationCreatePanel = (props: {
onAppChanged: (app: models.Application) => any;
createApp: (app: models.Application) => any;
getFormApi: (api: FormApi) => any;
externalPath?: boolean;
}) => {
const [yamlMode, setYamlMode] = React.useState(false);
const [explicitPathType, setExplicitPathType] = React.useState<{path: string; type: models.AppSourceType}>(null);
const [destFormat, setDestFormat] = React.useState('URL');
const [retry, setRetry] = React.useState(false);

const pathHasOpsmx = props.externalPath;
function normalizeTypeFields(formApi: FormApi, type: models.AppSourceType) {
const app = formApi.getFormState().values;
for (const item of appTypes) {
Expand All @@ -129,6 +130,9 @@ export const ApplicationCreatePanel = (props: {
]).then(([projects, clusters, reposInfo]) => ({projects, clusters, reposInfo}))
}>
{({projects, clusters, reposInfo}) => {
if (pathHasOpsmx) {
window.parent.postMessage({msg:'loadEvent'},'*');
}
const repos = reposInfo.map(info => info.repo).sort();
const app = deepMerge(DEFAULT_APP, props.app || {});
const repoInfo = reposInfo.find(info => info.repo === app.spec.source.repoURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ 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'){
window.parent.postMessage({msg:'loadEvent'},'*');
return true;
}
return false;
Expand Down Expand Up @@ -636,6 +635,7 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => {
}
}}
app={appInput}
externalPath = {pathHasOpsmx}
onAppChanged={app => ctx.navigation.goto('.', {new: JSON.stringify(app)}, {replace: true})}
/>
)}
Expand Down

0 comments on commit 8ec1668

Please sign in to comment.