@zenginehq/frontend-config
Advanced tools
Comparing version 3.3.0 to 3.4.0
{ | ||
"name": "@zenginehq/frontend-config", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "Helper module for implementing Zengine plugin configuration forms.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -156,3 +156,3 @@ plugin.service('wgnConfigInputs', [function () { | ||
* | ||
* @param {string} source | ||
* @param {string} target | ||
* @param {Array<string>} allowed | ||
@@ -163,2 +163,6 @@ * | ||
function checkAllowedItems (target, allowed) { | ||
if (!target) { | ||
return true; | ||
} | ||
// Allow concatenating multiple items with a pipe for consistency with znData. | ||
@@ -165,0 +169,0 @@ var items = target.split('|'); |
@@ -98,3 +98,3 @@ plugin.controller('wgnConfigCtrl', ['$scope', '$q', '$routeParams', 'znData', 'znModal', 'znMessage', 'wgnConfigSrv', | ||
title: 'Are you sure?', | ||
template: '<p>Are you sure you want to delete the <strong>' + $scope.editing.config.configName + '</strong> configuration?</p><p>This action is irreversible.</p>', | ||
template: '<p>Are you sure you want to delete the <strong>' + $scope.editing.config.name + '</strong> configuration?</p><p>This action is irreversible.</p>', | ||
classes: '', | ||
@@ -109,2 +109,3 @@ closeButton: false, | ||
action: function () { | ||
$scope.saving = true; | ||
return configService.deleteConfig(_workspaceId, $scope.editing.config, $scope.configs).then(function () { | ||
@@ -114,2 +115,3 @@ doRunHook('delete', shallowCopy($scope.editing.config)).finally(function () { | ||
znMessage('The configuration has been deleted!', 'info'); | ||
$scope.saving = false; | ||
}); | ||
@@ -174,12 +176,14 @@ }).catch(function (err) { | ||
$scope.onDisableConfig = function () { | ||
$scope.saving = true; | ||
$scope.editing.config.enabled = false; | ||
return doRunHook('disable', $scope.editing.config).then(function (data) { | ||
if (data && angular.isObject(data)) { | ||
angular.extend($scope.editing.config, data); | ||
} | ||
return doRunHook('disable', $scope.editing.config).then(function () { | ||
return doSaveConfig($scope.editing.config); | ||
}).catch(function () { | ||
$scope.editing.config.enabled = true; | ||
znMessage('There was an error disabling the configuration!', 'error'); | ||
}).then(function () { | ||
znMessage('Configuration disabled!', 'saved'); | ||
}).finally(function () { | ||
$scope.saving = false; | ||
}); | ||
@@ -192,12 +196,14 @@ }; | ||
$scope.onEnableConfig = function () { | ||
$scope.saving = true; | ||
$scope.editing.config.enabled = true; | ||
doRunHook('enable', $scope.editing.config).then(function (data) { | ||
if (data && angular.isObject(data)) { | ||
angular.extend($scope.editing.config, data); | ||
} | ||
doRunHook('enable', $scope.editing.config).then(function () { | ||
return doSaveConfig($scope.editing.config); | ||
}).catch(function () { | ||
$scope.editing.config.enabled = false; | ||
znMessage('There was an error enabling the configuration!', 'error'); | ||
}).then(function () { | ||
znMessage('Configuration enabled!', 'saved'); | ||
}).finally(function () { | ||
$scope.saving = false; | ||
}); | ||
@@ -417,3 +423,3 @@ }; | ||
return doSaveConfig(config).then(function () { | ||
znMessage('Configuration ' + config.configName + ' enabled!', 'saved'); | ||
znMessage('Configuration ' + config.name + ' enabled!', 'saved'); | ||
}); | ||
@@ -428,3 +434,3 @@ }); | ||
return doSaveConfig(config).then(function () { | ||
znMessage('Configuration ' + config.configName + ' disabled!', 'saved'); | ||
znMessage('Configuration ' + config.name + ' disabled!', 'saved'); | ||
}); | ||
@@ -431,0 +437,0 @@ }); |
plugin.service('wgnConfigSrv', ['$q', '$firebase', 'znData', function ($q, $firebase, znData) { | ||
var srv = this; | ||
@@ -4,0 +3,0 @@ |
@@ -92,3 +92,3 @@ plugin.service('wgnConfigSettings', ['$q', 'wgnConfigInputs', function ($q, configInputs) { | ||
// Make sure reserved ids aren't used. | ||
var reserved = ['configName']; | ||
var reserved = ['name', 'enabled']; | ||
if (reserved.indexOf(def.id) !== -1) { | ||
@@ -95,0 +95,0 @@ throw new Error('Config: The id "' + def.id + '" is reserved for internal use and can\'t be assigned to inputs.'); |
@@ -11,3 +11,3 @@ plugin.directive('wgnValidatorConfigName', [function () { | ||
scope.configs.forEach(function (config) { | ||
if (config.configName === viewVal && config.$id !== ourId) { | ||
if (config.name === viewVal && config.$id !== ourId) { | ||
valid = false; | ||
@@ -14,0 +14,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175545
1384