Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
angular.forEach(this.$scope.fieldList, (field: any) => {
let dn: any = (field.displayName.length === 0);
// Validate field
let _: any = (field.$error.duplicate = angular.isDefined(keys[field.systemName]));
hasError |= _;
hasError |= (field.$error.missingName = dn);
// Add to user fields object
if (field.systemName.length > 0) {
field.order = order++;
keys[field.systemName] = true;
model.push(angular.copy(field));
}
});
function _destroyInstance() {
if (refreshInterval !== null) {
$interval.cancel(refreshInterval);
}
if (angular.isDefined(scope.iscrollInstance)) {
delete scope.iscrollInstance;
}
instance.destroy();
element.removeClass(classes.on).addClass(classes.off);
// Remove element's CSS transition values:
element.children('.iscroll-scroller').attr('style', null);
angular.forEach(deregistrators, _call);
//$log.debug('angular-iscroll: destroyInstance');
}
ngOnInit(){
this.pageName = angular.isDefined(this.pageName) ? this.pageName : 'alerts';
//Page State
this.loading = true;
this.showProgress = true;
//Pagination and view Type (list or table)
this.paginationData = this.PaginationDataService.paginationData(this.pageName);
this.PaginationDataService.setRowsPerPageOptions(this.pageName, ['5', '10', '20', '50', '100']);
this.viewType = this.PaginationDataService.viewType(this.pageName);
//Setup the Tabs
this.tabNames = ['All', 'INFO', 'WARNING', 'MINOR', 'MAJOR', 'CRITICAL', 'FATAL'];
this.tabs = this.TabService.registerTabs(this.pageName, this.tabNames, this.paginationData.activeTab);
this.tabMetadata = this.TabService.metadata(this.pageName);
this.sortOptions = this.loadSortOptions();
this.PAGE_DIRECTION = {forward: 'f', backward: 'b', none: 'n'};
this.additionalMenuOptions = this.loadAdditionalMenuOptions();
this.selectedAdditionalMenuOptionVar = this.selectedAdditionalMenuOption;
private postLink($scope: IDatepickerDirectiveScope, $element: JQuery, attrs: any, ctrls: any[]): void {
let datepickerController: DatepickerController = ctrls[0];
let ngModel: angular.INgModelController = ctrls[1];
datepickerController.initDatepicker(ngModel);
if (angular.isDefined(ngModel) && ngModel !== null) {
ngModel.$render = function (): void {
if (
ngModel.$modelValue !== null
&& ngModel.$modelValue !== ''
&& typeof ngModel.$modelValue !== 'undefined'
) {
if (typeof ngModel.$modelValue === 'string') {
let date: Date = new Date(ngModel.$modelValue);
datepickerController.setValue(date);
} else {
datepickerController.setValue(ngModel.$modelValue);
}
ngModel.$setPristine();
}
};
}
link: function link(scope, iElement, iAttrs) {
const element = iElement[0];
const FULL_WIDTH = 100;
scope.isLimited = angular.isDefined(iAttrs.limited);
scope.isUnlimited = angular.isDefined(iAttrs.unlimited);
scope.isAvatar = angular.isDefined(iAttrs.avatar);
scope.isWide = angular.isDefined(iAttrs.wide);
scope.isAlignRight = angular.isDefined(iAttrs.alignRight);
scope.isGray = angular.isDefined(iAttrs.gray);
scope.isPullRight = angular.isDefined(iAttrs.pullRight);
scope.isPullLeft = angular.isDefined(iAttrs.pullLeft);
function adjustUnlimitedColumnWidths() {
const unlimitedColumnsCount = element.parentNode.
querySelectorAll('.ring-table__column[unlimited]').length;
if (unlimitedColumnsCount > 1) {
element.style.width = `${(FULL_WIDTH / unlimitedColumnsCount).toFixed()}%`;
}
}
if (scope.isUnlimited) {
adjustUnlimitedColumnWidths();
}
}
};
.success(function (data) {
thos.datasets = data.reverse();
var selectedDS;
if(angular.isDefined(thos.datasetID)){
selectedDS = thos.datasets.filter(function(item){
return item.id == thos.datasetID;
});
}
if (selectedDS && selectedDS.length > 0){
thos.select(selectedDS[0])
}
thos.uploaded = false;
})
.error(function (data, status) {
angular.forEach(fields, function(field, type) {
field.builder = field.builder || [];
field.replace = angular.isDefined(field.replace) ? field.replace : true;
decorators[name][type] = field;
});
Number.isNaN(+model.xmin) ? d3.min(this.data, timestampOf) : +model.xmin,
Number.isNaN(+model.xmax) ? d3.max(this.data, timestampOf) : +model.xmax,
]);
this.y.domain([ymin, ymax]);
this.yAxis.tickFormat((p) => p + (model.unit ? ` ${model.unit}` : ''));
if (model.timeScale) {
if (model.timeScale.unit && model.timeScale.amount) {
this.xAxis.ticks(d3.time[model.timeScale.unit], model.timeScale.amount);
}
if (model.timeScale.format) {
this.xAxis.tickFormat(d3.time.format(model.timeScale.format));
}
} else {
this.xAxis.ticks('days');
}
this.yAxis.ticks(angular.isDefined(model.yTicks) ? model.yTicks : 4);
this.margin = model.margin || this.margin;
this.resize();
this.update();
};
reset();
};
scope.editThreat = function () {
scope.save();
reset();
};
scope.cancelEdit = function () {
scope.threats[editIndex] = originalThreat;
reset();
};
var threatId = $routeParams.threat;
if (angular.isDefined(threatId)) {
var matchingIndex = -1;
scope.threats.forEach(function (threat, index) {
if (threat.id == threatId) {
matchingIndex = index;
}
});
if (matchingIndex >= 0) {
scope.onEditThreat(matchingIndex);
}
else {
logError('Invalid threat ID');
$location.search('threat', null);
}
}
attrs.$observe('uifArrow', (attrArrowDirection: string) => {
if (angular.isDefined(attrArrowDirection) && angular.isUndefined(CalloutArrow[attrArrowDirection])) {
calloutController.$log.error('Error [ngOfficeUiFabric] officeuifabric.components.callout - "' +
attrArrowDirection + '" is not a valid value for uifArrow. It should be left, right, top, bottom.');
return;
}
scope.arrowDirection = attrArrowDirection;
});