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

Extend filter fields functionality #1849

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

kelanik8
Copy link
Contributor

@kelanik8 kelanik8 commented Jul 4, 2024

The following changes are implemented

TODO: Summary

Changes in the user interface:

TODO: Add screenshots, recordings or remove this section

Checklist when submitting a final (!draft) PR

  • Commits are tidied up, squashed if needed and follow guidelines in CONTRIBUTING.md
  • Code builds
  • All existing tests pass
  • All new critical code is covered by tests
  • PR is linked to the relevant issue(s)
  • Rebased with the target branch

@kelanik8 kelanik8 requested a review from Fajfa July 4, 2024 10:18
@kelanik8 kelanik8 linked an issue Jul 4, 2024 that may be closed by this pull request
2 tasks
client/web/compose/src/lib/suggestions-tree.js Outdated Show resolved Hide resolved
client/web/reporter/src/views/Report/Builder.vue Outdated Show resolved Hide resolved
lib/vue/src/components/input/CAceEditor.vue Outdated Show resolved Hide resolved
lib/vue/src/components/input/CInputExpressions.vue Outdated Show resolved Hide resolved
}
</script>

<style lang="scss">
Copy link
Member

Choose a reason for hiding this comment

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

Since this style is not scoped you need to limit it to just this component!

@@ -90,27 +91,6 @@ export default {

methods: {
editorInit (editor) {
Copy link
Member

Choose a reason for hiding this comment

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

Move all ace-editor code to CAceEditor and make logic be tied to a prop.

This component should only parse the props passed by compose and process them so CAceEditor can use it.

caption: v.trimStart('$'),
value: v,
})).concat(result['$'])
export const getRecordBasedSuggestions = (param = []) => {
Copy link
Member

Choose a reason for hiding this comment

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

Move all this logic to CInputExpressions

const recordProperties = this.record.properties() || []

const recordSuggestions = this.isRecordPage ? [
...(['ownerID', 'userID', 'recordID'].map(value => ({ interpolate: true, value }))),
Copy link
Member

Choose a reason for hiding this comment

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

userID is not tied to a record existing, it should always be available

const { fields = [] } = this.module || {}
const moduleFields = fields.map(({ name }) => name)
const userProperties = this.$auth.user.properties() || []
const recordValueProperties = { value: 'values', properties: Object.keys(this.record.values) || [] }
Copy link
Member

Choose a reason for hiding this comment

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

record can be undefined so you can move this to line 494 instead (otherwise this.record is undefined and throws an error)

const { fields = [] } = this.module || {}
const moduleFields = fields.map(({ name }) => name)
const userProperties = this.$auth.user.properties() || []
const recordValueProperties = { value: 'values', properties: Object.keys(this.record.values) || [] }
const recordProperties = this.record.properties() || []
Copy link
Member

Choose a reason for hiding this comment

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

Same for this, you can move it to the line 493

@@ -64,7 +64,7 @@ import {
trimChar,
} from 'corteza-webapp-compose/src/lib/record-filter.js'
import FilterToolbox from 'corteza-webapp-compose/src/components/Common/FilterToolbox.vue'
import { getRecordBasedSuggestions } from 'corteza-webapp-compose/src/lib/suggestions-tree.js'
// import { getRecordBasedSuggestions } from 'corteza-webapp-compose/src/lib/suggestions-tree.js'
Copy link
Member

Choose a reason for hiding this comment

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

guessing this isn't needed anymore

@@ -1,61 +1,52 @@
/* eslint-disable no-template-curly-in-string */
export const getRecordBasedSuggestions = (param = []) => {
export const getRecordBasedSuggestions = (params) => {
Copy link
Member

Choose a reason for hiding this comment

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

Guessing this file isn't needed anymore?

@@ -23,7 +23,7 @@
auto-complete
lang="javascript"
:placeholder="$t('general.titlePlaceholder')"
:suggestion-tree="autoCompleteSuggestionTree"
:suggestion-params="autoCompleteParams"
Copy link
Member

@Fajfa Fajfa Jul 18, 2024

Choose a reason for hiding this comment

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

lets make the naming convention like recordAutoCompleteParams

Also on this input, there is no AND/OR since this is only interpolated and not evaluated (like prefilter).

@@ -273,7 +273,7 @@
auto-complete
lang="javascript"
:placeholder="$t('general.visibility.condition.placeholder')"
:suggestion-tree="visibilityAutoSuggestionTree"
:suggestion-params="visibilityAutoSuggestionTree"
Copy link
Member

Choose a reason for hiding this comment

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

This one would be visibilityAutoCompleteParams

@@ -4,8 +4,9 @@
>
Copy link
Member

@Fajfa Fajfa Jul 18, 2024

Choose a reason for hiding this comment

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

Can you rename this component to c-input-expression? Since its one expression

Also two things about the styles, the font should match the other inputs. And the input should expand if a new row is added, currently its height doesn't change.

Think about how you'll do placeholders (if possible)


fontFamily: {
type: String,
default: ""
Copy link
Member

Choose a reason for hiding this comment

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

Single quotes, strange that te linter didnt pick it up

]
},

processVisibilityAutoCompleteParams ({ module = this.module }) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldnt the methods work as functions? In my opinion mixins are a bit too much, and you can just pass the params to the function (user, record, module, isRecordPage)

placeholder="v"
class="mb-1"
height="55.16px"
Copy link
Member

Choose a reason for hiding this comment

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

can the heights be in rem please. We try not to use px since the base size is defined in px and then rem is relative to that.

@@ -106,6 +106,35 @@ export default {

return !!recordPageID || !!magnifiedBlockID
},

isRecordPage () {
Copy link
Member

Choose a reason for hiding this comment

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

If this is in a mixin then you don't need it here

@kelanik8 kelanik8 force-pushed the 2024.3.x-extend-filter-fields-functionality branch from c716429 to 3e1109b Compare September 10, 2024 10:43
@kelanik8 kelanik8 merged commit 3e1109b into 2024.3.x Sep 10, 2024
11 checks passed
@kelanik8 kelanik8 deleted the 2024.3.x-extend-filter-fields-functionality branch September 10, 2024 10:45
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.

Extends filter fields(textarea) functionality
2 participants