Skip to content

Commit

Permalink
feat(entities): support terraform in config card [khcp-12445] (#1549)
Browse files Browse the repository at this point in the history
Add support to view terraform configuration for entities.
For [KHCP-12445](https://konghq.atlassian.net/browse/KHCP-12445).
This work is behind a FF: `khcp-12445-terraform-config-details`
  • Loading branch information
kaiarrowood authored Aug 14, 2024
1 parent f3506f6 commit 794b4a4
Show file tree
Hide file tree
Showing 72 changed files with 1,207 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Set this value to display the documentation button.

Set this value to `true` to hide the card title.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### fetch:error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ The base konnect or kongManger config.

If showing the `Edit` type form, the ID of the CA Certificate.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Set this value to display the documentation button.

Set this value to `true` to hide the card title.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### fetch:error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ If showing the `Edit` type form, the ID of the Certificate.

Whether to show the SNIs field in the form.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:config="config"
:config-card-doc="configCardDoc"
:config-schema="configSchema"
:enable-terraform="enableTerraform"
:entity-type="SupportedEntityType.CaCertificate"
:fetch-url="fetchUrl"
:hide-title="hideTitle"
@fetch:error="(err: any) => $emit('fetch:error', err)"
Expand Down Expand Up @@ -68,7 +70,15 @@ import type { PropType } from 'vue'
import { computed, ref } from 'vue'
import type { AxiosError } from 'axios'
import type { KongManagerCertificateEntityConfig, KonnectCertificateEntityConfig, CACertificateConfigurationSchema, EntityRow } from '../types'
import { EntityBaseConfigCard, ConfigurationSchemaType, ConfigurationSchemaSection, useStringHelpers, useHelpers, ConfigCardItem } from '@kong-ui-public/entities-shared'
import {
EntityBaseConfigCard,
ConfigurationSchemaType,
ConfigurationSchemaSection,
useStringHelpers,
useHelpers,
ConfigCardItem ,
SupportedEntityType,
} from '@kong-ui-public/entities-shared'
import endpoints from '../ca-certificates-endpoints'
import composables from '../composables'
import '@kong-ui-public/entities-shared/dist/style.css'
Expand Down Expand Up @@ -110,6 +120,14 @@ const props = defineProps({
type: Boolean,
default: false,
},
/**
* Enable display of Terraform code
* Guarded by FF: khcp-12445-terraform-config-details
*/
enableTerraform: {
type: Boolean,
default: false,
},
})
const { i18n: { t, formatUnixTimeStamp } } = composables.useI18n()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:can-submit="canSubmit"
:config="config"
:edit-id="certificateId"
:enable-terraform="enableTerraform"
:entity-type="SupportedEntityType.CaCertificate"
:error-message="form.errorMessage"
:fetch-url="fetchUrl"
:form-fields="requestBody"
Expand Down Expand Up @@ -72,7 +74,14 @@ import type {
} from '../types'
import endpoints from '../ca-certificates-endpoints'
import composables from '../composables'
import { useAxios, useErrors, EntityFormSection, EntityBaseForm, EntityBaseFormType } from '@kong-ui-public/entities-shared'
import {
useAxios,
useErrors,
EntityFormSection,
EntityBaseForm,
EntityBaseFormType,
SupportedEntityType,
} from '@kong-ui-public/entities-shared'
import '@kong-ui-public/entities-shared/dist/style.css'
const emit = defineEmits<{
Expand Down Expand Up @@ -101,6 +110,14 @@ const props = defineProps({
required: false,
default: '',
},
/**
* Enable display of Terraform code
* Guarded by FF: khcp-12445-terraform-config-details
*/
enableTerraform: {
type: Boolean,
default: false,
},
})
const router = useRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:config="config"
:config-card-doc="configCardDoc"
:config-schema="(configSchema as any)"
:enable-terraform="enableTerraform"
:entity-type="SupportedEntityType.Certificate"
:fetch-url="fetchUrl"
:hide-title="hideTitle"
@fetch:error="(err: any) => $emit('fetch:error', err)"
Expand Down Expand Up @@ -138,7 +140,15 @@ import type { PropType } from 'vue'
import { computed, ref } from 'vue'
import type { AxiosError } from 'axios'
import type { KongManagerCertificateEntityConfig, KonnectCertificateEntityConfig, CertificateConfigurationSchema, EntityRow } from '../types'
import { EntityBaseConfigCard, ConfigurationSchemaSection, ConfigurationSchemaType, ConfigCardItem, useStringHelpers, useHelpers } from '@kong-ui-public/entities-shared'
import {
EntityBaseConfigCard,
ConfigurationSchemaSection,
ConfigurationSchemaType,
ConfigCardItem,
SupportedEntityType,
useStringHelpers,
useHelpers,
} from '@kong-ui-public/entities-shared'
import endpoints from '../certificates-endpoints'
import composables from '../composables'
import '@kong-ui-public/entities-shared/dist/style.css'
Expand Down Expand Up @@ -178,6 +188,14 @@ const props = defineProps({
type: Boolean,
default: false,
},
/**
* Enable display of Terraform code
* Guarded by FF: khcp-12445-terraform-config-details
*/
enableTerraform: {
type: Boolean,
default: false,
},
})
const { i18n: { t, formatUnixTimeStamp }, i18nT } = composables.useI18n()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:can-submit="canSubmit"
:config="config"
:edit-id="certificateId"
:enable-terraform="enableTerraform"
:entity-type="SupportedEntityType.Certificate"
:error-message="form.errorMessage"
:fetch-url="fetchUrl"
:form-fields="requestBody"
Expand Down Expand Up @@ -144,7 +146,14 @@ import type {
import endpoints from '../certificates-endpoints'
import composables from '../composables'
import CertificateFormSniField from './CertificateFormSniField.vue'
import { useAxios, useErrors, EntityFormSection, EntityBaseForm, EntityBaseFormType } from '@kong-ui-public/entities-shared'
import {
useAxios,
useErrors,
EntityFormSection,
EntityBaseForm,
EntityBaseFormType,
SupportedEntityType,
} from '@kong-ui-public/entities-shared'
import '@kong-ui-public/entities-shared/dist/style.css'
const emit = defineEmits<{
Expand Down Expand Up @@ -179,6 +188,14 @@ const props = defineProps({
required: false,
default: false,
},
/**
* Enable display of Terraform code
* Guarded by FF: khcp-12445-terraform-config-details
*/
enableTerraform: {
type: Boolean,
default: false,
},
})
const router = useRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Set this value to display the documentation button.

Set this value to `true` to hide the card title.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### fetch:error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ A form component to create/edit Consumer Group.

- [Requirements](#requirements)
- [Usage](#usage)
- [Install](#install)
- [Props](#props)
- [Events](#events)
- [Usage example](#usage-example)
- [Install](#install)
- [Props](#props)
- [Events](#events)
- [Usage example](#usage-example)
- [TypeScript interfaces](#typescript-interfaces)

## Requirements
Expand All @@ -26,49 +26,59 @@ A form component to create/edit Consumer Group.
### Props

#### `config`

- type: `Object as PropType<KonnectConsumerGroupFormConfig | KongManagerConsumerGroupFormConfig>`
- required: `true`
- default: `undefined`
- properties:
- `app`:
- type: `'konnect' | 'kongManager'`
- required: `true`
- default: `undefined`
- App name.
- `apiBaseUrl`:
- type: `string`
- required: `true`
- default: `undefined`
- Base URL for API requests.
- `axiosRequestConfig`:
- type: `AxiosRequestConfig`
- required: `false`
- default: `undefined`
- An optional configuration object for the underlying Axios request.
- `cancelRoute`:
- type: `RouteLocationRaw`
- required: `true`
- default: `undefined`
- Route to return to when canceling creation of a Consumer.

- `workspace`:
- type: `string`
- required: `true`
- default: `undefined`
- *Specific to Kong Manager*. Name of the current workspace.

- `controlPlaneId`:
- type: `string`
- required: `true`
- default: `undefined`
- *Specific to Konnect*. Name of the current control plane.
- `app`:
- type: `'konnect' | 'kongManager'`
- required: `true`
- default: `undefined`
- App name.
- `apiBaseUrl`:
- type: `string`
- required: `true`
- default: `undefined`
- Base URL for API requests.
- `axiosRequestConfig`:
- type: `AxiosRequestConfig`
- required: `false`
- default: `undefined`
- An optional configuration object for the underlying Axios request.
- `cancelRoute`:
- type: `RouteLocationRaw`
- required: `true`
- default: `undefined`
- Route to return to when canceling creation of a Consumer.

- `workspace`:
- type: `string`
- required: `true`
- default: `undefined`
- *Specific to Kong Manager*. Name of the current workspace.

- `controlPlaneId`:
- type: `string`
- required: `true`
- default: `undefined`
- *Specific to Konnect*. Name of the current control plane.

#### `consumerGroupId`

- type: `string`
- required: `false`
- default: `''`
- If a valid consumerGroupId is provided, it will put the form in Edit mode instead of Create.

#### `enableTerraform`

- type: `Boolean`
- required: `false`
- default: `false`

Enable display of Terraform code. Guarded by FF: `khcp-12445-terraform-config-details`.

### Events

#### update
Expand Down Expand Up @@ -103,4 +113,4 @@ import type {
ConsumerGroupActions,
ConsumerGroupData,
} from '@kong-ui-public/entities-consumer-groups'
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
:config-card-doc="configCardDoc"
:config-schema="configSchema"
data-key="consumer_group"
:enable-terraform="enableTerraform"
:entity-type="SupportedEntityType.ConsumerGroup"
:fetch-url="fetchUrl"
:hide-title="hideTitle"
@fetch:error="(err: any) => $emit('fetch:error', err)"
Expand All @@ -19,7 +21,7 @@ import type { PropType } from 'vue'
import { computed, ref } from 'vue'
import type { AxiosError } from 'axios'
import type { KongManagerConsumerGroupEntityConfig, KonnectConsumerGroupEntityConfig, ConsumerGroupConfigurationSchema } from '../types'
import { EntityBaseConfigCard } from '@kong-ui-public/entities-shared'
import { EntityBaseConfigCard, SupportedEntityType } from '@kong-ui-public/entities-shared'
import endpoints from '../consumer-groups-endpoints'
import composables from '../composables'
import '@kong-ui-public/entities-shared/dist/style.css'
Expand Down Expand Up @@ -59,6 +61,14 @@ const props = defineProps({
type: Boolean,
default: false,
},
/**
* Enable display of Terraform code
* Guarded by FF: khcp-12445-terraform-config-details
*/
enableTerraform: {
type: Boolean,
default: false,
},
})
const { i18n: { t } } = composables.useI18n()
Expand Down
Loading

0 comments on commit 794b4a4

Please sign in to comment.