-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resource explorer telemetry (#1347)
* capture resource explorer telemetry Co-authored-by: Charles Wahome <[email protected]>
- Loading branch information
1 parent
473d1e0
commit e5551e5
Showing
9 changed files
with
86 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { telemetry, eventTypes, componentNames } from '../../../telemetry'; | ||
|
||
export function downloadToLocal(content: any, filename: string) { | ||
const blob = new Blob([JSON.stringify(content, null, 4)], { | ||
type: 'text/json' | ||
}); | ||
download(blob, filename); | ||
trackDownload(filename); | ||
} | ||
|
||
function download(blob: Blob, filename: string) { | ||
const elem = window.document.createElement('a'); | ||
elem.href = window.URL.createObjectURL(blob); | ||
elem.download = filename; | ||
document.body.appendChild(elem); | ||
elem.click(); | ||
document.body.removeChild(elem); | ||
} | ||
|
||
function trackDownload(filename: string) { | ||
telemetry.trackEvent(eventTypes.BUTTON_CLICK_EVENT, { | ||
ComponentName: componentNames.DOWNLOAD_POSTMAN_COLLECTION_BUTTON, | ||
filename | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters