Merge branch 'master' into url_context_path
This commit is contained in:
commit
725eee549d
@ -31,6 +31,9 @@ class DestinationOutputSchema(LemurOutputSchema):
|
|||||||
def fill_object(self, data):
|
def fill_object(self, data):
|
||||||
if data:
|
if data:
|
||||||
data["plugin"]["pluginOptions"] = data["options"]
|
data["plugin"]["pluginOptions"] = data["options"]
|
||||||
|
for option in data["plugin"]["pluginOptions"]:
|
||||||
|
if "export-plugin" in option["type"]:
|
||||||
|
option["value"]["pluginOptions"] = option["value"]["plugin_options"]
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,12 +41,14 @@ def create(label, plugin_name, options, description=None):
|
|||||||
return database.create(destination)
|
return database.create(destination)
|
||||||
|
|
||||||
|
|
||||||
def update(destination_id, label, options, description):
|
def update(destination_id, label, plugin_name, options, description):
|
||||||
"""
|
"""
|
||||||
Updates an existing destination.
|
Updates an existing destination.
|
||||||
|
|
||||||
:param destination_id: Lemur assigned ID
|
:param destination_id: Lemur assigned ID
|
||||||
:param label: Destination common name
|
:param label: Destination common name
|
||||||
|
:param plugin_name:
|
||||||
|
:param options:
|
||||||
:param description:
|
:param description:
|
||||||
:rtype : Destination
|
:rtype : Destination
|
||||||
:return:
|
:return:
|
||||||
@ -54,6 +56,11 @@ def update(destination_id, label, options, description):
|
|||||||
destination = get(destination_id)
|
destination = get(destination_id)
|
||||||
|
|
||||||
destination.label = label
|
destination.label = label
|
||||||
|
destination.plugin_name = plugin_name
|
||||||
|
# remove any sub-plugin objects before try to save the json options
|
||||||
|
for option in options:
|
||||||
|
if "plugin" in option["type"]:
|
||||||
|
del option["value"]["plugin_object"]
|
||||||
destination.options = options
|
destination.options = options
|
||||||
destination.description = description
|
destination.description = description
|
||||||
|
|
||||||
|
@ -338,6 +338,7 @@ class Destinations(AuthenticatedResource):
|
|||||||
return service.update(
|
return service.update(
|
||||||
destination_id,
|
destination_id,
|
||||||
data["label"],
|
data["label"],
|
||||||
|
data["plugin"]["slug"],
|
||||||
data["plugin"]["plugin_options"],
|
data["plugin"]["plugin_options"],
|
||||||
data["description"],
|
data["description"],
|
||||||
)
|
)
|
||||||
|
@ -104,12 +104,13 @@ def create(label, plugin_name, options, description, certificates):
|
|||||||
return database.create(notification)
|
return database.create(notification)
|
||||||
|
|
||||||
|
|
||||||
def update(notification_id, label, options, description, active, certificates):
|
def update(notification_id, label, plugin_name, options, description, active, certificates):
|
||||||
"""
|
"""
|
||||||
Updates an existing notification.
|
Updates an existing notification.
|
||||||
|
|
||||||
:param notification_id:
|
:param notification_id:
|
||||||
:param label: Notification label
|
:param label: Notification label
|
||||||
|
:param plugin_name:
|
||||||
:param options:
|
:param options:
|
||||||
:param description:
|
:param description:
|
||||||
:param active:
|
:param active:
|
||||||
@ -120,6 +121,7 @@ def update(notification_id, label, options, description, active, certificates):
|
|||||||
notification = get(notification_id)
|
notification = get(notification_id)
|
||||||
|
|
||||||
notification.label = label
|
notification.label = label
|
||||||
|
notification.plugin_name = plugin_name
|
||||||
notification.options = options
|
notification.options = options
|
||||||
notification.description = description
|
notification.description = description
|
||||||
notification.active = active
|
notification.active = active
|
||||||
|
@ -340,6 +340,7 @@ class Notifications(AuthenticatedResource):
|
|||||||
return service.update(
|
return service.update(
|
||||||
notification_id,
|
notification_id,
|
||||||
data["label"],
|
data["label"],
|
||||||
|
data["plugin"]["slug"],
|
||||||
data["plugin"]["plugin_options"],
|
data["plugin"]["plugin_options"],
|
||||||
data["description"],
|
data["description"],
|
||||||
data["active"],
|
data["active"],
|
||||||
|
@ -264,13 +264,14 @@ def create(label, plugin_name, options, description=None):
|
|||||||
return database.create(source)
|
return database.create(source)
|
||||||
|
|
||||||
|
|
||||||
def update(source_id, label, options, description):
|
def update(source_id, label, plugin_name, options, description):
|
||||||
"""
|
"""
|
||||||
Updates an existing source.
|
Updates an existing source.
|
||||||
|
|
||||||
:param source_id: Lemur assigned ID
|
:param source_id: Lemur assigned ID
|
||||||
:param label: Source common name
|
:param label: Source common name
|
||||||
:param options:
|
:param options:
|
||||||
|
:param plugin_name:
|
||||||
:param description:
|
:param description:
|
||||||
:rtype : Source
|
:rtype : Source
|
||||||
:return:
|
:return:
|
||||||
@ -278,6 +279,7 @@ def update(source_id, label, options, description):
|
|||||||
source = get(source_id)
|
source = get(source_id)
|
||||||
|
|
||||||
source.label = label
|
source.label = label
|
||||||
|
source.plugin_name = plugin_name
|
||||||
source.options = options
|
source.options = options
|
||||||
source.description = description
|
source.description = description
|
||||||
|
|
||||||
|
@ -284,6 +284,7 @@ class Sources(AuthenticatedResource):
|
|||||||
return service.update(
|
return service.update(
|
||||||
source_id,
|
source_id,
|
||||||
data["label"],
|
data["label"],
|
||||||
|
data["plugin"]["slug"],
|
||||||
data["plugin"]["plugin_options"],
|
data["plugin"]["plugin_options"],
|
||||||
data["description"],
|
data["description"],
|
||||||
)
|
)
|
||||||
|
@ -52,20 +52,20 @@ angular.module('lemur')
|
|||||||
if (plugin.slug === $scope.destination.plugin.slug) {
|
if (plugin.slug === $scope.destination.plugin.slug) {
|
||||||
plugin.pluginOptions = $scope.destination.plugin.pluginOptions;
|
plugin.pluginOptions = $scope.destination.plugin.pluginOptions;
|
||||||
$scope.destination.plugin = plugin;
|
$scope.destination.plugin = plugin;
|
||||||
_.each($scope.destination.plugin.pluginOptions, function (option) {
|
|
||||||
if (option.type === 'export-plugin') {
|
|
||||||
PluginService.getByType('export').then(function (plugins) {
|
PluginService.getByType('export').then(function (plugins) {
|
||||||
$scope.exportPlugins = plugins;
|
$scope.exportPlugins = plugins;
|
||||||
|
|
||||||
|
_.each($scope.destination.plugin.pluginOptions, function (option) {
|
||||||
|
if (option.type === 'export-plugin') {
|
||||||
_.each($scope.exportPlugins, function (plugin) {
|
_.each($scope.exportPlugins, function (plugin) {
|
||||||
if (plugin.slug === option.value.slug) {
|
if (plugin.slug === option.value.slug) {
|
||||||
plugin.pluginOptions = option.value.pluginOptions;
|
plugin.pluginOptions = option.value.pluginOptions;
|
||||||
option.value = plugin;
|
option.value = plugin;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -42,8 +42,8 @@ angular.module('lemur')
|
|||||||
PluginService.getByType('notification').then(function (plugins) {
|
PluginService.getByType('notification').then(function (plugins) {
|
||||||
$scope.plugins = plugins;
|
$scope.plugins = plugins;
|
||||||
_.each($scope.plugins, function (plugin) {
|
_.each($scope.plugins, function (plugin) {
|
||||||
if (plugin.slug === $scope.notification.pluginName) {
|
if (plugin.slug === $scope.notification.plugin.slug) {
|
||||||
plugin.pluginOptions = $scope.notification.notificationOptions;
|
plugin.pluginOptions = $scope.notification.plugin.pluginOptions;
|
||||||
$scope.notification.plugin = plugin;
|
$scope.notification.plugin = plugin;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -51,16 +51,6 @@ angular.module('lemur')
|
|||||||
NotificationService.getCertificates(notification);
|
NotificationService.getCertificates(notification);
|
||||||
});
|
});
|
||||||
|
|
||||||
PluginService.getByType('notification').then(function (plugins) {
|
|
||||||
$scope.plugins = plugins;
|
|
||||||
_.each($scope.plugins, function (plugin) {
|
|
||||||
if (plugin.slug === $scope.notification.pluginName) {
|
|
||||||
plugin.pluginOptions = $scope.notification.notificationOptions;
|
|
||||||
$scope.notification.plugin = plugin;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.save = function (notification) {
|
$scope.save = function (notification) {
|
||||||
NotificationService.update(notification).then(
|
NotificationService.update(notification).then(
|
||||||
function () {
|
function () {
|
||||||
|
@ -41,22 +41,14 @@ angular.module('lemur')
|
|||||||
PluginService.getByType('source').then(function (plugins) {
|
PluginService.getByType('source').then(function (plugins) {
|
||||||
$scope.plugins = plugins;
|
$scope.plugins = plugins;
|
||||||
_.each($scope.plugins, function (plugin) {
|
_.each($scope.plugins, function (plugin) {
|
||||||
if (plugin.slug === $scope.source.pluginName) {
|
if (plugin.slug === $scope.source.plugin.slug) {
|
||||||
|
plugin.pluginOptions = $scope.source.plugin.pluginOptions;
|
||||||
$scope.source.plugin = plugin;
|
$scope.source.plugin = plugin;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
PluginService.getByType('source').then(function (plugins) {
|
|
||||||
$scope.plugins = plugins;
|
|
||||||
_.each($scope.plugins, function (plugin) {
|
|
||||||
if (plugin.slug === $scope.source.pluginName) {
|
|
||||||
$scope.source.plugin = plugin;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.save = function (source) {
|
$scope.save = function (source) {
|
||||||
SourceService.update(source).then(
|
SourceService.update(source).then(
|
||||||
function () {
|
function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user