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

Analytics for litmus portal. #2065

Merged
merged 22 commits into from
Sep 14, 2020
Merged

Analytics for litmus portal. #2065

merged 22 commits into from
Sep 14, 2020

Conversation

ishangupta-ds
Copy link
Member

Proposed changes

Adds analytics section and fixes for the same to litmus portal.

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • None.

Special notes for your reviewer:

Analytics PR #3

@ishangupta-ds ishangupta-ds marked this pull request as draft September 14, 2020 06:51
{ variables: { projectID: selectedProjectID } }
{
variables: { projectID: selectedProjectID },
fetchPolicy: 'cache-and-network',
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this...not required here

};

workflowRuns.push(edgeLow);
workflowRuns.push(workflowRunOnce);
workflowRuns.push(edgeHigh);

setWorkflowRunDataForPlot(workflowRuns);
}, [data]);
}, [data, loading]);
Copy link
Contributor

Choose a reason for hiding this comment

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

loading is not required here as a dependency...remove this

Suggested change
}, [data, loading]);
}, [data]);

}
});
setSelectedWorkflowRunDetails(workflowTestsArray);
}, [selectedWorkflowRunID, data, loading]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, [selectedWorkflowRunID, data, loading]);
}, [selectedWorkflowRunID, data]);

@@ -0,0 +1,43 @@
import React, { useEffect } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid naming components as Custom

Copy link
Contributor

Choose a reason for hiding this comment

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

change it to a more apt name

return setLabel(classes.passed);
}
return setLabel(classes.failed);
}, [status, classes.failed, classes.passed]);
Copy link
Contributor

Choose a reason for hiding this comment

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

classes can be removed as a dependency

palette: {
secondary: {
light: '#FFFFFF',
main: '#FFFFFF',
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Member Author

Choose a reason for hiding this comment

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

It is required @arkajyotiMukherjee do i move it to theme file?

},

calIcon: {
color: 'rgba(0, 0, 0, 0.4)',
Copy link
Contributor

Choose a reason for hiding this comment

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

try this @ishangupta-ds

getTests(processedWorkflowRunDetails);
getTestResults(processedWorkflowRunDetails);
setReload(true);
}, [data, loading, workflowID, reload]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, [data, loading, workflowID, reload]);
}, [data, workflowID, reload]);

setReload(true);
}, [data, loading, workflowID, reload]);

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

filter is a state variable it'll automatically recalculate this. no need for useEffect here

Copy link
Member Author

@ishangupta-ds ishangupta-ds Sep 14, 2020

Choose a reason for hiding this comment

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

I am updating the selection options dynamically upon changing he filter @arkajyotiMukherjee , if i don't use useEffect() how should i call the functions to update the drop down lists for test and test results?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is basic concept of state in react...we have done the same in browse workflow
filter is a state var. hence when it changes react will rerender the component where it is used...no need of useEffect

Copy link
Member Author

@ishangupta-ds ishangupta-ds Sep 14, 2020

Choose a reason for hiding this comment

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

That is good but I am calling 3 functions PTAL, how do I call them without use effect? If I don't use this hook those functions will never be called... getTests() and getTestResults()

}

interface TestResultCallBackType {
(testResult: string): void;
Copy link
Contributor

Choose a reason for hiding this comment

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

improve this callback situation wherever it is used

Copy link
Member Author

@ishangupta-ds ishangupta-ds Sep 14, 2020

Choose a reason for hiding this comment

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

Actually its more a state passing function than callback, have named it a callback as it functions similarly.. @arkajyotiMukherjee Not actually using any callback..

Signed-off-by: ishangupta-ds <[email protected]>
@ishangupta-ds
Copy link
Member Author

@arkajyotiMukherjee PTAL. cc: @rajdas98

setReload(true);
}, [data, loading, workflowID, reload]);

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is basic concept of state in react...we have done the same in browse workflow
filter is a state var. hence when it changes react will rerender the component where it is used...no need of useEffect

Signed-off-by: ishangupta-ds <[email protected]>
@ishangupta-ds
Copy link
Member Author

changes made PTAL @arkajyotiMukherjee @rajdas98

@ishangupta-ds
Copy link
Member Author

ishangupta-ds commented Sep 14, 2020

/preview 10
ERROR IN CI

Signed-off-by: ishangupta-ds <[email protected]>
amityt
amityt previously approved these changes Sep 14, 2020
amityt
amityt previously approved these changes Sep 14, 2020
@ishangupta-ds
Copy link
Member Author

ishangupta-ds commented Sep 14, 2020

/run-unit


Test Status: The testing has been started please wait for the results ...
Test Result: All tests are passed
Run ID: 254295145

Signed-off-by: ishangupta-ds <[email protected]>
@imrajdas imrajdas merged commit d433a35 into litmuschaos:master Sep 14, 2020
imrajdas pushed a commit to imrajdas/litmus that referenced this pull request Sep 14, 2020
Adds Analytics section and fixes for the same to litmus portal.

Signed-off-by: ishangupta-ds <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants