Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngModel.$parsers.unshift(function(viewValue){
// You will get undefined when input is required and model get unset
if (angular.isUndefined(viewValue)) {
viewValue = parser.getText();
}
if (!angular.isString(viewValue)) {
// let unknown value pass through
return viewValue;
}
mask.digest(null, viewValue);
if (!parser.isInit()) {
return undefined;
}
var date = parser.getDate();
if (ngModel.$validate || validMinMax(date)) {
if (modelParser) {
return modelParser.setDate(date).getText();
} else {
ParamValueController.prototype.getValue = function() {
var p = this.$scope.parameter();
if (angular.isNumber(p.numeric_value)) {
// can't easily do units since our proto parser doesn't support it
// we'd have to either parse them in python and serve them separately
// or fix protobuf.js
return p.numeric_value;
} else if (angular.isString(p.text_value)) {
return p.text_value;
}
return "";
};
var errorFn = function(response:any) {
// Update model state
self.model.state = "DISABLED";
// Display error message
var msg = "<p>The feed cannot be deleted at this time.</p><p>";
msg += angular.isString(response.data.message) ? _.escape(response.data.message) : "Please try again later.";
msg += "</p>";
$mdDialog.hide();
$mdDialog.show(
$mdDialog.alert()
.ariaLabel("Error deleting feed")
.clickOutsideToClose(true)
.htmlContent(msg)
.ok("Got it!")
.parent(document.body)
.title("Error deleting feed")
);
};
setAllowedActions= (module: any, users: any, groups: any, actions: any)=> {
// Build the request body
var safeModule: any = angular.isString(module) ? module : this.DEFAULT_MODULE;
var data: any = {actionSet: {name: safeModule, actions: actions}, change: "REPLACE"};
if (angular.isArray(users)) {
data.users = users;
} else if (angular.isString(users)) {
data.users = [users];
}
if (angular.isArray(groups)) {
data.groups = groups;
} else if (angular.isString(groups)) {
data.groups = [groups];
}
// Send the request
return this.$http({
data: angular.toJson(data),
method: "POST",
url: this.CommonRestUrlService.SECURITY_BASE_URL + "/actions/" + encodeURIComponent(safeModule) + "/allowed"
}).then((response: any)=>{
if (angular.isUndefined(response.data.actions)) {
datasourceNodeLabel = function(ds:any){
var label = "";
if (angular.isString(ds.datasourceType)) {
label = this.Utils.endsWith(ds.datasourceType.toLowerCase(), "datasource") ? ds.datasourceType.substring(0, ds.datasourceType.toLowerCase().lastIndexOf("datasource")) : ds.datasourceType;
if(label && label.toLowerCase() == 'database'){
//attempt to find the name of the database in the properties
if(ds.properties && ds.properties['Database Connection']){
label = ds.properties['Database Connection'];
}
}
} else if (angular.isString(ds.type)) {
label = ds.type;
} else {
label = this.Utils.endsWith(ds["@type"].toLowerCase(), "datasource") ? ds["@type"].substring(0, ds["@type"].toLowerCase().lastIndexOf("datasource")) : ds["@type"];
}
label += "\n" + ds.name;
return label;
};
function getStep(stepOrStepIdOrIndex) {
//index
if (angular.isNumber(stepOrStepIdOrIndex)) {
return stepList[stepOrStepIdOrIndex];
}
//ID string
if (angular.isString(stepOrStepIdOrIndex)) {
return stepList.filter(function (step) {
return step.stepId === stepOrStepIdOrIndex;
})[0];
}
//object
if (angular.isObject(stepOrStepIdOrIndex)) {
//step identity
if (~stepList.indexOf(stepOrStepIdOrIndex)) {
return stepOrStepIdOrIndex;
}
//step copy
if (stepOrStepIdOrIndex.stepId) {
return stepList.filter(function (step) {
return step.stepId === stepOrStepIdOrIndex.stepId;
function getRegExp(pattern: any, flags: any) {
var safeFlags = angular.isString(flags) ? flags : "";
return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFlags) : null;
}
function Capitalize(input) {
if (!angular.isString(input) || !input.length) {
return input;
}
return input[0].toUpperCase() + input.substr(1).toLowerCase();
}
function getRegExp(pattern: any, flags: any) {
var safeFlags = angular.isString(flags) ? flags : "";
return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFlags) : null;
}
function load(injector, name) {
if (angular.isString(name))
return injector.get(name, "KubeRequest");
else
return injector.invoke(name);
}