Skip to content

Commit f517fe8

Browse files
author
OpenShift Bot
authored
Merge pull request #1181 from spadgett/command-args-labels
Merged by openshift-bot
2 parents a2e9c6e + 824288f commit f517fe8

File tree

6 files changed

+61
-26
lines changed

6 files changed

+61
-26
lines changed

app/scripts/controllers/edit/buildConfig.js

+14
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ angular.module('openshiftConsole')
139139
type: {}
140140
};
141141

142+
$scope.getArgumentsDescription = function() {
143+
var commandType = _.get($scope, 'buildHookSelection.type.id', '');
144+
switch (commandType) {
145+
case 'args':
146+
return 'Enter the arguments that will be appended to the default image entry point.';
147+
case 'commandArgs':
148+
return 'Enter the arguments that will be appended to the command.';
149+
case 'scriptArgs':
150+
return 'Enter the arguments that will be appended to the script.';
151+
}
152+
153+
return null;
154+
};
155+
142156
var getInitialBuildHookSelection = function() {
143157
var hasArgs = !_.isEmpty(_.get($scope, 'buildConfig.spec.postCommit.args'));
144158
var hasCommand = !_.isEmpty(_.get($scope, 'buildConfig.spec.postCommit.command'));

app/scripts/directives/editCommand.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ angular.module('openshiftConsole')
77
scope: {
88
args: '=',
99
type: '@',
10+
placeholder: '@',
11+
description: '=',
1012
isRequired: '='
1113
},
1214
templateUrl: 'views/directives/_edit-command.html',

app/views/directives/_edit-command.html

+14-13
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@
3333
</span>
3434
</p>
3535
<div class="form-group">
36-
<label class="sr-only" ng-attr-for="{{id}}-add-arg">Add {{type || 'Command'}}</label>
36+
<label class="sr-only" ng-attr-for="{{id}}-add-arg">
37+
<span ng-if="placeholder">{{placeholder}}</span>
38+
<span ng-if="!placeholder">Add argument</span>
39+
</label>
3740
<!-- Single-line entry -->
3841
<span ng-show="!multiline" class="input-group">
3942
<input type="text"
4043
ng-model="nextArg"
4144
name="nextArg"
4245
ng-attr-id="{{id}}-add-arg"
4346
on-enter="addArg()"
44-
placeholder="Add {{type || 'command'}}"
47+
ng-attr-placeholder="{{placeholder || 'Add argument'}}"
4548
class="form-control"
4649
autocorrect="off"
4750
autocapitalize="off"
@@ -64,7 +67,7 @@
6467
name="nextArg"
6568
rows="10"
6669
ng-attr-id="{{id}}-add-arg"
67-
placeholder="Add {{type || 'command'}}"
70+
ng-attr-placeholder="{{placeholder || 'Add argument'}}"
6871
class="form-control"
6972
autocorrect="off"
7073
autocapitalize="off"
@@ -77,23 +80,21 @@
7780
ng-disabled="!nextArg"
7881
ng-attr-aria-disabled="!nextArg"
7982
role="button">Add</a>
80-
</div>
83+
</div>
8184
</span>
82-
</div>
83-
<div class="help-block">
84-
<div ng-if="!type">
85-
Enter the command to run inside the container. The command is considered successful if its exit code is 0.
86-
Drag and drop command arguments to reorder them.
87-
</div>
88-
<div ng-if="type">
89-
Enter the arguments that will be appended to the container's command. Drag and drop arguments to reorder them.
85+
<div class="help-block">
86+
<span ng-if="description">{{description}}</span>
87+
<span ng-if="!description">
88+
Enter the command to run inside the container. The command is considered successful if its
89+
exit code is 0. Drag and drop to reorder arguments.
90+
</span>
9091
</div>
9192
</div>
9293
<div class="mar-top-sm mar-bottom-md">
9394
<a href="" ng-click="multiline = !multiline">Switch to {{multiline ? 'Single-line' : 'Multiline'}} Editor</a>
9495
<span ng-show="input.args.length">
9596
<span class="action-divider">|</span>
96-
<a href="" ng-click="clear()" role="button">Clear {{ (type || 'Command') | sentenceCase }}</a>
97+
<a href="" ng-click="clear()" role="button">Clear {{ (type || 'Command') | upperFirst }}</a>
9798
</span>
9899
</div>
99100
<!-- Add a hidden input to help with form validation. -->

app/views/edit/build-config.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ <h4>Script</h4>
582582
<h4>Command</h4>
583583
<edit-command
584584
args="updatedBuildConfig.spec.postCommit.command"
585+
placeholder="Add to command"
585586
is-required="true">
586587
</edit-command>
587588
</div>
@@ -590,7 +591,8 @@ <h4>Command</h4>
590591
<h4>Arguments</h4>
591592
<edit-command
592593
args="updatedBuildConfig.spec.postCommit.args"
593-
type="argument"
594+
type="arguments"
595+
description="getArgumentsDescription()"
594596
is-required="true">
595597
</edit-command>
596598
</div>

dist/scripts/scripts.js

+15
Original file line numberDiff line numberDiff line change
@@ -7178,6 +7178,19 @@ id:"scriptArgs",
71787178
label:"Shell script with arguments"
71797179
} ], a.buildHookSelection = {
71807180
type:{}
7181+
}, a.getArgumentsDescription = function() {
7182+
var b = _.get(a, "buildHookSelection.type.id", "");
7183+
switch (b) {
7184+
case "args":
7185+
return "Enter the arguments that will be appended to the default image entry point.";
7186+
7187+
case "commandArgs":
7188+
return "Enter the arguments that will be appended to the command.";
7189+
7190+
case "scriptArgs":
7191+
return "Enter the arguments that will be appended to the script.";
7192+
}
7193+
return null;
71817194
};
71827195
var n = function() {
71837196
var b = !_.isEmpty(_.get(a, "buildConfig.spec.postCommit.args")), c = !_.isEmpty(_.get(a, "buildConfig.spec.postCommit.command")), d = !!_.get(a, "buildConfig.spec.postCommit.script");
@@ -12887,6 +12900,8 @@ restrict:"E",
1288712900
scope:{
1288812901
args:"=",
1288912902
type:"@",
12903+
placeholder:"@",
12904+
description:"=",
1289012905
isRequired:"="
1289112906
},
1289212907
templateUrl:"views/directives/_edit-command.html",

dist/scripts/templates.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -5839,37 +5839,38 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
58395839
"</span>\n" +
58405840
"</p>\n" +
58415841
"<div class=\"form-group\">\n" +
5842-
"<label class=\"sr-only\" ng-attr-for=\"{{id}}-add-arg\">Add {{type || 'Command'}}</label>\n" +
5842+
"<label class=\"sr-only\" ng-attr-for=\"{{id}}-add-arg\">\n" +
5843+
"<span ng-if=\"placeholder\">{{placeholder}}</span>\n" +
5844+
"<span ng-if=\"!placeholder\">Add argument</span>\n" +
5845+
"</label>\n" +
58435846
"\n" +
58445847
"<span ng-show=\"!multiline\" class=\"input-group\">\n" +
5845-
"<input type=\"text\" ng-model=\"nextArg\" name=\"nextArg\" ng-attr-id=\"{{id}}-add-arg\" on-enter=\"addArg()\" placeholder=\"Add {{type || 'command'}}\" class=\"form-control\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\">\n" +
5848+
"<input type=\"text\" ng-model=\"nextArg\" name=\"nextArg\" ng-attr-id=\"{{id}}-add-arg\" on-enter=\"addArg()\" ng-attr-placeholder=\"{{placeholder || 'Add argument'}}\" class=\"form-control\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\">\n" +
58465849
"<span class=\"input-group-btn\">\n" +
58475850
"\n" +
58485851
"<a class=\"btn btn-default\" href=\"\" ng-click=\"addArg()\" ng-disabled=\"!nextArg\" ng-attr-aria-disabled=\"!nextArg\" role=\"button\">Add</a>\n" +
58495852
"</span>\n" +
58505853
"</span>\n" +
58515854
"\n" +
58525855
"<span ng-show=\"multiline\">\n" +
5853-
"<textarea ng-model=\"nextArg\" name=\"nextArg\" rows=\"10\" ng-attr-id=\"{{id}}-add-arg\" placeholder=\"Add {{type || 'command'}}\" class=\"form-control\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\">\n" +
5856+
"<textarea ng-model=\"nextArg\" name=\"nextArg\" rows=\"10\" ng-attr-id=\"{{id}}-add-arg\" ng-attr-placeholder=\"{{placeholder || 'Add argument'}}\" class=\"form-control\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\">\n" +
58545857
" </textarea>\n" +
58555858
"<div class=\"mar-top-md\">\n" +
58565859
"<a class=\"btn btn-default\" href=\"\" ng-click=\"addArg()\" ng-disabled=\"!nextArg\" ng-attr-aria-disabled=\"!nextArg\" role=\"button\">Add</a>\n" +
58575860
"</div>\n" +
58585861
"</span>\n" +
5859-
"</div>\n" +
58605862
"<div class=\"help-block\">\n" +
5861-
"<div ng-if=\"!type\">\n" +
5862-
"Enter the command to run inside the container. The command is considered successful if its exit code is 0. Drag and drop command arguments to reorder them.\n" +
5863-
"</div>\n" +
5864-
"<div ng-if=\"type\">\n" +
5865-
"Enter the arguments that will be appended to the container's command. Drag and drop arguments to reorder them.\n" +
5863+
"<span ng-if=\"description\">{{description}}</span>\n" +
5864+
"<span ng-if=\"!description\">\n" +
5865+
"Enter the command to run inside the container. The command is considered successful if its exit code is 0. Drag and drop to reorder arguments.\n" +
5866+
"</span>\n" +
58665867
"</div>\n" +
58675868
"</div>\n" +
58685869
"<div class=\"mar-top-sm mar-bottom-md\">\n" +
58695870
"<a href=\"\" ng-click=\"multiline = !multiline\">Switch to {{multiline ? 'Single-line' : 'Multiline'}} Editor</a>\n" +
58705871
"<span ng-show=\"input.args.length\">\n" +
58715872
"<span class=\"action-divider\">|</span>\n" +
5872-
"<a href=\"\" ng-click=\"clear()\" role=\"button\">Clear {{ (type || 'Command') | sentenceCase }}</a>\n" +
5873+
"<a href=\"\" ng-click=\"clear()\" role=\"button\">Clear {{ (type || 'Command') | upperFirst }}</a>\n" +
58735874
"</span>\n" +
58745875
"</div>\n" +
58755876
"\n" +
@@ -9356,12 +9357,12 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
93569357
"</div>\n" +
93579358
"<div ng-if=\"buildHookSelection.type.id === 'command' || buildHookSelection.type.id === 'commandArgs'\">\n" +
93589359
"<h4>Command</h4>\n" +
9359-
"<edit-command args=\"updatedBuildConfig.spec.postCommit.command\" is-required=\"true\">\n" +
9360+
"<edit-command args=\"updatedBuildConfig.spec.postCommit.command\" placeholder=\"Add to command\" is-required=\"true\">\n" +
93609361
"</edit-command>\n" +
93619362
"</div>\n" +
93629363
"<div ng-if=\"buildHookSelection.type.id === 'args' || buildHookSelection.type.id === 'commandArgs' || buildHookSelection.type.id === 'scriptArgs' \">\n" +
93639364
"<h4>Arguments</h4>\n" +
9364-
"<edit-command args=\"updatedBuildConfig.spec.postCommit.args\" type=\"argument\" is-required=\"true\">\n" +
9365+
"<edit-command args=\"updatedBuildConfig.spec.postCommit.args\" type=\"arguments\" description=\"getArgumentsDescription()\" is-required=\"true\">\n" +
93659366
"</edit-command>\n" +
93669367
"</div>\n" +
93679368
"</fieldset>\n" +

0 commit comments

Comments
 (0)