Merge pull request #2699 from jlmitch5/fixLabelsIssues

Fix labels issues
This commit is contained in:
jlmitch5
2016-06-29 17:11:35 -04:00
committed by GitHub
3 changed files with 12 additions and 5 deletions

View File

@@ -7,7 +7,8 @@ export default
'ProcessErrors', 'ProcessErrors',
'Prompt', 'Prompt',
'$q', '$q',
function(templateUrl, Wait, Rest, GetBasePath, ProcessErrors, Prompt, $q) { '$filter',
function(templateUrl, Wait, Rest, GetBasePath, ProcessErrors, Prompt, $q, $filter) {
return { return {
restrict: 'E', restrict: 'E',
scope: false, scope: false,
@@ -49,15 +50,17 @@ export default
scope.deleteLabel = function(templateId, templateName, labelId, labelName) { scope.deleteLabel = function(templateId, templateName, labelId, labelName) {
var action = function () { var action = function () {
$('#prompt-modal').modal('hide'); $('#prompt-modal').modal('hide');
scope.seeMoreInactive = true;
Wait('start'); Wait('start');
var url = GetBasePath("job_templates") + templateId + "/labels/"; var url = GetBasePath("job_templates") + templateId + "/labels/";
Rest.setUrl(url); Rest.setUrl(url);
Rest.post({"disassociate": true, "id": labelId}) Rest.post({"disassociate": true, "id": labelId})
.success(function () { .success(function () {
Wait('stop');
scope.search("job_template"); scope.search("job_template");
Wait('stop');
}) })
.error(function (data, status) { .error(function (data, status) {
Wait('stop');
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Could not disacssociate label from JT. Call to ' + url + ' failed. DELETE returned status: ' + status }); msg: 'Could not disacssociate label from JT. Call to ' + url + ' failed. DELETE returned status: ' + status });
}); });
@@ -65,7 +68,7 @@ export default
Prompt({ Prompt({
hdr: 'Remove Label from ' + templateName, hdr: 'Remove Label from ' + templateName,
body: '<div class="Prompt-bodyQuery">Confirm the removal of the <span class="Prompt-emphasis">' + labelName + '</span> label.</div>', body: '<div class="Prompt-bodyQuery">Confirm the removal of the <span class="Prompt-emphasis">' + $filter('sanitize')(labelName) + '</span> label.</div>',
action: action, action: action,
actionText: 'REMOVE' actionText: 'REMOVE'
}); });

View File

@@ -608,8 +608,8 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
* ] * ]
* ``` * ```
*/ */
.factory('CreateSelect2', [ .factory('CreateSelect2', ['$filter',
function () { function ($filter) {
return function (params) { return function (params) {
var element = params.element, var element = params.element,
@@ -641,6 +641,9 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
containerCssClass: 'Form-dropDown', containerCssClass: 'Form-dropDown',
width: '100%', width: '100%',
minimumResultsForSearch: Infinity, minimumResultsForSearch: Infinity,
escapeMarkup: function(m) {
return $filter('sanitize')(m);
}
}; };
// multiple-choice directive calls select2 but needs to do so without this custom adapter // multiple-choice directive calls select2 but needs to do so without this custom adapter

View File

@@ -3,6 +3,7 @@
.Prompt-bodyQuery { .Prompt-bodyQuery {
margin-bottom: 20px; margin-bottom: 20px;
color: @default-interface-txt; color: @default-interface-txt;
word-break: break-word;
} }
.Prompt-bodyTarget { .Prompt-bodyTarget {