Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@zenginehq/frontend-multi-config
Advanced tools
Helper module for working with multiple configurations in Zengine frontend plugins.
Helper module for implementing settings forms. Contains a form-builder, support for multiple settings sections separated by tabs and also for multiple configurations.
# Run this from your frontend plugin's src diretory.
npm i @zenginehq/frontend-multi-config --save
It's important that this gets inside under the src
directory, alongside your plugin's other code if not Maya won't build it properly.
In order to update this module to a newer version run this in your plugin's src
directory:
npm i @zenginehq/frontend-multi-config@latest --save
Add the directive to you settings page template;
<script type="text/ng-template" id="wgn-settings">
<wgn-multi-config settings="configSettings"></wgn-multi-config>
</script>
Then, build out and add configSettings
to your controller's scope:
plugin.controller('wgnSettingsCtrl', ['$scope', function ($scope) {
// Define plugin settings (see "Settings" section below)
$scope.configSettings = {
title: 'My Awesome Plugin Settings',
icon: 'icon-emo-sunglasses',
help: 'This is some instructional text explaining what these settings do. I am concise, yet informative.',
multi: true,
toggle: true,
pages: [
{
id: 'target',
name: 'Target Form',
fields: [],
},
{
id: 'logging',
name: 'Logging Form',
fields: []
}
]
};
// For advanced usage you can also listen for certain multi config events (see "Events" section).
$scope.$on('wgnMultiConfigEdit', function (ev, config) {
console.log('this is the config being edited', config);
});
}]);
We're done, that's it! Give it some settings and the directive will take care of the rest!
The following options are supported:
true
to support multiple configurations or false
to have a single configuration. Defaults to false
true
to allow enabling and disabling a configuration (ie: to prevent webhooks running) or false
for configurations to be always on. Defaults to false
settings pages
(see next section)A settings page
is what will actually hold the fields for your settings.
You may define as many as you want but must have at least one!
In the event that there are multiple settings pages, they will be navigatable using tabs.
{
id: 'firstpage',
name: 'First Page',
fields: []
}
The following properties are supported:
settings fields
for each page (see next section)A field
is a simple object describing what the field should be:
[
{
id: 'targetFormId',
name: 'Target Form',
help: 'The form which contains the data to check.',
required: true,
type: 'form'
},
{
id: 'targetFieldId',
name: 'Target Field',
help: 'The field which contains the specific data to check.',
required: true,
type: 'field',
belongsTo: 'targetFormId',
restrict: 'text-input'
}
]
There are many different field types and some may have specific settings but all fields share the following base settings:
true
to make the field required or false
to make it optional. Defaults to false
.field type
(see next section)The following field types are available:
A form
field is a dropdown input that allows you to pick one of the forms in the given workspace.
A field
field is a special dropdown input that allows you to pick a field from a certain form, optionally limiting to a certain field type.
It has the following extra settings:
form
input this should display fields fromtext-input
, date-picker
, linked
, etc.A simple text input. It has the following extra setting:
A simple numeric input. It has the following extra setting:
A muli-line text input.
A dropdown input. It has the following extra setting:
[
{
value: 'off',
label: 'Off'
},
{
value: 'on',
label: 'On'
}
]
A special field that lets you display any arbitrary markup. Note: This field doesn't share any base settings and instead has just one:
See here for additional configuration examples.
The following events are emitted at various stages of the multi config workflow and can be used to achieve deeper customization for more complex forms.
wgnMultiConfigInit
when all firebase data has been loaded and the plugin has initialized.wgnMultiConfigAdd
when a new configuration is being created, receives no params. This is useful if you need to perform some first-time setup for new configurations.wgnMultiConfigSave
when configuration is saved, receives the config as a param. This is useful if you need to perform tasks once a config is successfully saved, such as enable a webhook.wgnMultiConfigEdit
when a configuration is selected for editing, receives the config as a param. This is useful if you need to load additional data such as fields for a selected form in the config.wgnMultiConfigDiscard
when changes are being discarded for the config being edited, receives no params. This is useful if you need to perform additional cleanup or perform any extra action such as going to a default tab.wgnMultiConfigDelete
when a configuration is deleted, receives the config as a param. This is useful to do some additional cleanup such as delete a webhook.wgnMultiConfigEnable
when a configuration is enabled.wgnMultiConfigDisable
when a configuration is disabled.In order to leverage multiple configs in your backend services it's recommended to always pass the following query string parameter to both znPluginData
requests and also webhook urls: '?config=' + encodeURI(config.$id)
Then in your backend service:
var configId = eventData.request.query.config;
if (!configId){
eventData.response.status(403).send('Config id required');
}
// Vanilla (boo)
firebase().child(workspaceId).child('settings').child(configId).once('value', function(snapshot) {
settings = snapshot.val();
console.log('settings', settings);
});
// Using zn-backend-firebase (awesome)
var zbf = require('zn-backend-firebase');
zbf.load([workspaceId, 'settings', configId]).then(function (settings) {
console.log('settings', settings);
});
2.4.0 (2018-06-12)
<a name="2.3.0"></a>
FAQs
Helper module for working with multiple configurations in Zengine frontend plugins.
We found that @zenginehq/frontend-multi-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.