Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prompt] Optionally make the prompt plugin pre-fill the last entered value #1597

Merged
merged 1 commit into from Aug 5, 2019

Conversation

mdeboer
Copy link
Contributor

@mdeboer mdeboer commented Jul 9, 2019

I have added an option to the prompt plugin to save the last entered value and have that set as default value the next time the prompt shows. This saves you from having to enter all details for each request while still being able to change them if needed.

This should be full backwards compatible as the old behaviour is used when a storage key is set explicitly.

Old scenario 馃槩

  1. User executes a request with a few prompt tags
  2. User enters details for each of them
  3. User sips some coffee, fixes some bugs in his code.
  4. User executes the request again
  5. User has to enter all details again and make sure they are exactly the same
  6. Repeat from step 3

New scenario 馃槃

  1. User executes a request with a few prompt tags
  2. User enters details for each of them
  3. User sips some coffee, fixes some bugs in his code.
  4. User executes the request again
  5. Bashes enter a few times as all things are pre-filled
  6. Repeat from step 3

Makes my life a lot easier 馃槄

Added an option to the prompt plugin to save the last entered value and have that set as default value the next time the prompt shows. This saves you from having to enter all details for each request while still being able to change them if needed. This should be BC and therefore the option is ignored when a storage key is set explicitly; this will still return the cached value directly.
@gschier
Copy link
Contributor

gschier commented Jul 17, 2019

Hmm, Insomnia already has the ability to store the last value using the "Storage Key" field.

I like your PR but, since Insomnia already offers such similar functionality, I'm hesitant to merge this one. Can you describe a bit more how they are different or how they might work together?

@mdeboer
Copy link
Contributor Author

mdeboer commented Jul 19, 2019

I tried as best as I could but okay. I know very well Insomnia has that ability but this is not the same.

When you use the "storage key" method, Insomnia will not prompt again until you change the key. I'm sure there are advanced use cases but to me it is no use.

This plugin offers an option to remember the last entered value and will prompt the user every time, just like a regular prompt instance. Except this plugin will pre-fill the value field with the last entered value. No need to change keys to change your value etc.

This plugin should be fully backwards compatible and all the old functionality is still there. I set it to enabled by default but I can change this to disabled if you want.

@gschier gschier merged commit 8fb35d0 into Kong:develop Aug 5, 2019
@welcome
Copy link

welcome bot commented Aug 5, 2019

Congrats on merging your first pull request! 馃帀馃帀馃帀 You're helping make Insomnia awesome! 馃檶

@gschier
Copy link
Contributor

gschier commented Aug 5, 2019

Thanks for the explanation! I noticed you weren't actually using the variable you added inside the render method, so I did it on my end: 685c522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants