-
Notifications
You must be signed in to change notification settings - Fork 17
Fix context UI add formatting refactor #57
base: main
Are you sure you want to change the base?
Fix context UI add formatting refactor #57
Conversation
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Thanks @chanwit! Would you please split this into PRs that accomplish one thing (or near enough) -- maybe
|
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.
@chanwit Can you describe the bug this is trying to fix?
@@ -4,7 +4,8 @@ | |||
"plugin:import/errors", | |||
"plugin:import/warnings", | |||
"plugin:@typescript-eslint/recommended", | |||
"plugin:import/typescript" | |||
"plugin:import/typescript", | |||
"plugin:prettier/recommended" // eslint shows prettier formatting warnings. Must be always the last configuration. |
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 may cause conflicts with typescript
. Having two formmatters running will cause them to over-write each others' 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.
I'm not very good at this kind of configuration.
Did you mean that we could just use eslint --fix
and the source would get formatted without using prettier? If so, I'm happy to remove it.
const { navigate, currentPage } = useNavigation(); | ||
|
||
const contextSelectChanged = (ev) => { |
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 was this moved?
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.
Embedding event handlers into the view is too hard to read.
@@ -1,38 +1,46 @@ | |||
|
|||
export interface TwirpErrorJSON { |
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 a generated file. When make proto
is run, this formatting will be over-written.
|
||
all: test build | ||
all: dist/index.html fmt vet test 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.
We probably shouldn't do "write" operations (formatting) on the make all
commands. I wouldn't expect a make all
command to leave us with a (potentially) modified git
state.
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 did that in Flux CLI. Go Fmt is part of the make file. Should we do this @stefanprodan?
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 agree with Jordan here; I think it's OK to have phony targets that rewrite files, but the main build shouldn't create (more) diffs. If it does, it encourages commits which contain code changes then some random reformatting elsewhere.
This can make it difficult to reconcile with builds in which you commit generated files. For that, you can make people explicitly regenerate the file, and have a guard in the tests (and CI) to make sure the committed, generated file is correct.
(Also see go build -mod=readonly
.)
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.
(You can call me a hypocrite, since all the flux controllers inherit a Makefile structure which does fmt
in the build, from kubebuilder. I don't notice because I've told emacs to run go fmt
when I save a file.)
for _, c := range rules.Contexts { | ||
contexts = append(contexts, c.Cluster) | ||
for contextName := range rules.Contexts { | ||
contexts = append(contexts, contextName) |
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 were accessing c.Cluster
before. Do we no longer need to do that?
@@ -1,39 +1,32 @@ | |||
// Code generated by protoc-gen-twirp v7.1.1, DO NOT EDIT. |
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 would not have expected this file to change. We probably need to use buf
instead to avoid this happening in the future. Not something that needs to be taken care of by this PR, but we should probably revert this change for now.
@@ -0,0 +1,223 @@ | |||
#!/usr/bin/env bash |
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 we should have users manage their own installation. In addition, anyone who downloads the binary won't have this script, and if they have cloned the repo, they are probably intending to build from source.
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's a plan to have a brew/tap, yes.
|
||
dist/index.html: | ||
npm run build | ||
|
||
fmt: | ||
go fmt ./... | ||
npx prettier --write 'ui/**/*.ts(x)?' |
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 one formatter is the way to go here. Two formatters may end up conflicting with one another.
@jpellizzari I am in process of splitting this PR into smaller ones as @squaremo pointed out. For the bug fixing part, there's a bug when we obtaining the list of contexts. Please see its structure and you'll see that we used the wrong field, |
Excellent! Nice find. I will await those PRs; feel free to add me as a reviewer when they are ready. Thanks for the contribution. |
Please be sure to put this explanation in the commit message :-) |
This PR