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'">
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"
32 <cd-helper>Enter the Dashboard API URL. You can retrieve it from the CLI with: <b>ceph mgr services</b></cd-helper>
34 <div class="cd-col-form-input">
35 <input class="form-control"
37 placeholder="https://localhost:4202"
39 name="remoteClusterUrl"
40 formControlName="remoteClusterUrl">
41 <span class="invalid-feedback"
42 *ngIf="remoteClusterForm.showError('remoteClusterUrl', frm, 'required')"
43 i18n>This field is required.
45 <span class="invalid-feedback"
46 *ngIf="remoteClusterForm.showError('remoteClusterUrl', frm, 'endpoint')"
47 i18n>Please enter a valid URL.
51 <div class="form-group row">
52 <label class="cd-col-form-label required"
56 <div class="cd-col-form-input">
57 <input id="clusterAlias"
61 placeholder="Name/Text to uniquely identify cluster"
62 formControlName="clusterAlias">
63 <span class="invalid-feedback"
64 *ngIf="remoteClusterForm.showError('clusterAlias', frm, 'required')"
65 i18n>This field is required.
67 <span class="invalid-feedback"
68 *ngIf="remoteClusterForm.showError('clusterAlias', frm, 'uniqueName')"
69 i18n>The chosen alias name is already in use.
73 <div class="form-group row"
74 *ngIf="action !== 'edit'">
75 <label class="cd-col-form-label required"
79 <div class="cd-col-form-input">
84 formControlName="username">
85 <span class="invalid-feedback"
86 *ngIf="remoteClusterForm.showError('username', frm, 'required')"
87 i18n>This field is required.
89 <span class="invalid-feedback"
90 *ngIf="remoteClusterForm.showError('username', frm, 'uniqueUrlandUser')"
91 i18n>A cluster with the chosen user is already connected.
95 <div class="form-group row"
96 *ngIf="remoteClusterForm.getValue('showToken') && action !== 'edit'">
97 <label class="cd-col-form-label required"
101 <div class="cd-col-form-input">
102 <input id="clusterFsid"
106 formControlName="clusterFsid">
107 <span class="invalid-feedback"
108 *ngIf="remoteClusterForm.showError('clusterFsid', frm, 'required')"
109 i18n>This field is required.
113 <div class="form-group row"
114 *ngIf="!remoteClusterForm.getValue('showToken') && !showCrossOriginError && action !== 'edit'">
115 <label class="cd-col-form-label required"
119 <div class="cd-col-form-input">
120 <div class="input-group">
125 formControlName="password">
126 <span class="input-group-button">
127 <button type="button"
128 class="btn btn-light"
129 cdPasswordButton="password">
131 <cd-copy-2-clipboard-button source="password">
132 </cd-copy-2-clipboard-button>
134 <span class="invalid-feedback"
135 *ngIf="remoteClusterForm.showError('password', frm, 'required')"
136 i18n>This field is required.
141 <div class="form-group row"
142 *ngIf="remoteClusterForm.getValue('showToken') && action !== 'edit'">
143 <label class="cd-col-form-label required"
147 <div class="cd-col-form-input">
152 formControlName="apiToken">
153 <span class="invalid-feedback"
154 *ngIf="remoteClusterForm.showError('apiToken', frm, 'required')"
155 i18n>This field is required.</span>
158 <div class="form-group row"
159 *ngIf="action !== 'edit'">
160 <div class="cd-col-form-offset">
161 <div class="custom-control custom-checkbox">
162 <input class="custom-control-input"
165 [checked]="showToken"
166 (change)="toggleToken()"
167 formControlName="showToken">
168 <label class="custom-control-label"
170 i18n>Auth with token</label>
175 <div class="form-group row">
176 <div class="cd-col-form-offset">
177 <div class="custom-control custom-checkbox">
178 <input class="custom-control-input"
181 formControlName="ssl">
182 <label class="custom-control-label"
190 <div *ngIf="remoteClusterForm.controls.ssl.value"
191 class="form-group row">
192 <label class="cd-col-form-label"
194 <span i18n>Certificate</span>
195 <cd-helper i18n>The SSL certificate in PEM format.</cd-helper>
197 <div class="cd-col-form-input">
198 <textarea id="ssl_cert"
199 class="form-control resize-vertical text-monospace text-pre"
200 formControlName="ssl_cert"
204 (change)="fileUpload($event.target.files, 'ssl_cert')">
205 <span class="invalid-feedback"
206 *ngIf="remoteClusterForm.showError('ssl_cert', frm, 'required')"
207 i18n>This field is required.</span>
208 <span class="invalid-feedback"
209 *ngIf="remoteClusterForm.showError('ssl_cert', frm, 'pattern')"
210 i18n>Invalid SSL certificate.</span>
213 <div class="form-group row"
214 *ngIf="!showCrossOriginError && action !== 'edit' && !remoteClusterForm.getValue('showToken')">
215 <div class="cd-col-form-offset">
216 <div class="custom-control">
217 <button class="btn btn-primary"
219 [disabled]="(remoteClusterForm.getValue('showToken') && remoteClusterForm.getValue('apiToken') === '') || (!remoteClusterForm.getValue('showToken') && (remoteClusterForm.getValue('username') === '' || remoteClusterForm.getValue('password') === ''))"
220 (click)="verifyConnection()">
227 <div class="modal-footer">
228 <cd-form-button-panel (submitActionEvent)="onSubmit()"
229 [submitText]="(action | titlecase) + ' ' + 'Cluster'"
230 [form]="remoteClusterForm">
231 </cd-form-button-panel>