2016-09-23 04:54:58 +00:00
|
|
|
angular.module('service', [])
|
2017-04-12 19:47:22 +00:00
|
|
|
.controller('ServiceController', ['$scope', '$stateParams', '$state', '$location', '$anchorScroll', 'Service', 'ServiceHelper', 'Task', 'Node', 'Notifications', 'Pagination', 'ModalService',
|
|
|
|
function ($scope, $stateParams, $state, $location, $anchorScroll, Service, ServiceHelper, Task, Node, Notifications, Pagination, ModalService) {
|
2016-09-23 04:54:58 +00:00
|
|
|
|
2017-01-24 01:28:40 +00:00
|
|
|
$scope.state = {};
|
|
|
|
$scope.state.pagination_count = Pagination.getPaginationCount('service_tasks');
|
2016-09-23 04:54:58 +00:00
|
|
|
$scope.service = {};
|
|
|
|
$scope.tasks = [];
|
|
|
|
$scope.displayNode = false;
|
|
|
|
$scope.sortType = 'Status';
|
|
|
|
$scope.sortReverse = false;
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.lastVersion = 0;
|
|
|
|
|
|
|
|
var originalService = {};
|
|
|
|
var previousServiceValues = [];
|
2016-11-09 00:23:56 +00:00
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
$scope.order = function (sortType) {
|
|
|
|
$scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
|
|
|
|
$scope.sortType = sortType;
|
|
|
|
};
|
|
|
|
|
2017-01-24 01:28:40 +00:00
|
|
|
$scope.changePaginationCount = function() {
|
|
|
|
Pagination.setPaginationCount('service_tasks', $scope.state.pagination_count);
|
|
|
|
};
|
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
$scope.renameService = function renameService(service) {
|
2016-11-09 00:23:56 +00:00
|
|
|
updateServiceAttribute(service, 'Name', service.newServiceName || service.name);
|
|
|
|
service.EditName = false;
|
|
|
|
};
|
|
|
|
$scope.changeServiceImage = function changeServiceImage(service) {
|
|
|
|
updateServiceAttribute(service, 'Image', service.newServiceImage || service.image);
|
|
|
|
service.EditImage = false;
|
|
|
|
};
|
|
|
|
$scope.scaleService = function scaleService(service) {
|
2016-12-30 23:59:20 +00:00
|
|
|
var replicas = service.newServiceReplicas === null || isNaN(service.newServiceReplicas) ? service.Replicas : service.newServiceReplicas;
|
|
|
|
updateServiceAttribute(service, 'Replicas', replicas);
|
2016-11-09 00:23:56 +00:00
|
|
|
service.EditReplicas = false;
|
|
|
|
};
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.goToItem = function(hash) {
|
|
|
|
$anchorScroll(hash);
|
|
|
|
};
|
|
|
|
|
2016-11-09 00:23:56 +00:00
|
|
|
$scope.addEnvironmentVariable = function addEnvironmentVariable(service) {
|
|
|
|
service.EnvironmentVariables.push({ key: '', value: '', originalValue: '' });
|
2017-03-20 20:28:09 +00:00
|
|
|
updateServiceArray(service, 'EnvironmentVariables', service.EnvironmentVariables);
|
2016-11-09 00:23:56 +00:00
|
|
|
};
|
|
|
|
$scope.removeEnvironmentVariable = function removeEnvironmentVariable(service, index) {
|
|
|
|
var removedElement = service.EnvironmentVariables.splice(index, 1);
|
2017-03-20 20:28:09 +00:00
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'EnvironmentVariables', service.EnvironmentVariables);
|
|
|
|
}
|
2016-11-09 00:23:56 +00:00
|
|
|
};
|
|
|
|
$scope.updateEnvironmentVariable = function updateEnvironmentVariable(service, variable) {
|
2017-03-20 20:28:09 +00:00
|
|
|
if (variable.value !== variable.originalValue || variable.key !== variable.originalKey) {
|
|
|
|
updateServiceArray(service, 'EnvironmentVariables', service.EnvironmentVariables);
|
|
|
|
}
|
2016-11-09 00:23:56 +00:00
|
|
|
};
|
2016-11-10 02:38:49 +00:00
|
|
|
$scope.addLabel = function addLabel(service) {
|
|
|
|
service.ServiceLabels.push({ key: '', value: '', originalValue: '' });
|
2017-03-20 20:28:09 +00:00
|
|
|
updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
|
2016-11-10 02:38:49 +00:00
|
|
|
};
|
|
|
|
$scope.removeLabel = function removeLabel(service, index) {
|
|
|
|
var removedElement = service.ServiceLabels.splice(index, 1);
|
2017-03-20 20:28:09 +00:00
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
|
|
|
|
}
|
2016-11-10 02:38:49 +00:00
|
|
|
};
|
|
|
|
$scope.updateLabel = function updateLabel(service, label) {
|
2017-03-20 20:28:09 +00:00
|
|
|
if (label.value !== label.originalValue || label.key !== label.originalKey) {
|
|
|
|
updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
|
|
|
|
}
|
2016-11-10 02:38:49 +00:00
|
|
|
};
|
2016-11-25 06:21:06 +00:00
|
|
|
$scope.addContainerLabel = function addContainerLabel(service) {
|
|
|
|
service.ServiceContainerLabels.push({ key: '', value: '', originalValue: '' });
|
2017-03-20 20:28:09 +00:00
|
|
|
updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
|
2016-11-25 06:21:06 +00:00
|
|
|
};
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.removeContainerLabel = function removeLabel(service, index) {
|
2016-11-25 06:21:06 +00:00
|
|
|
var removedElement = service.ServiceContainerLabels.splice(index, 1);
|
2017-03-20 20:28:09 +00:00
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$scope.updateContainerLabel = function updateLabel(service, label) {
|
|
|
|
if (label.value !== label.originalValue || label.key !== label.originalKey) {
|
|
|
|
updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$scope.addMount = function addMount(service) {
|
|
|
|
service.ServiceMounts.push({Type: 'volume', Source: '', Target: '', ReadOnly: false });
|
|
|
|
updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
|
|
|
|
};
|
|
|
|
$scope.removeMount = function removeMount(service, index) {
|
|
|
|
var removedElement = service.ServiceMounts.splice(index, 1);
|
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$scope.updateMount = function updateMount(service, mount) {
|
|
|
|
updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
|
|
|
|
};
|
|
|
|
$scope.addPlacementConstraint = function addPlacementConstraint(service) {
|
|
|
|
service.ServiceConstraints.push({ key: '', operator: '==', value: '' });
|
|
|
|
updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
|
|
|
|
};
|
|
|
|
$scope.removePlacementConstraint = function removePlacementConstraint(service, index) {
|
|
|
|
var removedElement = service.ServiceConstraints.splice(index, 1);
|
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$scope.updatePlacementConstraint = function updatePlacementConstraint(service, constraint) {
|
|
|
|
updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
|
2016-11-25 06:21:06 +00:00
|
|
|
};
|
2016-11-09 00:23:56 +00:00
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.addPublishedPort = function addPublishedPort(service) {
|
|
|
|
if (!service.Ports) {
|
|
|
|
service.Ports = [];
|
|
|
|
}
|
2017-05-04 07:43:20 +00:00
|
|
|
service.Ports.push({ PublishedPort: '', TargetPort: '', Protocol: 'tcp', PublishMode: 'ingress' });
|
2016-12-25 20:31:22 +00:00
|
|
|
};
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.updatePublishedPort = function updatePublishedPort(service, portMapping) {
|
|
|
|
updateServiceArray(service, 'Ports', service.Ports);
|
2016-12-25 20:31:22 +00:00
|
|
|
};
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.removePortPublishedBinding = function removePortPublishedBinding(service, index) {
|
|
|
|
var removedElement = service.Ports.splice(index, 1);
|
|
|
|
if (removedElement !== null) {
|
|
|
|
updateServiceArray(service, 'Ports', service.Ports);
|
|
|
|
}
|
2016-12-25 20:31:22 +00:00
|
|
|
};
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.cancelChanges = function cancelChanges(service, keys) {
|
|
|
|
if (keys) { // clean out the keys only from the list of modified keys
|
|
|
|
keys.forEach(function(key) {
|
|
|
|
var index = previousServiceValues.indexOf(key);
|
|
|
|
if (index >= 0) {
|
|
|
|
previousServiceValues.splice(index, 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else { // clean out all changes
|
|
|
|
keys = Object.keys(service);
|
|
|
|
previousServiceValues = [];
|
|
|
|
}
|
|
|
|
keys.forEach(function(attribute) {
|
|
|
|
service[attribute] = originalService[attribute]; // reset service values
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
2016-11-09 00:23:56 +00:00
|
|
|
service.hasChanges = false;
|
2016-09-23 04:54:58 +00:00
|
|
|
};
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.hasChanges = function(service, elements) {
|
|
|
|
var hasChanges = false;
|
|
|
|
elements.forEach(function(key) {
|
|
|
|
hasChanges = hasChanges || (previousServiceValues.indexOf(key) >= 0);
|
|
|
|
});
|
|
|
|
return hasChanges;
|
|
|
|
};
|
|
|
|
|
2016-11-09 00:23:56 +00:00
|
|
|
$scope.updateService = function updateService(service) {
|
2017-04-06 08:34:49 +00:00
|
|
|
$('#loadingViewSpinner').show();
|
2016-09-23 04:54:58 +00:00
|
|
|
var config = ServiceHelper.serviceToConfig(service.Model);
|
2017-03-20 20:28:09 +00:00
|
|
|
config.Name = service.Name;
|
2016-11-25 06:21:06 +00:00
|
|
|
config.Labels = translateServiceLabelsToLabels(service.ServiceLabels);
|
2016-11-09 00:23:56 +00:00
|
|
|
config.TaskTemplate.ContainerSpec.Env = translateEnvironmentVariablesToEnv(service.EnvironmentVariables);
|
2016-11-25 06:21:06 +00:00
|
|
|
config.TaskTemplate.ContainerSpec.Labels = translateServiceLabelsToLabels(service.ServiceContainerLabels);
|
2017-03-20 20:28:09 +00:00
|
|
|
config.TaskTemplate.ContainerSpec.Image = service.Image;
|
|
|
|
config.TaskTemplate.ContainerSpec.Secrets = service.ServiceSecrets;
|
|
|
|
|
2016-11-11 02:26:19 +00:00
|
|
|
if (service.Mode === 'replicated') {
|
|
|
|
config.Mode.Replicated.Replicas = service.Replicas;
|
|
|
|
}
|
2017-03-20 20:28:09 +00:00
|
|
|
config.TaskTemplate.ContainerSpec.Mounts = service.ServiceMounts;
|
|
|
|
if (typeof config.TaskTemplate.Placement === 'undefined') {
|
|
|
|
config.TaskTemplate.Placement = {};
|
|
|
|
}
|
2017-05-04 06:57:08 +00:00
|
|
|
config.TaskTemplate.Placement.Constraints = ServiceHelper.translateKeyValueToPlacementConstraints(service.ServiceConstraints);
|
2017-03-20 20:28:09 +00:00
|
|
|
|
|
|
|
config.TaskTemplate.Resources = {
|
|
|
|
Limits: {
|
|
|
|
NanoCPUs: service.LimitNanoCPUs,
|
|
|
|
MemoryBytes: service.LimitMemoryBytes
|
|
|
|
},
|
|
|
|
Reservations: {
|
|
|
|
NanoCPUs: service.ReservationNanoCPUs,
|
|
|
|
MemoryBytes: service.ReservationMemoryBytes
|
|
|
|
}
|
|
|
|
};
|
2016-11-09 00:23:56 +00:00
|
|
|
|
2016-12-25 20:31:22 +00:00
|
|
|
config.UpdateConfig = {
|
2017-03-20 20:28:09 +00:00
|
|
|
Parallelism: service.UpdateParallelism,
|
|
|
|
Delay: service.UpdateDelay,
|
|
|
|
FailureAction: service.UpdateFailureAction
|
|
|
|
};
|
|
|
|
config.TaskTemplate.RestartPolicy = {
|
|
|
|
Condition: service.RestartCondition,
|
|
|
|
Delay: service.RestartDelay,
|
|
|
|
MaxAttempts: service.RestartMaxAttempts,
|
|
|
|
Window: service.RestartWindow
|
|
|
|
};
|
2017-03-30 10:00:16 +00:00
|
|
|
|
2017-04-06 08:35:01 +00:00
|
|
|
if (service.Ports) {
|
|
|
|
service.Ports.forEach(function (binding) {
|
|
|
|
if (binding.PublishedPort === null || binding.PublishedPort === '') {
|
|
|
|
delete binding.PublishedPort;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-03-30 10:00:16 +00:00
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
config.EndpointSpec = {
|
|
|
|
Mode: config.EndpointSpec.Mode || 'vip',
|
|
|
|
Ports: service.Ports
|
2016-12-25 20:31:22 +00:00
|
|
|
};
|
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
Service.update({ id: service.Id, version: service.Version }, config, function (data) {
|
2017-04-06 08:34:49 +00:00
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.success("Service successfully updated", "Service updated");
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.cancelChanges({});
|
|
|
|
fetchServiceDetails();
|
2016-09-23 04:54:58 +00:00
|
|
|
}, function (e) {
|
2017-04-06 08:34:49 +00:00
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Failure", e, "Unable to update service");
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2017-03-30 09:22:59 +00:00
|
|
|
$scope.removeService = function() {
|
|
|
|
ModalService.confirmDeletion(
|
2017-04-25 08:20:57 +00:00
|
|
|
'Do you want to remove this service? All the containers associated to this service will be removed too.',
|
2017-03-30 09:22:59 +00:00
|
|
|
function onConfirm(confirmed) {
|
|
|
|
if(!confirmed) { return; }
|
|
|
|
removeService();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
2016-11-09 00:23:56 +00:00
|
|
|
|
2017-03-30 09:22:59 +00:00
|
|
|
function removeService() {
|
2016-09-23 04:54:58 +00:00
|
|
|
$('#loadingViewSpinner').show();
|
|
|
|
Service.remove({id: $stateParams.id}, function (d) {
|
|
|
|
if (d.message) {
|
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Error", d, "Unable to remove service");
|
2016-09-23 04:54:58 +00:00
|
|
|
} else {
|
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.success("Service removed", $stateParams.id);
|
2016-09-23 04:54:58 +00:00
|
|
|
$state.go('services', {});
|
|
|
|
}
|
|
|
|
}, function (e) {
|
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Failure", e, "Unable to remove service");
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
2017-03-30 09:22:59 +00:00
|
|
|
}
|
2016-09-23 04:54:58 +00:00
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
function translateServiceArrays(service) {
|
|
|
|
service.ServiceSecrets = service.Secrets;
|
|
|
|
service.EnvironmentVariables = translateEnvironmentVariables(service.Env);
|
|
|
|
service.ServiceLabels = translateLabelsToServiceLabels(service.Labels);
|
|
|
|
service.ServiceContainerLabels = translateLabelsToServiceLabels(service.ContainerLabels);
|
|
|
|
service.ServiceMounts = angular.copy(service.Mounts);
|
|
|
|
service.ServiceConstraints = translateConstraintsToKeyValue(service.Constraints);
|
|
|
|
}
|
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
function fetchServiceDetails() {
|
|
|
|
$('#loadingViewSpinner').show();
|
|
|
|
Service.get({id: $stateParams.id}, function (d) {
|
|
|
|
var service = new ServiceViewModel(d);
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.isUpdating = $scope.lastVersion >= service.Version;
|
|
|
|
if (!$scope.isUpdating) {
|
|
|
|
$scope.lastVersion = service.Version;
|
|
|
|
}
|
2016-11-09 00:23:56 +00:00
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
translateServiceArrays(service);
|
2016-09-23 04:54:58 +00:00
|
|
|
$scope.service = service;
|
2017-03-20 20:28:09 +00:00
|
|
|
originalService = angular.copy(service);
|
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
Task.query({filters: {service: [service.Name]}}, function (tasks) {
|
|
|
|
Node.query({}, function (nodes) {
|
|
|
|
$scope.displayNode = true;
|
|
|
|
$scope.tasks = tasks.map(function (task) {
|
|
|
|
return new TaskViewModel(task, nodes);
|
|
|
|
});
|
|
|
|
$('#loadingViewSpinner').hide();
|
|
|
|
}, function (e) {
|
|
|
|
$('#loadingViewSpinner').hide();
|
|
|
|
$scope.tasks = tasks.map(function (task) {
|
|
|
|
return new TaskViewModel(task, null);
|
|
|
|
});
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Failure", e, "Unable to retrieve node information");
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
|
|
|
}, function (e) {
|
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Failure", e, "Unable to retrieve tasks associated to the service");
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
|
|
|
}, function (e) {
|
|
|
|
$('#loadingViewSpinner').hide();
|
2017-04-12 19:47:22 +00:00
|
|
|
Notifications.error("Failure", e, "Unable to retrieve service details");
|
2016-09-23 04:54:58 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
$scope.updateServiceAttribute = function updateServiceAttribute(service, name) {
|
|
|
|
if (service[name] !== originalService[name] || !(name in originalService)) {
|
|
|
|
service.hasChanges = true;
|
2016-11-09 00:23:56 +00:00
|
|
|
}
|
2017-03-20 20:28:09 +00:00
|
|
|
previousServiceValues.push(name);
|
|
|
|
};
|
|
|
|
|
|
|
|
function updateServiceArray(service, name) {
|
|
|
|
previousServiceValues.push(name);
|
2016-11-09 00:23:56 +00:00
|
|
|
service.hasChanges = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function translateEnvironmentVariables(env) {
|
|
|
|
if (env) {
|
|
|
|
var variables = [];
|
|
|
|
env.forEach(function(variable) {
|
2016-11-25 11:48:12 +00:00
|
|
|
var idx = variable.indexOf('=');
|
|
|
|
var keyValue = [variable.slice(0,idx), variable.slice(idx+1)];
|
2016-11-09 00:23:56 +00:00
|
|
|
var originalValue = (keyValue.length > 1) ? keyValue[1] : '';
|
2017-03-20 20:28:09 +00:00
|
|
|
variables.push({ key: keyValue[0], value: originalValue, originalKey: keyValue[0], originalValue: originalValue, added: true});
|
2016-11-09 00:23:56 +00:00
|
|
|
});
|
|
|
|
return variables;
|
|
|
|
}
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
function translateEnvironmentVariablesToEnv(env) {
|
|
|
|
if (env) {
|
|
|
|
var variables = [];
|
|
|
|
env.forEach(function(variable) {
|
2017-05-05 04:25:48 +00:00
|
|
|
if (variable.key && variable.key !== '') {
|
2016-11-09 00:23:56 +00:00
|
|
|
variables.push(variable.key + '=' + variable.value);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return variables;
|
|
|
|
}
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2016-11-10 02:38:49 +00:00
|
|
|
function translateLabelsToServiceLabels(Labels) {
|
|
|
|
var labels = [];
|
|
|
|
if (Labels) {
|
|
|
|
Object.keys(Labels).forEach(function(key) {
|
2017-03-20 20:28:09 +00:00
|
|
|
labels.push({ key: key, value: Labels[key], originalKey: key, originalValue: Labels[key], added: true});
|
2016-11-10 02:38:49 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return labels;
|
|
|
|
}
|
|
|
|
function translateServiceLabelsToLabels(labels) {
|
|
|
|
var Labels = {};
|
|
|
|
if (labels) {
|
|
|
|
labels.forEach(function(label) {
|
|
|
|
Labels[label.key] = label.value;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return Labels;
|
|
|
|
}
|
|
|
|
|
2017-03-20 20:28:09 +00:00
|
|
|
function translateConstraintsToKeyValue(constraints) {
|
|
|
|
function getOperator(constraint) {
|
|
|
|
var indexEquals = constraint.indexOf('==');
|
|
|
|
if (indexEquals >= 0) {
|
|
|
|
return [indexEquals, '=='];
|
|
|
|
}
|
|
|
|
return [constraint.indexOf('!='), '!='];
|
|
|
|
}
|
|
|
|
if (constraints) {
|
|
|
|
var keyValueConstraints = [];
|
|
|
|
constraints.forEach(function(constraint) {
|
|
|
|
var operatorIndices = getOperator(constraint);
|
|
|
|
|
|
|
|
var key = constraint.slice(0, operatorIndices[0]);
|
|
|
|
var operator = operatorIndices[1];
|
|
|
|
var value = constraint.slice(operatorIndices[0] + 2);
|
|
|
|
|
|
|
|
keyValueConstraints.push({
|
|
|
|
key: key,
|
|
|
|
value: value,
|
|
|
|
operator: operator,
|
|
|
|
originalKey: key,
|
|
|
|
originalValue: value
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return keyValueConstraints;
|
|
|
|
}
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2016-09-23 04:54:58 +00:00
|
|
|
fetchServiceDetails();
|
|
|
|
}]);
|