Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(entity-consumers): optimize consumer data fetching in <AddConsumerModal /> and <AddToGroupModal /> #935

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.development.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ VITE_KONNECT_CONTROL_PLANE_ID=

# Kong Manager Consumer Id
VITE_KONG_MANAGER_CONSUMER_ID=
VITE_KONG_MANAGER_CONSUMER_GROUP_ID=

# Konnect Consumer Id
VITE_KONNECT_CONSUMER_ID=
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const kongManagerConfig = ref<KongManagerConsumerGroupListConfig>({
apiBaseUrl: '/kong-manager', // For local dev server proxy
isExactMatch: false,
// Uncomment to test Consumer -> Consumer Groups
// consumerId: 'b20b1848-6640-4200-9102-73a184de976e',
// consumerId: import.meta.env.VITE_KONG_MANAGER_CONSUMER_ID,
// consumerUsername: 'c-1',
createRoute: { name: 'create-consumer-group' },
getViewRoute: (id: string) => ({ name: 'view-consumer-group', params: { id } }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<script setup lang="ts">
import type { PropType } from 'vue'
import { computed, ref, watch, onBeforeMount } from 'vue'
import { computed, ref, watch } from 'vue'
import type {
KongManagerConsumerGroupListConfig,
KonnectConsumerGroupListConfig,
Expand Down Expand Up @@ -253,10 +253,11 @@ watch(availableConsumerGroups, () => {
consumerGroupsSelectKey.value++
}, { immediate: true, deep: true })

onBeforeMount(async () => {
// load consumer groups
await loadItems()
})
watch(() => props.visible, () => {
if (props.visible) {
loadItems() // load consumer groups
}
}, { immediate: true })
</script>

<style lang="scss" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const kongManagerConfig = ref<KongManagerConsumerListConfig>({
isExactMatch: false,
createRoute: { name: 'create-consumer' },
// Uncomment to test Consumer Groups -> Consumers
consumerGroupId: '0de87974-352c-4054-8969-238cdd82a57f',
// consumerGroupId: import.meta.env.VITE_KONG_MANAGER_CONSUMER_GROUP_ID,
// consumerGroupName: 'Group 1',
getViewRoute: (id: string) => ({ name: 'view-consumer', params: { id } }),
getEditRoute: (id: string) => ({ name: 'edit-consumer', params: { id } }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<script setup lang="ts">
import type { PropType } from 'vue'
import { computed, ref, watch, onBeforeMount } from 'vue'
import { computed, ref, watch } from 'vue'
import type {
KongManagerConsumerListConfig,
KonnectConsumerListConfig,
Expand Down Expand Up @@ -268,10 +268,11 @@ watch(availableConsumers, () => {
consumersSelectKey.value++
}, { immediate: true, deep: true })

onBeforeMount(async () => {
// load consumers
await loadItems()
})
watch(() => props.visible, () => {
if (props.visible) {
loadItems() // load consumers
}
}, { immediate: true })
</script>

<style lang="scss" scoped>
Expand Down
Loading