-
Notifications
You must be signed in to change notification settings - Fork 605
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
Create Edit flow for Upload Jar Form #8458
Conversation
const pageHeading = getPageHeading( | ||
_.get(initialValues, 'build.strategy', ''), | ||
_.get(initialValues, 'build.source.type', undefined), | ||
); | ||
const validationSchema = getValidationSchema( | ||
_.get(initialValues, 'build.strategy', ''), | ||
_.get(initialValues, 'build.source.type', undefined), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can have strategy
and source.type
as const and use in getPageHeading
, getValidationSchema
@@ -249,6 +249,7 @@ export const appResources: AppResources = { | |||
annotations: { | |||
'app.openshift.io/vcs-ref': 'master', | |||
'app.openshift.io/vcs-uri': 'https://github.com/divyanshiGupta/nationalparks-py', | |||
jarFileName: 'demo-app.jar', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all three of these annotations will be not be used together right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, jarFileName will be used to form Jar initial values and the other is for git import.
expect(getFileUploadValues(editAppResource.data, buildConfig.data)).toEqual({ | ||
fileUpload: { name: 'demo-app.jar', value: '', javaArgs: undefined }, | ||
runtimeIcon: 'python', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it make sense to update buildConfig
mock data to have java
as runtime as Upload Jar will always have that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just mock data. I don't see any difference using java or python here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just mock data. I don't see any difference using java or python here.
import { BuildConfigModel, BuildModel } from '@console/internal/models'; | ||
import { K8sResourceKind } from '@console/internal/module/k8s'; | ||
import { history, resourcePathFromModel } from '@console/internal/components/utils'; | ||
import { useTranslation } from 'react-i18next'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: sort imports
const renderForm = (formikProps: FormikProps<any>) => { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can use implicit return
const isFromJarUpload = (type: string): boolean => type === BuildSourceType.Binary; | ||
|
||
const getBuildSourceType = (buildConfig: K8sResourceKind): string => | ||
buildConfig?.spec?.source?.type ?? undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if any value is not there in buildConfig?.spec?.source?.type
then it'll return undefined
only so does it make sense to return undefined
explicitly as well?
const fileName = buildConfig.metadata?.annotations?.jarFileName ?? ''; | ||
const javaArgs: string = resource.spec?.template?.spec?.containers | ||
?.find((container) => container.name === resourceName) | ||
?.env?.find((args) => args.name === 'JAVA_ARGS').value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/retest |
|
||
export enum BuildSourceType { | ||
Git = 'Git', | ||
Binary = 'Binary', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about if we move these to edit-application-types.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other enums are also in this file. Not sure if it matters to move these to edit-application-types.ts
.
@sahil143 a test case is failing verified the changes, it works fine |
/lgtm |
/retest |
/approve Verified the changes, works as expected. |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, works as expected.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: debsmita1, invincibleJai, rottencandy, sahil143 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes: https://issues.redhat.com/browse/ODC-5466
This PR adds the flow to edit resources created from UploadJarForm.
Screen shots / Gifs for design review:
Unit test coverage report:
Test setup:
Browser conformance: