1 <cd-modal [modalRef]="activeModal">
2 <ng-container i18n="form title"
3 class="modal-title">Connect 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.
69 <div class="form-group row"
70 *ngIf="!remoteClusterForm.getValue('showToken') && !showCrossOriginError">
71 <label class="cd-col-form-label required"
75 <div class="cd-col-form-input">
80 formControlName="username">
81 <span class="invalid-feedback"
82 *ngIf="remoteClusterForm.showError('username', frm, 'required')"
83 i18n>This field is required.
87 <div class="form-group row"
88 *ngIf="!remoteClusterForm.getValue('showToken') && !showCrossOriginError">
89 <label class="cd-col-form-label required"
93 <div class="cd-col-form-input">
98 formControlName="password">
99 <span class="invalid-feedback"
100 *ngIf="remoteClusterForm.showError('password', frm, 'required')"
101 i18n>This field is required.
105 <div class="form-group row">
106 <div class="cd-col-form-offset">
107 <div class="custom-control custom-checkbox">
108 <input class="custom-control-input"
111 (click)="showToken = !showToken"
112 formControlName="showToken"
114 <label class="custom-control-label"
116 i18n>Auth with token</label>
120 <div class="form-group row"
121 *ngIf="remoteClusterForm.getValue('showToken')">
122 <label class="cd-col-form-label required"
126 <div class="cd-col-form-input">
131 formControlName="apiToken">
132 <span class="invalid-feedback"
133 *ngIf="remoteClusterForm.showError('apiToken', frm, 'required')"
134 i18n>This field is required.</span>
137 <div class="form-group row"
138 *ngIf="!showCrossOriginError">
139 <div class="cd-col-form-offset">
140 <div class="custom-control">
141 <button class="btn btn-primary"
143 [disabled]="(remoteClusterForm.getValue('showToken') && remoteClusterForm.getValue('apiToken') === '') || (!remoteClusterForm.getValue('showToken') && (remoteClusterForm.getValue('username') === '' || remoteClusterForm.getValue('password') === ''))"
144 (click)="verifyConnection()">
151 <div class="modal-footer">
152 <cd-form-button-panel (submitActionEvent)="onSubmit()"
153 [submitText]="actionLabels.CONNECT"
154 [disabled]="!connectionVerified && !showCrossOriginError"
155 [form]="remoteClusterForm">
156 </cd-form-button-panel>