diff --git a/packages/server-admin-ui/src/views/ServerConfig/BasicProvider.js b/packages/server-admin-ui/src/views/ServerConfig/BasicProvider.js index e367e8962..ba6158e70 100644 --- a/packages/server-admin-ui/src/views/ServerConfig/BasicProvider.js +++ b/packages/server-admin-ui/src/views/ServerConfig/BasicProvider.js @@ -794,13 +794,29 @@ const NMEA2000 = (props) => { )} {(props.value.options.type === 'canbus' || props.value.options.type === 'canbus-canboatjs') && ( - +
+ + + +
)} {(props.value.options.type === 'ngt-1-canboatjs' || props.value.options.type === 'ikonvert-canboatjs' || diff --git a/src/interfaces/providers.js b/src/interfaces/providers.js index 68b896423..c54fc8c22 100644 --- a/src/interfaces/providers.js +++ b/src/interfaces/providers.js @@ -143,11 +143,20 @@ module.exports = function (app) { ] } - if ( - provider.options.type === 'canbus-canboatjs' && - !provider.options.uniqueNumber - ) { - provider.options.uniqueNumber = Math.floor(Math.random() * 2097151) + if (provider.options.type === 'canbus-canboatjs') { + const uniqueNumber = parseInt(provider.options.uniqueNumber, 10) + if (!isNaN(uniqueNumber)) { + provider.options.uniqueNumber = uniqueNumber + } else { + provider.options.uniqueNumber = Math.floor(Math.random() * 2097151) + } + + const mfgCode = parseInt(provider.options.mfgCode, 10) + if (!isNaN(mfgCode)) { + provider.options.mfgCode = mfgCode + } else { + if (provider.options.mfgCode !== '') delete provider.options.mfgCode //if value is not empty or not a number then removing property + } } if (applyProviderSettings(updatedProvider, provider, res)) {