### Start UI Bakery Containers
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-compose
After running the setup script, use this command to start all necessary UI Bakery containers in detached mode.
```bash
docker compose up -d
```
--------------------------------
### Run UI Bakery Setup Script
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-compose
Execute the setup script to configure your UI Bakery instance. You will be prompted for your license key, desired port, and server URL.
```bash
./setup.sh
```
--------------------------------
### Backup Installation Folder
Source: https://docs.uibakery.io/on-premise/install-and-update/updating-on-premise-version
Create a copy of the existing installation directory before performing a major version upgrade.
```bash
cp -R ui-bakery-on-premise ui-bakery-on-premise_old
```
--------------------------------
### React Integration Example
Source: https://docs.uibakery.io/concepts/components/custom-component
A full-page example demonstrating how to integrate custom components using React. It utilizes UB.connectReactComponent for seamless integration.
```html
```
--------------------------------
### Install NGINX on Ubuntu
Source: https://docs.uibakery.io/on-premise/networking-and-security/custom-base-url
Standard commands to update package lists and install the NGINX web server.
```bash
sudo apt update
sudo apt install nginx
```
--------------------------------
### Install On-Premise UI Bakery
Source: https://docs.uibakery.io/concepts/data-sources/connecting-local-database-via-ngrok
Use this command to set up the on-premise version of UI Bakery. You can generate a trial license during installation.
```bash
curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
```
--------------------------------
### Download On-Premise Configuration Files
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-compose
Use this command to download the necessary Docker Compose and setup files for UI Bakery on-premise installation. Ensure you have curl installed.
```bash
mkdir ui-bakery-on-premise && cd ui-bakery-on-premise && curl -k -L -o docker-compose.yml https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose.yml && curl -k -L -o docker-compose-external-db.yml https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose-external-db.yml && curl -k -L -o setup.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/setup.sh
```
--------------------------------
### Initialize Environment
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-run
Create the project directory and download the setup script.
```bash
mkdir ui-bakery-on-premise && cd ui-bakery-on-premise && curl -k -L -o setup.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/setup.sh
```
```bash
./setup.sh
```
--------------------------------
### Get List of Users Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Example JSON response for a successful GET request to retrieve all users in a workspace.
```json
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 0,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "user@example.com",
"meta": {
"resourceType": "User",
"created": "2023-04-12T00:00:00+03:00",
"lastModified": "2023-04-12T00:00:00+03:00",
"location": "/scim/v2/workspace/Users/user@example.com"
},
"userName": "user@example.com",
"name": {
"formatted": "User Name",
"familyName": "",
"givenName": "",
"middleName": ""
},
"displayName": "User Name",
"active": true,
"emails": [
{
"value": "user@example.com"
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "admin",
"type": "workspace"
}
]
}
]
}
```
--------------------------------
### Start Application Containers
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-run
Launch individual UI Bakery service containers.
```bash
docker run -d \
--name bakery-back \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/bakery-back:latest
```
```bash
docker run -d \
--name workbench-front \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/workbench-front:latest
```
```bash
docker run -d \
--name bakery-front \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/bakery-front:latest
```
```bash
docker run -d \
--name datasource \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/datasource:latest
```
```bash
docker run -d \
--name python-runtime \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/python-runtime:latest
```
```bash
docker run -d \
--name automation \
--env-file .env \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/automation:latest
```
```bash
docker run -d \
--name gateway \
--env-file .env \
-p ${UI_BAKERY_PORT:-3030}:3030 \
--restart always \
--network ui-bakery-on-premise \
cruibakeryonprem.azurecr.io/cloud/gateway:latest
```
--------------------------------
### Start Database Container
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-run
Launch the internal MySQL database container for metadata storage.
```bash
docker run -d \
--name db \
--restart always \
--platform linux/amd64 \
--cap-add SYS_NICE \
--env-file .env \
-e MYSQL_DATABASE=bakery \
-e MYSQL_USER=bakery \
-e MYSQL_PASSWORD=bakery \
-e MYSQL_ROOT_PASSWORD=root \
-v my-db:/var/lib/mysql \
--health-cmd 'mysql -h localhost -u bakery --password=bakery -e "select 1"' \
--health-timeout 1s \
--health-interval 10s \
--health-retries 10 \
--network=ui-bakery-on-premise \
mysql:8.0 --default-authentication-plugin=mysql_native_password
```
--------------------------------
### Install Certbot using Snap
Source: https://docs.uibakery.io/on-premise/networking-and-security/setting-up-ssl-on-ubuntu
Installs the Certbot tool, which automates the process of obtaining and renewing SSL certificates from Let's Encrypt. It's recommended to install via snap.
```bash
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
```
--------------------------------
### localStorage API Usage Examples
Source: https://docs.uibakery.io/concepts/localstorage
Demonstrates common localStorage operations: setting an item, getting an item, removing an item, and clearing all items. Use these methods to manage persistent browser data.
```javascript
// Save data to localStorage
await {{localStorage}}.setItem('foo', 'bar');
```
```javascript
// Retrieve data from localStorage
const username = {{localStorage}}.getItem('foo');
```
```javascript
// Remove data from localStorage
await {{localStorage}}.removeItem('foo');
```
```javascript
// Clear all data from localStorage
await {{localStorage}}.clear();
```
--------------------------------
### Install JSON-Server Package
Source: https://docs.uibakery.io/build-from-scratch/getting-started/build-ui/mocking-data
Install the JSON-Server npm package globally to set up a local fake JSON API. This command is the first step in creating mock APIs.
```bash
npm install -g json-server
```
--------------------------------
### Dynamic Structure Configuration Example
Source: https://docs.uibakery.io/reference/working-with-components/dynamic-structure-properties
An example of how to configure dynamic structure properties for table columns, including basic string properties and object configurations for type, primary key, and styling.
```javascript
// Example:
[
'full_name',
{ prop: 'id', type: 'number', primaryKey: true, color: 'danger' },
{ prop: 'full_name' },
{ prop: 'avatar', type: 'image' },
{ prop: 'email', type: 'link' },
{
prop: 'email',
type: 'button',
text: '{{value}}',
triggers: {
buttonClick: [`{{actions.onClick.trigger(value)}}`],
},
labelConfig: {
align: 'center',
position: 'horizontal',
},
},
];
// Default type if not specified - string
// Required keys - prop, primaryKey (at least one column must be a primary key for table)
```
--------------------------------
### jQuery Integration Example
Source: https://docs.uibakery.io/concepts/components/custom-component
A full-page example demonstrating how to integrate custom components using jQuery. It includes event triggering, value updates, and data display.
```html
```
--------------------------------
### Start Azure Container Instance
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/azure-container-instance
Starts the UI Bakery services on Azure Container Instance using the specified docker-compose file. This command brings up the necessary containers for UI Bakery to run.
```bash
docker compose -f docker-compose-azure-container-instances.yml up
```
--------------------------------
### General Component Integration Example
Source: https://docs.uibakery.io/concepts/custom-components-2.0
A comprehensive example demonstrating the integration of `useData`, `useLoadAction`, `useMutateAction`, and `triggerEvent` within a React component for full interaction with UI Bakery.
```javascript
import { useData, useLoadAction, useMutateAction, triggerEvent } from '@uibakery/data';
function MyComponent() {
// Receiving data from UI Bakery
const componentData = useData('someData', {});
// Loading data via an action
const [items, loading, error, refreshItems] = useLoadAction('loadItems', []);
// Action for creating data
const [createItem] = useMutateAction('createItem');
const handleCreate = () => {
const newItem = { name: 'A New Item' };
// Call the action
createItem(newItem);
// Trigger the event
triggerEvent({ type: 'itemCreated', data: newItem });
};
// ... rest of the component code
}
```
--------------------------------
### Run JSON-Server
Source: https://docs.uibakery.io/build-from-scratch/getting-started/build-ui/mocking-data
Start the JSON-Server using the watch command to serve your mock API from the db.json file. This command makes your fake API accessible for testing.
```bash
json-server --watch db.json
```
--------------------------------
### Navigate to Installation Directory
Source: https://docs.uibakery.io/on-premise/install-and-update/updating-on-premise-version
Change the current working directory to the UI Bakery on-premise folder before running update commands.
```bash
cd ./ui-bakery-on-premise
```
--------------------------------
### Set Contact Email
Source: https://docs.uibakery.io/on-premise/environment-variables
Example format for the contact email address.
```text
someone@yourdomain.com
```
--------------------------------
### React Custom Component Example
Source: https://docs.uibakery.io/concepts/components/custom-component
An example of a custom component built with React, demonstrating how to receive data from UI Bakery, trigger events, and update values. Ensure all necessary React and Babel scripts are included.
```html
```
--------------------------------
### Run PostgreSQL Container for UI Bakery
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-run
Use this command to start a PostgreSQL container for UI Bakery. Ensure the .env file is configured and the network 'ui-bakery-on-premise' exists.
```bash
docker run -d \
--name bakery-db \
--restart always \
--health-cmd "pg_isready -U bakery" \
--health-interval 1s \
--health-timeout 5s \
--health-retries 10 \
--env-file .env \
-e POSTGRES_USER="bakery" \
-e POSTGRES_PASSWORD="bakery" \
-e POSTGRES_DB="bakery" \
-v internal-db:/var/lib/postgresql/data \
--network ui-bakery-on-premise \
postgres:16.1
```
--------------------------------
### Example of Browser-Compatible React Build
Source: https://docs.uibakery.io/how-tos/data/connect-external-js-library
Illustrates loading a browser-compatible UMD build for React from a CDN. Avoid loading index.js files which may contain require calls.
```html
https://cdn.jsdelivr.net/npm/react@17.0.1/umd/react.production.min.js
```
--------------------------------
### Install Ingress NGINX via Helm
Source: https://docs.uibakery.io/on-premise/networking-and-security/custom-base-url
Command to deploy the ingress-nginx controller into the specified Kubernetes namespace.
```bash
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ui-bakery
```
--------------------------------
### Retrieve Created User Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Example response body returned after successfully creating a new user.
```json
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "user@example.com",
"externalId": null,
"meta": {
"resourceType": "User",
"created": "2023-04-11T21:00:00.000+00:00",
"lastModified": "2023-04-11T21:00:00.000+00:00",
"location": null,
"version": null
},
"userName": "user@example.com",
"name": {
"formatted": "John Doe",
"familyName": "",
"givenName": "",
"middleName": "",
"honorificPrefix": null,
"honorificSuffix": null
},
"displayName": "John Doe",
"emails": [
{
"value": "user@example.com",
"display": null,
"type": null,
"primary": null
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "user",
"type": "endUser",
"$ref": null
}
],
...
}
```
--------------------------------
### Configure environment variables for domain setup
Source: https://docs.uibakery.io/on-premise/networking-and-security/setting-up-a-domain-name
Set the server name and port variables to match your domain or IP address. Ensure the port in UI_BAKERY_PORT matches the port specified in UI_BAKERY_APP_SERVER_NAME.
```bash
UI_BAKERY_APP_SERVER_NAME=http://YOUR_DOMAIN_OR_IP:3030
UI_BAKERY_PORT=3030
```
```bash
UI_BAKERY_APP_SERVER_NAME=https://YOUR_DOMAIN
UI_BAKERY_PORT=80
```
--------------------------------
### Example of ESM Build for Yup
Source: https://docs.uibakery.io/how-tos/data/connect-external-js-library
Demonstrates how to correctly load an ESM build for the Yup library from a CDN. UMD builds generated by jsdelivr might not work for libraries like Yup.
```javascript
import yup from 'https://cdn.jsdelivr.net/npm/yup@0.32.11/+esm'
```
--------------------------------
### Triggering unique actions based on the selected menu item
Source: https://docs.uibakery.io/reference/working-with-components/context-menu-button
This example demonstrates how to set up unique actions for each selected menu item in the Context menu component using JavaScript Code.
```APIDOC
## Working with the component
### Triggering unique actions based on the selected menu item
UI Bakery allows you to set up unique actions for each selected menu item in the Context menu component. Here's how you can do that:
1. Select the Context menu component and set up its menu items.
Make sure each one has a *unique id*, for example, item_1, item_2, item_3, etc.
2. Create your unique actions that you want to be triggered for each item.
3. Next, create another action of the *JavaScript Code* type to trigger specific actions depending on the selected item:
```javascript
if ({{params.id}} === 'item_1') {
await {{actions.itemOneClick.trigger()}};
} else if ({{params.id}} === 'item_2') {
await {{actions.itemTwoClick.trigger()}};
} else if ({{params.id}} === 'item_3') {
await {{actions.itemThreeClick.trigger()}};
}
```
4. Assign this action to the component's **On Item Click** trigger.
When clicking on a menu item, the unique action will be triggered and the `{{params.id}}` variable will contain the value of the selected item id.
```
--------------------------------
### Get User by Email Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Example JSON response for a successful GET request to retrieve a specific user by their email address.
```json
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "test@example.com",
"externalId": null,
"meta": {
"resourceType": "User",
"created": "2023-04-11T21:00:00.000+00:00",
"lastModified": "2023-04-11T21:00:00.000+00:00",
"location": null,
"version": null
},
"userName": "test@example.com",
"name": {
"formatted": "User Name",
"familyName": "",
"givenName": "",
"middleName": "",
"honorificPrefix": null,
"honorificSuffix": null
},
"displayName": "User Name",
"emails": [
{
"value": "test@example.com",
"display": null,
"type": null,
"primary": null
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "admin",
"type": "workspace",
"$ref": null
}
],
...
}
```
--------------------------------
### Initialize UI Bakery Directory
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/windows-installation
Commands to create and navigate to the directory for UI Bakery configuration files.
```bash
mkdir ui-bakery-on-premise
```
```bash
cd ui-bakery-on-premise
```
--------------------------------
### Generate custom keystore
Source: https://docs.uibakery.io/on-premise/networking-and-security/configuring-custom-certificate-authority
Create a new Java keystore file on the host machine.
```bash
keytool -genkey -keyalg RSA -keystore mybakerystore.jks
```
--------------------------------
### GET /Users/{email}
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Retrieves a specific user by their email address.
```APIDOC
## GET /Users/{email}
### Description
Get a user by their email address.
### Method
GET
### Endpoint
`https://UI_BAKERY_INSTANCE/api/scim/v2/{workspace}/Users/{email}`
### Parameters
#### Path Parameters
- **workspace** (String) - Required - UI Bakery workspace slug
- **email** (String) - Required - User email
### Response
#### Success Response (200)
- **schemas** (Array) - Contains the list of schemas for the response.
- **id** (String) - The unique identifier for the user.
- **externalId** (String) - The external identifier for the user.
- **meta** (Object) - Metadata about the user resource.
- **resourceType** (String) - The resource type (e.g., "User").
- **created** (String) - The timestamp when the user was created.
- **lastModified** (String) - The timestamp when the user was last modified.
- **location** (String) - The URL to access the user resource.
- **version** (String) - The version of the user resource.
- **userName** (String) - The username of the user.
- **name** (Object) - The name object for the user.
- **formatted** (String) - The full name, including middle name and suffixes.
- **familyName** (String) - The family name (last name) of the user.
- **givenName** (String) - The given name (first name) of the user.
- **middleName** (String) - The middle name of the user.
- **honorificPrefix** (String) - Honorific prefix (e.g., "Mr.").
- **honorificSuffix** (String) - Honorific suffix (e.g., "Jr.").
- **displayName** (String) - The name displayed for the user.
- **emails** (Array) - An array of email addresses for the user.
- **value** (String) - The email address.
- **display** (String) - The display name for the email address.
- **type** (String) - The type of email address (e.g., "work", "home").
- **primary** (Boolean) - Indicates if this is the primary email address.
- **groups** (Array) - An array of groups the user belongs to.
- **value** (String) - The group ID.
- **display** (String) - The display name of the group.
- **type** (String) - The type of group assignment.
- **$ref** (String) - A reference to the group resource.
### Response Example
```json
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"id": "test@example.com",
"externalId": null,
"meta": {
"resourceType": "User",
"created": "2023-04-11T21:00:00.000+00:00",
"lastModified": "2023-04-11T21:00:00.000+00:00",
"location": null,
"version": null
},
"userName": "test@example.com",
"name": {
"formatted": "User Name",
"familyName": "",
"givenName": "",
"middleName": "",
"honorificPrefix": null,
"honorificSuffix": null
},
"displayName": "User Name",
"emails": [
{
"value": "test@example.com",
"display": null,
"type": null,
"primary": null
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "admin",
"type": "workspace",
"$ref": null
}
],
...
}
```
```
--------------------------------
### GET /Users
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Retrieves a list of users within the specified workspace.
```APIDOC
## GET /Users
### Description
Get a list of users in the workspace.
### Method
GET
### Endpoint
`https://UI_BAKERY_INSTANCE/api/scim/v2/{workspace}/Users`
### Parameters
#### Path Parameters
- **workspace** (String) - Required - UI Bakery workspace slug
#### Query Parameters
- **filter** (String) - Optional - Filter string
- **count** (Integer) - Optional - Number of items to return
- **startIndex** (Integer) - Optional - The starting index of the resource to return
### Response
#### Success Response (200)
- **schemas** (Array) - Contains the list of schemas for the response.
- **totalResults** (Integer) - The total number of results returned.
- **startIndex** (Integer) - The starting index of the current set of resources.
- **itemsPerPage** (Integer) - The number of resources returned in this response.
- **Resources** (Array) - An array of user resources.
- **schemas** (Array) - Schemas for the user resource.
- **id** (String) - The unique identifier for the user.
- **meta** (Object) - Metadata about the user resource.
- **resourceType** (String) - The resource type (e.g., "User").
- **created** (String) - The timestamp when the user was created.
- **lastModified** (String) - The timestamp when the user was last modified.
- **location** (String) - The URL to access the user resource.
- **userName** (String) - The username of the user.
- **name** (Object) - The name object for the user.
- **formatted** (String) - The full name, including middle name and suffixes.
- **familyName** (String) - The family name (last name) of the user.
- **givenName** (String) - The given name (first name) of the user.
- **middleName** (String) - The middle name of the user.
- **displayName** (String) - The name displayed for the user.
- **active** (Boolean) - Indicates if the user account is active.
- **emails** (Array) - An array of email addresses for the user.
- **value** (String) - The email address.
- **groups** (Array) - An array of groups the user belongs to.
- **value** (String) - The group ID.
- **display** (String) - The display name of the group.
- **type** (String) - The type of group assignment.
### Response Example
```json
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 0,
"Resources": [
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"id": "user@example.com",
"meta": {
"resourceType": "User",
"created": "2023-04-12T00:00:00+03:00",
"lastModified": "2023-04-12T00:00:00+03:00",
"location": "/scim/v2/workspace/Users/user@example.com"
},
"userName": "user@example.com",
"name": {
"formatted": "User Name",
"familyName": "",
"givenName": "",
"middleName": ""
},
"displayName": "User Name",
"active": true,
"emails": [
{
"value": "user@example.com"
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "admin",
"type": "workspace"
}
]
}
]
}
```
```
--------------------------------
### Import certificate into keystore
Source: https://docs.uibakery.io/on-premise/networking-and-security/configuring-custom-certificate-authority
Add a certificate file to the existing Java keystore.
```bash
keytool -import -trustcacerts -keystore mybakerystore.jks -alias mycert -file file.cer
```
--------------------------------
### Configure Instance API Token
Source: https://docs.uibakery.io/on-premise/on-premise-features/instance-api
Set the authentication token as an environment variable to enable API access.
```bash
UI_BAKERY_INSTANCE_API_TOKEN=YOUR_TOKEN
```
--------------------------------
### Data Transformation Examples
Source: https://docs.uibakery.io/reference/working-with-actions/load-table-action
JavaScript snippets for modifying the returned data structure.
```javascript
return {{data}}.map(item => {
return {
id: item.id,
name: item.name.toUpperCase(),
};
});
```
```javascript
return {{data}}.map(item => {
return {
...item, // put all the keys from the original object
created_at: new Date(), // add a new property
};
});
```
```javascript
return {{data}}.filter(item => item.id > 10);
```
```javascript
return {{data}}.filter((item) => {
return item.id > 10;
});
```
--------------------------------
### Filter Condition Syntax
Source: https://docs.uibakery.io/reference/working-with-actions/load-table-action
Examples of filter conditions used to locate rows.
```javascript
// name like "%Bobbie%"
{{ui.input.value}}
```
```javascript
// id in array
[1,2,3]
```
--------------------------------
### Initialize Standalone Postgres Database
Source: https://docs.uibakery.io/on-premise/additional-configurations/ui-bakery-postgres
SQL commands to create a dedicated database and user for UI Bakery, including permission restrictions.
```sql
CREATE DATABASE bakery;
CREATE ROLE bakery WITH LOGIN PASSWORD 'SECURE_PASSWORD';
ALTER ROLE bakery CREATEDB CREATEROLE;
# remove unnecessary default permissions
REVOKE TEMPORARY, CONNECT ON DATABASE bakery FROM PUBLIC;
REVOKE TEMPORARY, CONNECT ON DATABASE postgres FROM PUBLIC;
REVOKE TEMPORARY, CONNECT ON DATABASE template1 FROM PUBLIC;
GRANT CONNECT ON DATABASE bakery TO bakery;
```
--------------------------------
### Get an item from DynamoDB
Source: https://docs.uibakery.io/reference/working-with-actions/dynamodb-request
Returns attributes for a specific item identified by its primary key.
```javascript
{
TableName: 'users',
Key: {
Id: {
N: '101'
}
}
}
```
--------------------------------
### Data Transformation Examples
Source: https://docs.uibakery.io/reference/working-with-actions/load-row-action
JavaScript snippets for modifying or extending the returned data object.
```javascript
return {
...{{data}},
name: {{data}}.name.toUpperCase(),
};
```
```javascript
return {
...{{data}},
created_at: new Date(),
};action
```
--------------------------------
### Filter Condition Syntax
Source: https://docs.uibakery.io/reference/working-with-actions/load-row-action
Example of using a UI component property as a filter condition.
```javascript
// id = 23
{{ui.table.selectedRow.data.id}}
```
--------------------------------
### Configure bakery-back volume
Source: https://docs.uibakery.io/on-premise/networking-and-security/configuring-custom-certificate-authority
Mount the keystore directory to the bakery-back service container.
```yaml
bakery-back:
container_name: bakery-back
depends_on:
db:
condition: service_healthy
image: cruibakeryonprem.azurecr.io/cloud/bakery-back:latest
restart: always
env_file: .env
volumes:
- ./keystore_folder:/usr/bakery/keystore_folder
```
--------------------------------
### Get List of Workspace Roles
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Retrieves a list of all roles available within a specific workspace.
```APIDOC
## GET /api/scim/v2/{workspace}/Groups
### Description
Gets a list of all roles within the specified workspace.
### Method
GET
### Endpoint
`https://UI_BAKERY_INSTANCE/api/scim/v2/{workspace}/Groups`
### Parameters
#### Path Parameters
- **workspace** (String) - Required - UI Bakery workspace slug
#### Query Parameters
- **filter** (String) - Optional - Filter string
- **count** (Integer) - Optional - Number of results to return
- **startIndex** (String) - Optional - The starting index for pagination
### Response
#### Success Response (200)
- **schemas** (Array) - Description
- **totalResults** (Integer) - Description
- **Resources** (Array) - Description
#### Response Example
```json
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 3,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "bdeM5DxR8tG",
"meta": {
"created": "2023-06-15T12:49:42+03:00",
"resourceType": "Group",
"location": "/scim/v2/workspace/Groups/ddMfWdR8tG"
},
"displayName": "admin",
"members": [
{
"value": "user@example.com",
"display": "John Doe"
}
],
"roleType": "workspace"
}
]
}
```
```
--------------------------------
### Set Java keystore environment variables
Source: https://docs.uibakery.io/on-premise/networking-and-security/configuring-custom-certificate-authority
Configure the Java trustStore path and password in the .env file.
```bash
JAVA_OPTS='-Djavax.net.ssl.trustStore=/usr/bakery/keystore_folder/mybakerystore.jks -Djavax.net.ssl.trustStorePassword=yourpassword'
```
--------------------------------
### Get hash field with HGET
Source: https://docs.uibakery.io/reference/working-with-actions/redis-command
Retrieves the value of a specific field within a hash map.
```js
['HGET', 'user:123', 'username']
```
--------------------------------
### SQL Dollar Quoting
Source: https://docs.uibakery.io/reference/working-with-actions/sql-query
Example of dollar quoting syntax, which is discouraged due to security risks.
```javascript
SELECT $$ 1 $$
```
--------------------------------
### Return Server Action Parameters
Source: https://docs.uibakery.io/concepts/actions/server-actions
Return the configured parameters from the initial step of a server action. This makes the parameters available for subsequent steps.
```javascript
return {{params}};
```
--------------------------------
### Get List of Workspace Roles Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Successful response body containing a list of workspace groups.
```json
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 3,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "bdeM5DxR8tG",
"meta": {
"created": "2023-06-15T12:49:42+03:00",
"resourceType": "Group",
"location": "/scim/v2/workspace/Groups/ddMfWdR8tG"
},
"displayName": "admin",
"members": [
{
"value": "user@example.com",
"display": "John Doe"
}
],
"roleType": "workspace"
},
...
]
}
```
--------------------------------
### Create and write to a remote file
Source: https://docs.uibakery.io/reference/working-with-actions/ssh-command
Use echo to create a file and populate it with data, including UI Bakery component values.
```bash
echo {{ui.input.value}} > myfile.txt
```
--------------------------------
### Configure Google OAuth2 with Classic Integration
Source: https://docs.uibakery.io/on-premise/sso/openid/google-oauth2
Alternative configuration method requiring multiple environment variables for full OAuth integration.
```text
UI_BAKERY_OAUTH_CLIENT_ID=
UI_BAKERY_OAUTH_CLIENT_SECRET=
UI_BAKERY_OAUTH_SCOPE=profile email
UI_BAKERY_OAUTH_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth
UI_BAKERY_OAUTH_TOKEN_URL=https://oauth2.googleapis.com/token
UI_BAKERY_OAUTH_USERINFO_URL=https://openidconnect.googleapis.com/v1/userinfo
UI_BAKERY_BRANDING_AUTH_SSO_BTN_TEXT=Login with Google
```
--------------------------------
### Get Role Details by ID
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Retrieves the details of a specific role within a workspace using its unique ID.
```APIDOC
## GET /api/scim/v2/{workspace}/Groups/{id}
### Description
Gets the details of a specific role by its ID.
### Method
GET
### Endpoint
`https://UI_BAKERY_INSTANCE/api/scim/v2/{workspace}/Groups/{id}`
### Parameters
#### Path Parameters
- **workspace** (String) - Required - UI Bakery workspace slug
- **id** (String) - Required - UI Bakery Role id
### Response
#### Success Response (200)
- **schemas** (Array) - Description
- **id** (String) - Description
- **externalId** (String) - Description
- **meta** (Object) - Description
- **displayName** (String) - Description
- **members** (Array) - Description
- **roleType** (String) - Description
#### Response Example
```json
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "bdeM5DxR8tG",
"externalId": null,
"meta": {
"resourceType": null,
"created": "2023-06-15T09:49:42.000+00:00"
},
"displayName": "admin",
"members": [
{
"value": "user@example.com",
"display": "John Doe"
}
],
"roleType": "workspace"
}
```
```
--------------------------------
### Get Role Details by ID Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Successful response body containing details for a specific workspace role.
```json
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "bdeM5DxR8tG",
"externalId": null,
"meta": {
"resourceType": null,
"created": "2023-06-15T09:49:42.000+00:00",
},
"displayName": "admin",
"members": [
{
"value": "user@example.com",
"display": "John Doe",
}
],
"roleType": "workspace"
}
```
--------------------------------
### Nginx IPv6 socket error log
Source: https://docs.uibakery.io/on-premise/install-and-update/troubleshooting
Example of the error message indicating an unsupported IPv6 address family.
```plaintext
1#1: socket() [::]:3030 failed (97: Address family not supported by protocol)
socket() [::]:3030 failed (97: Address family not supported by protocol)
```
--------------------------------
### Configure Google OAuth2 with Single Variable
Source: https://docs.uibakery.io/on-premise/sso/openid/google-oauth2
Recommended configuration method using a single environment variable for the Google Client ID.
```text
UI_BAKERY_GOOGLE_CLIENT_ID=
```
--------------------------------
### Apply Kubernetes Changes and Restart
Source: https://docs.uibakery.io/on-premise/networking-and-security/custom-base-url
Commands to apply the updated configuration and perform a rolling restart of the frontend deployments.
```bash
kubectl apply -f .
# you may need to restart frontend
kubectl rollout restart deployment/ui-bakery-front --namespace=ui-bakery
kubectl rollout restart deployment/ui-bakery-workbench-front --namespace=ui-bakery
```
--------------------------------
### Retrieve Updated User Response
Source: https://docs.uibakery.io/on-premise/on-premise-features/scim-2.0
Example response body returned after successfully updating an existing user's details.
```json
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "user@example.com",
"externalId": null,
"meta": {
"resourceType": "User",
"created": "2023-04-11T21:00:00.000+00:00",
"lastModified": "2023-04-11T21:00:00.000+00:00",
"location": null,
"version": null
},
"userName": "user@example.com",
"name": {
"formatted": "John Doe 2",
"familyName": "",
"givenName": "",
"middleName": "",
"honorificPrefix": null,
"honorificSuffix": null
},
"displayName": "John Doe 2",
"emails": [
{
"value": "user@example.com",
"display": null,
"type": null,
"primary": null
}
],
"groups": [
{
"value": "ardFdxe8tG",
"display": "user",
"type": "endUser",
"$ref": null
}
],
...
}
```
--------------------------------
### Execute Update Script
Source: https://docs.uibakery.io/on-premise/install-and-update/updating-on-premise-version
Run the provided shell script to download new images and restart the instance.
```bash
./update.sh
```
--------------------------------
### SQL DELETE statement example
Source: https://docs.uibakery.io/reference/working-with-actions/bulk-delete-rows-action
This represents the SQL command generated by the Bulk Delete Rows step when filtering by ID.
```sql
DELETE FROM users WHERE id IN (23, 24, 25);
```
--------------------------------
### Connect to Old PostgreSQL Instance
Source: https://docs.uibakery.io/extras/ui-bakery-postgres/database-migration
Connect to the 'bakery-db' PostgreSQL instance using Docker. This is the first step in the data-only migration process to access the database.
```bash
docker exec -it bakery-db psql -U bakery
```
--------------------------------
### Create Oracle Stored Procedure
Source: https://docs.uibakery.io/reference/data-sources/oracle
Example of a stored procedure that adds two numbers and returns the result via an OUT parameter.
```plsql
CREATE OR REPLACE PROCEDURE sum_numbers(
num1 IN INT,
num2 IN INT,
result OUT INT
)
IS
BEGIN
result := num1 + num2;
END;
/
```
--------------------------------
### Importing Pandas in Python
Source: https://docs.uibakery.io/reference/working-with-actions/python-backend-code
Import the Pandas library for data manipulation and analysis, particularly for working with DataFrames. Ensure Pandas is installed.
```python
import pandas as pd
# Now you can use Pandas functions and tools in your code, for example:
my_dataframe = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
```
--------------------------------
### Create Docker Network
Source: https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/manual-w-docker-run
Establish a network for inter-container communication.
```bash
docker network create ui-bakery-on-premise
```
--------------------------------
### Importing NumPy in Python
Source: https://docs.uibakery.io/reference/working-with-actions/python-backend-code
Import the NumPy library to use its array manipulation and mathematical functions. Ensure NumPy is installed in the environment.
```python
import numpy as np
# Now you can use NumPy functions and tools in your code, for example:
my_array = np.array([1, 2, 3])
```
--------------------------------
### Rebuild and Restart Containers
Source: https://docs.uibakery.io/on-premise/install-and-update/updating-on-premise-version
Build, pull, and restart the containers to apply changes for legacy version upgrades.
```bash
sudo docker compose build --pull
sudo docker compose pull
sudo docker compose up -d
```
--------------------------------
### Redis Command Action
Source: https://docs.uibakery.io/reference
Perform operations on a Redis instance. This action supports commands like GET, SET, HGETALL, etc.
```json
{
"command": "set",
"key": "mykey",
"value": "myvalue"
}
```
--------------------------------
### Triggering a single action
Source: https://docs.uibakery.io/concepts/actions/action-basics/use-actions.name.trigger
Use `await actions.actionName.trigger()` to call an action and get its result. This can be used anywhere in your app actions code.
```javascript
const user = await {{ actions.getCurrentUser.trigger() }};
```
```javascript
const user = await {{ actions.getUser.trigger('email@example.com') }};
```
--------------------------------
### Configure Robots.txt
Source: https://docs.uibakery.io/on-premise/environment-variables
Default content for the robots.txt file.
```text
User-agent: *
Disallow: /
```
--------------------------------
### Configure SAML Environment Variables
Source: https://docs.uibakery.io/on-premise/sso/saml
Set these environment variables in your UI Bakery instance to enable SAML authentication.
```bash
UI_BAKERY_SAML_ENABLED=true
UI_BAKERY_SAML_METADATA_URL=https://integration.com/yourapp/metadata.xml
UI_BAKERY_SAML_ENTITY_ID=uibakery
UI_BAKERY_BRANDING_AUTH_SSO_BTN_TEXT=Login with SAML
UI_BAKERY_GLOBAL_SESSION_COOKIE=true
```
--------------------------------
### S3 Query Action
Source: https://docs.uibakery.io/reference
Interact with AWS S3 buckets. This action allows you to list objects, get object content, and upload files.
```json
{
"bucket": "my-bucket-name",
"key": "path/to/file.txt",
"operation": "getObject"
}
```
--------------------------------
### Create Database Dump
Source: https://docs.uibakery.io/on-premise/install-and-update/recommendations/running-a-standalone-database-instance
Command to create a SQL dump of the UI Bakery database. Replace DB_CONTAINER_ID with the actual container ID.
```bash
docker exec DB_CONTAINER_ID /usr/bin/mysqldump -u root --password=root bakery > backup.sql
```
--------------------------------
### Perform MongoDB Aggregation
Source: https://docs.uibakery.io/reference/working-with-actions/mongodb-command
Execute an aggregation pipeline to process data. This example matches documents by age and groups them by status to count occurrences.
```js
{
aggregate: "users",
pipeline: [
{ $match: { age: { $gte: 30 } } },
{ $group: { _id: "$status", count: { $sum: 1 } } }
],
cursor: { batchSize: 10 }
}
```
--------------------------------
### Configure Multiple SSO Providers
Source: https://docs.uibakery.io/on-premise/sso/multiple-sso
Use these environment variables to define an array of SSO configuration objects.
```text
UI_BAKERY_SSO_CONFIGURATION='[ { SSO_CONFIG }, { SSO_CONFIG }, { SSO_CONFIG }]'
UI_BAKERY_SSO_CONFIGURATION_ENABLED=true
```