-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issue/5868 right sidebar #5930
base: issue/composer-v2
Are you sure you want to change the base?
Issue/5868 right sidebar #5930
Conversation
….0 (PR #5938) Bumps [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) from 6.2.2 to 6.3.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/testing-library/eslint-plugin-testing-library/releases">eslint-plugin-testing-library's releases</a>.</em></p> <blockquote> <h2>v6.3.0</h2> <h1><a href="https://github.com/testing-library/eslint-plugin-testing-library/compare/v6.2.2...v6.3.0">6.3.0</a> (2024-08-11)</h1> <h3>Features</h3> <ul> <li>add support for flat config (<a href="https://redirect.github.com/testing-library/eslint-plugin-testing-library/issues/923">#923</a>) (<a href="https://github.com/testing-library/eslint-plugin-testing-library/commit/4dc7caa86b880d7b762a5df23f4ec736a548b502">4dc7caa</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/testing-library/eslint-plugin-testing-library/commit/4dc7caa86b880d7b762a5df23f4ec736a548b502"><code>4dc7caa</code></a> feat: add support for flat config (<a href="https://redirect.github.com/testing-library/eslint-plugin-testing-library/issues/923">#923</a>)</li> <li><a href="https://github.com/testing-library/eslint-plugin-testing-library/commit/e04a94092cd5a6399c9d3b605766f9ed0eb56570"><code>e04a940</code></a> docs(contributing): fix broken link (<a href="https://redirect.github.com/testing-library/eslint-plugin-testing-library/issues/911">#911</a>)</li> <li><a href="https://github.com/testing-library/eslint-plugin-testing-library/commit/c975ced3c17ddb8808332422891e69a2fa3f126e"><code>c975ced</code></a> docs: add Chamion as a contributor for code, and test (<a href="https://redirect.github.com/testing-library/eslint-plugin-testing-library/issues/896">#896</a>)</li> <li>See full diff in <a href="https://github.com/testing-library/eslint-plugin-testing-library/compare/v6.2.2...v6.3.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-testing-library&package-manager=npm_and_yarn&previous-version=6.2.2&new-version=6.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
…g related Inventories
…to issue/5868-right-sidebar
@@ -28,6 +33,7 @@ interface GetInstanceWithRelationsHook { | |||
*/ | |||
export const useGetInstanceWithRelations = ( | |||
instanceId: string, | |||
serviceModel: ServiceModel | undefined, |
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 you can have the value as undefined, it means it is optional, I prefer having the '?'
@@ -61,6 +67,63 @@ export const useGetInstanceWithRelations = ( | |||
return await response.json(); | |||
}; | |||
|
|||
const getAllRelations = ( |
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.
docstrings
return [...relations, ...nestedRelations]; | ||
}; | ||
|
||
const getAllEmbeddedEntities = ( |
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.
docstrings
And by the name you gave, I'd expect the full items, not an array of strings, so maybe rename it to contain the keyword 'name'
return [...embedded, ...nestedEmbedded]; | ||
}; | ||
|
||
const findAllRelatedIds = ( |
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.
docstrings
also, maybe try to be consistent, just like the method before, this would be getAllRelatedIds.
Semantically, a getter typically wouldn't return undefined, whereas a find method potentially could.
embeddedNames: string[], | ||
): string[] => { | ||
const relationIDs = relationNames.map( | ||
(relationName) => (attributes[relationName] as string) || "", |
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.
why the empty string?
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.
After a thought I changed it to filter out (possible) undefined, but casting has to stay as we can't assert for certain that ids will be string from the interfaces as the attributes are of type unknown
holderName = "", | ||
): ServiceEntityBlock { | ||
//Create shape for Entity | ||
const instanceAsTable = new ServiceEntityBlock().setName(serviceModel.name); |
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.
That may be personal, but I don't like chaining a method and then directly setting something to the result of that method like this. I'd rather have it in two separate statements. Or pass the name in as an argument so the constructor of your class can assign it on creation
instanceAsTable, | ||
serviceModel.key_attributes || [], | ||
attributes, | ||
true, |
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.
I'd prefer no anonymous arguments, especially when there are multiple boolean arguments in the list
const attributes = | ||
serviceInstance.candidate_attributes || | ||
serviceInstance.active_attributes || | ||
undefined; |
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.
why undefined here, and not an empty object like in the other file?
Also, shouldn't active have priority over candidate?
); | ||
|
||
//if instance is not main, we need to apply it's stencil name to the shape to later disable it's adequate blueprint in the sidebar |
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 instance is not main, we need to apply it's stencil name to the shape to later disable it's adequate blueprint in the sidebar | |
// If the instance is not main, we need to apply its stencil name to the shape to later disable its adequate stencil in the sidebar |
const relatedCell = allCells.find((cell) => cell.id === key); | ||
|
||
if (relatedCell) { | ||
const relation = serviceModel.inter_service_relations?.find( |
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.
you're relying too much on the safe operator, needing it is typically a code-smell unless you're doing Angular. It usually means your not defensive enough in your coding and bypassing typescript
Description
closes Add ticket reference here
Self Check:
Strike through any lines that are not applicable (
~~line~~
) then check the box