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

feat: #174 As a 'Developer', I want to see a graph on my analytics page showing API calls #221

Merged

Conversation

nphivu414
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the marketplace Relates to the Marketplace label Feb 10, 2020
Copy link
Contributor

@willmcvay willmcvay left a comment

Choose a reason for hiding this comment

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

Nice work 👍

@@ -188,7 +198,7 @@ export const AnalyticsPage: React.FC<AnalyticsPageProps> = ({ installations, dev
handleMapAppNameToInstallation(installationAppDataArray, developerDataArray),
[installationAppDataArray, developerDataArray],
)

console.log('appUsageStats', appUsageStats)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove console please

@github-actions github-actions bot requested a review from willmcvay February 11, 2020 02:09
Comment on lines 29 to 34
...{
[developerAppId]: {
appName: developerAppName,
requests,
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

will this work without ...{} ?

              [developerAppId]: {
                appName: developerAppName,
                requests,
              },

Copy link
Contributor Author

@nphivu414 nphivu414 Feb 11, 2020

Choose a reason for hiding this comment

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

It wont work without the spread operator here because I need to merge 2 objects into 1.
For example:

a = {
  appId1: {
    appName: 'App 1',
    request: 5
  }
}
b = {
  appId2: {
    appName: 'App 2',
    request: 10
  }
}

Expected result:

{
  appId1: {
    appName: 'App 1',
    request: 5
  },
  appId2: {
    appName: 'App 2',
    request: 10
  }
}

Comment on lines 70 to 73
return Object.values(appUsage)
.filter((app: any) => app.appName)
.map((app: any) => {
return `${app.appName}: ${app.requests}`
Copy link
Contributor

@vuhuucuong vuhuucuong Feb 11, 2020

Choose a reason for hiding this comment

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

it's nice if you can replace any with a correct type

const { appId, usage } = currentValue || {}
const developerApp = developerApps?.find(app => app.id === appId)
if (developerApp && developerApp.id) {
const { id: developerAppId, name: developerAppName } = developerApp
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be changed to

if (!developerApp?.id){|
  return accumulator
}
const { id: developerAppId, name: developerAppName } = developerApp
... 

}

describe('DeveloperTrafficChart', () => {
describe('getAppUsageStatsChartData', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

make sure to test this function with more cases since it looks quite complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @vuhuucuong , i've already added another test case for multiple app usages

@github-actions github-actions bot requested a review from vuhuucuong February 11, 2020 06:58
@github-actions github-actions bot requested a review from vuhuucuong February 11, 2020 11:31
@nphivu414 nphivu414 merged commit ac38dcf into master Feb 11, 2020
@nphivu414 nphivu414 deleted the feat/174-add-a-graph-showing-api-calls-in-analytics-page branch February 11, 2020 11:54
nphivu414 pushed a commit that referenced this pull request Apr 29, 2020
* [CLD-598] Searching by app name or company name on browse apps

* Change auze-pipelines
nphivu414 pushed a commit that referenced this pull request Apr 29, 2020
…-component

[CLD-696] change style help guide component
nphivu414 added a commit that referenced this pull request Apr 29, 2020
…ge showing API calls (#221)

* feat: #174 - Add AppUsageStats apis + redux store
- Update market place api schema
- Add AppUsageStats component

* feat: #174 - Add AppUsageStats apis + redux store
- Update market place api schema
- Add AppUsageStats component

* feat: #173 create traffic table

* feat: #174 - Build app usages graph

* Revert package.json

* feat: #174 - Update test for developer traffic chart

* feat: #174 - Add util test, fix created date format in traffic table

* feat: #174 - Remove developerId param from appUsageStatsRequest

* feat: #174 Remove unused logs - Update appId params

* feat: #174 - Update usage stats test for multiple apps

* feat: #174 - Fix app usage stats test issues

* feat: #174 - Update analytic page rendering flow while loading

* feat: #174 - Add type for app trafic tooltip label

* feat: #174 - Update marketplace-api-schema.ts file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
marketplace Relates to the Marketplace
Projects
None yet
3 participants