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
Add remove app button #989
Conversation
@joshri Can you edit the title of this PR to read like a commit message/release note? Here are some examples: https://github.com/weaveworks/weave-gitops/releases/tag/v0.3.3 |
@joshri What about if we created a So clicking the WDYT (what do you think)? |
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 like some other branch or commit made it into this one. LMK if you need help getting your git
state corrected.
.github/workflows/test.yml
Outdated
@@ -134,7 +134,7 @@ jobs: | |||
|
|||
acceptance-tests-0: | |||
runs-on: ubuntu-latest | |||
needs: [lint, build, test] | |||
needs: [lint, build] |
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.
? Whats up with these changes?
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.
Don't know what I'm doing 😦 not sure how I caused that!
Makefile
Outdated
@@ -169,10 +169,10 @@ coverage/merged.lcov: coverage/lcov.info coverage/golang.info | |||
##@ Utilities | |||
|
|||
.PHONY: help | |||
# Thanks to https://www.thapaliya.com/en/writings/well-documented-makefiles/ | |||
# Thanks to https://www.thapaliya.com/en/writings/well-documented-s/ |
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.
The node_modules thing I'm almost positive we did on purpose - the parts where makefile is deleted are certainly........suspicious
cmd/gitops/add/app/cmd.go
Outdated
@@ -1,4 +1,4 @@ | |||
package add | |||
package app |
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.
? It looks like some other changes leaked into your branch
ui/components/Layout.tsx
Outdated
height: 100%; | ||
margin: 0 auto; | ||
padding: 0; | ||
background-color: ${negativeSpaceColor}; | ||
`; | ||
|
||
const NavContainer = styled.div` | ||
width: 240px; | ||
min-width: 200px; |
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 wouldn't have expected layout params to change. This side-bar being variable width will cause some issues.
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.
NavContainer was a set width, but ContentContainer was not - which caused weird interactions with elements inside ContentContainer being able to overflow ContentContainer itself. I found that setting the x-overflow on AppContainer kept ContentContainer and NavContainer in check, and got the percentages working as I expected them too - this might be possible without making changes in Layout but I thought that we wouldn't want x-overflow in almost all situations anyway. Now the min-width...I can't exactly remember WHY I did it that way but I'm sure I had a brilliant and well-thought-out reason - will revert it and see what happens
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.
Please take another look at this. I would really like this to be a fixed width, media queries notwithstanding
ui/pages/ApplicationDetail.tsx
Outdated
React.useEffect(() => { | ||
if (!removeRes) return; | ||
//if app is succesfully removed, redirect to applications page | ||
history.push(defaultLinkResolver(PageRoute.Applications)); |
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.
We need to pull the linkResolver
from AppContext
. That way, if another context provider gives a different linkResolver
, the navigation will work.
ui/pages/ApplicationDetail.tsx
Outdated
const RemoveAppAuthError = ( | ||
<div> | ||
{removeError?.code === 16 ? ( | ||
!authSuccess && ( |
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 confusing. It would be better to build this into the above conditional.
!authSuccess && ( | |
removeError?.code === 16 && !authSuccess && () |
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.
Yeah...this was my solution to not being able to reset the error - I have to still display an error that's not authentication related, but if authentication has actually happened but the error still exists, display nothing. That probably sounds like nonsense.
ui/pages/Applications.tsx
Outdated
<Flex align wide between> | ||
<TitleBar> | ||
<Flex align between> | ||
<TitleBar style={{ width: "25%" }}> |
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.
Re inline styles:
https://c.tenor.com/PLpe-LYpJUcAAAAC/shame-gameofthrones.gif
Not sure if this is left over, but it probably won't work for us. Why wouldn't this be full width?
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.
Having it full width ends up wrapping the button text. I kind of wish everything had a width prop or something like that where I don't have to make a whole class or component to change one style (usually width or height) you know?
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.
Something else is going on if the text inside the button is wrapping because of another component's width.
I kind of wish everything had a width prop
That would be inline styles...
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.
Wow did I just invent inline styles? Great minds. What's the best way for me to add one line of style to something? The TitleBar width is initially 100% and the Button isn't set so it takes up the minimum amount of space.
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.
Inline style would be fine here, but I disagree with the 25%
value. I would have to play around and figure out the right values. Maybe <Flex align end />
instead of <Flex align between />
would give you what you want?
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 think it's the Link component that is limiting the width of the button - made a class for it.
11ee60c
to
13c4c61
Compare
@jpellizzari Here's an updated vid from the latest commit featuring an upgraded UX! Screen.Recording.2021-10-29.at.5.09.53.PM.mov |
@joshri How does it know you are not authenticated BEFORE you click remove? |
It knows because of the 'authSuccess' state variable we're using to check the auth for commit history. I'm just reusing that variable! |
Oh very slick... |
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.
LGTM, no major issues. Nice work! This was a hard one.
ui/components/Layout.tsx
Outdated
height: 100%; | ||
margin: 0 auto; | ||
padding: 0; | ||
background-color: ${negativeSpaceColor}; | ||
`; | ||
|
||
const NavContainer = styled.div` | ||
width: 240px; | ||
min-width: 200px; |
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.
Please take another look at this. I would really like this to be a fixed width, media queries notwithstanding
ui/pages/ApplicationDetail.tsx
Outdated
open={removeAppModalOpen} | ||
onClose={() => setRemoveAppModalOpen(false)} | ||
title="Are You Sure?" | ||
description={`You are about to remove ${application.name} from Weave GitOps!`} |
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.
description={`You are about to remove ${application.name} from Weave GitOps!`} | |
description={`You are about to remove ${application.name} from Weave GitOps`} |
@jpellizzari Got all those fixes in the latest commit! Thanks! |
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.
LGTM @joshri 🚀
Thank you for the videos, they are very helpful.
Just 2 comments :
-
Is the pink colour of the remove app button used anywhere else in weave-gitops so far? I know that it is a material design recommendation, but I would prefer Weave Cloud's
orange800
-
The second dialog ('Authenticate with GitHub') shifts down in position while it is loading, maybe it could just have the same
y
position as the first one ('Are You Sure?')
orange800 is looking a little dark - @bia what do you think? |
Good catch! I like |
…ded modal and circular progress height to avoid jittering when removing app
@@ -117,7 +117,7 @@ function GithubDeviceAuthModal({ | |||
|
|||
<Flex wide center> | |||
{codeLoading || !codeRes ? ( | |||
<CircularProgress /> | |||
<CircularProgress size={143} /> |
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.
Sort of a random value here. Can we pick some sizes that will keep things consistent? Small, Medium, Large?
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.
It's the value only because that's the exact size of the text that replaces it - I could wrap both in a div with a set size which would definitely be better
ui/components/Modal.tsx
Outdated
background-color: ${(props) => props.theme.colors.white}; | ||
margin: 0 auto; | ||
height: 400px; |
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.
Do we want ALL Modals
to have this height?
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.
Yeah...the github auth and remove app modals need to be the same height. I could make a class for the two of them which again, is probably better
ui/pages/ApplicationDetail.tsx
Outdated
applicationsClient.RemoveApplication({ | ||
name: application.name, | ||
namespace: application.namespace, | ||
//CAN'T FIND AUTOMERGE IN APPLICATION OBJECT |
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.
Why is this comment yelling at me? 😉
Can you phrase this as a note for the next person to come across this code?
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 wrote that so I would remember and then I forgot about it which is an absolute classic. Will do.
…d added option to position alerts icenter rather than flex-start
* Allow for body to be passed in HTTP delete method for RemoveApplication * Add Remove App button * Update README with command npm run test -- -u to update css snapshots * reverted Spacer and Makefile, and changed Remove App confirm text * Reorganize remove app modal display to improve ux and actually revert Makefile * removed inline style on Application TitleBar * update snapshots * small cleanup - text changes, nav bar width, and rremoving extra button variable * added orange600 as the value for secondary in the mui theme, chard coded modal and circular progress height to avoid jittering when removing app * update snapshots * adjusted modal size to account for error alert in GithubAuthModal, and added option to position alerts icenter rather than flex-start Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: Joshua Israel <joshua.israel@weave.works>
Closes: #904
The biggest changes here are in the ApplicationDetail page, where a remove app button has been added along with error handling for a failed GitHub authentication. You can see the functionality below!
Screen.Recording.2021-10-28.at.8.26.14.PM.mov
NOTE: I already fixed the wonky spacing of the Error Alert since the creation of the video -__-
Some additional styling changes to get things looking right: addition of topRight prop to the breadcrumbs section to add remove button, size adjustments in Layout to prevent content from overflowing horizontally, and customPadding and customMargin options added to Spacer.
The other big change is in the backend to include the namespace as part of the DELETE request.
One big thing I want to change: I'd like to tie the github authentication success to clearing the authentication error on the first modal. My solution for now is to close the first modal on clicking the authenticate with github button, but that requires the user to make an extra click after returning from github - Jordan I think you managed to do this on the Add Application button - do you think it's possible here as well? I also need to change the ugliness of the loading circle within the button.