Select Admin Documentation

website·Indexed 32 days ago

https://dev.selectfromuser.com

A tool for quickly building admin pages based on databases and APIs using YAML configurations. It supports connections to MySQL, PostgreSQL, Redis, MongoDB, DynamoDB, and BigQuery, and provides features for user property management, custom layouts, API security, and self-hosted CLI installation.

Tokens
51.4K
Snippets
274
Records
343
Agent score
58%

What's inside Select Admin

  1. Overview of Select for Admin and Back-office Development

    Select is a tool used to build admin, back-office, and management pages using SQL queries and API inputs. It eliminates the need for manual frontend development, API creation, and deployment for internal tools. Key capabilities include sharing SQL results as pages, providing no-code Excel downloads, creating safe UI wrappers for update queries, and building dashboards or reports without installation.
  2. Overview of Select Admin Design Philosophy

    Select Admin reduces the cost of developing and maintaining administrative tools by replacing traditional coding (server frameworks, ORM, UI templates) with a specification-based configuration. Key design principles include:

    • Built-in core admin components configured via specs.
    • Separation of concerns (e.g., by menu or page).
    • Direct data manipulation using raw SQL, APIs, or JavaScript without abstraction layers.
    • Built-in management for connections, authentication, and drivers.
    • Universal UI components (tables, input forms) that are easily replicable, integrable, or splittable.
    • High readability and maintainability by defining the admin structure as a spec rather than code.
  3. Overview of Select Admin Audit Logs

    Select Admin records and allows the retrieval of logs related to user access, account changes, and permission grants.

    Access Logs: Records successful logins and failed login attempts, including instances where the device has changed.

    • Role access: User access
    • Role access denied: User access denied

    Permission Logs: These can be enabled under Settings > Security by activating the 'Reason for Granting Permission' feature. Common event codes include:

    • Role create: New user invitation (permission added)
    • Role update: User permission change
    • Role delete: User permission deletion
    • group grant: User permission group added
    • group revoke: User permission group deleted
    • ServiceRole update: Admin page service permission change
    • property update: UserProperty change

    Download Logs: Enabled under Settings > Security by activating the 'Reason for Download' feature.

    • Activity download: User activity log download
    • Audit download: Audit log download
  4. Overview of JavaScript Data Transformation Lifecycle

    JavaScript transformation functions allow developers to implement validation logic or convert common codes before data is displayed or modified in the admin. The execution flow follows this sequence:

    1. Request Transformation: requestFn $\rightarrow$ requestSubmitFn $\rightarrow$ requestParamFn
    2. Server Execution: Query/API is executed on the server.
    3. Response Transformation: responseFn $\rightarrow$ responseRowFn $\rightarrow$ responseErrorFn
    4. Display: The final result is displayed to the user.
  5. Understand Menus and Pages in Select

    Select distinguishes between two primary concepts: Menus and Pages. Menus define the navigation structure, supporting top-level and sub-menu hierarchies through grouping. Pages are composed of blocks and are linked to menus via a shared path.
  6. Understand User Properties in Select Admin

    User Properties allow for specialized handling of users within Select Admin. They can be used to restrict data access (e.g., viewing only data belonging to a specific department), require specific codes when adding data, or filter data to show only a user's own store information. Administrator accounts can have these properties manually configured under Settings > Account.
  7. Connect a database or resource to Select

    To connect a database (such as MySQL, PostgreSQL, or Redis) to the Select service for building admin pages, navigate to the Admin page and follow these steps:

    1. Go to the 'Resources' (리소스) menu at the top of the Admin page.
    2. Click the '+ Add' (+ 추가) button in the connected data section.
    3. Enter the required connection information.

    Note: For security reasons, connection information cannot be viewed or modified once it has been added.

  8. Use HTML within Markdown blocks

    Markdown blocks support the use of HTML tags for advanced styling or layout requirements. You can use standard HTML elements and CSS classes within the content field.
    - type: markdown
      content: |
        <p class="text-slate-600 font-bold text-2xl">Receipt Store List Page</p>
        <ul class="text-slate-400 font-bold text-xs">
          <li>Past data can be viewed on the <a href='#'>Transaction History</a> page.</li>
        </ul>
  9. Implement mandatory and optional search conditions in SQL

    Select uses Bind Parameters/Prepared Statements by default for security. Depending on whether a search parameter is required or optional, use the following patterns:

    • Mandatory: The query will return no results if the parameter is empty.
    • Optional (MySQL): Use CASE-WHEN or a logical OR with LENGTH() to ignore the condition when the parameter is empty.
    • Optional (PostgreSQL): Use LENGTH(:param) = 0 to ignore the condition when the parameter is empty.
    -- Mandatory
    SELECT * FROM users WHERE name = :name
    
    -- Optional (MySQL)
    SELECT * FROM users WHERE status = 'active' AND (!LENGTH(:name) OR name = :name)
    
    -- Optional (PostgreSQL)
    SELECT * FROM users WHERE status = 'active' AND (LENGTH(:name) = 0 OR name = :name)
  10. Configure user properties via UI

    User properties (key-value pairs) can be assigned to specific users through the administrative interface. These properties can then be used as variables in SQL query blocks or API blocks to restrict or filter information based on the user's identity (e.g., for B2B client portals or partner centers). To configure: Navigate to Settings > Account > Account List and click on the email address of the target user to define the property keys and values.
  11. Perform API modifications and deletions using HTTP POST

    To perform modifications or deletions via API, use the http block type with method: POST. When configured this way, the system operates in a 'Confirm before execution' mode to prevent accidental data changes.
    menus:
    - path: test/http-post
      name: HTTP-POST
    pages:
    - path: test/http-post
      blocks:  
      - type: http
        name: POST Sample
        axios:
          method: POST
          url: https://httpbin.org/anything?query=1
          data:
            'customer_id': customer-{{id}}
            'v': "{{API_VERSION}}"
        params:
          - key: id
            label: 'Customer ID'
            format: 'number'
          - key: API_VERSION
            valueFromEnv: true
  12. Implement customer search with parameters

    To find a specific customer using a field like email, use the params property. This allows the UI to pass user input into the SQL query or HTTP request. For partial matches in SQL, use a combination of LENGTH and LIKE with the CONTACT function to handle empty inputs and wildcards.
    # SQL Example for partial email search
    sql: >
      SELECT * 
      FROM users 
      WHERE (LENGTH(:email) = 0 OR email LIKE CONTACT('%', :email, '%'))
    params:
    - key: email
    
    # HTTP Example for email search
    axios:
      method: GET
      url: https://api.example.com/v1/users?email={{email}}&limit=10
    rowsPath: rows
    params:
    - key: email