-
Notifications
You must be signed in to change notification settings - Fork 21
981174: Add Grid with AI Assist view sample #27
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
base: master
Are you sure you want to change the base?
Conversation
let suggestionListRef = createRef<any>(); | ||
function AssistiveGrid() { | ||
|
||
/// <summary>Toolbar options for Grid with AI Assist button</summary> |
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.
remove the commented line
/// <summary>Toolbar options for Grid with AI Assist button</summary> | ||
const toolbarOptions: object[] = [{ tooltipText: 'AI Assist', prefixIcon: 'e-assistview-icon', id: 'ai-assist-btn', align: 'Left' }]; | ||
|
||
/// <summary>Handles the Grid toolbar button click action. If the AI Assist button clicked shows the AI Assist dialog.</summary> |
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.
remove the commented line
} | ||
} | ||
|
||
/// <summary>Configures toolbar settings for AI assist dialog</summary> |
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.
remove
tag alone
template={(data: any) => ( | ||
<div className='product-items'> | ||
<img className="rounded" src={`src/ai-components/grid/assistive-grid/sales-transactions-table/${data.product.image}`} width={40} height={40} alt="product image" /> | ||
{/* src={data.product.image ? `/sales-transactions-table/${data.product.image}` : '/sales-transactions-table/fallback-image.jpg'} */} |
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.
remove the commented code
import { GridComponent, ColumnsDirective, ColumnDirective, Inject, Toolbar, Sort, Filter, Group, Page, Search, ToolbarItems, FilterSettingsModel } from '@syncfusion/ej2-react-grids'; | ||
import { DialogComponent } from '@syncfusion/ej2-react-popups'; | ||
import { AIAssistViewComponent, ToolbarSettingsModel, PromptRequestEventArgs } from '@syncfusion/ej2-react-interactive-chat'; | ||
import { gadgetsPurchaseData } from './datasource'; |
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.
maodify this as purchaseDetails
import { AIAssistViewComponent, ToolbarSettingsModel, PromptRequestEventArgs } from '@syncfusion/ej2-react-interactive-chat'; | ||
import { gadgetsPurchaseData } from './datasource'; | ||
import { createRef } from "react"; | ||
import { onPromptExecute } from './AIModel'; |
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.
provide a proper name for AI model (fetchAI)
import { onPromptExecute } from './AIModel'; | ||
import './assistive-grid.css'; | ||
|
||
let assistInstance!: AIAssistViewComponent; |
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.
variable name should be assistView
import './assistive-grid.css'; | ||
|
||
let assistInstance!: AIAssistViewComponent; | ||
let dialogInstance!: DialogComponent; |
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.
variable name should be dialog
|
||
let assistInstance!: AIAssistViewComponent; | ||
let dialogInstance!: DialogComponent; | ||
let gridInstance!:GridComponent; |
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.
variable name should be grid
const toolbarClick = (args: any) => { | ||
if (args.item.id === 'ai-assist-btn') { | ||
const gridRect = gridInstance.element.getBoundingClientRect(); | ||
const toolbarEleRect = document.getElementById('ai-grid_toolbarItems')!.getBoundingClientRect(); |
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.
variable name should be toolbarRect
}; | ||
|
||
// Renders response template for AI prompts. | ||
const responseTemplate = (props: any) => { |
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.
any -> { prompt: string}
import {executeGridAction} from './GridAction'; | ||
|
||
|
||
function fetchAI(text: string | undefined, grid: any, dialog: any, assistView: any, columns: any) { |
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.
don't use value type as any. Provide proper type for all the variables.
interface Filter { | ||
field: string; | ||
operator: string; | ||
value: any; |
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.
don't use any here. use string | number | boolean | date
let dialog!: DialogComponent; | ||
let grid!:GridComponent; | ||
let suggestionListRef = createRef<any>(); | ||
function AssistiveGrid() { |
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.
provide space above the function declaration.
const toolbarOptions: object[] = [{ tooltipText: 'AI Assist', prefixIcon: 'e-assistview-icon', id: 'ai-assist-btn', align: 'Left' }]; | ||
|
||
// Handles the Grid toolbar button click action. If the AI Assist button clicked shows the AI Assist dialog. | ||
const toolbarClick = (args: any) => { |
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.
don't use any type here
|
||
// Handles prompt request execution. | ||
const onPromptRequest = (args: PromptRequestEventArgs) => { | ||
(assistView as any).stopResponding.classList.remove('e-btn-active'); |
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.
don't use any here
<ColumnDirective field="date" headerText="Purchase Date" width="180" format={{ type: "date", format: "MM/dd/yyyy" }} textAlign="Right" /> | ||
<ColumnDirective field="paymentMethod" headerText="Payment Method" width="200" /> | ||
<ColumnDirective field="status" headerText="Status" width="120" textAlign='Right' | ||
template={(data: any) => ( |
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.
don't use any here
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.
provide a proper PR template for this implementation
Added Grid with AI Assist view sample.