Skip to content

Commit f2a46ee

Browse files
committed
Merge remote-tracking branch 'origin' into ITC-3645
2 parents 1c9e920 + 252ea82 commit f2a46ee

File tree

59 files changed

+4815
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4815
-720
lines changed

src/app/app.routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { mshypervModuleRoutes } from './modules/mshyperv_module/mshyperv_module.
4444
import { ciscoModuleRoutes } from './modules/cisco_module/cisco_module.routes';
4545
import { networkModuleRoutes } from './modules/network_module/network_module.routes';
4646
import { broadcomProxyModuleRoutes } from './modules/broadcomproxy_module/broadcomproxy_module.routes';
47+
import { nutanixModuleRoutes } from './modules/nutanix_module/nutanix_module.routes';
4748

4849
@Component({
4950
selector: 'legacy-redirect',
@@ -109,6 +110,7 @@ const moduleRoutes: Routes = [
109110
...mshypervModuleRoutes,
110111
...ciscoModuleRoutes,
111112
...broadcomProxyModuleRoutes,
113+
...nutanixModuleRoutes,
112114
...networkModuleRoutes
113115
];
114116
/*** Core routes ***/

src/app/components/dynamical-form-fields/dynamical-form-fields.component.html

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,35 @@
149149
[(ngModel)]="ngModel"
150150
(ngModelChange)="ngModelChange.emit($event)"
151151
[ngModelOptions]="{standalone: true}"
152-
[showClear]="false">
152+
[showClear]="false"
153+
oitcFormError [errors]="errors" errorField="{{formField['ngModel']}}">
153154
</oitc-select>
155+
<oitc-form-feedback [errors]="errors"
156+
errorField="{{formField['ngModel']}}"></oitc-form-feedback>
157+
<div class="help-block small" *ngIf="formField['help']">
158+
{{ formField['help'] }}
159+
</div>
160+
</div>
161+
<!-- MULTI SELECT FIELDS -->
162+
<div *ngIf="formField['type'] === 'multiselect'" class="mb-3">
163+
{{ formField['label'] }}
164+
@if (formField['required']) {
165+
<oitc-required-icon></oitc-required-icon>
166+
}
167+
<oitc-multi-select
168+
[attr.id]="formField['ngModel']"
169+
[name]="name"
170+
optionValue="key"
171+
optionLabel="value"
172+
[options]="formField['options']"
173+
[(ngModel)]="ngModel"
174+
(ngModelChange)="ngModelChange.emit($event)"
175+
[ngModelOptions]="{standalone: true}"
176+
[showClear]="false"
177+
oitcFormError [errors]="errors" errorField="{{formField['ngModel']}}">
178+
</oitc-multi-select>
179+
<oitc-form-feedback [errors]="errors"
180+
errorField="{{formField['ngModel']}}"></oitc-form-feedback>
154181
<div class="help-block small" *ngIf="formField['help']">
155182
{{ formField['help'] }}
156183
</div>

src/app/components/dynamical-form-fields/dynamical-form-fields.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { TranslocoDirective } from '@jsverse/transloco';
2828
import { NgSelectComponent } from '@ng-select/ng-select';
2929
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
3030
import { SelectComponent } from '../../layouts/primeng/select/select/select.component';
31+
import { MultiSelectComponent } from '../../layouts/primeng/multi-select/multi-select/multi-select.component';
3132

3233
@Component({
3334
selector: 'oitc-dynamical-form-fields',
@@ -47,7 +48,8 @@ import { SelectComponent } from '../../layouts/primeng/select/select/select.comp
4748
TranslocoDirective,
4849
NgSelectComponent,
4950
SelectComponent,
50-
FormsModule
51+
FormsModule,
52+
MultiSelectComponent
5153
],
5254
templateUrl: './dynamical-form-fields.component.html',
5355
styleUrl: './dynamical-form-fields.component.css',

src/app/layouts/coreui/form-error.directive.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
22
import { ValidationErrors } from '@angular/forms';
33
import _ from 'lodash';
44

5+
6+
// In case that the error directive is not working as expected
7+
// and is not adding the 'is-invalid' class to the host element,
8+
// please (and yes this sounds stupid) make sure that the
9+
// "FormControlDirective" is loaded before the "FormErrorDirective" directive
10+
// in the imports[] array of your component or module.
11+
// See: https://github.com/openITCOCKPIT/openITCOCKPIT-frontend-angular/commit/c91c1d58a1ef9ca40b8c71b8ad632ec5615d66f7
12+
// for an example
513
@Directive({
614
selector: '[oitcFormError]',
715
standalone: true

src/app/layouts/primeng/multi-select/multi-select/multi-select.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class MultiSelectComponent implements ControlValueAccessor, OnInit, OnDes
5858
*/
5959
private _options: any[] | undefined;
6060
@Input()
61-
set options(value: any[]) {
61+
set options(value: any[] | undefined) {
6262
this._options = value;
6363
this.onOptionsChanged();
6464
}

src/app/modules/autoreport_module/pages/autoreports/autoreport-add-step-one/autoreport-add-step-one.component.html

Lines changed: 151 additions & 131 deletions
Large diffs are not rendered by default.

src/app/modules/autoreport_module/pages/autoreports/autoreport-add-step-one/autoreport-add-step-one.component.ts

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Router, RouterLink } from '@angular/router';
66
import {
77
BadgeComponent,
88
ButtonDirective,
9-
CalloutComponent,
109
CardBodyComponent,
1110
CardComponent,
1211
CardHeaderComponent,
@@ -33,18 +32,18 @@ import { AutoreportsService } from '../autoreports.service';
3332
import { AutoreportPost, CalendarParams, getDefaultCalendarParams, getDefaultPost } from '../autoreports.interface';
3433
import { FormErrorDirective } from '../../../../../layouts/coreui/form-error.directive';
3534
import { FormFeedbackComponent } from '../../../../../layouts/coreui/form-feedback/form-feedback.component';
36-
import { formatDate, NgIf } from '@angular/common';
35+
import { formatDate, NgClass } from '@angular/common';
3736
import { RequiredIconComponent } from '../../../../../components/required-icon/required-icon.component';
3837
import { SelectComponent } from '../../../../../layouts/primeng/select/select/select.component';
3938
import { GenericResponseWrapper, GenericValidationError } from '../../../../../generic-responses';
4039
import { TrueFalseDirective } from '../../../../../directives/true-false.directive';
4140
import { TimeperiodsService } from '../../../../../pages/timeperiods/timeperiods.service';
4241
import { UsersService } from '../../../../../pages/users/users.service';
4342
import { LabelLinkComponent } from '../../../../../layouts/coreui/label-link/label-link.component';
44-
import { DebounceDirective } from '../../../../../directives/debounce.directive';
4543
import { MultiSelectComponent } from '../../../../../layouts/primeng/multi-select/multi-select/multi-select.component';
4644
import { NotyService } from '../../../../../layouts/coreui/noty.service';
4745
import { ContainersService } from '../../../../../pages/containers/containers.service';
46+
import { XsButtonDirective } from '../../../../../layouts/coreui/xsbutton-directive/xsbutton.directive';
4847

4948
@Component({
5049
selector: 'oitc-autoreport-add-step-one',
@@ -63,28 +62,28 @@ import { ContainersService } from '../../../../../pages/containers/containers.se
6362
BadgeComponent,
6463
RowComponent,
6564
ColComponent,
66-
FormErrorDirective,
6765
FormFeedbackComponent,
6866
FormLabelDirective,
69-
NgIf,
7067
RequiredIconComponent,
7168
SelectComponent,
7269
FormControlDirective,
70+
FormErrorDirective,
7371
FormCheckComponent,
7472
FormCheckInputDirective,
7573
FormCheckLabelDirective,
7674
TrueFalseDirective,
7775
LabelLinkComponent,
78-
CalloutComponent,
7976
InputGroupComponent,
8077
InputGroupTextDirective,
8178
DropdownComponent,
8279
ButtonDirective,
8380
DropdownToggleDirective,
8481
DropdownMenuDirective,
8582
DropdownItemDirective,
86-
DebounceDirective,
8783
MultiSelectComponent,
84+
XsButtonDirective,
85+
NgClass,
86+
8887
],
8988
templateUrl: './autoreport-add-step-one.component.html',
9089
styleUrl: './../../../assets/autoreport.css', //'./autoreport-add-step-one.component.css',
@@ -126,9 +125,9 @@ export class AutoreportAddStepOneComponent implements OnInit, OnDestroy {
126125
{key: 'WEEK', value: this.TranslocoService.translate('weekly')},
127126
{key: 'DAY', value: this.TranslocoService.translate('daily')}
128127
];
129-
public graphoptions: SelectKeyValue[] = [
130-
{key: 0, value: this.TranslocoService.translate('in %')},
131-
{key: 1, value: this.TranslocoService.translate('in h')}
128+
public graphoptions: SelectKeyValueString[] = [
129+
{key: '0', value: this.TranslocoService.translate('in %')},
130+
{key: '1', value: this.TranslocoService.translate('in h')}
132131
];
133132
public checkstates: SelectKeyValue[] = [
134133
{key: 0, value: this.TranslocoService.translate('soft and hard state')},
@@ -144,48 +143,56 @@ export class AutoreportAddStepOneComponent implements OnInit, OnDestroy {
144143
this.subscriptions.unsubscribe();
145144
}
146145

147-
private loadContainers() {
148-
this.subscriptions.add(this.ContainersService.loadAllContainers().subscribe((result) => {
149-
this.containers = result;
150-
this.cdr.markForCheck();
151-
}));
152-
}
153-
154146
public onContainerChange() {
155147
this.loadTimeperiods();
156148
this.loadCalendars();
157149
this.loadUsers();
158150
this.cdr.markForCheck();
159151
}
160152

161-
public onAvailabilityChange($event: boolean) {
162-
if (!$event) {
153+
public onAvailabilityChange() {
154+
if (!this.post) {
155+
return;
156+
}
157+
if (!this.setMinAvailability) {
163158
this.post.Autoreport.min_availability = null;
164159
}
165160
}
166161

167-
public onOutageChange($event: boolean) {
168-
if (!$event) {
162+
public onOutageChange() {
163+
if (!this.post) {
164+
return;
165+
}
166+
if (!this.setMaxNumberOfOutages) {
169167
this.post.Autoreport.max_number_of_outages = null;
170168
this.cdr.markForCheck();
171169
}
172170
}
173171

174-
public onHolidayChange($event: any) {
175-
if ($event === 0 && this.post.Autoreport.calendar_id !== 0) {
176-
this.post.Autoreport.calendar_id = 0;
172+
public onHolidayChange() {
173+
if (!this.post) {
174+
return;
175+
}
176+
if (this.post.Autoreport.consider_holidays === 0 && this.post.Autoreport.calendar_id !== 0) {
177+
this.post.Autoreport.calendar_id = null;
177178
this.cdr.markForCheck();
178179
}
179180
}
180181

181-
public onStartChange($event: any) {
182-
if ($event === 0) {
182+
public onStartChange() {
183+
if (!this.post) {
184+
return;
185+
}
186+
if (this.post.Autoreport.use_start_time === 0) {
183187
this.post.Autoreport.report_start_date = null;
184188
this.cdr.markForCheck();
185189
}
186190
}
187191

188192
private loadTimeperiods() {
193+
if (!this.post) {
194+
return;
195+
}
189196
if (this.post.Autoreport.container_id === 0) {
190197
return;
191198
}
@@ -196,6 +203,9 @@ export class AutoreportAddStepOneComponent implements OnInit, OnDestroy {
196203
}
197204

198205
private loadCalendars() {
206+
if (!this.post) {
207+
return;
208+
}
199209
if (this.post.Autoreport.container_id === 0) {
200210
return;
201211
}
@@ -207,6 +217,9 @@ export class AutoreportAddStepOneComponent implements OnInit, OnDestroy {
207217
}
208218

209219
private loadUsers() {
220+
if (!this.post) {
221+
return;
222+
}
210223
if (this.post.Autoreport.container_id === 0) {
211224
return;
212225
}
@@ -216,6 +229,13 @@ export class AutoreportAddStepOneComponent implements OnInit, OnDestroy {
216229
}));
217230
}
218231

232+
private loadContainers() {
233+
this.subscriptions.add(this.ContainersService.loadAllContainers().subscribe((result) => {
234+
this.containers = result;
235+
this.cdr.markForCheck();
236+
}));
237+
}
238+
219239
public submitStepOne() {
220240
this.errors = null;
221241
if (this.post.Autoreport.report_start_date !== null) {

0 commit comments

Comments
 (0)