Commit ff454c22 authored by Ryo Yamashita's avatar Ryo Yamashita Committed by Yas Naoi
Browse files

Issue #3318439 by Ryo Yamashita, yas: Add the SPA form to copy the OpenStack...

Issue #3318439 by Ryo Yamashita, yas: Add the SPA form to copy the OpenStack launch template in the Cloud module
parent ed636578
Loading
Loading
Loading
Loading
+95 −0
Changes for modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/openstack/launch_template.ts: 95 added lines, 0 removed lines.
Original line number Diff line number Diff line
import EntityFormTemplate from 'model/EntityFormTemplate';

const OPENSTACK_CLOUD_LAUNCH_TEMPLATE: EntityFormTemplate[] = [
  {
    cloudServiceProvider: 'openstack',
    entityName: 'cloud_launch_template',
    actionType: 'copy',
    entityRecords: [
      {
        type: 'panel',
        panelName: 'Instance',
        keyValueRecords: [
          {
            type: 'default', labelName: 'Name', name: 'name',
            defaultValue: 'copy_{name}', required: true
          },
          {
            type: 'textarea', labelName: 'Description', name: 'field_description',
            defaultValue: ''
          },
          {
            type: 'join', labelName: 'Flavor', name: 'field_instance_type', info: {
              entityTypeId: 'openstack_flavor',
              keyColumn: 'name',
            }, defaultValue: '', required: true
          },
          {
            type: 'boolean', labelName: 'Test only', name: 'field_test_only',
            defaultValue: false
          },
        ]
      },
      {
        type: 'panel',
        panelName: 'Image',
        keyValueRecords: [
          {
            type: 'select', labelName: 'Image ID', name: 'field_openstack_image_id',
            url: '/cloud_dashboard/openstack/{cloud_context}/cloud_launch_template/image_options',
            defaultValue: '', required: true
          },
        ]
      },
      {
        type: 'panel',
        panelName: 'Network',
        keyValueRecords: [
          {
            type: 'select', labelName: 'Availability Zone', name: 'field_os_availability_zone',
            url: '/cloud_dashboard/openstack/{cloud_context}/availability_zones',
            defaultValue: '', required: true
          },
          {
            type: 'multi-select', labelName: 'Security groups', name: 'security_groups',
            url: '/cloud_dashboard/openstack/{cloud_context}/security_group_options',
            defaultValue: ["{tryNotNull(getValue(openstack_security_group,relationship(field_openstack_security_group,drupal_internal__target_id),drupal_internal__id,name),'')}"],
            required: true
          },
          // TODO: Update defaultValue
          {
            type: 'join', labelName: 'SSH key', name: 'ssh_key', info: {
              entityTypeId: 'openstack_key_pair',
              keyColumn: 'key_pair_name',
              label: '{key_pair_name}'
            },
            defaultValue: "{tryNotNull(getValue(openstack_key_pair,relationship(field_openstack_ssh_key,drupal_internal__target_id),drupal_internal__id,key_pair_name),'')}",
            required: true
          },
          {
            type: 'select', labelName: 'Network interface', name: 'network_interface_id',
            url: '/cloud_dashboard/openstack/{cloud_context}/network_interface_ids',
            defaultValue: "{tryNotNull(relationship(field_openstack_network,drupal_internal__target_id), '_none')}",
          },
        ]
      },
      {
        type: 'panel',
        panelName: 'Tags',
        keyValueRecords: [
          {
            type: 'key-value', labelName: 'Tags', name: 'field_tags',
            defaultValue: []
          },
        ]
      },
      {
        type: 'panel',
        panelName: 'Others',
        keyValueRecords: [
          {
            type: 'textarea', labelName: 'Revision log message', name: 'revision_log_message',
            defaultValue: ''
          },
        ]
      },
    ],
    submitButtonLabel: 'Copy'
  },
  {
    cloudServiceProvider: 'openstack',
    entityName: 'cloud_launch_template',