Skip to content

Commit

Permalink
Merge pull request #246 from ec-jrc/233/234-update-error-message
Browse files Browse the repository at this point in the history
233/234 update error message
  • Loading branch information
oruscalleda authored Dec 23, 2022
2 parents 7bb6bb8 + 9af669b commit 2a8bf2c
Show file tree
Hide file tree
Showing 26 changed files with 111 additions and 99 deletions.
4 changes: 4 additions & 0 deletions sources/Re3gistry2ServiceWebapp/public_html/conf/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ registryApp.maxSearchResultsPerPage = 10;
// Force http URIs (even if the original call has https URIs)
registryApp.forceHttpURIs=true;

// Default Error message parameters (Change if needed to your own repository or link)
registryApp.errorMessageDefinition = "Re3gistry Software repository";
registryApp.errorMessageURL = "https://github.com/ec-jrc/re3gistry";

// The app's base URL
registryApp.domainURL = '//registry-test.eu';
registryApp.hostURL = '//registry-test.eu/registry';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

// Element name constants



const elementId_searchForm = 'search-form';
const elementId_buttonSearch = 'btn-search';

Expand Down Expand Up @@ -45,10 +47,13 @@ const val_falsee = 'false';

// HTML snippet constants
const htmlSnippet_errorMessage = '<div role="alert" class="ecl-message ecl-message--error" data-ecl-message="true" data-ecl-auto-init="Message"><svg focusable="false" aria-hidden="true" class="ecl-message__icon ecl-icon ecl-icon--l"><use xlink:href="' + registryApp.hostURL + registryApp.staticResourcesPath + 'icons.svg#notifications--error"></use></svg><div class="ecl-message__content"><button data-ecl-message-close="true" type="button" class="ecl-message__close ecl-button ecl-button--ghost"><span class="ecl-button__container"><span class="ecl-button__label" data-ecl-label="true">Close</span><svg focusable="false" aria-hidden="true" data-ecl-icon="true" class="ecl-button__icon ecl-button__icon--after ecl-icon ecl-icon--s"><use xlink:href="' + registryApp.hostURL + registryApp.staticResourcesPath + 'icons.svg#ui--close"></use></svg></span></button><div class="ecl-message__title">Error message</div><p class="ecl-message__description">{0}</p></div></div>';
const htmlSnippet_infoMessage = '<div role="alert" class="ecl-message ecl-message--error" data-ecl-message="true" data-ecl-auto-init="Message"><svg focusable="false" aria-hidden="true" class="ecl-message__icon ecl-icon ecl-icon--l"><use xlink:href="' + registryApp.hostURL + registryApp.staticResourcesPath + 'icons.svg#notifications--information"></use></svg><div class="ecl-message__content"><button data-ecl-message-close="true" type="button" class="ecl-message__close ecl-button ecl-button--ghost"><span class="ecl-button__container"><span class="ecl-button__label" data-ecl-label="true">Close</span><svg focusable="false" aria-hidden="true" data-ecl-icon="true" class="ecl-button__icon ecl-button__icon--after ecl-icon ecl-icon--s"><use xlink:href="' + registryApp.hostURL + registryApp.staticResourcesPath + 'icons.svg#ui--close"></use></svg></span></button><div class="ecl-message__title">Information message</div><p class="ecl-message__description">{0}</p></div></div>';

// Event name constants
const eventName_click = 'click';



// Regular expression constants

// Global variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,15 @@ function renderFetchError(data) {
// Clearing the conatiner
resultsContainer.empty();

resultsContainer.append(htmlSnippet_errorMessage.replace('{0}', i18n[key_errorFetch]));

// Initializing the ECL Message component after creating it
let elt = document.querySelector('[' + key_dataEclMessage + ']');
let message = new ECL.Message(elt);
message.init();
if(data.error.code = 400){
resultsContainer.append(htmlSnippet_infoMessage.replace('{0}', "Data was not found in the current selected language, please try again later or select another active language. If you think this is an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.".replace('{0}',registryApp.errorMessageURL).replace('{1}',registryApp.errorMessageDefinition)));
}else{
resultsContainer.append(htmlSnippet_errorMessage.replace('{0}', i18n[key_errorFetch]).replace('{0}',registryApp.errorMessageURL).replace('{1}',registryApp.errorMessageDefinition));
}
// Initializing the ECL Message component after creating it
let elt = document.querySelector('[' + key_dataEclMessage + ']');
let message = new ECL.Message(elt);
message.init();
}

/*
Expand All @@ -745,7 +748,7 @@ function renderServiceError(data) {
// Clearing the conatiner
resultsContainer.empty();

resultsContainer.append(htmlSnippet_errorMessage.replace('{0}', i18n[key_errorFetch]));
resultsContainer.append(htmlSnippet_errorMessage.replace('{0}', i18n[key_errorFetch]).replace('{0}',registryApp.errorMessageURL).replace('{1}',registryApp.errorMessageDefinition));

// Initializing the ECL Message component after creating it
let elt = document.querySelector('[' + key_dataEclMessage + ']');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Регистър",
"s-facet-title-status_uri":"Статус",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Registr",
"s-facet-title-status_uri":"Stav",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Register",
"s-facet-title-status_uri":"Status",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Register",
"s-facet-title-status_uri":"Status",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Καταχωρητής",
"s-facet-title-status_uri":"Κατάσταση",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"s-search-results-current-page":"Showing results {0} to {1}",
"s-facet-title-register_itemclass_localid":"Register",
"s-facet-title-status_uri":"Status",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info, you can contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please contact <a href=\"mailto:jrc-inspire-support@ec.europa.eu\">jrc-inspire-support@ec.europa.eu</a>",
"s-error-fetch":"An error occurred while trying to access the data service. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-404":"The element requested has not been found in the system. If you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-406":"The format or language specified in the request is not available. Please specify a supported format/language. For additional info or if you think this could be an error, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"s-error-500":"The data service is not able to retrieve the information because of an internal error. If the error persist, please visit the <a href=\"{0}\">{1}</a> to try and give more information about your problem.",
"l-ec-web-presence":"https://ec.europa.eu/info/about-commissions-new-web-presence_{0}",
"l-ec-language-policy":"https://ec.europa.eu/info/language-policy_{0}",
"l-ec-resources-partners":"https://ec.europa.eu/info/resources-partners_{0}",
Expand Down
Loading

0 comments on commit 2a8bf2c

Please sign in to comment.