Skip to content

Commit

Permalink
feat: report telemetry when sandbox login button pressed (#91)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Golovin <dgolovin@redhat.com>
  • Loading branch information
dgolovin authored Sep 1, 2023
1 parent e41dba4 commit 524a126
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"redhat.sandbox.form.description": {
"type": "markdown",
"scope": "KubernetesProviderConnectionFactory",
"markdownDescription": "You will need to log into your Developer Sandbox in an external browser:\n\n:button[Log into Developer Sandbox]{href=\"https://developers.redhat.com/developer-sandbox/?sc_cid=7013a000003SUmgAAG\" title=Login into Developer Sandbox in an external browser}\n\nFrom your Developer Sandbox Console, click on your login name in the upper right corner and select 'Copy login command' from the menu. Copy full login command from browser page and paste it in the 'Login command' field below."
"markdownDescription": "You will need to log into your Developer Sandbox in an external browser:\n\n:button[Log into Developer Sandbox]{command=sandbox.open.login.url href=\"https://developers.redhat.com/developer-sandbox/?sc_cid=7013a000003SUmgAAG\"}\n\nFrom your Developer Sandbox Console, click on your login name in the upper right corner and select 'Copy login command' from the menu. Copy full login command from browser page and paste it in the 'Login command' field below."
},
"redhat.sandbox.context.name": {
"type": "string",
Expand All @@ -41,6 +41,12 @@
}
}
},
"commands": [
{
"command": "sandbox.open.login.url",
"title": "Log into Developer Sandbox"
}
],
"menus": {
"dashboard/image": [
{
Expand Down
12 changes: 12 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import * as kubeconfig from './kubeconfig';

const ProvideDisplayName = 'Developer Sandbox';

const TelemetryLogger = extensionApi.env.createTelemetryLogger();

interface ConnectionData {
disposable?: extensionApi.Disposable;
connection: extensionApi.KubernetesProviderConnection;
Expand Down Expand Up @@ -240,6 +242,16 @@ export async function activate(extensionContext: extensionApi.ExtensionContext):
'A free, private OpenShift environment including one project and a resource quota of 14 GB RAM, and 40 GB storage. It lasts 30 days.\n\nSign up at [https://developers.redhat.com/developer-sandbox](https://developers.redhat.com/developer-sandbox/?sc_cid=7013a000003SUmgAAG).',
};

extensionApi.commands.registerCommand('sandbox.open.login.url', () => {
extensionApi.env
.openExternal(
extensionApi.Uri.parse('https://developers.redhat.com/developer-sandbox/?sc_cid=7013a000003SUmgAAG'),
)
.then(successful => {
TelemetryLogger.logUsage('sandboxOpenLoginUrlRequest', { successful });
});
});

provider = extensionApi.provider.createProvider(providerOptions);

const LoginCommandParam = 'redhat.sandbox.login.command';
Expand Down

0 comments on commit 524a126

Please sign in to comment.