-
Notifications
You must be signed in to change notification settings - Fork 0
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
14 error display #22
Draft
PeteCoward
wants to merge
2
commits into
master
Choose a base branch
from
14_error_display
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
14 error display #22
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,17 +51,23 @@ export default async function initialise(config) { | |
|
||
// handler to encapsulate an async submission action ( update or delete ) | ||
function submit(action) { | ||
formElement.hidden = true; | ||
deleteElement.hidden = true; | ||
submitElement.hidden = true; | ||
loaderElement.hidden = false; | ||
|
||
action().then(() => { | ||
updateDisplay(); | ||
}).catch((err) => { | ||
errorElement.innerHTML = err; | ||
errorElement.hidden = false; | ||
}).finally(() => { | ||
formElement.hidden = true; | ||
displayElement.hidden = false; | ||
formElement.hidden = true; | ||
}).catch((errorCode) => { | ||
if (config.options.errors.hasOwnProperty(errorCode)) { | ||
inputElement.setCustomValidity(config.options.errors[errorCode]); | ||
} else { | ||
inputElement.setCustomValidity(config.options.errors['unknown']); | ||
} | ||
formElement.reportValidity(); | ||
}).finally(() => { | ||
submitElement.hidden = false; | ||
loaderElement.hidden = true; | ||
}); | ||
} | ||
|
@@ -83,6 +89,7 @@ export default async function initialise(config) { | |
|
||
// what happens when a key is hit in the input | ||
inputElement.onkeyup = function(e) { | ||
inputElement.setCustomValidity(''); | ||
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. This is the main reason this PR is still draft. It clears the validation on input, but causes an ugly flicker on submission with enter :/ |
||
if (e.key === 'Enter') updateOrCreate(inputElement.value); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from django.urls import path | ||
from .views import LoggingSubmitView, ExampleView | ||
from .views import FakingSubmitView, CacheSubmitView, ExampleView | ||
|
||
urlpatterns = [ | ||
# an example endpoint to demonstrate component use | ||
# example endpoint to demonstrate component use | ||
path('', ExampleView.as_view()), | ||
# a simple example submit endpoint that returns 200 ok | ||
path('example_submit', LoggingSubmitView.as_view(), name='example_submit'), | ||
# an example submit endpoint with a parameter that returns 200 ok | ||
path('example_submit/<name>/', LoggingSubmitView.as_view(), name='example_submit'), | ||
|
||
# submit endpoint that uses the fieldupdater cache | ||
path('cache_submit', CacheSubmitView.as_view(), name='cache_submit'), | ||
path('cache_submit/<name>/', CacheSubmitView.as_view(), name='cache_submit'), | ||
|
||
# submit endpoint that will do nothing but | ||
# return any status you put in Catalpa-FieldUpdater-Fake header | ||
path('fake_submit', FakingSubmitView.as_view(), name='faking_submit'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 really decided what to send back here, code
-1
, string 'fetch error'?