-
Notifications
You must be signed in to change notification settings - Fork 66
Доработать статью про лукап в документации. #220
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
|
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Outdated
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Outdated
Show resolved
Hide resolved
|
WalkthroughВ данном запросе на извлечение изменений обновлена документация для компонента Flexberry Ember Lookup на русском языке. Основные изменения включают добавление новых разделов, описывающих функциональность, параметры конфигурации и примеры использования компонента. Документация теперь включает улучшенные описания API компонента, новые настройки для модальных окон и подробности о сервисе Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md (2)
391-400: Улучшите форматирование кодаВ примере кода нарушено форматирование. Рекомендуется использовать отступ в 2 пробела для улучшения читаемости.
actions: { - updateLookupValue(updateData) { - // Базовая логика - this._super(...arguments); + updateLookupValue(updateData) { + // Базовая логика + this._super(...arguments); - // Дополнительная логика - // ... + // Дополнительная логика + // ... } }
461-487: Исправьте форматирование примера кодаВ примере кода присутствуют лишние пустые строки и неконсистентные отступы.
getCellComponent(attr, bindingPath, model) { let cellComponent = this._super(...arguments); - // Признак мастеровой связи. + // Признак мастеровой связи if (attr.kind === 'belongsTo') { let updateLookupValue = this.get('actions.updateLookupValue').bind(this); switch (`${model.modelName}+${bindingPath}`) { // ${Имя модели лукапа}+${Имя свойства, которое редактирует лукап} case 'test-project-test-model+testAttr': cellComponent.componentProperties = { ... remove: 'removeLookupValue', updateLookupValue: updateLookupValue ... }; break; - ... + ... } } - - ... + ... return cellComponent; -}, +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
[uncategorized] ~421-~421: Два предлога подряд: «в» или «в»
Context: ... логика при очистке значения лукапа, то в в лукапе следует указать событие или функ...(Two_PREP)
[uncategorized] ~451-~451: Пропущена запятая: «Например, по».
Context: ...` лукапа: * Очистка значения в лукапе. Например по кнопке "Очистить"; * Выбор значения по ...(VVODNOE_SLOVO)
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Outdated
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Outdated
Show resolved
Hide resolved
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md
Outdated
Show resolved
Hide resolved
…okup.ru.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…okup.ru.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…okup.ru.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md (2)
391-400: Улучшите документацию примераРекомендуется добавить комментарии, поясняющие:
- Когда следует переопределять этот метод
- Какие данные доступны в updateData
- Типичные сценарии использования
424-429: Дополните пример контекстом использованияРекомендуется добавить комментарий перед примером кода, объясняющий:
- В каком файле должен находиться этот код (шаблон или контроллер)
- Как это связано с контроллером
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md (1 hunks)
🔇 Additional comments (1)
pages/products/flexberry-ember/3.x/components/ef3_flexberry-lookup.ru.md (1)
456-456:⚠️ Potential issueИсправьте опечатку в слове
-Для возможности настройки событий лукапа, находящегося внутри `flexberry-gropedit`, необходимо в контроллер добавить метод `getCellComponent`. +Для возможности настройки событий лукапа, находящегося внутри `flexberry-gropedit`, необходимо в контроллер добавить метод `getCellComponent`.Likely invalid or redundant comment.
| ```js | ||
| removeLookupValue(removeData) { | ||
| // Дополнительная логика | ||
| // ... | ||
| } | ||
| ``` |
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.
🛠️ Refactor suggestion
Дополните пример обработкой ошибок
Рекомендуется расширить пример:
- Добавить обработку ошибок
- Указать возвращаемое значение
- Показать как правильно обновить модель
removeLookupValue(removeData) {
+ try {
// Дополнительная логика
// ...
+ this.set(`model.${removeData.relationName}`, null);
+ return true;
+ } catch (error) {
+ console.error('Ошибка при очистке значения:', error);
+ return false;
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ```js | |
| removeLookupValue(removeData) { | |
| // Дополнительная логика | |
| // ... | |
| } | |
| ``` | |
| ```js | |
| removeLookupValue(removeData) { | |
| try { | |
| // Дополнительная логика | |
| // ... | |
| this.set(`model.${removeData.relationName}`, null); | |
| return true; | |
| } catch (error) { | |
| console.error('Ошибка при очистке значения:', error); | |
| return false; | |
| } | |
| } | |
| ``` |
| getCellComponent(attr, bindingPath, model) { | ||
| let cellComponent = this._super(...arguments); | ||
|
|
||
| // Признак мастеровой связи. | ||
| if (attr.kind === 'belongsTo') { | ||
| let updateLookupValue = this.get('actions.updateLookupValue').bind(this); | ||
|
|
||
| switch (`${model.modelName}+${bindingPath}`) { | ||
| // ${Имя модели лукапа}+${Имя свойства, которое редактирует лукап} | ||
| case 'test-project-test-model+testAttr': | ||
| cellComponent.componentProperties = { | ||
| ... | ||
| remove: 'removeLookupValue', | ||
| updateLookupValue: updateLookupValue | ||
| ... | ||
| }; | ||
| break; | ||
|
|
||
| ... | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ... | ||
|
|
||
| return cellComponent; | ||
| }, | ||
| ``` |
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.
🛠️ Refactor suggestion
Улучшите пример метода getCellComponent
Рекомендуется:
- Добавить проверку входных параметров
- Улучшить обработку ошибок
- Дополнить документацию примерами использования
getCellComponent(attr, bindingPath, model) {
+ if (!attr || !bindingPath || !model) {
+ console.warn('getCellComponent: missing required parameters');
+ return null;
+ }
+
let cellComponent = this._super(...arguments);
// Признак мастеровой связи.
if (attr.kind === 'belongsTo') {
let updateLookupValue = this.get('actions.updateLookupValue').bind(this);
switch (`${model.modelName}+${bindingPath}`) {
// ${Имя модели лукапа}+${Имя свойства, которое редактирует лукап}
case 'test-project-test-model+testAttr':
cellComponent.componentProperties = {
...
remove: 'removeLookupValue',
updateLookupValue: updateLookupValue
...
};
break;
+ default:
+ console.warn(`Unexpected model+bindingPath: ${model.modelName}+${bindingPath}`);
+ break;
}
}
return cellComponent;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| getCellComponent(attr, bindingPath, model) { | |
| let cellComponent = this._super(...arguments); | |
| // Признак мастеровой связи. | |
| if (attr.kind === 'belongsTo') { | |
| let updateLookupValue = this.get('actions.updateLookupValue').bind(this); | |
| switch (`${model.modelName}+${bindingPath}`) { | |
| // ${Имя модели лукапа}+${Имя свойства, которое редактирует лукап} | |
| case 'test-project-test-model+testAttr': | |
| cellComponent.componentProperties = { | |
| ... | |
| remove: 'removeLookupValue', | |
| updateLookupValue: updateLookupValue | |
| ... | |
| }; | |
| break; | |
| ... | |
| } | |
| } | |
| ``` | |
| ... | |
| return cellComponent; | |
| }, | |
| ``` | |
| getCellComponent(attr, bindingPath, model) { | |
| if (!attr || !bindingPath || !model) { | |
| console.warn('getCellComponent: missing required parameters'); | |
| return null; | |
| } | |
| let cellComponent = this._super(...arguments); | |
| // Признак мастеровой связи. | |
| if (attr.kind === 'belongsTo') { | |
| let updateLookupValue = this.get('actions.updateLookupValue').bind(this); | |
| switch (`${model.modelName}+${bindingPath}`) { | |
| // ${Имя модели лукапа}+${Имя свойства, которое редактирует лукап} | |
| case 'test-project-test-model+testAttr': | |
| cellComponent.componentProperties = { | |
| ... | |
| remove: 'removeLookupValue', | |
| updateLookupValue: updateLookupValue | |
| ... | |
| }; | |
| break; | |
| default: | |
| console.warn(`Unexpected model+bindingPath: ${model.modelName}+${bindingPath}`); | |
| break; | |
| } | |
| } | |
| return cellComponent; | |
| }, |



Summary by CodeRabbit