Skip to content

CmpdReg Salts new salt fails to show server error message #1117

@jmcneil86043

Description

@jmcneil86043

Expected Behavior

When you open the CmpdReg Salts browser, click Create New Salt and enter a duplicate salt, you should receive an error that the salt exists
The server returns this in errorMsg.responseText
[{"level":"error","message":"Duplicate salt name. Another salt exists with the same name."},{"level":"error","message":"Duplicate salt abbreviation. Another salt exists with the same abbreviation."},{"level":"error","message":"Duplicate salt found in system."}]

It may not be well formatted, but it is clear

Current Behavior

Follow the above steps, then the form clears and shows this
An error occured creating Salt . Please contact support for additional help.

The console shows:
Uncaught TypeError: this.$(...) is not a function
at Object.error (SaltBrowser.js:453:62)
at k (jquery.min.js:2:16920)
at Object.fireWith [as rejectWith] (jquery.min.js:2:17707)
at y (jquery.min.js:2:80829)
at XMLHttpRequest.d (jquery.min.js:2:86374)

Steps to Reproduce

See above

Possible Solution

I can patch a fix like this:
docker-compose exec acas bash
cd /home/runner/build/public/javascripts/src/ServerAPI
vi SaltBrowser.js

search for bv_createSaltErrorMessageHolder

change

return this.$('.bv_createSaltErrorMessageHolder')(errorMsg);

to

return this.$('.bv_createSaltErrorMessageHolder').text(errorMsg.responseText);

I haven't tried this, but I think editing line 336 of SlatBrowser.coffee from
@$('.bv_createSaltErrorMessageHolder') errorMsg
to
@$('.bv_createSaltErrorMessageHolder').text errorMsg.responseText
will make the same change when deployed and compiled

It would be better to format the error message, but it is usable this way

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions