1 <cd-modal [modalRef]="activeModal">
2 <ng-container i18n="form title"
3 class="modal-title">{{ action | titlecase }} Cluster
5 <ng-container class="modal-content">
6 <form name="remoteClusterForm"
8 [formGroup]="remoteClusterForm">
9 <div class="modal-body">
10 <cd-alert-panel *ngIf="connectionVerified !== undefined && !connectionVerified && connectionMessage !== 'Connection refused'"
13 i18n>{{ connectionMessage }}
15 <cd-alert-panel *ngIf="connectionVerified !== undefined && connectionVerified"
18 i18n>{{ connectionMessage }}
20 <cd-alert-panel type="info"
23 *ngIf="connectionVerified !== undefined && !connectionVerified && connectionMessage === 'Connection refused' || remoteClusterForm.getValue('showToken')">
24 <p>You need to set this cluster's url as the cross origin url in the remote cluster you are trying to connect.
25 You can do it by running this CLI command in your remote cluster and proceed with authentication via token.</p>
26 <cd-code-block [codes]="[crossOriginCmd]"></cd-code-block>
28 <div class="form-group row">
29 <label class="cd-col-form-label required"
30 for="remoteClusterUrl"
34 <p>Enter the Dashboard API URL. You can retrieve it from the CLI with: <b>{{ clusterApiUrlCmd }} </b>
35 <cd-copy-2-clipboard-button [source]="clusterApiUrlCmd"
36 [byId]="false"></cd-copy-2-clipboard-button>
41 <div class="cd-col-form-input">
42 <input class="form-control"
44 placeholder="https://localhost:4202"
46 name="remoteClusterUrl"
47 formControlName="remoteClusterUrl">
48 <span class="invalid-feedback"
49 *ngIf="remoteClusterForm.showError('remoteClusterUrl', frm, 'required')"
50 i18n>This field is required.
52 <span class="invalid-feedback"
53 *ngIf="remoteClusterForm.showError('remoteClusterUrl', frm, 'endpoint')"
54 i18n>Please enter a valid URL.
58 <div class="form-group row">
59 <label class="cd-col-form-label required"
63 <div class="cd-col-form-input">
64 <input id="clusterAlias"
68 placeholder="Name/Text to uniquely identify cluster"
69 formControlName="clusterAlias">
70 <span class="invalid-feedback"
71 *ngIf="remoteClusterForm.showError('clusterAlias', frm, 'required')"
72 i18n>This field is required.
74 <span class="invalid-feedback"
75 *ngIf="remoteClusterForm.showError('clusterAlias', frm, 'uniqueName')"
76 i18n>The chosen alias name is already in use.
80 <div class="form-group row"
81 *ngIf="action !== 'edit'">
82 <label class="cd-col-form-label required"
86 <div class="cd-col-form-input">
91 formControlName="username">
92 <span class="invalid-feedback"
93 *ngIf="remoteClusterForm.showError('username', frm, 'required')"
94 i18n>This field is required.
96 <span class="invalid-feedback"
97 *ngIf="remoteClusterForm.showError('username', frm, 'uniqueUrlandUser')"
98 i18n>A cluster with the chosen user is already connected.
102 <div class="form-group row"
103 *ngIf="remoteClusterForm.getValue('showToken') && action !== 'edit'">
104 <label class="cd-col-form-label required"
108 <div class="cd-col-form-input">
109 <input id="clusterFsid"
113 formControlName="clusterFsid">
114 <span class="invalid-feedback"
115 *ngIf="remoteClusterForm.showError('clusterFsid', frm, 'required')"
116 i18n>This field is required.
120 <div class="form-group row"
121 *ngIf="remoteClusterForm.getValue('showToken') && action !== 'edit'">
122 <label class="cd-col-form-label required"
123 for="prometheusApiUrl"
124 i18n>Prometheus API URL
127 <p>Enter the Prometheus API URL. You can retrieve it from the CLI with: <b>{{ prometheusApiUrlCmd }} </b>
128 <cd-copy-2-clipboard-button [source]="prometheusApiUrlCmd"
129 [byId]="false"></cd-copy-2-clipboard-button>
134 <div class="cd-col-form-input">
135 <input id="prometheusApiUrl"
136 name="prometheusApiUrl"
139 formControlName="prometheusApiUrl">
140 <span class="invalid-feedback"
141 *ngIf="remoteClusterForm.showError('prometheusApiUrl', frm, 'required')"
142 i18n>This field is required.
146 <div class="form-group row"
147 *ngIf="!remoteClusterForm.getValue('showToken') && !showCrossOriginError && action !== 'edit'">
148 <label class="cd-col-form-label required"
152 <div class="cd-col-form-input">
153 <div class="input-group">
158 formControlName="password">
159 <span class="input-group-button">
160 <button type="button"
161 class="btn btn-light"
162 cdPasswordButton="password">
164 <cd-copy-2-clipboard-button source="password">
165 </cd-copy-2-clipboard-button>
167 <span class="invalid-feedback"
168 *ngIf="remoteClusterForm.showError('password', frm, 'required')"
169 i18n>This field is required.
174 <div class="form-group row"
175 *ngIf="remoteClusterForm.getValue('showToken') && action !== 'edit'">
176 <label class="cd-col-form-label required"
180 <div class="cd-col-form-input">
185 formControlName="apiToken">
186 <span class="invalid-feedback"
187 *ngIf="remoteClusterForm.showError('apiToken', frm, 'required')"
188 i18n>This field is required.</span>
191 <div class="form-group row"
192 *ngIf="!remoteClusterForm.getValue('showToken') && action !== 'edit'">
193 <label class="cd-col-form-label"
195 i18n>Login Expiration</label>
196 <div class="cd-col-form-input">
197 <select class="form-select"
199 formControlName="ttl"
201 <option value="1">1 day</option>
202 <option value="7">1 week</option>
204 [selected]="true">15 days</option>
205 <option value="30">30 days</option>
209 <div class="form-group row"
210 *ngIf="action !== 'edit'">
211 <div class="cd-col-form-offset">
212 <div class="custom-control custom-checkbox">
213 <input class="custom-control-input"
216 [checked]="showToken"
217 (change)="toggleToken()"
218 formControlName="showToken">
219 <label class="custom-control-label"
221 i18n>Auth with token</label>
226 <div class="form-group row">
227 <div class="cd-col-form-offset">
228 <div class="custom-control custom-checkbox">
229 <input class="custom-control-input"
232 formControlName="ssl">
233 <label class="custom-control-label"
241 <div *ngIf="remoteClusterForm.controls.ssl.value"
242 class="form-group row">
243 <label class="cd-col-form-label"
245 <span i18n>Certificate</span>
246 <cd-helper i18n>The SSL certificate in PEM format.</cd-helper>
248 <div class="cd-col-form-input">
249 <textarea id="ssl_cert"
250 class="form-control resize-vertical text-monospace text-pre"
251 formControlName="ssl_cert"
255 (change)="fileUpload($event.target.files, 'ssl_cert')">
256 <span class="invalid-feedback"
257 *ngIf="remoteClusterForm.showError('ssl_cert', frm, 'required')"
258 i18n>This field is required.</span>
259 <span class="invalid-feedback"
260 *ngIf="remoteClusterForm.showError('ssl_cert', frm, 'pattern')"
261 i18n>Invalid SSL certificate.</span>
265 <div class="modal-footer">
266 <cd-form-button-panel (submitActionEvent)="onSubmit()"
267 [submitText]="(action | titlecase) + ' ' + 'Cluster'"
268 [form]="remoteClusterForm">
269 </cd-form-button-panel>