Skip to content

Commit 0b1435e

Browse files
author
OpenShift Bot
authored
Merge pull request #1073 from spadgett/show-prefilled-source-context
Merged by openshift-bot
2 parents 3453605 + b813cb8 commit 0b1435e

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

Diff for: app/scripts/controllers/create/createFromImage.js

+5
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ angular.module("openshiftConsole")
133133
scope.buildConfig.sourceUrl = annotations.sampleRepo || "";
134134
scope.buildConfig.gitRef = annotations.sampleRef || "";
135135
scope.buildConfig.contextDir = annotations.sampleContextDir || "";
136+
if (annotations.sampleRef || annotations.sampleContextDir) {
137+
// Show the advanced source options (without exapnding all
138+
// advanced options) if the sample repo uses it.
139+
scope.advancedSourceOptions = true;
140+
}
136141
};
137142

138143
scope.usingSampleRepo = function() {

Diff for: app/views/create/fromimage.html

+19-18
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@
7171
</div>
7272
<div class="row">
7373
<div ng-class="{
74-
'col-md-8': advancedOptions,
75-
'col-lg-12': !advancedOptions}">
74+
'col-md-8': advancedOptions || advancedSourceOptions,
75+
'col-lg-12': !advancedOptions && !advancedSourceOptions
76+
}">
7677
<div class="form-group">
7778
<label for="sourceUrl" class="required">Git Repository URL</label>
7879
<div ng-class="{
@@ -107,7 +108,7 @@
107108
</div>
108109
</div>
109110

110-
<div class="col-md-4" ng-if="advancedOptions">
111+
<div class="col-md-4" ng-if="advancedOptions || advancedSourceOptions">
111112
<div class="form-group">
112113
<label for="gitref">Git Reference</label>
113114
<div>
@@ -126,23 +127,23 @@
126127
</div>
127128
</div>
128129

129-
<div ng-if="advancedOptions">
130-
<div class="form-group">
131-
<label for="contextdir">Context Dir</label>
132-
<div>
133-
<input
134-
id="contextdir"
135-
ng-model="buildConfig.contextDir"
136-
type="text"
137-
placeholder="/"
138-
autocorrect="off"
139-
autocapitalize="off"
140-
spellcheck="false"
141-
class="form-control">
142-
</div>
143-
<div class="help-block">Optional subdirectory for the application source code, used as the context directory for the build.</div>
130+
<div ng-if="advancedOptions || advancedSourceOptions" class="form-group">
131+
<label for="contextdir">Context Dir</label>
132+
<div>
133+
<input
134+
id="contextdir"
135+
ng-model="buildConfig.contextDir"
136+
type="text"
137+
placeholder="/"
138+
autocorrect="off"
139+
autocapitalize="off"
140+
spellcheck="false"
141+
class="form-control">
144142
</div>
143+
<div class="help-block">Optional subdirectory for the application source code, used as the context directory for the build.</div>
144+
</div>
145145

146+
<div ng-if="advancedOptions">
146147
<div class="form-group">
147148
<osc-secrets model="buildConfig.secrets.gitSecret"
148149
namespace="projectName"

Diff for: dist/scripts/scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7806,7 +7806,7 @@ value:!0
78067806
resources:{}
78077807
}, b.cpuRequestCalculated = j.isRequestCalculated("cpu", e), b.cpuLimitCalculated = j.isLimitCalculated("cpu", e), b.memoryRequestCalculated = j.isRequestCalculated("memory", e), b.fillSampleRepo = function() {
78087808
var a;
7809-
(b.image || b.image.metadata || b.image.metadata.annotations) && (a = b.image.metadata.annotations, b.buildConfig.sourceUrl = a.sampleRepo || "", b.buildConfig.gitRef = a.sampleRef || "", b.buildConfig.contextDir = a.sampleContextDir || "");
7809+
(b.image || b.image.metadata || b.image.metadata.annotations) && (a = b.image.metadata.annotations, b.buildConfig.sourceUrl = a.sampleRepo || "", b.buildConfig.gitRef = a.sampleRef || "", b.buildConfig.contextDir = a.sampleContextDir || "", (a.sampleRef || a.sampleContextDir) && (b.advancedSourceOptions = !0));
78107810
}, b.usingSampleRepo = function() {
78117811
return b.buildConfig.sourceUrl === _.get(b, "image.metadata.annotations.sampleRepo");
78127812
}, k.isAvailable().then(function(b) {

Diff for: dist/scripts/templates.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -4799,8 +4799,9 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
47994799
"</div>\n" +
48004800
"<div class=\"row\">\n" +
48014801
"<div ng-class=\"{\n" +
4802-
" 'col-md-8': advancedOptions,\n" +
4803-
" 'col-lg-12': !advancedOptions}\">\n" +
4802+
" 'col-md-8': advancedOptions || advancedSourceOptions,\n" +
4803+
" 'col-lg-12': !advancedOptions && !advancedSourceOptions\n" +
4804+
" }\">\n" +
48044805
"<div class=\"form-group\">\n" +
48054806
"<label for=\"sourceUrl\" class=\"required\">Git Repository URL</label>\n" +
48064807
"<div ng-class=\"{\n" +
@@ -4822,7 +4823,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
48224823
"</div>\n" +
48234824
"</div>\n" +
48244825
"</div>\n" +
4825-
"<div class=\"col-md-4\" ng-if=\"advancedOptions\">\n" +
4826+
"<div class=\"col-md-4\" ng-if=\"advancedOptions || advancedSourceOptions\">\n" +
48264827
"<div class=\"form-group\">\n" +
48274828
"<label for=\"gitref\">Git Reference</label>\n" +
48284829
"<div>\n" +
@@ -4832,14 +4833,14 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
48324833
"</div>\n" +
48334834
"</div>\n" +
48344835
"</div>\n" +
4835-
"<div ng-if=\"advancedOptions\">\n" +
4836-
"<div class=\"form-group\">\n" +
4836+
"<div ng-if=\"advancedOptions || advancedSourceOptions\" class=\"form-group\">\n" +
48374837
"<label for=\"contextdir\">Context Dir</label>\n" +
48384838
"<div>\n" +
48394839
"<input id=\"contextdir\" ng-model=\"buildConfig.contextDir\" type=\"text\" placeholder=\"/\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"form-control\">\n" +
48404840
"</div>\n" +
48414841
"<div class=\"help-block\">Optional subdirectory for the application source code, used as the context directory for the build.</div>\n" +
48424842
"</div>\n" +
4843+
"<div ng-if=\"advancedOptions\">\n" +
48434844
"<div class=\"form-group\">\n" +
48444845
"<osc-secrets model=\"buildConfig.secrets.gitSecret\" namespace=\"projectName\" display-type=\"source\" type=\"source\" service-account-to-link=\"builder\" secrets-by-type=\"secretsByType\" alerts=\"alerts\" allow-multiple-secrets=\"false\">\n" +
48454846
"</osc-secrets>\n" +

0 commit comments

Comments
 (0)