-
Notifications
You must be signed in to change notification settings - Fork 366
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
Extend filter fields functionality #1849
Conversation
} | ||
</script> | ||
|
||
<style lang="scss"> |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 = []) => { |
There was a problem hiding this comment.
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 }))), |
There was a problem hiding this comment.
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) || [] } |
There was a problem hiding this comment.
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() || [] |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 @@ | |||
> |
There was a problem hiding this comment.
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: "" |
There was a problem hiding this comment.
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 }) { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 () { |
There was a problem hiding this comment.
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
43064e7
to
c716429
Compare
c716429
to
3e1109b
Compare
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