web/storagenode: telemetry removed

Change-Id: I26e9d96178539d76a0aecaf5e62d76a56b6559a3
This commit is contained in:
crawter 2020-07-14 14:40:41 +03:00
parent 2ef9f7f644
commit 68a2726e2a
7 changed files with 8 additions and 125 deletions

View File

@ -6177,9 +6177,9 @@
"dev": true
},
"elliptic": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
@ -9950,9 +9950,9 @@
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"lodash.defaultsdeep": {
"version": "4.6.1",

View File

@ -58,14 +58,11 @@ export default class App extends Vue {
return this.$store.state.appStateModule.isLoading;
}
public async beforeCreate(): Promise<void> {
public beforeCreate(): void {
document.body.classList.add('js-loading');
window.onload = () => {
document.body.classList.remove('js-loading');
};
// TODO: place key to server config.
await this.$telemetry.init('DTEcoJRlUAN2VylCWMiLrqoknW800GNO');
}
public onScroll(): void {

View File

@ -1,57 +0,0 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import { Telemetry, TelemetryViews } from '@/app/telemetry/telemetry';
import { LoadScript } from '@/app/utils/loadScript';
/**
* Segmentio implements all telemetry related functionality of Telemetry interface.
*/
export class Segmentio implements Telemetry {
private analytics: SegmentAnalytics.AnalyticsJS;
private loadScript: LoadScript;
/**
* Segment.io client.
* @param key - public key to your source.
*/
public init(key: string): void {
if (key === '' || key.includes('SegmentIOPublicKey')) {
return;
}
const url = `https://cdn.segment.com/analytics.js/v1/${key}/analytics.min.js`;
this.loadScript = new LoadScript(url,
() => {
this.analytics = window['analytics'];
this.view(TelemetryViews.Dashboard);
},
(error) => {
throw error;
},
);
}
/**
* The view method lets you record how many times view, component or page was viewed in your application.
*/
public view(view: TelemetryViews): void {
if (!this.analytics) {
return;
}
this.analytics.page(view);
}
/**
* Updates information about user with specified NodeId.
*/
public identify(id: string): void {
if (!this.analytics) {
return;
}
this.analytics.identify(id);
}
}

View File

@ -1,39 +0,0 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import { Segmentio } from '@/app/telemetry/segmnetio/segmentio';
/**
* Telemetry exposes all telemetry related functionality.
*/
export interface Telemetry {
/**
* Init method initialize all dependencies and parameters.
*/
init(key: string);
/**
* The view method lets you record how many times view, component or page was viewed in your application.
*/
view(view: TelemetryViews);
/**
* Updates information about user with specified NodeId.
*/
identify(nodeId: string);
}
/**
* TelemetryPlugin is a Vue Plugin that allows to extend vue context with Telemetry functionality.
*/
export class TelemetryPlugin {
public install(Vue) {
Vue.prototype.$telemetry = new Segmentio();
}
}
export enum TelemetryViews {
Dashboard = 'SNO Dashboard Web App',
MainPage = 'Main Page',
Payments = 'Payments Page',
Notifications = 'Notifications Page',
}

View File

@ -1,10 +0,0 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import { Telemetry } from '@/app/telemetry/telemetry';
declare module 'vue/types/vue' {
interface Vue {
$telemetry: Telemetry;
}
}

View File

@ -20,7 +20,6 @@ import { APPSTATE_ACTIONS } from '@/app/store/modules/appState';
import { NODE_ACTIONS } from '@/app/store/modules/node';
import { NOTIFICATIONS_ACTIONS } from '@/app/store/modules/notifications';
import { PAYOUT_ACTIONS } from '@/app/store/modules/payout';
import { TelemetryViews } from '@/app/telemetry/telemetry';
import { NotificationsCursor } from '@/app/types/notifications';
@Component ({
@ -56,9 +55,6 @@ export default class Dashboard extends Vue {
}
await this.$store.dispatch(APPSTATE_ACTIONS.SET_LOADING, false);
this.$telemetry.identify(this.$store.state.node.info.id);
this.$telemetry.view(TelemetryViews.MainPage);
}
}
</script>

View File

@ -8,14 +8,10 @@ import { DirectiveBinding } from 'vue/types/options';
import App from '@/app/App.vue';
import { router } from '@/app/router';
import { store } from '@/app/store';
import { TelemetryPlugin } from '@/app/telemetry/telemetry';
Vue.config.productionTip = false;
const telemetry = new TelemetryPlugin();
Vue.use(telemetry);
VueClipboard.config.autoSetContainer = true;
Vue.use(VueClipboard);
let clickOutsideEvent: EventListener;