User Tools

Site Tools


recipes

This is an old revision of the document!


Recipes

The recipe allows you to initialize a set of registers with pre-defined values. There are several options for using recipes:

  • Recipes can be applied either by selecting an entry in the recipe drop-down list or by calling a script
  • Recipes can be edited right on the dashboard with a quick edit method (not going back to the main recipe menu)
  • Recipes can be visible or not for different users. Some recipes can be 'locked' (i.e. viewed w/o possibility to change recipe data for users except the admin) to protect important, or base recipes from changing.
  • Recipe list can be used as a handy tool for analysing user choice from different options. In this case recipe names in the list or category serve as a placeholders for the selection listbox. The selected id is returned to the lua script which then can process the selection.

Recipes page

The recipe management menu resides in a 'logic' section of the Setup menu:

The main spots of the recipe management page are:

  1. Import/Export buttons. The recipe can be exported to a JSON file. After importing such recipe file, it will create a new entry in the list with a new id.
  2. Add recipe button
  3. Recipe category. use them to divide the list, then the dropdown lists on dashboard can show only specific category you set for them
  4. 'Locked' recipe colored light gray. This recipe can only be edited by admin, but still viewed by the users with respective rights
  5. Checkbox for selecting export candidates
  6. Common (non-locked) recipe list.
  7. Edit/Delete/Clone buttons

Recipe setup

The Basic tab:

  • Title - this title will be seen in the selection lists and setup page
  • Description - user comments for the recipe
  • Disable checkbox - hides this recipe from the list
  • Lock - prevent the recipe from editing by non-admin users
  • Registers 1..4 / Value / Description - this set of the registers will be initialized with the respective values upon invoking recipe. The description given here will be used to show the comments in the quick edit window (right on the dashboard)
  • Delete button deletes the register n from the list
  • Add register to recipe button expands the list with a new entry

The Permission tab lists the users who can view or edit recipes.

Using recipe on the dashboard

When placing a recipes selection listbox on a dashboard, there are some specific attributes you must specify:

  • Category of recipes, or a full list.
  • The register accosiated with the dropdown list which will keep the id of the selected recipe.
  • 'Allow change value' checkbox. If you want the user be able to expand the list, check it, otherwise the user won't be able to select and expand the list. With unchecked option, the recipes can be itereated with the lua script and extra buttons which return next/previous selection event (register value coding the action)
  • 'Apply immediately' checkbox. The values from the set will be written at once after selection, or you can check register change in a lua script and first do some steps before applying a recipe.

If the user has right to edit the recipe, he can do this right in the selectoin box:

Using recipes in scripts

To apply recipes within scripts, the ApplyRecipe (recipeId, userId) function is used. See here. The example of such script:

function main (userId)
    local id = GetReg("rcpSelector")
    ApplyRecipe(id, userId)
    AddInfoMessage("The recipe with id = " .. id .. " was applied!")
end

recipes.1591024420.txt.gz ยท Last modified: 2020/06/01 15:13 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki