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

Rendering undefined values #719

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

shekela
Copy link

@shekela shekela commented Oct 7, 2024

Frontend Pull Request Description

Hey, I created function which renders the specific values for undefined or false values. In the case the data contains null, undefined, false and etc. In case of undefined or null data was not rendering values after null or undefined because those values do not have properties, so it was error in console, so I mapped data and when I was rendering the data I turned undefined or null values to string "undefined" or "null" and it continued working. I render string and "-" for false or undefined values. Strings can be changed to specific values whatever will be necessary from function. I run spec.ts file also with additional case and it doesn't break any other code. There are no errors in console.
Screenshot 2024-10-07 124515
Screenshot_7-10-2024_123143_localhost

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have updated change log
  • I have been following Definition of done
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new lint warnings
  • New and existing unit tests pass locally and on CI with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Additional Context (if necessary)

@@ -142,7 +142,7 @@
"a11y": "start-server-and-test serve-examples:prod 4200 a11y:base",
"a11y:base": "yarn run e2e:base --suite a11y",
"a11y:ci": "yarn run e2e:ci --suite a11y",
"assemble": "run-s prettier-check lint build-lib:locl build-lib:prod compodoc-custom-theme build-examples:prod build-schematics",
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert changes in package.json (removing prettier-check and lint serves only for making local development faster)

@@ -125,4257 +129,4261 @@ export const GRAPH_DATA_MOCK = {
},
],
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't comment out previous mock data. This can potentially break other tests

@@ -286,6 +286,7 @@ const widgetConfig: IWidget = {
// drillstate: [""],
groupBy: ["continent.name"],


Copy link
Contributor

Choose a reason for hiding this comment

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

run prettier + lint locally before reviews

</nui-repeat>

<div class="empty" *ngIf="!shouldDisplayRepeat()">
<nui-image image="no-data-to-show"></nui-image>
<p>EMPTY VOBSHE</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

vobshe?

}

public ngOnChanges(changes: SimpleChanges): void {
//this.data = [true,false, 1, 0, "", undefined, null, "ajajaja"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary comments

}

public ngOnChanges(changes: SimpleChanges): void {
//this.data = [true,false, 1, 0, "", undefined, null, "ajajaja"]
this.data = this.data?.map((x) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will loop through all values after each change (since it is in ngOnChanges function). If there are many values, won't that slow down performance?

@@ -86,6 +99,50 @@ export class ListWidgetComponent
this.eventBus.getStream(DRILLDOWN).next({ payload: item });
}

public getDisplayText(item: any): string {
if (item === undefined || item === "undefined") {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about empty array [], empty object {}, object which contains empty array, etc..


public dismissNavigation(data: SimpleChanges) {
if (this.data?.length > 0) {
console.log(this.configuration.itemProperties);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use console.log only locally but don't merge it into main branch

@pavlo-poimanov
Copy link
Contributor

please rebase on latest master
@shekela
@KleinMichalGit from now it is possible to run the forked PR

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

Successfully merging this pull request may close these issues.

3 participants