/
add-config-to-application.html
128 lines (128 loc) · 6.28 KB
/
add-config-to-application.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<div>
<div class="dialog-title">
<h3>Add to Application</h3>
</div>
<div class="dialog-body">
<form name="addToApplicationForm" novalidate>
<fieldset ng-disabled="disableInputs">
<legend>Add this {{ctrl.apiObject.kind | humanizeKind}} to application:</legend>
<div class="form-group" ng-class="{'has-error' : ctrl.addType === 'env' && ctrl.application && !ctrl.canAddRefToApplication}">
<div class="application-select">
<ui-select id="application" ng-model="ctrl.application" on-select="ctrl.checkApplicationContainersRefs($item)" required="true" ng-disabled="ctrl.disableInputs">
<ui-select-match placeholder="{{ctrl.applications.length ? 'Select an application' : 'There are no applications in this project'}}">
<span>
{{$select.selected.metadata.name}}
<small class="text-muted">– {{$select.selected.kind | humanizeKind : true}}</small>
</span>
</ui-select-match>
<ui-select-choices
repeat="application in (ctrl.applications) | filter : { metadata: { name: $select.search } } track by (application | uid)"
group-by="ctrl.groupByKind">
<span ng-bind-html="application.metadata.name | highlight : $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
</div>
<div class="has-error" ng-if="ctrl.addType === 'env' && ctrl.application && !ctrl.canAddRefToApplication">
<span class="help-block">
The {{ctrl.apiObject.kind | humanizeKind}} has already been added to this application.
</span>
</div>
<legend>Add {{ctrl.apiObject.kind | humanizeKind}} as:</legend>
<div class="form-group">
<div class="radio">
<div class="add-choice">
<label>
<input type="radio" ng-model="ctrl.addType" value="env" ng-disabled="ctrl.disableInputs">
Environment variables
</label>
<div class="has-warning" ng-if="ctrl.hasInvalidEnvVars">
<span class="help-block">Some of the keys for {{ctrl.apiObject.kind | humanizeKind}} <strong>{{ctrl.apiObject.metadata.name}}</strong> are not valid environment variable names and will not be added.</span>
</div>
</div>
<div>
<label class="add-choice" for="volume">
<input id="volume" type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs">
Volume
</label>
</div>
<div class="volume-options">
<div ng-class="{'has-error': (addToApplicationForm.mountVolume.$error.oscUnique || (addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched))}">
<input class="form-control"
name="mountVolume"
id="mountVolume"
placeholder="Enter a mount path"
type="text"
required
ng-pattern="/^\/.*$/"
osc-unique="ctrl.existingMountPaths"
aria-describedby="mount-path-help"
ng-disabled="ctrl.addType !== 'volume' || ctrl.disableInputs || !ctrl.application"
ng-model="ctrl.mountVolume"
autocorrect="off"
autocapitalize="off"
spellcheck="false">
</div>
<div class="help-block bind-description">
Mount Path for the volume. A file will be created in this
directory for each key from the {{ctrl.apiObject.kind | humanizeKind}}.
The file contents will be the value of the key.
</div>
<div class="has-error" ng-show="addToApplicationForm.mountVolume.$error.oscUnique">
<span class="help-block">
The mount path is already used. Please choose another mount path.
</span>
</div>
<div class="has-error" ng-show="addToApplicationForm.mountVolume.$error.pattern && addToApplicationForm.mountVolume.$touched">
<span class="help-block">
Mount path must be a valid path to a directory starting with <code>/</code>.
</span>
</div>
</div>
</div>
</div>
<div ng-if="ctrl.canAddRefToApplication">
<legend ng-if-start="ctrl.application.spec.template.spec.containers.length > 1">Containers:</legend>
<div ng-if-end class="form-group container-options">
<div ng-if="ctrl.attachAllContainers">
The {{ctrl.apiObject.kind | humanizeKind}} will be added to all containers. You can
<a href="" ng-click="ctrl.attachAllContainers = false">select specific containers</a>
instead.
</div>
<div ng-if="!ctrl.attachAllContainers" class="form-group">
<label class="sr-only required">Containers</label>
<select-containers
ng-model="ctrl.attachContainers"
pod-template="ctrl.application.spec.template"
ng-required="true"
help-text="Add the {{ctrl.apiObject.kind | humanizeKind}} to the selected containers.">
</select-containers>
</div>
</div>
</div>
<div class="button-group pull-right">
<button
class="btn btn-default"
ng-class="{'dialog-btn': isDialog}"
ng-click="ctrl.onCancel()">
Cancel
</button>
<button type="submit"
class="btn btn-primary"
ng-class="{'dialog-btn': isDialog}"
ng-click="ctrl.addToApplication()"
ng-disabled="addToApplicationForm.$invalid || (ctrl.addType === 'env' && !ctrl.canAddRefToApplication)"
value="">
Save
</button>
</div>
</fieldset>
</form>
<div class="updating" ng-if="ctrl.updating">
<div class="spinner spinner-lg" aria-hidden="true"></div>
<h3>
<span class="sr-only">Updating</span>
</h3>
</div>
</div>
</div>