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

feat(pivot-data-table): create pivot form (transform data-table) #5215

Merged

Conversation

piggggggggy
Copy link
Member

@piggggggggy piggggggggy commented Dec 12, 2024

To Reviewers

  • Self-reviewed (coding conventions, bug-free, functionality verified, tests checked, documentation updated)
  • Minor change, review optional (style, chore, ci, straightforward changes, etc.)
  • Previously reviewed in feature branch, no further review needed
  • Need review or discussion

Description (optional)

  • Separate wrapper component (WidgetFormDataTableCardTransformFormWrapper.vue) from WidgetFormDataTableCardTransformForm.vue.
  • Create pivot form component (90%).
  • Create default form value (transform form).
    image

Things to Talk About (optional)

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
bye-bye-vuex ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 0:29am
console ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 0:29am
dashboard ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 0:29am
hotfix2 ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 0:29am

@piggggggggy piggggggggy changed the base branch from master to feature-dashboard-november December 12, 2024 09:44
Signed-off-by: samuel.park <[email protected]>
Signed-off-by: samuel.park <[email protected]>
Signed-off-by: samuel.park <[email protected]>
Copy link
Member

@WANZARGEN WANZARGEN left a comment

Choose a reason for hiding this comment

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

😊

Comment on lines 72 to 86
export const DEFAULT_TRANSFORM_DATA_TABLE_VALUE_MAP = {
PIVOT: {
fields: {
labels: [],
data: undefined,
column: undefined,
},
limit: 5,
functions: 'sum',
order_by: {
type: 'key',
desc: false,
},
},
};
Copy link
Member

Choose a reason for hiding this comment

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

question: why those types are not under the schema directory?? 😮

Comment on lines 48 to 58
.widget-form-data-table-card-transform-form {
padding: 0.75rem 1rem;

.data-table-select-form {
.operator {
@apply inline-flex items-center gap-1 rounded-md border border-gray-150 bg-gray-100 text-label-sm font-bold text-gray-700;
padding: 0.25rem 0.5rem;
margin-bottom: 0.5rem;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: We decided to use tailwindcss class utility directly at the template.
And using @apply generates each style block. like:
.data-tab-elselect-form.operator { display: inline-block; }
.data-tab-elselect-form.operator { gap: 0.25rem }
...

It makes hard to find css issue on the browser 😭

Comment on lines +65 to +68
columnFieldInvalid: computed<boolean>(() => {
if (state.labelFieldItems.length === 1) return true;
return false;
}),
Copy link
Member

Choose a reason for hiding this comment

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

question: Why didn't u use fieldValidator or formValidator? It has different behavior?

const dataTableId = dataTableInfo.dataTableId;
if (dataTableId) {
state.selectedValueType = 'auto';
state.proxyFormData = DEFAULT_TRANSFORM_DATA_TABLE_VALUE_MAP.PIVOT;
Copy link
Member

Choose a reason for hiding this comment

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

issue: constant object must be assign with new object to prevent not intended mutation.

Comment on lines +103 to +131
const handleChangeValueType = (value: string) => {
state.selectedValueType = value;
if (value === 'auto') {
state.proxyFormData = {
...state.proxyFormData,
select: undefined,
limit: DEFAULT_TRANSFORM_DATA_TABLE_VALUE_MAP.PIVOT.limit,
};
} else {
state.proxyFormData = {
...state.proxyFormData,
select: [],
limit: undefined,
};
}
};

const handleSelectDynamicFields = (value: MenuItem[]) => {
state.proxyFormData = {
...state.proxyFormData,
select: value.map((item) => item.name),
};
};
const handleUpdateLimit = (value: string) => {
state.proxyFormData = {
...state.proxyFormData,
limit: value,
};
};
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: updating the merged object(formData) everytime when each property has changed is.. I think, a little dangerous 🤔.
it's hard to track which handler changes that object. That means, it's hard to maintain.
But it's just a nitpick comment and another solution also can have other problems... 😂

<widget-form-data-table-card-transform-pivot-form v-if="state.operator === DATA_TABLE_OPERATOR.PIVOT"
:data-table-id="state.dataTableId"
:data-table-info.sync="state.dataTableInfo"
:form-data.sync="valueState.pivot"
Copy link
Member

Choose a reason for hiding this comment

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

question: what is this formData prop means?

Copy link
Member

@WANZARGEN WANZARGEN left a comment

Choose a reason for hiding this comment

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

❤️

Signed-off-by: samuel.park <[email protected]>
Signed-off-by: samuel.park <[email protected]>
@piggggggggy piggggggggy merged commit e657b17 into cloudforet-io:feature-dashboard-november Dec 13, 2024
8 of 9 checks passed
@piggggggggy piggggggggy deleted the pivot branch December 13, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants