name: apps
label: App
icon: apps
hidden: true
version: 2
isMetadata: true
enable_dataloader: false
enable_form_tabs: true
fields:
  name:
    label: Name
    type: text
    defaultValue: ''
    description: ''
    inlineHelpText: ''
    required: true
    searchable: true
    filterable: true
    index: true
  code:
    label: API Name
    type: text
    required: true
    searchable: true
    filterable: true
    defaultValue: 'app_${UUID(3)}'
  icon_slds:
    label: Icon
    type: select
    required: true
    amis:
      "source": "${window:Steedos.resources.sldsIcons.standard}"
      "menuTpl": "<div style=\"display: flex; align-items: center;\"><span class=\"slds-icon_container slds-icon-standard-${REPLACE(value, '_', '-')} slds-m-right_x-small\"><svg class=\"slds-icon w-7 h-7\" aria-hidden=\"true\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${value}\"></use></svg></span><span>${label}</span></div>"
      searchable: true
  sort:
    label: Sort Number
    type: number
    defaultValue: 9100
    sortable: true
  color:
    label: Color
    type: select
    defaultValue: 'sky'
    options:
      - label: Red
        value: red
      - label: Orange
        value: orange
      - label: Yellow
        value: yellow
      - label: Green
        value: green
      - label: Teal
        value: teal
      - label: Cyan
        value: cyan
      - label: Blue
        value: blue
      - label: Pink
        value: pink
      - label: Purple
        value: purple
      - label: Gray
        value: gray
    amis:
      menuTpl: "<div style=\"display: flex; align-items: center;\"><span style=\"display: inline-block; width: 12px; height: 12px; border-radius: 2px; background-color: ${value}; margin-right: 8px;\"></span><span>${label}</span></div>"
  dark:
    label: Dark Mode
    type: boolean
    defaultValue: true
  description:
    label: Description
    type: textarea
    is_wide: true
    searchable: true
    filterable: true
  tabs:
    label: Tabs
    type: lookup
    multiple: true
    group: Business object
    is_wide: true
    reference_to: tabs
    reference_to_field: name
    hidden: true
  tab_groups:
    type: grid
    blackbox: true
    is_wide: true
    # hidden: true
    visible_on: "{{false}}"
  tab_groups.$.group_name:
    type: text
  tab_groups.$.default_open:
    type: boolean
  tab_items:
    label: Tabs
    type: object
    blackbox: true
    is_wide: true
    required: false
    group: Tabs
    visible_on: "{{global.mode ==='read' ? false : true}}"
    # hidden: true
  is_creator:
    type: boolean
    label: Show this app for Desktop
    defaultValue: true
  mobile:
    type: boolean
    label: Show this app for Mobile
    defaultValue: true
  icon:
    label: Icon
    type: text
    hidden: true
  visible:
    label: Visible
    type: boolean
    defaultValue: true

  showSidebar:
    label: 显示左侧导航
    type: boolean
    defaultValue: true

  nav_schema:
    label: 自定义导航
    type: code
    language: json
    visible_on: "{{false}}"
  # members:
  #   type: object
  #   label: Members
  #   is_wide: true
  # members.users:
  #   type: lookup
  #   label: User Members
  #   reference_to: users
  #   multiple: true
  #   filterable: true
  # members.organizations:
  #   type: lookup
  #   label: Department Members
  #   reference_to: organizations
  #   multiple: true
  #   filterable: true

  url:
    label: URL
    type: url
    group: External Application
  is_use_iframe:
    type: boolean
    label: Open with iframe
    defaultValue: false
    group: External Application
    visible_on: "{{false}}"
    filterable: true
  is_new_window:
    type: boolean
    label: Open in New Window
    defaultValue: false
    group: External Application
    filterable: true
  on_click:
    type: textarea
    label: onClick
    rows: 2
    is_wide: true
    group: External Application
    hidden: true

  auth_name:
    label: Auth Name
    type: text
    group: External Application
    hidden: true
  secret:
    label: API Secret Key
    type: text
    max: 16
    min: 16
    group: External Application
    hidden: true
  # visible_on:
  #   name: visible_on
  #   is_wide: true
  #   label: Visible On
  #   inlineHelpText: Visible On
  #   type: textarea
  #   group: other

  oauth2_enabled:
    group: External Application 
    label: OAuth2 Enabled
    type: boolean
  oauth2_callback_url:
    group: External Application
    label: Callback URL
    type: text
    required: "${oauth2_enabled == true}"
    visible_on: "${oauth2_enabled == true}"
  oauth2_scopes:
    group: OAuth2
    label: Scopes
    type: select
    hidden: true
    multiple: true
    required: "{{formData.oauth2_enabled}}"
    options:
      - label: Access to Your Unique Identifier (openid)
        value: openid
      - label: Access Basic Information (id, email, address, phone, locale)
        value: profile
      - label: Access Fully (full)
        value: full
  oauth2_logout_enabled: 
    group: OAuth2
    label: OAuth2 Logout Enabled
    type: boolean
    hidden: true
  oauth2_logout_url:
    group: OAuth2
    label: OAuth2 Logout URL
    type: url
    hidden: true
  oauth2_home_url:
    group: OAuth2
    label: Homepage URL
    type: url
    required: "{{formData.oauth2_enabled}}"
    hidden: true
  oauth2_logo:
    group: OAuth2
    label: OAuth2 Logo
    type: image
    required: "{{formData.oauth2_enabled}}"
    hidden: true
  oauth2_client_secret:
    group: External Application
    label: OAuth2 Client secret
    type: text
    required: "${oauth2_enabled == true}"
    visible_on: "${oauth2_enabled == true}"
  saml_enabled:
    hidden: true
    group: SAML
    label: SAML Enabled
    type: boolean
  saml_entity_id:
    hidden: true
    group: SAML
    label: Entity Id
    type: text
  saml_issuer:
    hidden: true
    group: SAML
    label: Issuer
    type: text
  saml_idp_cert:
    hidden: true
    group: SAML
    label: IDP Cert
    type: text
  saml_acs_url:
    hidden: true
    group: SAML
    label: ACS URL
    type: url
  saml_name_id_format:
    hidden: true
    group: SAML
    label: Name
    type: text
  saml_logout_enabled: 
    hidden: true
    group: SAML
    label: SAML Logout Enabled
    type: boolean
  saml_logout_url:
    hidden: true
    group: SAML
    label: SAML Logout URL
    type: url
  saml_logout_block:
    hidden: true
    group: SAML
    label: SAML Logout Block
    type: select
    options: 
      - label: HTTP Redirect
        value: redirect
      - label: HTTP Post
        value: post
  is_system:
    type: boolean
    label: System
    # omit: true
    readonly: true
    visible_on: "{{global.mode ==='read' ? true : false}}"
    disabled: true
  from_code_id:
    type: text
    visible_on: "{{false}}"
    disabled: true
paging:
  enabled: false
actions:
  reset:
    label: Reset
    on: record_only
list_views:
  all:
    label: All Apps
    filter_scope: space
    columns:
      - name
      - code
      - description
      - visible
      - sort
      - is_system
permission_set:
  user:
    allowCreate: false
    allowDelete: false
    allowEdit: false
    allowRead: true
    modifyAllRecords: false
    viewAllRecords: true
  admin:
    allowCreate: true
    allowDelete: true
    allowEdit: true
    allowRead: true
    modifyAllRecords: true
    viewAllRecords: true