Skip to content

Conversation

sumimakito
Copy link
Member

Summary

This pull request migrates the MVP from the previous PoC. The current implementation is not perfect and will be improved by future pull requests.

KM-1107

@sumimakito sumimakito force-pushed the KM-1107-entities-config-editor-migrate-from-poc branch from 1a8a64e to 2588ed8 Compare April 15, 2025 07:03
@kongponents-bot
Copy link
Collaborator

Preview components from this PR in consuming application

In consuming application project install preview versions of shared packages generated by this PR:

@kong-ui-public/entities-config-editor@pr-2078

Comment on lines +39 to +41
rootSchema.properties = {
...rootSchema.properties,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: why are we copying this property here?

Comment on lines +51 to +57
return monaco.editor.createModel(_language === 'json' ? '{}' : '', _language, uri.value)
})

const textDocument = computed(() =>{
const _language = unref(language)
return TextDocument.create(uri.value.toString(), _language, 0, _language === 'json' ? '{}' : '')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about isolating the ternary expression into computed like:

const langTemplate = computed(() => language.value === 'json' ? '{}' : '')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion. I'm marking this pull request as Draft for now as I plan to refactor the code a little bit. Let me come back with more improvements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, let me know when it's ready ✉️

Comment on lines +26 to +28
export interface FieldEmits<V = any> {
(e: 'update-value', value: V): void
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking maybe we should use the same definition for Emitter

Suggested change
export interface FieldEmits<V = any> {
(e: 'update-value', value: V): void
}
export interface FieldEmits<V = any> {
'updateValue': [value: V],
}

}

export const isNumberLikeField = (schema: FieldSchema): schema is NumberLikeFieldSchema =>
schema.type === FIELD_TYPES.NUMBER || schema.type === FIELD_TYPES.INTEGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd prefer

Suggested change
schema.type === FIELD_TYPES.NUMBER || schema.type === FIELD_TYPES.INTEGER
[FIELD_TYPES.NUMBER, FIELD_TYPES].includes(schema.type)

@sumimakito sumimakito marked this pull request as draft April 16, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants