]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
d1617ed7be11962787ab4ce0788a28cc969fda48
[ceph-ci.git] /
1 <div class="modal-header">
2   <h4 class="modal-title pull-left"
3       i18n>Subuser
4   </h4>
5   <button type="button"
6           class="close pull-right"
7           aria-label="Close"
8           (click)="bsModalRef.hide()">
9     <span aria-hidden="true">&times;</span>
10   </button>
11 </div>
12 <form class="form-horizontal"
13       #frm="ngForm"
14       [formGroup]="formGroup"
15       novalidate>
16   <div class="modal-body">
17
18     <!-- Username -->
19     <div class="form-group"
20          [ngClass]="{'has-error': formGroup.showError('uid', frm)}">
21       <label class="control-label col-sm-3"
22              for="uid"
23              i18n>Username
24       </label>
25       <div class="col-sm-9">
26         <input id="uid"
27                class="form-control"
28                type="text"
29                formControlName="uid"
30                [readonly]="true">
31       </div>
32     </div>
33
34     <!-- Subuser -->
35     <div class="form-group"
36          [ngClass]="{'has-error': formGroup.showError('subuid', frm)}">
37       <label class="control-label col-sm-3"
38              for="subuid">
39         <ng-container i18n>Subuser</ng-container>
40         <span class="required"
41               *ngIf="!editing">
42         </span>
43       </label>
44       <div class="col-sm-9">
45         <input id="subuid"
46                class="form-control"
47                type="text"
48                formControlName="subuid"
49                [readonly]="editing"
50                autofocus>
51         <span class="help-block"
52               *ngIf="formGroup.showError('subuid', frm, 'required')"
53               i18n>
54           This field is required.
55         </span>
56         <span class="help-block"
57               *ngIf="formGroup.showError('subuid', frm, 'subuserIdExists')"
58               i18n>
59           The chosen subuser ID is already in use.
60         </span>
61       </div>
62     </div>
63
64     <!-- Permission -->
65     <div class="form-group"
66          [ngClass]="{'has-error': formGroup.showError('perm', frm)}">
67       <label class="control-label col-sm-3"
68              for="perm">
69         <ng-container i18n>Permission</ng-container>
70         <span class="required"></span>
71       </label>
72       <div class="col-sm-9">
73         <select id="perm"
74                 class="form-control"
75                 formControlName="perm">
76           <option i18n
77                   [ngValue]="null">
78             -- Select a permission --
79           </option>
80           <option *ngFor="let perm of ['read', 'write']"
81                   [value]="perm">
82             {{ perm }}
83           </option>
84           <option i18n
85                   value="read-write">
86             read, write
87           </option>
88           <option i18n
89                   value="full-control">
90             full
91           </option>
92         </select>
93         <span class="help-block"
94               *ngIf="formGroup.showError('perm', frm, 'required')"
95               i18n>
96           This field is required.
97         </span>
98       </div>
99     </div>
100
101     <!-- Swift key -->
102     <fieldset *ngIf="!editing">
103       <legend i18n>Swift key</legend>
104
105       <!-- Auto-generate key -->
106       <div class="form-group">
107         <div class="col-sm-offset-3 col-sm-9">
108           <div class="checkbox checkbox-primary">
109             <input id="generate_secret"
110                    type="checkbox"
111                    formControlName="generate_secret">
112             <label for="generate_secret"
113                    i18n>Auto-generate secret
114             </label>
115           </div>
116         </div>
117       </div>
118
119       <!-- Secret key -->
120       <div class="form-group"
121            [ngClass]="{'has-error': formGroup.showError('secret_key', frm)}"
122            *ngIf="!editing && !formGroup.getValue('generate_secret')">
123         <label class="control-label col-sm-3"
124                for="secret_key">
125           <ng-container i18n>Secret key</ng-container>
126           <span class="required"></span>
127         </label>
128         <div class="col-sm-9">
129           <div class="input-group">
130             <input id="secret_key"
131                    class="form-control"
132                    type="password"
133                    formControlName="secret_key">
134             <span class="input-group-btn">
135               <button type="button"
136                       class="btn btn-default"
137                       cdPasswordButton="secret_key">
138               </button>
139               <button type="button"
140                       class="btn btn-default"
141                       cdCopy2ClipboardButton="secret_key">
142               </button>
143             </span>
144           </div>
145           <span class="help-block"
146                 *ngIf="formGroup.showError('secret_key', frm, 'required')"
147                 i18n>
148             This field is required.
149           </span>
150         </div>
151       </div>
152
153     </fieldset>
154
155   </div>
156   <div class="modal-footer">
157     <cd-submit-button (submitAction)="onSubmit()"
158                       [form]="formGroup">
159       <ng-container i18n>{editing, select, 1 {Update} other {Add}}</ng-container>
160     </cd-submit-button>
161     <button class="btn btn-sm btn-default"
162             type="button"
163             (click)="bsModalRef.hide()"
164             i18n>Close
165     </button>
166   </div>
167 </form>