-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Issue10352 removegetvariables #10475
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
Issue10352 removegetvariables #10475
Conversation
|
The script works, but I fail to get it to work with the typescript files. Could you check what I'm doing wrong ? |
kkthxbye-code
left a comment
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.
Not sure why lldp.js is changed, I don't think it should with the current changes. The relevant dist files should be updated before merge though.
Your current approach needs some work, please see comments.
|
Works well for me. @kkthxbye-code any lingering concerns? |
|
@jeremystretch - I don't think the approach works in general. It breaks the form when navigating back as the elements are still disabled, at least for me in both chrome and firefox. Maybe an alternative approach would be to modify the history with window.history.pushState()/window.history.replaceState(). I'm not really a frontend guy though. The new code also has some other issue. The switch is not needed for two outcomes, there should not be a default case as that will break if we ever add other form elements to a get form, there's redunant checks when checking for falsy values, the function returns a boolean for no reason, the prototype of the object is compared by the nodeName string instead of Object.getPrototypeOf. |
|
|
I realize that, but you didn't have to treat everything else as an HTMLInputElement.
The first !inputElement.value covers the last two cases in your code here. That's what I meant.
I didn't see that in my testing. Returning false might break it, but when I tested making the function return void did not.
Just validate first that Regardless, as I said, I think breaking back button behavior is a no-go here, so the chosen approach seems to be a non-starter. |
I'm inclined to agree. I suspect we'd need to handle the form submission ourselves, ignoring empty values, rather than relying on the default submission process. But I'm also not a front end person. 😆 |
|
Well, you can't say I didn't try :-D Another option that I read, is to use the FormData, going to test that out |
|
We could Is that your intent @PieterL75 ? |
|
https://developer.mozilla.org/en-US/docs/Web/API/FormDataEvent This works pretty awesome.. too bad typescript doesnt know the formdata event |
kkthxbye-code
left a comment
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.
Works as expected, see suggested change.
|
I created #10526 to test if my suggestion really was only working for me, but it seems like the CI builds it fine, so you should check your environment to make sure it is up to date. You can see the change here: https://github.com/netbox-community/netbox/pull/10526/files I would prefer if you could try again to make sure we do it properly. Sorry for all the issues, the solution you came up with is great! |
It's actually my local tsc (v4.8.4, latest build) that is throwing the errors. |
|
You are running a globally installed tsc. You need to use yarn validate instead, which uses the correct typescript version installed locally. Docs link: https://demo.netbox.dev/static/docs/development/web-ui/ |
|
I did follow that guide to setup all things.. worked perfect till now :-( But I think I really need the 3 comments, as per the docs: |
|
Remove the typescript you have globally installed with something like.
No you don't need ignore on all lines, please see the CI build in the PR I linked, it runs validate fine. Nevertheless you need to fix your environment, you are currently using a newer version of typescript than netbox. Edit: I just tested with a fresh node docker image, where I the global typescript package and it always prefers the project installed one, so I'm not sure how your environment got so messed up. You can try running
The output should include: We are getting a little bit into tech support here though. |
Fixes: #10352 Remove empty variables from GET urls