Implements the new trigger setup user interface, which is now a linear workflow found on its own page, rather than a tiny modal dialog Fixes #1187
36 lines
No EOL
988 B
JavaScript
36 lines
No EOL
988 B
JavaScript
/**
|
|
* An element which displays the matches and non-matches for a regular expression against a set of
|
|
* items.
|
|
*/
|
|
angular.module('quay').directive('regexMatchView', function () {
|
|
var directiveDefinitionObject = {
|
|
priority: 0,
|
|
templateUrl: '/static/directives/regex-match-view.html',
|
|
replace: false,
|
|
transclude: true,
|
|
restrict: 'C',
|
|
scope: {
|
|
'regex': '=regex',
|
|
'items': '=items'
|
|
},
|
|
controller: function($scope, $element) {
|
|
$scope.filterMatches = function(regexstr, items, shouldMatch) {
|
|
regexstr = regexstr || '.+';
|
|
|
|
try {
|
|
var regex = new RegExp(regexstr);
|
|
} catch (ex) {
|
|
return null;
|
|
}
|
|
|
|
return items.filter(function(item) {
|
|
var value = item['value'];
|
|
var m = value.match(regex);
|
|
var matches = !!(m && m[0].length == value.length);
|
|
return matches == shouldMatch;
|
|
});
|
|
};
|
|
}
|
|
};
|
|
return directiveDefinitionObject;
|
|
}); |