Skip to content

Commit

Permalink
- Fix translation loading problem on the batch operation page.
Browse files Browse the repository at this point in the history
- Execute new handler on all translation keys.
- Add search pill comparison operators as proper translate strings.
  • Loading branch information
tasso94 committed Jun 13, 2024
1 parent 6e61611 commit 36c6526
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,27 @@ module.exports = [
$scope.translations[key] = $translate.instant(value);
});

const initTypes = () => {
$scope.types.map(function(el) {
el.id.value = $translate.instant(el.id.value);
if (el.operators) {
el.operators = el.operators.map(function(op) {
op.value = $translate.instant(op.value);
return op;
});
}

if (el.options && typeof el.options[0] === 'object') {
el.mappedOptions = el.options.map(({key, value}) => {
return {
key: key,
value: $translate.instant(value)
};
});
$scope.types.map(function(el) {
el.id.value = $translate.instant(el.id.value);
if (el.operators) {
el.operators = el.operators.map(function(op) {
op.value = $translate.instant(op.value);
return op;
});
}

el.options = el.mappedOptions.map(({value}) => value);
}
return el;
});
};
if (el.options && typeof el.options[0] === 'object') {
el.mappedOptions = el.options.map(({key, value}) => {
return {
key: key,
value: $translate.instant(value)
};
});

if ($scope.types) initTypes();
el.options = el.mappedOptions.map(({value}) => value);
}
return el;
});

angular.forEach($scope.operators, function(operatorGroupedByType) {
angular.forEach(operatorGroupedByType, function(operator) {
Expand Down Expand Up @@ -735,7 +731,7 @@ module.exports = [

if (
$scope.matchAny &&
!$location.search().hasOwnProperty(searchId + 'OrQuery')// eslint-disable-line
!$location.search().hasOwnProperty(searchId + 'OrQuery') // eslint-disable-line
) {
newLocation = $location.url() + '&' + searchId + 'OrQuery';
} else if (!$scope.matchAny) {
Expand Down Expand Up @@ -775,11 +771,11 @@ module.exports = [
$scope.$on('$locationChangeSuccess', function() {
$scope.matchAny = $location
.search()
.hasOwnProperty(searchId + 'OrQuery');// eslint-disable-line
.hasOwnProperty(searchId + 'OrQuery'); // eslint-disable-line

if (
!IGNORE_URL_UPDATE &&
$location.search().hasOwnProperty(searchId + 'Query')// eslint-disable-line
$location.search().hasOwnProperty(searchId + 'Query') // eslint-disable-line
) {
// make new array of searches from the url
var searches = getSearchesFromURL();
Expand Down Expand Up @@ -825,11 +821,9 @@ module.exports = [
$scope.searches[i].type.values = types;
}
};

$scope.$watch(
'types',
function() {
initTypes();
//in case if array of types changed - update dropdown values
$scope.searchTypes = $scope.types.map(function(el) {
return el.id;
Expand Down
6 changes: 5 additions & 1 deletion webapps/frontend/public/app/admin/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@
"USER_MEMBERSHIP_TENANT_SELECT_TENANTS": "Select Tenants",
"USER_MEMBERSHIP_TENANT_TENANT_ID": "Tenant ID",
"USER_MEMBERSHIP_TENANT_TENANT_NAME": "Tenant Name",
"VALUE": "Value"
"VALUE": "Value",
"SEARCH_LESS_THAN": "<",
"SEARCH_LESS_THAN_EQUALS": "<=",
"SEARCH_GREATER_THAN": ">",
"SEARCH_GREATER_THAN_EQUALS": ">="
}
}
6 changes: 5 additions & 1 deletion webapps/frontend/public/app/cockpit/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2554,6 +2554,10 @@
"VARIABLE_UPLOAD_PROGRESS": "Upload progress: {{progress}}%",
"VARIABLE_UPLOAD_SELECT_FILE": "Select a file containing the binary content for the variable",
"VARIABLE_UPLOAD_UPLOAD": "Upload",
"WITHOUT_DUE_DATE": "Without Due Date"
"WITHOUT_DUE_DATE": "Without Due Date",
"SEARCH_LESS_THAN": "<",
"SEARCH_LESS_THAN_EQUALS": "<=",
"SEARCH_GREATER_THAN": ">",
"SEARCH_GREATER_THAN_EQUALS": ">="
}
}
6 changes: 5 additions & 1 deletion webapps/frontend/public/app/tasklist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@
"name": "Name",
"owner": "Owner",
"parentTask": "Parent task",
"priority": "Priority"
"priority": "Priority",
"SEARCH_LESS_THAN": "<",
"SEARCH_LESS_THAN_EQUALS": "<=",
"SEARCH_GREATER_THAN": ">",
"SEARCH_GREATER_THAN_EQUALS": ">="
}
}
6 changes: 5 additions & 1 deletion webapps/frontend/public/app/welcome/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@
"TOGGLE_NAVIGATION": "Toggle navigation",
"UPDATE": "Update",
"USERNAME": "Username",
"USERNAME_FOR_AUTHENTICATION": "Username for authentication: {{username}}"
"USERNAME_FOR_AUTHENTICATION": "Username for authentication: {{username}}",
"SEARCH_LESS_THAN": "<",
"SEARCH_LESS_THAN_EQUALS": "<=",
"SEARCH_GREATER_THAN": ">",
"SEARCH_GREATER_THAN_EQUALS": ">="
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -89,19 +89,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -119,19 +119,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
}
],
"boolean": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand Down Expand Up @@ -100,19 +100,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -130,19 +130,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -160,19 +160,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
}
],
"boolean": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -79,19 +79,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -109,19 +109,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
},
{
"key": "like",
Expand All @@ -139,19 +139,19 @@
},
{
"key": "gt",
"value": ">"
"value": "SEARCH_GREATER_THAN"
},
{
"key": "gteq",
"value": ">="
"value": "SEARCH_GREATER_THAN_EQUALS"
},
{
"key": "lt",
"value": "<"
"value": "SEARCH_LESS_THAN"
},
{
"key": "lteq",
"value": "<="
"value": "SEARCH_LESS_THAN_EQUALS"
}
],
"boolean": [
Expand Down
Loading

0 comments on commit 36c6526

Please sign in to comment.