-
Notifications
You must be signed in to change notification settings - Fork 61
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
Display error messages for invalid trace type #231
Display error messages for invalid trace type #231
Conversation
With this PR, the user will get a toast notification while trying to import an invalid trace. If the user attempts to import a directory that contains some invalid traces then, in that case, it will create an experiment with a set of valid traces (if any) and will be presented with a toast notification displaying all the invalid traces within that directory. Screenshot: |
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.
Looks good to me. Thanks for the contribution.
} | ||
// Display the names of all the incorrect traces. | ||
if (Array.isArray(invalidTraces) && invalidTraces.length) { | ||
this.messageService.error('Invalid trace(s): ' + invalidTraces.toString()); |
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.
Since this line appears both in the if
and else
clauses, can it be extracted outside of the condition block? Then perhaps the whole if
block can be slightly simplified.
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.
Agree. However, with the new proposed changes, this can't be extracted out :(.
I want to be sure about this. from what I see, this will land us on the front page of /r/programminghumor as we have "trace loaded successfully" and "invalid trace" shown at the same time. Did I misunderstand? |
Nice catch :) Should we have a warning message instead? "trace loaded successfully and have a warning message displaying all the invalid trace(s). @mirsky-work @ebugden Thoughts? |
In my opinion we should have the same error message on the screen. The toaster by its nature is short-lived, and so it's not google friendly. On the screen where we have "your traces loaded fine", the user can then copy-paste the error and google/bing/duckduckgo the message. |
After thinking about it: The error message can be :
|
I like your proposal but given the MVP deadline, I suggest an alternative solution.
|
5444d88
to
d04285a
Compare
I have made the changes as discussed. @MatthewKhouzam please verify. |
|
||
if (traces === undefined || traces.length === 0) { | ||
// All the traces are invalid. Display the error message and exit. | ||
this.messageService.error('Invalid trace(s): ' + invalidTraces.toString()); |
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.
When trying to import a folder that contains no metadata files, the message will say "Invalid trace(s): ", which is weird. In case of invalidTraces.length == 0
can we display something along the lines of "No valid traces found in the selected directory"?
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.
When trying to import a folder that contains no metadata files, the message will say "Invalid trace(s): ", which is weird. In case of
invalidTraces.length == 0
can we display something along the lines of "No valid traces found in the selected directory"?
Good catch, I have added a check to see if the folder is empty (doesn't contain metadata files).
Note: There are other corner cases that we need to address, post MVP, for example (what happens if you upload a JSON file, txt file or other non-ctf traces.
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.
My only issue is resolved. please handle Ilya's requests :)
fixes eclipse-cdt-cloud#187 Signed-off-by: Ankush Tyagi <ankush.tyagi@ericsson.com>
d04285a
to
b0c5d7d
Compare
fixes eclipse-cdt-cloud#187 Signed-off-by: Ankush Tyagi <ankush.tyagi@ericsson.com>
fixes #187
Signed-off-by: Ankush Tyagi ankush.tyagi@ericsson.com