-
Notifications
You must be signed in to change notification settings - Fork 361
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
feat: [M3-7160] - Add AGLB "Edit Certificate" drawer #9723
Conversation
b85ace7
to
411b570
Compare
...manager/src/features/LoadBalancers/LoadBalancerDetail/Certificates/EditCertificateDrawer.tsx
Show resolved
Hide resolved
<TextField | ||
errorText={errorMap.certificate} | ||
label={labelMap[certificate.type]} | ||
labelTooltipText="TODO: AGLB" |
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.
I'm not sure what the plan is for the copy in these tooltips, but given that we are not able to retrieve or display a certificate object's certificate
or key
fields for security reasons, we should probably mention that in this form so that the user does not think that their cert/key data is missing.
packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Certificates/Certificates.tsx
Show resolved
Hide resolved
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.
Looks great! My only concerns regard consistency between the Create Drawer and this new Edit Drawer. We may need to ask Daniel for some clarification.
- In the Create Service Target Cert drawer we say "TLS Certificate" but in the edit drawer we say "Service Certificate". I guess we should say "Service Certificate" in both places?
- We have placeholders in the Create drawer but not the edit drawer
Good catch on this! 🔍 Asked Daniel for clarification in a comment on the mocks and reached out to let him know.
Yeah, I'm not sure what's best here because we could use the same example placeholder as the Create drawer, but that might face the same problem as leaving it blank -- causing users to think that it is missing/incomplete, when really we're just not able to display the data. I also asked Daniel about this in the mocks. |
3a896c4
to
499247b
Compare
@@ -91,7 +93,7 @@ export const CreateCertificateDrawer = (props: Props) => { | |||
/> | |||
<TextField | |||
errorText={errorMap.certificate} | |||
label="TLS Certificate" | |||
label={labelMap[type]} |
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.
In the Create Service Target Cert drawer we say "TLS Certificate" but in the edit drawer we say "Service Certificate". I guess we should say "Service Certificate" in both places?
Daniel updated to mocks so that the Create drawer now labels the field as "Server Certificate" for ca/service target certificates and is "TLS Certificate" for downstream/TLS, so I made the change to dynamically render the label based on type
in the Create drawer here.
@@ -13,7 +13,7 @@ import { | |||
} from '@linode/api-v4/lib/aglb/types'; | |||
import * as Factory from 'factory.ts'; | |||
|
|||
const certificate = ` | |||
export const mockCertificate = ` |
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.
I preemptively renamed in hope of making it clear that these are not real values that are a cause of security concern.
...manager/src/features/LoadBalancers/LoadBalancerDetail/Certificates/EditCertificateDrawer.tsx
Outdated
Show resolved
Hide resolved
@@ -141,6 +141,7 @@ type CertificateType = 'ca' | 'downstream'; | |||
export interface Certificate { | |||
id: number; | |||
label: string; | |||
certificate: string; |
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.
The API spec has been updated to indicate that certificate
will now be returned in GET /v4beta/aglb/{id}/certificates
.
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.
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.
Great job! 🎉
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.
Over all looks great! left couple comments for minor suggestions.
Validated
- Edit Certificate drawer with dynamic fields depending on certificate type
- test coverage for EditCertificateDrawer
...manager/src/features/LoadBalancers/LoadBalancerDetail/Certificates/EditCertificateDrawer.tsx
Outdated
Show resolved
Hide resolved
...manager/src/features/LoadBalancers/LoadBalancerDetail/Certificates/EditCertificateDrawer.tsx
Outdated
Show resolved
Hide resolved
Thanks for the reviews! I'll be merging this shortly. In my last commit, I addressed UX feedback to make the cert field contain the actual cert value instead of placeholder text. We now check whether the user is updating the cert from its original value and, if they are, require them to provide a key (as per the API spec). Otherwise, we can safely exclude the cert in the request and therefore avoid the user needing to submit their existing key, which we cannot return. (Validation seems to work correctly, as do request payloads; I think when I tried this initially, I was having unrelated validation issues.) Creating follow up tickets to address additional UX feedback:
|
Description 📝
Add an edit drawer for AGLB certificates.
Major Changes 🔄
EditCertificateDrawer
componentPUT
endpoint for*/v4beta/aglb/:id/certificates/:certId
to return adownstream
cert in addition to the existingca
certs.Preview 📷
How to test 🧪
yarn dev
tls-certificate
. Confirm that the edit drawer matches the mocks above for a TLS certificate.ca
). Confirm that the edit drawer matches the mocks above for a Service Target certificate.PUT
request is sent by the MSW when the Update Certificate button is clicked.PUT
request is sent by the MSW when the drawer is Canceled or closed out of.label
of either certificate type, the form submits without error.certificate
of a Service Target (ca
) cert, the form submits without error.certificate
of a TLS (downstream
) cert and submits without a key, they should receive a validation error upon submission indicatingPrivate Key is required
in that case.Unit:
E2E:
Will be completed in M3-7134, since there was an existing ticket created for this.