[ADF-865] codelyzer diagrams and analytics (#2072)

* fix codelyzer diagrams and analytics

* fix test
This commit is contained in:
Eugenio Romano
2017-07-11 16:20:03 +01:00
parent 8a509e3c31
commit 8a013b3bd1
88 changed files with 331 additions and 192 deletions

View File

@@ -15,7 +15,8 @@
* limitations under the License.
*/
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
/* tslint:disable::no-access-missing-member */
import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core';
import { AbstractControl, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import * as moment from 'moment';
import { WidgetComponent } from './../widget.component';
@@ -34,7 +35,7 @@ declare let mdDateTimePicker: any;
templateUrl: './date-range.widget.html',
styleUrls: ['./date-range.widget.css']
})
export class DateRangeWidget extends WidgetComponent {
export class DateRangeWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
public static FORMAT_DATE_ACTIVITI: string = 'YYYY-MM-DD';
@@ -97,7 +98,7 @@ export class DateRangeWidget extends WidgetComponent {
future: moment().add(100, 'years')
};
settings.init = moment(date, DateRangeWidget.FORMAT_DATE_ACTIVITI);
settings.init = moment(date, DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
this.dialogStart = new mdDateTimePicker.default(settings);
this.dialogStart.trigger = this.startElement.nativeElement;
@@ -145,7 +146,7 @@ export class DateRangeWidget extends WidgetComponent {
future: moment().add(100, 'years')
};
settings.init = moment(date, DateRangeWidget.FORMAT_DATE_ACTIVITI);
settings.init = moment(date, DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
this.dialogEnd = new mdDateTimePicker.default(settings);
this.dialogEnd.trigger = this.endElement.nativeElement;
@@ -157,7 +158,7 @@ export class DateRangeWidget extends WidgetComponent {
}
onOkStart(inputEl: HTMLInputElement) {
let date = this.dialogStart.time.format(DateRangeWidget.FORMAT_DATE_ACTIVITI);
let date = this.dialogStart.time.format(DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
this.dateRange.patchValue({
startDate: date
});
@@ -168,7 +169,7 @@ export class DateRangeWidget extends WidgetComponent {
}
onOkEnd(inputEl: HTMLInputElement) {
let date = this.dialogEnd.time.format(DateRangeWidget.FORMAT_DATE_ACTIVITI);
let date = this.dialogEnd.time.format(DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
this.dateRange.patchValue({
endDate: date
});
@@ -188,14 +189,14 @@ export class DateRangeWidget extends WidgetComponent {
}
public convertToMomentDateWithTime(date: string) {
return moment(date, DateRangeWidget.FORMAT_DATE_ACTIVITI, true).format(DateRangeWidget.FORMAT_DATE_ACTIVITI) + 'T00:00:00.000Z';
return moment(date, DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI, true).format(DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI) + 'T00:00:00.000Z';
}
private convertToMomentDate(date: string) {
if (date) {
return moment(date).format(DateRangeWidget.FORMAT_DATE_ACTIVITI);
return moment(date).format(DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
} else {
return moment().format(DateRangeWidget.FORMAT_DATE_ACTIVITI);
return moment().format(DateRangeWidgetComponent.FORMAT_DATE_ACTIVITI);
}
}