-
Notifications
You must be signed in to change notification settings - Fork 64
/
addComponent.component.html
121 lines (121 loc) · 6.81 KB
/
addComponent.component.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
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License 2.0 which is available at
~ http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
~ which is available at https://www.apache.org/licenses/LICENSE-2.0.
~
~ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<winery-modal bsModal #addModal="bs-modal" [modalRef]="addModal">
<winery-modal-header [title]="'Add a new ' + addModalType"></winery-modal-header>
<winery-modal-body>
<form #addComponentForm="ngForm">
<div *ngIf="!loading; else showLoader">
<div *ngIf="!validation?.noTypeAvailable; else showNoTypeAvailable">
<div class="form-group">
<label for="componentName" class="control-label">Name</label>
<input type="text"
class="form-control"
id="componentName"
name="componentName"
#newName="ngModel"
[(ngModel)]="newComponentName"
required
[wineryDuplicateValidator]="validatorObject">
<div *ngIf="(newName.errors || validation?.noDuplicatesAllowed)
&& (newName.dirty || newName.touched)"
class="alert alert-danger">
<div [hidden]="!validation?.noDuplicatesAllowed">
No duplicates allowed!
</div>
<div [hidden]="!newName?.errors?.required">
Name is required!
</div>
</div>
<div *ngIf="validation?.differentNamespaceDuplicateWarning
|| validation?.differentCaseDuplicateWarning"
class="alert alert-warning">
<div [hidden]="!validation.differentCaseDuplicateWarning">
There is a duplicate with a different case!
</div>
<div [hidden]="!validation.differentNamespaceDuplicateWarning">
There is a duplicate in another namespace!
</div>
</div>
<br>
<label for="newComponentVersion">
Component version
</label>
<ng-template #versionExplanation>
The component version specifies the components' external version. For example, Tomcat in version 8 has a
component version 8.<br>
The management version (winery & wip) is automatically set to 1. For example the final id for Tomcat with component
version 8 is: <code style="color: black">Tomcat_8-w1-wip1</code>.<br>
The final name is displayed below in the 'Final name' field.
</ng-template>
<i class="fa fa-question-circle" [tooltip]="versionExplanation" containerClass="versionTooltip"></i>
<input type="text"
id="newComponentVersion"
name="newComponentVersion"
class="form-control"
#newVersion="ngModel"
[wineryDuplicateValidator]="validatorObject"
[(ngModel)]="newComponentVersion.componentVersion">
<div *ngIf="(newName.dirty || newName.touched) && validation?.noVersionProvidedWarning"
class="alert alert-warning">
<div>
You haven't provided a version!
</div>
</div>
<div *ngIf="(validation?.noUnderscoresAllowed)
&& (newVersion.dirty || newVersion.touched)"
class="alert alert-danger">
<div [hidden]="!validation?.noUnderscoresAllowed">
Underscores are not allowed in the version!<br>Please replace them with dashes.
</div>
</div>
<br>
<label for="finalName">Final name</label>
<code class="form-control" id="finalName">{{ newComponentFinalName }}</code>
</div>
<br>
<div class="form-group" *ngIf="types">
<label for="typeSelect" class="control-label">Type</label>
<ng-select id="typeSelect" [items]="types" (selected)="typeSelected($event)"
[active]="[newComponentSelectedType]"></ng-select>
</div>
<br>
<!-- pattern parameter is required to enable form validation -->
<winery-namespace-selector #namespaceInput
name="namespace"
required
pattern="^\S*$"
[(ngModel)]="newComponentNamespace"
[isRequired]="true"
[useStartNamespace]="useStartNamespace"
[toscaType]="toscaType">
</winery-namespace-selector>
</div>
<ng-template #showNoTypeAvailable>
<alert [type]="'danger'">
There are no types available. Please add a type first!
</alert>
</ng-template>
</div>
<ng-template #showLoader>
<winery-loader></winery-loader>
</ng-template>
</form>
</winery-modal-body>
<winery-modal-footer
(onOk)="addComponent()"
[closeButtonLabel]="'Cancel'"
[okButtonLabel]="'Add'"
[disableOkButton]="!addComponentForm?.valid || validation?.noTypeAvailable">
</winery-modal-footer>
</winery-modal>