2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

chore: add few more logs

This commit is contained in:
18alantom 2022-03-09 16:49:26 +05:30
parent 11f192f22a
commit 7696435504
5 changed files with 23 additions and 9 deletions

View File

@ -383,4 +383,5 @@ module.exports = {
},
t,
T,
store: {},
};

View File

@ -3,6 +3,8 @@ const Observable = require('frappe/utils/observable');
const naming = require('./naming');
const { isPesa } = require('../utils/index');
const { DEFAULT_INTERNAL_PRECISION } = require('../utils/consts');
const telemetry = require('@/telemetry/telemetry');
const { Verb } = require('@/telemetry/types');
module.exports = class BaseDocument extends Observable {
constructor(data) {
@ -577,6 +579,7 @@ module.exports = class BaseDocument extends Observable {
await this.trigger('afterInsert');
await this.trigger('afterSave');
telemetry.log(Verb.Created, this.doctype);
return this;
}
@ -620,6 +623,8 @@ module.exports = class BaseDocument extends Observable {
await this.trigger('beforeDelete');
await frappe.db.delete(this.doctype, this.name);
await this.trigger('afterDelete');
telemetry.log(Verb.Deleted, this.doctype);
}
async submitOrRevert(isSubmit) {

View File

@ -25,7 +25,6 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils';
ipcRenderer.invoke = getErrorHandled(ipcRenderer.invoke);
window.frappe = frappe;
window.frappe.store = {};
window.onerror = (message, source, lineno, colno, error) => {
error = error ?? new Error('triggered in window.onerror');

View File

@ -51,15 +51,17 @@
</div>
</template>
<script>
import frappe from 'frappe';
import BackLink from '@/components/BackLink';
import Button from '@/components/Button';
import PageHeader from '@/components/PageHeader';
import SearchBar from '@/components/SearchBar';
import Button from '@/components/Button';
import BackLink from '@/components/BackLink';
import TwoColumnForm from '@/components/TwoColumnForm';
import { IPC_ACTIONS } from '@/messages';
import telemetry from '@/telemetry/telemetry';
import { Verb } from '@/telemetry/types';
import { makePDF } from '@/utils';
import { ipcRenderer } from 'electron';
import { IPC_ACTIONS } from '@/messages';
import frappe from 'frappe';
export default {
name: 'PrintView',
@ -96,6 +98,7 @@ export default {
if (!savePath) return;
const html = this.$refs.printContainer.innerHTML;
telemetry.log(Verb.Exported, 'SalesInvoice', { extension: 'pdf' });
makePDF(html, savePath);
},
async getSavePath() {

View File

@ -1,5 +1,6 @@
import { DoctypeName } from 'models/types';
export type AppVersion = string;
export type UniqueId = string;
export type Timestamp = number;
@ -27,14 +28,19 @@ export interface Telemetry {
timeline?: InteractionEvent[];
counts?: Count;
locale: Locale;
version: AppVersion;
}
export enum Verb {
Saved = 'saved',
Submitted = 'sumbitted',
Canceled = 'canceled',
Created = 'created',
Deleted = 'deleted',
Navigated = 'navigated',
Imported = 'imported',
Exported = 'exported',
}
export enum Noun {}
export enum NounEnum {
Route = 'route',
}
export type Noun = string | NounEnum;