-
Notifications
You must be signed in to change notification settings - Fork 71
fix: trim whitespace for secrete name and file paths in UI #628
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
5bffc4f
5c7add0
caf97bf
df539cb
d5602da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -142,6 +142,8 @@ export var ManageSecret = { | |||||
| secretEditor.browseFilesOnClick(fileUploadLink, fileUpload); | ||||||
| secretEditor.formatUploadedFile(fileUpload, fileContent, fileDiv, fileInput, fileDeleteLink, fileMd5PresentId, fileImageId); | ||||||
| secretEditor.activateFilesDeleteLink(fileDeleteLink, fileDiv, fileInput, fileContent, md5Id); | ||||||
| // Attach trimming handler for the file path input | ||||||
| secretEditor.attachFilePathTrimmer(fileInput); | ||||||
| }); | ||||||
| }, | ||||||
|
|
||||||
|
|
@@ -152,12 +154,16 @@ export var ManageSecret = { | |||||
|
|
||||||
| let envVarIndex = secretEditor.envVars.length - 1; | ||||||
| let envVar = secretEditor.envVars[envVarIndex]; | ||||||
| let [element, envVarDiv, envVarDeleteLink, envVarInput, md5Id] = | ||||||
| // envVarElement returns [element, envVarNameId, envVarDivId, envVarDeleteLink, envVarValueId, envVarMd5Id] | ||||||
| let [element, envVarNameId, envVarDiv, envVarDeleteLink, envVarInput, md5Id] = | ||||||
| secretEditor.envVarElement(envVar, envVarIndex); | ||||||
|
|
||||||
| document.getElementById("env-vars-input").insertAdjacentHTML("beforeend", element); | ||||||
| secretEditor.activateEnvVarDeleteLink(envVarDeleteLink, envVarDiv, envVarInput, md5Id); | ||||||
|
|
||||||
| // ensure validation/trim is attached for the newly created input | ||||||
| secretEditor.activateEnvVarValidation(envVarNameId); | ||||||
|
|
||||||
| return false; | ||||||
| }); | ||||||
| }, | ||||||
|
|
@@ -177,23 +183,45 @@ export var ManageSecret = { | |||||
| secretEditor.browseFilesOnClick(fileUploadLink, fileUpload); | ||||||
| secretEditor.formatUploadedFile(fileUpload, fileContent, fileDiv, fileInput, fileDeleteLink, fileMd5PresentId, fileImageId); | ||||||
| secretEditor.activateFilesDeleteLink(fileDeleteLink, fileDiv, fileInput, fileContent, md5Id); | ||||||
| // Attach trimming handler for newly cloned file path input | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Pass
Suggested change
|
||||||
| secretEditor.attachFilePathTrimmer(fileInput); | ||||||
|
|
||||||
| return false; | ||||||
| }); | ||||||
| }, | ||||||
|
|
||||||
| attachFilePathTrimmer: function(fileInputId) { | ||||||
| // fileInputId is the id of the visible text input for the file path (e.g. files_0_path) | ||||||
| $("body").on("change blur input", "#" + fileInputId, function() { | ||||||
|
||||||
| $("body").on("change blur input", "#" + fileInputId, function() { | |
| $("body").on("change input", "#" + fileInputId, function() { |
Outdated
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.
Suggestion: Remove blur event here too for consistency:
| $("body").on("change textInput input blur", "#" + selector, function () { | |
| $("body").on("change textInput input", "#" + selector, function () { |
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.
Suggestion: Pass
filePathInput(the actual input field ID) instead offileInput(the container):