mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
Translate job status in smart status tooltip. Mark strings for translation in project form
This commit is contained in:
@@ -56,7 +56,7 @@ export default ['i18n', 'NotificationsList', 'TemplateList',
|
|||||||
label: i18n._('SCM Type'),
|
label: i18n._('SCM Type'),
|
||||||
type: 'select',
|
type: 'select',
|
||||||
class: 'Form-dropDown--scmType',
|
class: 'Form-dropDown--scmType',
|
||||||
defaultText: 'Choose an SCM Type',
|
defaultText: i18n._('Choose an SCM Type'),
|
||||||
ngOptions: 'type.label for type in scm_type_options track by type.value',
|
ngOptions: 'type.label for type in scm_type_options track by type.value',
|
||||||
ngChange: 'scmChange()',
|
ngChange: 'scmChange()',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -115,7 +115,7 @@ export default ['i18n', 'NotificationsList', 'TemplateList',
|
|||||||
hideSubForm: "scm_type.value === 'manual'",
|
hideSubForm: "scm_type.value === 'manual'",
|
||||||
awPopOverWatch: "urlPopover",
|
awPopOverWatch: "urlPopover",
|
||||||
awPopOver: "set in controllers/projects",
|
awPopOver: "set in controllers/projects",
|
||||||
dataTitle: 'SCM URL',
|
dataTitle: i18n._('SCM URL'),
|
||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)'
|
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
|
|||||||
@@ -4,13 +4,38 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default ['$scope', '$filter', 'i18n',
|
export default ['$scope', '$filter', 'i18n', 'JobsStrings',
|
||||||
function ($scope, $filter, i18n) {
|
function ($scope, $filter, i18n, JobsStrings) {
|
||||||
|
|
||||||
|
const strings = JobsStrings;
|
||||||
|
|
||||||
function isFailureState(status) {
|
function isFailureState(status) {
|
||||||
return status === 'failed' || status === 'error' || status === 'canceled';
|
return status === 'failed' || status === 'error' || status === 'canceled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTranslatedStatusString(status) {
|
||||||
|
switch (status) {
|
||||||
|
case 'new':
|
||||||
|
return strings.get('list.NEW');
|
||||||
|
case 'pending':
|
||||||
|
return strings.get('list.PENDING');
|
||||||
|
case 'waiting':
|
||||||
|
return strings.get('list.WAITING');
|
||||||
|
case 'running':
|
||||||
|
return strings.get('list.RUNNING');
|
||||||
|
case 'successful':
|
||||||
|
return strings.get('list.SUCCESSFUL');
|
||||||
|
case 'failed':
|
||||||
|
return strings.get('list.FAILED');
|
||||||
|
case 'error':
|
||||||
|
return strings.get('list.ERROR');
|
||||||
|
case 'canceled':
|
||||||
|
return strings.get('list.CANCELED');
|
||||||
|
default:
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
var singleJobStatus = true;
|
var singleJobStatus = true;
|
||||||
var firstJobStatus;
|
var firstJobStatus;
|
||||||
@@ -37,7 +62,7 @@ export default ['$scope', '$filter', 'i18n',
|
|||||||
jobId: job.id,
|
jobId: job.id,
|
||||||
sortDate: job.finished || "running" + job.id,
|
sortDate: job.finished || "running" + job.id,
|
||||||
finished: finished,
|
finished: finished,
|
||||||
status_tip: `${i18n._('JOB ID')}: ${job.id} <br>${i18n._('STATUS')}: ${job.status.toUpperCase()} <br>${i18n._('FINISHED')}: ${finished}`,
|
status_tip: `${i18n._('JOB ID')}: ${job.id} <br>${i18n._('STATUS')}: ${getTranslatedStatusString(job.status).toUpperCase()} <br>${i18n._('FINISHED')}: ${finished}`,
|
||||||
detailsUrl: detailsBaseUrl + job.id
|
detailsUrl: detailsBaseUrl + job.id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user