Commit 4939a96e by Samuel Padgett

Add generateName filter

parent 99b8a398
...@@ -1022,4 +1022,16 @@ angular.module('openshiftCommonUI') ...@@ -1022,4 +1022,16 @@ angular.module('openshiftCommonUI')
if(!hash) { return 0; } if(!hash) { return 0; }
return Object.keys(hash).length; return Object.keys(hash).length;
}; };
})
.filter('generateName', function() {
return function(prefix, length) {
if (!prefix) {
prefix = "";
}
if (!length) {
length = 5;
}
var randomString = Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1);
return prefix + randomString;
};
}); });
...@@ -1227,6 +1227,18 @@ angular.module('openshiftCommonUI') ...@@ -1227,6 +1227,18 @@ angular.module('openshiftCommonUI')
if(!hash) { return 0; } if(!hash) { return 0; }
return Object.keys(hash).length; return Object.keys(hash).length;
}; };
})
.filter('generateName', function() {
return function(prefix, length) {
if (!prefix) {
prefix = "";
}
if (!length) {
length = 5;
}
var randomString = Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1);
return prefix + randomString;
};
}); });
;'use strict'; ;'use strict';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -24,4 +24,16 @@ angular.module('openshiftCommonUI') ...@@ -24,4 +24,16 @@ angular.module('openshiftCommonUI')
if(!hash) { return 0; } if(!hash) { return 0; }
return Object.keys(hash).length; return Object.keys(hash).length;
}; };
})
.filter('generateName', function() {
return function(prefix, length) {
if (!prefix) {
prefix = "";
}
if (!length) {
length = 5;
}
var randomString = Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1);
return prefix + randomString;
};
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment