This repository has been archived by the owner on Feb 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
file-service-modal.component.html
146 lines (146 loc) · 5.32 KB
/
file-service-modal.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<div class="glass-fileservice-modal">
<glass-alert-panel *ngIf="showWarning"
type="warning">
<div fxLayout="column">
<span *ngFor="let warning of showWarningText">
{{ warning }}
</span>
</div>
</glass-alert-panel>
<h1 mat-dialog-title
translate>
{{ title }}
</h1>
<mat-dialog-content fxLayout="column"
fxLayoutAlign="none">
<form [formGroup]="formGroup"
class="mat-typography"
novalidate
fxLayout="column"
fxLayoutAlign="none">
<div fxLayout="row"
fxLayoutAlign="space-between none"
fxLayoutGap="16px">
<mat-form-field fxFlex>
<mat-label translate>Available Capacity</mat-label>
<input matInput
type="text"
[value]="formGroup.value.availableSpace | bytesToSize"
readonly>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>Allocated Capacity</mat-label>
<input matInput
type="text"
[value]="formGroup.value.allocatedSpace | bytesToSize"
readonly>
</mat-form-field>
<mat-form-field [ngClass]="{'mat-form-field-invalid': formGroup.hasError('overBudget', 'requiredSpace')}"
fxFlex>
<mat-label translate>Raw Required Capacity</mat-label>
<input matInput
type="text"
[value]="formGroup.value.rawRequiredSpace | bytesToSize"
readonly>
</mat-form-field>
</div>
<mat-form-field fxFlex>
<mat-label translate>Service Name</mat-label>
<input matInput
type="text"
formControlName="name"
required>
<mat-error *ngIf="formGroup.invalid">
<span *ngIf="formGroup.hasError('required', 'name')"
translate>
This field is required.
</span>
<span *ngIf="formGroup.hasError('notUnique', 'name')"
translate>
The service name already exists.
</span>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>Service Type</mat-label>
<mat-select formControlName="type"
required>
<mat-option *ngFor="let type of types"
[value]="type.id">
{{ type.text }}
</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.invalid">
<span *ngIf="formGroup.hasError('required', 'serviceType')"
translate>
This field is required.
</span>
</mat-error>
</mat-form-field>
<mat-form-field class="glass-form-field-no-underline glass-form-field-hint"
[ngClass]="{'mat-form-field-invalid': formGroup.hasError('overBudget', 'replicas')}"
fxFlex>
<mat-label translate>Number Of Replicas</mat-label>
<input #replicasInput
matInput
type="number"
formControlName="replicas"
hidden>
<mat-slider color="primary"
[value]="replicasInput.value"
(input)="onReplicasChange($event)"
min="1"
max="3"
step="1"
thumbLabel="true"
fxFlex>
</mat-slider>
<mat-hint>
<span>{{ formGroup.get('replicas')?.value | redundancyLevel:'long' }}</span>
</mat-hint>
</mat-form-field>
<div fxLayout="row"
fxLayoutAlign="space-between center"
fxLayoutGap="16px">
<mat-form-field class="glass-form-field-no-underline"
[ngClass]="{'mat-form-field-invalid': formGroup.hasError('overBudget', 'requiredSpace')}"
fxFlex="80">
<mat-label translate>Estimated Required Capacity</mat-label>
<input #requiredSpaceInput
matInput
type="number"
formControlName="requiredSpace"
hidden>
<mat-slider color="primary"
[value]="requiredSpaceInput.value"
(input)="onInputRequiredSpace($event)"
min="0"
[max]="formGroup.value.availableSpace"
step="1"
fxFlex>
</mat-slider>
</mat-form-field>
<mat-form-field [ngClass]="{'mat-form-field-invalid': formGroup.hasError('overBudget', 'requiredSpace')}"
fxFlex="20">
<input matInput
type="text"
[value]="formGroup.value.requiredSpace | bytesToSize"
(change)="onChangeRequiredSpace($event)">
</mat-form-field>
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end"
fxLayout="row"
fxLayoutGap="10px">
<button mat-flat-button
[mat-dialog-close]="false">
<span translate>Cancel</span>
</button>
<glass-submit-button [form]="formGroup"
(buttonClick)="onSubmit()"
cdkFocusInitial>
<span translate>Create</span>
</glass-submit-button>
</mat-dialog-actions>
</div>