mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
Add segment metrics for plugin data context (#3903)
This commit is contained in:
parent
18e7f49b43
commit
63fd9bc3a5
@ -1,3 +1,4 @@
|
|||||||
|
import { trackSegmentEvent } from '../../common/analytics';
|
||||||
import { exportWorkspacesData, exportWorkspacesHAR } from '../../common/export';
|
import { exportWorkspacesData, exportWorkspacesHAR } from '../../common/export';
|
||||||
import type { ImportRawConfig } from '../../common/import';
|
import type { ImportRawConfig } from '../../common/import';
|
||||||
import { importRaw, importUri } from '../../common/import';
|
import { importRaw, importUri } from '../../common/import';
|
||||||
@ -26,11 +27,15 @@ const buildImportRawConfig = (options: PluginImportOptions, activeSpaceId: strin
|
|||||||
getSpaceId: () => Promise.resolve(activeSpaceId),
|
getSpaceId: () => Promise.resolve(activeSpaceId),
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: add metrics here to track how frequently this fallback is being used
|
const getWorkspaces = (activeSpaceId?: string) => {
|
||||||
const getWorkspaces = (activeSpaceId?: string) =>
|
if (activeSpaceId) {
|
||||||
activeSpaceId
|
trackSegmentEvent('Plugin export loading workspaces for active space');
|
||||||
? models.workspace.findByParentId(activeSpaceId)
|
return models.workspace.findByParentId(activeSpaceId);
|
||||||
: models.workspace.all();
|
} else {
|
||||||
|
trackSegmentEvent('Plugin export loading all workspace');
|
||||||
|
return models.workspace.all();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Only in the case of running unit tests from Inso via send-request can activeSpaceId be undefined. This is because the concept of a space doesn't exist in git/insomnia sync or an export file
|
// Only in the case of running unit tests from Inso via send-request can activeSpaceId be undefined. This is because the concept of a space doesn't exist in git/insomnia sync or an export file
|
||||||
export const init = (activeSpaceId?: string) => ({
|
export const init = (activeSpaceId?: string) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user