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

Simple table with data from external API #2416

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

cammiida
Copy link
Contributor

@cammiida cammiida commented Sep 9, 2024

Description

MVP for showing a static table with data from external API. Should maybe extend the data sources in the future, like hard coded lists or data models, but first of all seeing if this is sufficient for now to avoid gold plating.

The biggest question is how to best make this backwards compatible if we decide to change it. I have added the type property to the data property in the config to support this. But maybe expressions could be better, potentially? But in that case expressions would need to support lists, and we might not want to continue to extend expressions before we decide if we actually want to have them both backend and frontend. 🤔 Appreciate any thoughts on this!

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Copy link

sonarcloud bot commented Sep 9, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
30.0% Coverage on New Code (required ≥ 65%)
0.0% Condition Coverage on New Code (required ≥ 65%)

See analysis details on SonarCloud

Comment on lines +20 to +25
return (
<ErrorList
nodeId={node.id}
errors={['Tabelldata må være en liste av objekter']}
/>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of rendering out an ErrorList, just throw an error instead. It will be caught in the error handler, logged to devtools, and then displayed in an error list. I would prefer not to export the ErrorList, as it just makes it possible to circumvent the normal way these errors are caught and logged.

);
};

function renderCell(component: ColumnConfig['component'], row: Record<string, unknown>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably just be a react component instead. 🙌

new CG.prop('id', new CG.str()),
new CG.prop('title', new CG.str()),
new CG.prop(
'component',
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably call this content instead of component. The latter has a specific meaning for app developers, and we use it in Grid to point to other components in the layout. Here, as it's a mini-layout with types Text and Link. Since we already have an actual layout-component called Text, this might look confusing to app developers.

Copy link

sonarcloud bot commented Oct 9, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
34.9% Coverage on New Code (required ≥ 65%)
0.0% Condition Coverage on New Code (required ≥ 65%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Listevisning av data uten definert datamodell
2 participants