mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
organize and translate job output strings
This commit is contained in:
parent
b68b4db888
commit
930ecaec3e
@ -27,7 +27,7 @@ function getStatusDetails (jobStatus) {
|
||||
|
||||
const choices = mapChoices(resource.model.options('actions.GET.status.choices'));
|
||||
|
||||
const label = 'Status';
|
||||
const label = strings.get('labels.STATUS');
|
||||
const icon = `fa icon-job-${unmapped}`;
|
||||
const value = choices[unmapped];
|
||||
|
||||
@ -36,15 +36,14 @@ function getStatusDetails (jobStatus) {
|
||||
|
||||
function getStartDetails (started) {
|
||||
const unfiltered = started || resource.model.get('started');
|
||||
|
||||
const label = 'Started';
|
||||
const label = strings.get('labels.STARTED');
|
||||
|
||||
let value;
|
||||
|
||||
if (unfiltered) {
|
||||
value = $filter('longDate')(unfiltered);
|
||||
} else {
|
||||
value = 'Not Started';
|
||||
value = strings.get('details.NOT_STARTED');
|
||||
}
|
||||
|
||||
return { label, value };
|
||||
@ -52,15 +51,14 @@ function getStartDetails (started) {
|
||||
|
||||
function getFinishDetails (finished) {
|
||||
const unfiltered = finished || resource.model.get('finished');
|
||||
|
||||
const label = 'Finished';
|
||||
const label = strings.get('labels.FINISHED');
|
||||
|
||||
let value;
|
||||
|
||||
if (unfiltered) {
|
||||
value = $filter('longDate')(unfiltered);
|
||||
} else {
|
||||
value = 'Not Finished';
|
||||
value = strings.get('details.NOT_FINISHED');
|
||||
}
|
||||
|
||||
return { label, value };
|
||||
@ -68,7 +66,7 @@ function getFinishDetails (finished) {
|
||||
|
||||
function getModuleArgDetails () {
|
||||
const value = resource.model.get('module_args');
|
||||
const label = 'Module Args';
|
||||
const label = strings.get('labels.MODULE_ARGS');
|
||||
|
||||
if (!value) {
|
||||
return null;
|
||||
@ -86,7 +84,7 @@ function getJobTypeDetails () {
|
||||
|
||||
const choices = mapChoices(resource.model.options('actions.GET.job_type.choices'));
|
||||
|
||||
const label = 'Job Type';
|
||||
const label = strings.get('labels.JOB_TYPE');
|
||||
const value = choices[unmapped];
|
||||
|
||||
return { label, value };
|
||||
@ -101,7 +99,7 @@ function getVerbosityDetails () {
|
||||
|
||||
const choices = mapChoices(resource.model.options('actions.GET.verbosity.choices'));
|
||||
|
||||
const label = 'Verbosity';
|
||||
const label = strings.get('labels.VERBOSITY');
|
||||
const value = choices[verbosity];
|
||||
|
||||
return { label, value };
|
||||
@ -115,7 +113,7 @@ function getSourceWorkflowJobDetails () {
|
||||
}
|
||||
|
||||
const link = `/#/workflows/${sourceWorkflowJob.id}`;
|
||||
const tooltip = strings.get('resourceTooltips.SOURCE_WORKFLOW_JOB');
|
||||
const tooltip = strings.get('tooltips.SOURCE_WORKFLOW_JOB');
|
||||
|
||||
return { link, tooltip };
|
||||
}
|
||||
@ -127,10 +125,10 @@ function getJobTemplateDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Job Template';
|
||||
const label = strings.get('labels.JOB_TEMPLATE');
|
||||
const link = `/#/templates/job_template/${jobTemplate.id}`;
|
||||
const value = $filter('sanitize')(jobTemplate.name);
|
||||
const tooltip = strings.get('resourceTooltips.JOB_TEMPLATE');
|
||||
const tooltip = strings.get('tooltips.JOB_TEMPLATE');
|
||||
|
||||
return { label, link, value, tooltip };
|
||||
}
|
||||
@ -172,8 +170,8 @@ function getInventoryJobNameDetails () {
|
||||
const name = resource.model.get('name');
|
||||
const id = resource.model.get('id');
|
||||
|
||||
const label = 'Name';
|
||||
const tooltip = strings.get('resourceTooltips.INVENTORY');
|
||||
const label = strings.get('labels.NAME');
|
||||
const tooltip = strings.get('tooltips.INVENTORY');
|
||||
const value = `${id} - ${$filter('sanitize')(name)}`;
|
||||
const link = `/#/inventories/inventory/${inventoryId}`;
|
||||
|
||||
@ -188,7 +186,7 @@ function getInventorySourceDetails () {
|
||||
const { source } = resource.model.get('summary_fields.inventory_source');
|
||||
const choices = mapChoices(resource.model.options('actions.GET.source.choices'));
|
||||
|
||||
const label = 'Source';
|
||||
const label = strings.get('labels.SOURCE');
|
||||
const value = choices[source];
|
||||
|
||||
return { label, value };
|
||||
@ -199,7 +197,7 @@ function getOverwriteDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Overwrite';
|
||||
const label = strings.get('labels.OVERWRITE');
|
||||
const value = resource.model.get('overwrite');
|
||||
|
||||
return { label, value };
|
||||
@ -210,7 +208,7 @@ function getOverwriteVarsDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Overwrite Vars';
|
||||
const label = strings.get('labels.OVERWRITE_VARS');
|
||||
const value = resource.model.get('overwrite_vars');
|
||||
|
||||
return { label, value };
|
||||
@ -221,7 +219,7 @@ function getLicenseErrorDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'License Error';
|
||||
const label = strings.get('labels.LICENSE_ERROR');
|
||||
const value = resource.model.get('license_error');
|
||||
|
||||
return { label, value };
|
||||
@ -230,7 +228,6 @@ function getLicenseErrorDetails () {
|
||||
function getLaunchedByDetails () {
|
||||
const createdBy = resource.model.get('summary_fields.created_by');
|
||||
const jobTemplate = resource.model.get('summary_fields.job_template');
|
||||
|
||||
const relatedSchedule = resource.model.get('related.schedule');
|
||||
const schedule = resource.model.get('summary_fields.schedule');
|
||||
|
||||
@ -238,18 +235,18 @@ function getLaunchedByDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Launched By';
|
||||
const label = strings.get('labels.LAUNCHED_BY');
|
||||
|
||||
let link;
|
||||
let tooltip;
|
||||
let value;
|
||||
|
||||
if (createdBy) {
|
||||
tooltip = strings.get('resourceTooltips.USER');
|
||||
tooltip = strings.get('tooltips.USER');
|
||||
link = `/#/users/${createdBy.id}`;
|
||||
value = $filter('sanitize')(createdBy.username);
|
||||
} else if (relatedSchedule && jobTemplate) {
|
||||
tooltip = strings.get('resourceTooltips.SCHEDULE');
|
||||
tooltip = strings.get('tooltips.SCHEDULE');
|
||||
link = `/#/templates/job_template/${jobTemplate.id}/schedules/${schedule.id}`;
|
||||
value = $filter('sanitize')(schedule.name);
|
||||
} else {
|
||||
@ -268,8 +265,8 @@ function getInventoryDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Inventory';
|
||||
const tooltip = strings.get('resourceTooltips.INVENTORY');
|
||||
const label = strings.get('labels.INVENTORY');
|
||||
const tooltip = strings.get('tooltips.INVENTORY');
|
||||
const value = $filter('sanitize')(inventory.name);
|
||||
|
||||
let link;
|
||||
@ -290,10 +287,10 @@ function getProjectDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Project';
|
||||
const label = strings.get('labels.PROJECT');
|
||||
const link = `/#/projects/${project.id}`;
|
||||
const value = $filter('sanitize')(project.name);
|
||||
const tooltip = strings.get('resourceTooltips.PROJECT');
|
||||
const tooltip = strings.get('tooltips.PROJECT');
|
||||
|
||||
return { label, link, value, tooltip };
|
||||
}
|
||||
@ -318,13 +315,13 @@ function getProjectUpdateDetails (updateId) {
|
||||
}
|
||||
|
||||
const link = `/#/jobs/project/${jobId}`;
|
||||
const tooltip = strings.get('resourceTooltips.PROJECT_UPDATE');
|
||||
const tooltip = strings.get('tooltips.PROJECT_UPDATE');
|
||||
|
||||
return { link, tooltip };
|
||||
}
|
||||
|
||||
function getSCMRevisionDetails () {
|
||||
const label = 'Revision';
|
||||
const label = strings.get('labels.SCM_REVISION');
|
||||
const value = resource.model.get('scm_revision');
|
||||
|
||||
if (!value) {
|
||||
@ -335,7 +332,7 @@ function getSCMRevisionDetails () {
|
||||
}
|
||||
|
||||
function getPlaybookDetails () {
|
||||
const label = 'Playbook';
|
||||
const label = strings.get('labels.PLAYBOOK');
|
||||
const value = resource.model.get('playbook');
|
||||
|
||||
if (!value) {
|
||||
@ -353,7 +350,7 @@ function getJobExplanationDetails () {
|
||||
}
|
||||
|
||||
const limit = 150;
|
||||
const label = 'Explanation';
|
||||
const label = strings.get('labels.JOB_EXPLANATION');
|
||||
|
||||
let more = explanation;
|
||||
|
||||
@ -380,7 +377,7 @@ function getResultTracebackDetails () {
|
||||
}
|
||||
|
||||
const limit = 150;
|
||||
const label = 'Error Details';
|
||||
const label = strings.get('labels.RESULT_TRACEBACK');
|
||||
|
||||
const more = traceback;
|
||||
const less = $filter('limitTo')(more, limit);
|
||||
@ -398,25 +395,25 @@ function getCredentialDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
let label = 'Credential';
|
||||
let label = strings.get('labels.CREDENTIAL');
|
||||
|
||||
if (resource.type === 'playbook') {
|
||||
label = 'Machine Credential';
|
||||
label = strings.get('labels.MACHINE_CREDENTIAL');
|
||||
}
|
||||
|
||||
if (resource.type === 'inventory') {
|
||||
label = 'Source Credential';
|
||||
label = strings.get('labels.SOURCE_CREDENTIAL');
|
||||
}
|
||||
|
||||
const link = `/#/credentials/${credential.id}`;
|
||||
const tooltip = strings.get('resourceTooltips.CREDENTIAL');
|
||||
const tooltip = strings.get('tooltips.CREDENTIAL');
|
||||
const value = $filter('sanitize')(credential.name);
|
||||
|
||||
return { label, link, tooltip, value };
|
||||
}
|
||||
|
||||
function getForkDetails () {
|
||||
const label = 'Forks';
|
||||
const label = strings.get('labels.FORKS');
|
||||
const value = resource.model.get('forks');
|
||||
|
||||
if (!value) {
|
||||
@ -427,7 +424,7 @@ function getForkDetails () {
|
||||
}
|
||||
|
||||
function getLimitDetails () {
|
||||
const label = 'Limit';
|
||||
const label = strings.get('labels.LIMIT');
|
||||
const value = resource.model.get('limit');
|
||||
|
||||
if (!value) {
|
||||
@ -444,13 +441,13 @@ function getInstanceGroupDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Instance Group';
|
||||
const label = strings.get('labels.INSTANCE_GROUP');
|
||||
const value = $filter('sanitize')(instanceGroup.name);
|
||||
|
||||
let isolated = null;
|
||||
|
||||
if (instanceGroup.controller_id) {
|
||||
isolated = 'Isolated';
|
||||
isolated = strings.get('details.ISOLATED');
|
||||
}
|
||||
|
||||
return { label, value, isolated };
|
||||
@ -471,7 +468,7 @@ function getJobTagDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Job Tags';
|
||||
const label = strings.get('labels.JOB_TAGS');
|
||||
const more = false;
|
||||
|
||||
const value = jobTags.map($filter('sanitize'));
|
||||
@ -494,8 +491,8 @@ function getSkipTagDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Skip Tags';
|
||||
const more = false;
|
||||
const label = strings.get('labels.SKIP_TAGS');
|
||||
const value = skipTags.map($filter('sanitize'));
|
||||
|
||||
return { label, more, value };
|
||||
@ -508,8 +505,8 @@ function getExtraVarsDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Extra Variables';
|
||||
const tooltip = 'Read-only view of extra variables added to the job template.';
|
||||
const label = strings.get('labels.EXTRA_VARS');
|
||||
const tooltip = strings.get('tooltips.EXTRA_VARS');
|
||||
const value = parse(extraVars);
|
||||
const disabled = true;
|
||||
|
||||
@ -523,7 +520,7 @@ function getLabelDetails () {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label = 'Labels';
|
||||
const label = strings.get('labels.LABELS');
|
||||
const more = false;
|
||||
|
||||
const value = jobLabels.map(({ name }) => name).map($filter('sanitize'));
|
||||
@ -663,6 +660,7 @@ function JobDetailsController (
|
||||
|
||||
vm.$onInit = () => {
|
||||
resource = this.resource; // eslint-disable-line prefer-destructuring
|
||||
vm.strings = strings;
|
||||
|
||||
vm.status = getStatusDetails();
|
||||
vm.started = getStartDetails();
|
||||
@ -726,7 +724,7 @@ JobDetailsController.$inject = [
|
||||
'$state',
|
||||
'ProcessErrors',
|
||||
'Prompt',
|
||||
'JobStrings',
|
||||
'OutputStrings',
|
||||
'Wait',
|
||||
'ParseVariableString',
|
||||
'JobStatusService',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!-- todo: styling, css etc. - disposition according to project lib conventions -->
|
||||
<div class="JobResults-panelHeader">
|
||||
<div class="JobResults-panelHeaderText" translate> DETAILS</div>
|
||||
<div class="JobResults-panelHeaderText"> {{:: vm.strings.get('details.HEADER')}}</div>
|
||||
<!-- LEFT PANE HEADER ACTIONS -->
|
||||
<div class="JobResults-panelHeaderButtonActions">
|
||||
<!-- RELAUNCH ACTION -->
|
||||
@ -14,7 +14,7 @@
|
||||
ng-show="vm.status.value === 'Pending' ||
|
||||
vm.status.value === 'Waiting' ||
|
||||
vm.status.value === 'Running'"
|
||||
aw-tool-tip="{{'Cancel' | translate }}"
|
||||
aw-tool-tip="{{:: vm.strings.get('tooltips.CANCEL') }}"
|
||||
data-original-title=""
|
||||
title="">
|
||||
<i class="fa fa-minus-circle"></i>
|
||||
@ -31,7 +31,7 @@
|
||||
vm.status.value === 'Failed' ||
|
||||
vm.status.value === 'Error' ||
|
||||
vm.status.value === 'Canceled')"
|
||||
aw-tool-tip="{{ 'Delete' | translate }}"
|
||||
aw-tool-tip="{{:: vm.strings.get('tooltips.DELETE') }}"
|
||||
data-original-title=""
|
||||
title="">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
@ -71,7 +71,7 @@
|
||||
<span ng-show="vm.jobExplanation.hasMoreToShow"
|
||||
class="JobResults-seeMoreLess"
|
||||
ng-click="vm.jobExplanation.showMore = true">
|
||||
Show More
|
||||
{{:: vm.strings.get('details.SHOW_MORE') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="JobResults-resultRowText"
|
||||
@ -79,7 +79,7 @@
|
||||
{{ vm.jobExplanation.more }}
|
||||
<span class="JobResults-seeMoreLess"
|
||||
ng-click="vm.jobExplanation.showMore = false">
|
||||
Show Less
|
||||
{{:: vm.strings.get('details.SHOW_LESS') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -124,7 +124,7 @@
|
||||
<span ng-show="vm.resultTraceback.hasMoreToShow"
|
||||
class="JobResults-seeMoreLess"
|
||||
ng-click="vm.resultTraceback.showMore = true">
|
||||
Show More
|
||||
{{:: vm.strings.get('details.SHOW_MORE') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="JobResults-resultRowText"
|
||||
@ -132,7 +132,7 @@
|
||||
{{ vm.resultTraceback.more }}
|
||||
<span class="JobResults-seeMoreLess"
|
||||
ng-click="vm.resultTraceback.showMore = false">
|
||||
Show Less
|
||||
{{:: vm.strings.get('details.SHOW_LESS') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -298,14 +298,14 @@
|
||||
ng-show="vm.labels.more"
|
||||
href=""
|
||||
ng-click="vm.toggleLabels()">
|
||||
<span translate>{{ vm.labels.label }}</span>
|
||||
<span>{{ vm.labels.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-right"></i>
|
||||
</a>
|
||||
<a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
|
||||
ng-show="!vm.labels.more"
|
||||
href=""
|
||||
ng-click="vm.toggleLabels()">
|
||||
<span translate>{{ vm.labels.label }}</span>
|
||||
<span>{{ vm.labels.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -323,14 +323,14 @@
|
||||
ng-show="vm.jobTags.more"
|
||||
href=""
|
||||
ng-click="vm.toggleJobTags()">
|
||||
<span translate>{{ vm.jobTags.label }}</span>
|
||||
<span>{{ vm.jobTags.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-right"></i>
|
||||
</a>
|
||||
<a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
|
||||
ng-show="!vm.jobTags.more"
|
||||
href=""
|
||||
ng-click="vm.toggleJobTags()">
|
||||
<span translate>{{ vm.jobTags.label }}</span>
|
||||
<span>{{ vm.jobTags.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -348,14 +348,14 @@
|
||||
ng-show="vm.skipTags.more"
|
||||
href=""
|
||||
ng-click="vm.toggleSkipTags()">
|
||||
<span translate>{{ vm.skipTags.label }}</span>
|
||||
<span>{{ vm.skipTags.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-right"></i>
|
||||
</a>
|
||||
<a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
|
||||
ng-show="!vm.skipTags.more"
|
||||
href=""
|
||||
ng-click="vm.toggleSkipTags()">
|
||||
<span translate>{{ vm.skipTags.label }}</span>
|
||||
<span>{{ vm.skipTags.label }}</span>
|
||||
<i class="JobResults-expandArrow fa fa-caret-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
let $compile;
|
||||
let $filter;
|
||||
let $q;
|
||||
let $scope;
|
||||
|
||||
let page;
|
||||
let render;
|
||||
let resource;
|
||||
@ -13,29 +15,34 @@ let streaming;
|
||||
let listeners = [];
|
||||
|
||||
function JobsIndexController (
|
||||
_$compile_,
|
||||
_$filter_,
|
||||
_$q_,
|
||||
_$scope_,
|
||||
_resource_,
|
||||
_page_,
|
||||
_scroll_,
|
||||
_render_,
|
||||
_engine_,
|
||||
_$scope_,
|
||||
_$compile_,
|
||||
_$q_,
|
||||
_status_,
|
||||
_strings_,
|
||||
) {
|
||||
vm = this || {};
|
||||
|
||||
$compile = _$compile_;
|
||||
$scope = _$scope_;
|
||||
$filter = _$filter_;
|
||||
$q = _$q_;
|
||||
resource = _resource_;
|
||||
$scope = _$scope_;
|
||||
|
||||
resource = _resource_;
|
||||
page = _page_;
|
||||
scroll = _scroll_;
|
||||
render = _render_;
|
||||
engine = _engine_;
|
||||
status = _status_;
|
||||
|
||||
vm.strings = _strings_;
|
||||
|
||||
// Development helper(s)
|
||||
vm.clear = devClear;
|
||||
|
||||
@ -45,7 +52,7 @@ function JobsIndexController (
|
||||
|
||||
// Panel
|
||||
vm.resource = resource;
|
||||
vm.title = resource.model.get('name');
|
||||
vm.title = $filter('sanitize')(resource.model.get('name'));
|
||||
|
||||
// Stdout Navigation
|
||||
vm.scroll = {
|
||||
@ -386,15 +393,17 @@ function devClear () {
|
||||
// }
|
||||
|
||||
JobsIndexController.$inject = [
|
||||
'$compile',
|
||||
'$filter',
|
||||
'$q',
|
||||
'$scope',
|
||||
'resource',
|
||||
'JobPageService',
|
||||
'JobScrollService',
|
||||
'JobRenderService',
|
||||
'JobEventEngine',
|
||||
'$scope',
|
||||
'$compile',
|
||||
'$q',
|
||||
'JobStatusService',
|
||||
'OutputStrings',
|
||||
];
|
||||
|
||||
module.exports = JobsIndexController;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import atLibModels from '~models';
|
||||
import atLibComponents from '~components';
|
||||
|
||||
import Strings from '~features/output/jobs.strings';
|
||||
import Strings from '~features/output/output.strings';
|
||||
import Controller from '~features/output/index.controller';
|
||||
import PageService from '~features/output/page.service';
|
||||
import RenderService from '~features/output/render.service';
|
||||
@ -241,7 +241,7 @@ function JobsRun ($stateRegistry, $filter, strings) {
|
||||
$stateRegistry.register(state);
|
||||
}
|
||||
|
||||
JobsRun.$inject = ['$stateRegistry', '$filter', 'JobStrings'];
|
||||
JobsRun.$inject = ['$stateRegistry', '$filter', 'OutputStrings'];
|
||||
|
||||
angular
|
||||
.module(MODULE_NAME, [
|
||||
@ -249,7 +249,7 @@ angular
|
||||
atLibComponents,
|
||||
HostEvent
|
||||
])
|
||||
.service('JobStrings', Strings)
|
||||
.service('OutputStrings', Strings)
|
||||
.service('JobPageService', PageService)
|
||||
.service('JobScrollService', ScrollService)
|
||||
.service('JobRenderService', RenderService)
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<div ng-show="vm.scroll.showBackToTop" class="at-Stdout-menuBottom">
|
||||
<div class="at-Stdout-menuIconGroup" ng-click="vm.scroll.home()">
|
||||
<p class="pull-left"><i class="fa fa-angle-double-up"></i></p>
|
||||
<p class="pull-right">Back to Top</p>
|
||||
<p class="pull-right">{{ vm.strings.get('stdout.BACK_TO_TOP') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="at-u-clear"></div>
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
function JobsStrings (BaseString) {
|
||||
BaseString.call(this, 'jobs');
|
||||
|
||||
const { t } = this;
|
||||
const ns = this.jobs;
|
||||
|
||||
ns.state = {
|
||||
BREADCRUMB_DEFAULT: t.s('RESULTS'),
|
||||
};
|
||||
|
||||
ns.status = {
|
||||
RUNNING: t.s('The host status bar will update when the job is complete.'),
|
||||
UNAVAILABLE: t.s('Host status information for this job is unavailable.'),
|
||||
};
|
||||
|
||||
ns.resourceTooltips = {
|
||||
USER: t.s('View the User'),
|
||||
SCHEDULE: t.s('View the Schedule'),
|
||||
INVENTORY: t.s('View the Inventory'),
|
||||
CREDENTIAL: t.s('View the Credential'),
|
||||
JOB_TEMPLATE: t.s('View the Job Template'),
|
||||
SOURCE_WORKFLOW_JOB: t.s('View the source Workflow Job'),
|
||||
PROJECT: t.s('View the Project'),
|
||||
PROJECT_UPDATE: t.s('View Project checkout results')
|
||||
};
|
||||
|
||||
ns.expandCollapse = {
|
||||
EXPAND: t.s('Expand Output'),
|
||||
COLLAPSE: t.s('Collapse Output')
|
||||
};
|
||||
}
|
||||
|
||||
JobsStrings.$inject = ['BaseStringService'];
|
||||
|
||||
export default JobsStrings;
|
||||
99
awx/ui/client/features/output/output.strings.js
Normal file
99
awx/ui/client/features/output/output.strings.js
Normal file
@ -0,0 +1,99 @@
|
||||
function OutputStrings (BaseString) {
|
||||
BaseString.call(this, 'output');
|
||||
|
||||
const { t } = this;
|
||||
const ns = this.output;
|
||||
|
||||
ns.state = {
|
||||
BREADCRUMB_DEFAULT: t.s('RESULTS'),
|
||||
};
|
||||
|
||||
ns.status = {
|
||||
RUNNING: t.s('The host status bar will update when the job is complete.'),
|
||||
UNAVAILABLE: t.s('Host status information for this job is unavailable.'),
|
||||
};
|
||||
|
||||
ns.tooltips = {
|
||||
CANCEL: t.s('Cancel'),
|
||||
COLLAPSE_OUTPUT: t.s('Collapse Output'),
|
||||
DELETE: t.s('Delete'),
|
||||
DOWNLOAD_OUTPUT: t.s('Download Output'),
|
||||
CREDENTIAL: t.s('View the Credential'),
|
||||
EXPAND_OUTPUT: t.s('Expand Output'),
|
||||
EXTRA_VARS: t.s('Read-only view of extra variables added to the job template.'),
|
||||
INVENTORY: t.s('View the Inventory'),
|
||||
JOB_TEMPLATE: t.s('View the Job Template'),
|
||||
PROJECT: t.s('View the Project'),
|
||||
PROJECT_UPDATE: t.s('View Project checkout results'),
|
||||
SCHEDULE: t.s('View the Schedule'),
|
||||
SOURCE_WORKFLOW_JOB: t.s('View the source Workflow Job'),
|
||||
USER: t.s('View the User'),
|
||||
};
|
||||
|
||||
ns.details = {
|
||||
HEADER: t.s('Details'),
|
||||
ISOLATED: t.s('Isolated'),
|
||||
NOT_FINISHED: t.s('Not Finished'),
|
||||
NOT_STARTED: t.s('Not Started'),
|
||||
SHOW_LESS: t.s('Show Less'),
|
||||
SHOW_MORE: t.s('Show More'),
|
||||
};
|
||||
|
||||
ns.labels = {
|
||||
CREDENTIAL: t.s('Credential'),
|
||||
EXTRA_VARS: t.s('Extra Variables'),
|
||||
FINISHED: t.s('Finished'),
|
||||
FORKS: t.s('Forks'),
|
||||
INSTANCE_GROUP: t.s('Instance Group'),
|
||||
INVENTORY: t.s('Inventory'),
|
||||
JOB_EXPLANATION: t.s('Explanation'),
|
||||
JOB_TAGS: t.s('Job Tags'),
|
||||
JOB_TEMPLATE: t.s('Job Template'),
|
||||
JOB_TYPE: t.s('Job Type'),
|
||||
LABELS: t.s('Labels'),
|
||||
LAUNCHED_BY: t.s('Launched By'),
|
||||
LICENSE_ERROR: t.s('License Error'),
|
||||
LIMIT: t.s('Limit'),
|
||||
MACHINE_CREDENTIAL: t.s('Machine Credential'),
|
||||
MODULE_ARGS: t.s('Module Args'),
|
||||
NAME: t.s('Name'),
|
||||
OVERWRITE: t.s('Overwrite'),
|
||||
OVERWRITE_VARS: t.s('Overwrite Vars'),
|
||||
PLAYBOOK: t.s('Playbook'),
|
||||
PROJECT: t.s('Project'),
|
||||
RESULT_TRACEBACK: t.s('Error Details'),
|
||||
SCM_REVISION: t.s('Revision'),
|
||||
SKIP_TAGS: t.s('Skip Tags'),
|
||||
SOURCE: t.s('Source'),
|
||||
SOURCE_CREDENTIAL: t.s('Source Credential'),
|
||||
STARTED: t.s('Started'),
|
||||
STATUS: t.s('Status'),
|
||||
VERBOSITY: t.s('Verbosity'),
|
||||
};
|
||||
|
||||
ns.search = {
|
||||
ADDITIONAL_INFORMATION_HEADER: t.s('ADDITIONAL_INFORMATION'),
|
||||
ADDITIONAL_INFORMATION: t.s('For additional information on advanced search search syntax please see the Ansible Tower'),
|
||||
CLEAR_ALL: t.s('CLEAR ALL'),
|
||||
DOCUMENTATION: t.s('documentation'),
|
||||
EXAMPLES: t.s('EXAMPLES'),
|
||||
FIELDS: t.s('FIELDS'),
|
||||
KEY: t.s('KEY'),
|
||||
PLACEHOLDER_DEFAULT: t.s('SEARCH'),
|
||||
PLACEHOLDER_RUNNING: t.s('JOB IS STILL RUNNING'),
|
||||
REJECT_DEFAULT: t.s('Failed to update search results.'),
|
||||
REJECT_INVALID: t.s('Invalid search filter provided.'),
|
||||
};
|
||||
|
||||
ns.stats = {
|
||||
ELAPSED: t.s('Elapsed'),
|
||||
};
|
||||
|
||||
ns.stdout = {
|
||||
BACK_TO_TOP: t.s('Back to Top'),
|
||||
};
|
||||
}
|
||||
|
||||
OutputStrings.$inject = ['BaseStringService'];
|
||||
|
||||
export default OutputStrings;
|
||||
@ -3,14 +3,11 @@ const templateUrl = require('~features/output/search.partial.html');
|
||||
const searchReloadOptions = { inherit: false, location: 'replace' };
|
||||
const searchKeyExamples = ['host_name:localhost', 'task:set', 'created:>=2000-01-01'];
|
||||
const searchKeyFields = ['changed', 'created', 'failed', 'host_name', 'stdout', 'task', 'role', 'playbook', 'play'];
|
||||
|
||||
const PLACEHOLDER_RUNNING = 'CANNOT SEARCH RUNNING JOB';
|
||||
const PLACEHOLDER_DEFAULT = 'SEARCH';
|
||||
const REJECT_DEFAULT = 'Failed to update search results.';
|
||||
const REJECT_INVALID = 'Invalid search filter provided.';
|
||||
const searchKeyDocLink = 'https://docs.ansible.com/ansible-tower/3.3.0/html/userguide/search_sort.html';
|
||||
|
||||
let $state;
|
||||
let qs;
|
||||
let strings;
|
||||
|
||||
let vm;
|
||||
|
||||
@ -32,7 +29,7 @@ function getSearchTags (queryset) {
|
||||
.filter(tag => !tag.startsWith('order_by'));
|
||||
}
|
||||
|
||||
function reloadQueryset (queryset, rejection = REJECT_DEFAULT) {
|
||||
function reloadQueryset (queryset, rejection = strings.get('search.REJECT_DEFAULT')) {
|
||||
const params = angular.copy($state.params);
|
||||
const currentTags = vm.tags;
|
||||
|
||||
@ -72,23 +69,25 @@ function submitSearch () {
|
||||
const searchInputQueryset = qs.getSearchInputQueryset(vm.value, isFilterable);
|
||||
const modifiedQueryset = qs.mergeQueryset(currentQueryset, searchInputQueryset);
|
||||
|
||||
reloadQueryset(modifiedQueryset, REJECT_INVALID);
|
||||
reloadQueryset(modifiedQueryset, strings.get('search.REJECT_INVALID'));
|
||||
}
|
||||
|
||||
function clearSearch () {
|
||||
reloadQueryset();
|
||||
}
|
||||
|
||||
function JobSearchController (_$state_, _qs_, { subscribe }) {
|
||||
function JobSearchController (_$state_, _qs_, _strings_, { subscribe }) {
|
||||
$state = _$state_;
|
||||
qs = _qs_;
|
||||
strings = _strings_;
|
||||
|
||||
vm = this || {};
|
||||
vm.strings = strings;
|
||||
|
||||
vm.examples = searchKeyExamples;
|
||||
vm.fields = searchKeyFields;
|
||||
vm.docLink = searchKeyDocLink;
|
||||
vm.relatedFields = [];
|
||||
vm.placeholder = PLACEHOLDER_DEFAULT;
|
||||
|
||||
vm.clearSearch = clearSearch;
|
||||
vm.toggleSearchKey = toggleSearchKey;
|
||||
@ -103,11 +102,12 @@ function JobSearchController (_$state_, _qs_, { subscribe }) {
|
||||
vm.key = false;
|
||||
vm.rejected = false;
|
||||
vm.disabled = true;
|
||||
vm.running = false;
|
||||
vm.tags = getSearchTags(getCurrentQueryset());
|
||||
|
||||
unsubscribe = subscribe(({ running }) => {
|
||||
vm.disabled = running;
|
||||
vm.placeholder = running ? PLACEHOLDER_RUNNING : PLACEHOLDER_DEFAULT;
|
||||
vm.running = running;
|
||||
});
|
||||
};
|
||||
|
||||
@ -119,6 +119,7 @@ function JobSearchController (_$state_, _qs_, { subscribe }) {
|
||||
JobSearchController.$inject = [
|
||||
'$state',
|
||||
'QuerySet',
|
||||
'OutputStrings',
|
||||
'JobStatusService',
|
||||
];
|
||||
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
class="form-control at-Input"
|
||||
ng-class="{ 'at-Input--rejected': vm.rejected }"
|
||||
ng-model="vm.value"
|
||||
ng-attr-placeholder="{{ vm.placeholder }}"
|
||||
ng-attr-placeholder="{{ vm.running ? vm.strings.get('search.PLACEHOLDER_RUNNING') :
|
||||
vm.strings.get('search.PLACEHOLDER_DEFAULT') }}"
|
||||
ng-disabled="vm.disabled">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn at-ButtonHollow--default at-Input-button"
|
||||
@ -18,13 +19,15 @@
|
||||
ng-if="vm.key"
|
||||
ng-disabled="vm.disabled"
|
||||
ng-click="vm.toggleSearchKey()"
|
||||
type="button"> key
|
||||
type="button">
|
||||
{{:: vm.strings.get('search.KEY') }}
|
||||
</button>
|
||||
<button class="btn at-ButtonHollow--default at-Input-button"
|
||||
ng-if="!vm.key"
|
||||
ng-disabled="vm.disabled"
|
||||
ng-click="vm.toggleSearchKey()"
|
||||
type="button"> key
|
||||
type="button">
|
||||
{{:: vm.strings.get('search.KEY') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@ -40,25 +43,31 @@
|
||||
<i class="fa fa-times LabelList-tagDelete"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div><a href class="jobz-searchClearAll" ng-click="vm.clearSearch()" ng-show="!(vm.tags | isEmpty)">CLEAR ALL</a></div>
|
||||
<div><a href class="jobz-searchClearAll" ng-click="vm.clearSearch()" ng-show="!(vm.tags | isEmpty)">
|
||||
{{:: vm.strings.get('search.CLEAR_ALL') }}
|
||||
</a></div>
|
||||
</div>
|
||||
|
||||
<div class="jobz-searchKeyPaneContainer" ng-show="vm.key">
|
||||
<div class="jobz-searchKeyPane">
|
||||
<div class="SmartSearch-keyRow">
|
||||
<div class="SmartSearch-examples">
|
||||
<div class="SmartSearch-examples--title"><b>EXAMPLES:</b></div>
|
||||
<div class="SmartSearch-examples--search" ng-repeat="tag in vm.examples"> {{ tag }}</div>
|
||||
<div class="SmartSearch-examples--title">
|
||||
<b>{{:: vm.strings.get('search.EXAMPLES') }}:</b>
|
||||
</div>
|
||||
<div class="SmartSearch-examples--search" ng-repeat="tag in vm.examples">{{ tag }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="SmartSearch-keyRow">
|
||||
<b>FIELDS:</b>
|
||||
<b>{{:: vm.strings.get('search.FIELDS') }}:</b>
|
||||
<span ng-repeat="field in vm.fields">{{ field }}<span ng-if="!$last">, </span></span>
|
||||
</div>
|
||||
<div class="SmartSearch-keyRow">
|
||||
<b>ADDITIONAL INFORMATION:</b>
|
||||
For additional information on advanced search search syntax please see the Ansible Tower
|
||||
<a ng-attr-href="undefined" target="_blank">documentation</a>.
|
||||
<b>{{:: vm.strings.get('search.ADDITIONAL_INFORMATION_HEADER') }}:</b>
|
||||
{{:: vm.strings.get('search.ADDITIONAL_INFORMATION') }}
|
||||
<a ng-attr-href="{{ vm.docLink }}" target="_blank">
|
||||
{{:: vm.strings.get('search.DOCUMENTATION') }}.
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -11,6 +11,7 @@ function createStatsBarTooltip (key, count) {
|
||||
|
||||
function JobStatsController (strings, { subscribe }) {
|
||||
vm = this || {};
|
||||
vm.strings = strings;
|
||||
|
||||
let unsubscribe;
|
||||
|
||||
@ -21,7 +22,9 @@ function JobStatsController (strings, { subscribe }) {
|
||||
|
||||
vm.$onInit = () => {
|
||||
vm.download = vm.resource.model.get('related.stdout');
|
||||
vm.toggleStdoutFullscreenTooltip = strings.get('expandCollapse.EXPAND');
|
||||
vm.tooltips.toggleExpand = vm.expanded ?
|
||||
strings.get('tooltips.COLLAPSE_OUTPUT') :
|
||||
strings.get('tooltips.EXPAND_OUTPUT');
|
||||
|
||||
unsubscribe = subscribe(({ running, elapsed, counts, stats, hosts }) => {
|
||||
vm.plays = counts.plays;
|
||||
@ -52,14 +55,14 @@ function JobStatsController (strings, { subscribe }) {
|
||||
|
||||
vm.toggleExpanded = () => {
|
||||
vm.expanded = !vm.expanded;
|
||||
vm.toggleStdoutFullscreenTooltip = vm.expanded ?
|
||||
strings.get('expandCollapse.COLLAPSE') :
|
||||
strings.get('expandCollapse.EXPAND');
|
||||
vm.tooltips.toggleExpand = vm.expanded ?
|
||||
strings.get('tooltips.COLLAPSE_OUTPUT') :
|
||||
strings.get('tooltips.EXPAND_OUTPUT');
|
||||
};
|
||||
}
|
||||
|
||||
JobStatsController.$inject = [
|
||||
'JobStrings',
|
||||
'OutputStrings',
|
||||
'JobStatusService',
|
||||
];
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<span ng-show="!vm.hosts" class="at-Panel-headingTitleBadge">...</span>
|
||||
<span ng-show="vm.hosts" class="at-Panel-headingTitleBadge">{{ vm.hosts }}</span>
|
||||
|
||||
<span class="at-Panel-label">elapsed</span>
|
||||
<span class="at-Panel-label">{{ vm.strings.get('stats.ELAPSED') }}</span>
|
||||
<span ng-show="!vm.elapsed" class="at-Panel-headingTitleBadge">...</span>
|
||||
<span ng-show="vm.elapsed" class="at-Panel-headingTitleBadge">
|
||||
{{ vm.elapsed * 1000 | duration: "hh:mm:ss" }}
|
||||
@ -20,16 +20,15 @@
|
||||
|
||||
<a ng-show="vm.download && !vm.running" href="{{ vm.download }}?format=txt_download">
|
||||
<button class="btn at-Input-button at-u-noBorder"
|
||||
aw-tool-tip="{{ standardOutTooltip }}"
|
||||
data-tip-watch="standardOutTooltip"
|
||||
aw-tool-tip="{{ vm.strings.get('tooltips.DOWNLOAD_OUTPUT') }}"
|
||||
data-placement="top">
|
||||
<i class="fa fa-download"></i>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<button class="btn at-Input-button at-u-noBorder"
|
||||
aw-tool-tip="{{ vm.toggleStdoutFullscreenTooltip }}"
|
||||
data-tip-watch="vm.toggleStdoutFullscreenTooltip"
|
||||
aw-tool-tip="{{ vm.tooltips.toggleExpand }}"
|
||||
data-tip-watch="vm.tooltips.toggleExpand"
|
||||
data-placement="top"
|
||||
ng-class="{'at-Input-button--active': vm.expanded}"
|
||||
ng-click="vm.toggleExpanded()">
|
||||
|
||||
@ -154,6 +154,11 @@ function JobStatusService (moment, message) {
|
||||
const isExpectingStats = this.isExpectingStatsEvent();
|
||||
const isIncomplete = _.includes(INCOMPLETE, status);
|
||||
const isFinished = _.includes(FINISHED, status);
|
||||
const isAlreadyFinished = _.includes(FINISHED, this.state.status);
|
||||
|
||||
if (isAlreadyFinished) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((isExpectingStats && isIncomplete) || (!isExpectingStats && isFinished)) {
|
||||
if (this.latestTime) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user