Add banner to handle errors for Containers page instead of window.alert()#8897
Conversation
…rt() Signed-off-by: Tyler Critchlow <tylerdarincritchlow@gmail.com>
|
Added comments to explain what I am doing while cleaning the error message, I can remove them if wanted |
mook-as
left a comment
There was a problem hiding this comment.
Basically fine; just a question about parsing out messages from msg= lines.
| // Extract message from fatal/error format: time="..." level=fatal msg="actual message" | ||
| const msgMatch = rawMessage.match(/msg="([^"]+)"/); | ||
| if (msgMatch) { | ||
| return msgMatch[1].replace(/\\n/g, ' '); // Replace \n with spaces |
There was a problem hiding this comment.
\n doesn't actually matter because HTML doesn't display new lines, but it doesn't hurt either (except readability).
|
|
||
| if (typeof rawMessage === 'string') { | ||
| // Extract message from fatal/error format: time="..." level=fatal msg="actual message" | ||
| const msgMatch = rawMessage.match(/msg="([^"]+)"/); |
There was a problem hiding this comment.
Does this need to worry about escaped quotes (i.e. the error message itself contains a quote and got escaped)?
There was a problem hiding this comment.
yes it does, will push up change
| > | ||
| {{ error }} | ||
| </banner> |
There was a problem hiding this comment.
This is equivalent to:
| > | |
| {{ error }} | |
| </banner> | |
| v-text="error" /> |
But there's no harm leaving it as-is either.
There was a problem hiding this comment.
Sorry! Turns out this is not equivalent; it was breaking the <banner> rendering. Reverting this change fixed it.
Signed-off-by: Tyler Critchlow <tylerdarincritchlow@gmail.com>
mook-as
left a comment
There was a problem hiding this comment.
Please revert the v-text= change; sorry about that. It broke <banner> rendering.
Signed-off-by: Tyler Critchlow <tylerdarincritchlow@gmail.com>

#8893
This changes displaying error messages with window.alert() to using the banner component in the Containers page.
similar to how it is done for the volumes page implementation here: #8856