mirror of
https://github.com/frappe/books.git
synced 2025-01-03 15:17:30 +00:00
fix: telemetry log when printing
This commit is contained in:
parent
18fc0e1a5d
commit
00ce281afc
@ -34,6 +34,7 @@
|
|||||||
<PrintContainer
|
<PrintContainer
|
||||||
v-if="printProps"
|
v-if="printProps"
|
||||||
ref="printContainer"
|
ref="printContainer"
|
||||||
|
:print-schema-name="schemaName"
|
||||||
:template="printProps.template"
|
:template="printProps.template"
|
||||||
:values="printProps.values"
|
:values="printProps.values"
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
@ -55,11 +56,11 @@ import PageHeader from 'src/components/PageHeader.vue';
|
|||||||
import { handleErrorWithDialog } from 'src/errorHandling';
|
import { handleErrorWithDialog } from 'src/errorHandling';
|
||||||
import { fyo } from 'src/initFyo';
|
import { fyo } from 'src/initFyo';
|
||||||
import { getPrintTemplatePropValues } from 'src/utils/printTemplates';
|
import { getPrintTemplatePropValues } from 'src/utils/printTemplates';
|
||||||
|
import { showSidebar } from 'src/utils/refs';
|
||||||
import { PrintValues } from 'src/utils/types';
|
import { PrintValues } from 'src/utils/types';
|
||||||
import { getFormRoute, openSettings, routeTo } from 'src/utils/ui';
|
import { getFormRoute, openSettings, routeTo } from 'src/utils/ui';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import PrintContainer from '../TemplateBuilder/PrintContainer.vue';
|
import PrintContainer from '../TemplateBuilder/PrintContainer.vue';
|
||||||
import { showSidebar } from 'src/utils/refs';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'PrintView',
|
name: 'PrintView',
|
||||||
@ -244,16 +245,16 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.templateList = list.map(({ name }) => name);
|
this.templateList = list.map(({ name }) => name);
|
||||||
},
|
},
|
||||||
savePDF() {
|
async savePDF() {
|
||||||
const printContainer = this.$refs.printContainer as {
|
const printContainer = this.$refs.printContainer as {
|
||||||
savePDF: (name?: string) => void;
|
savePDF: (name?: string) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!printContainer?.savePDF) {
|
if (!printContainer?.savePDF) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printContainer.savePDF(this.doc?.name);
|
await printContainer.savePDF(this.doc?.name);
|
||||||
},
|
},
|
||||||
async setTemplateFromDefault() {
|
async setTemplateFromDefault() {
|
||||||
const defaultName =
|
const defaultName =
|
||||||
|
@ -145,20 +145,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { Verb } from 'fyo/telemetry/types';
|
||||||
import { Report } from 'reports/Report';
|
import { Report } from 'reports/Report';
|
||||||
import { reports } from 'reports/index';
|
import { reports } from 'reports/index';
|
||||||
|
import { OptionField } from 'schemas/types';
|
||||||
import Button from 'src/components/Button.vue';
|
import Button from 'src/components/Button.vue';
|
||||||
import Check from 'src/components/Controls/Check.vue';
|
import Check from 'src/components/Controls/Check.vue';
|
||||||
import Int from 'src/components/Controls/Int.vue';
|
import Int from 'src/components/Controls/Int.vue';
|
||||||
|
import Select from 'src/components/Controls/Select.vue';
|
||||||
import PageHeader from 'src/components/PageHeader.vue';
|
import PageHeader from 'src/components/PageHeader.vue';
|
||||||
import { getReport } from 'src/utils/misc';
|
import { getReport } from 'src/utils/misc';
|
||||||
|
import { getPathAndMakePDF } from 'src/utils/printTemplates';
|
||||||
|
import { showSidebar } from 'src/utils/refs';
|
||||||
|
import { paperSizeMap, printSizes } from 'src/utils/ui';
|
||||||
import { PropType, defineComponent } from 'vue';
|
import { PropType, defineComponent } from 'vue';
|
||||||
import ScaledContainer from '../TemplateBuilder/ScaledContainer.vue';
|
import ScaledContainer from '../TemplateBuilder/ScaledContainer.vue';
|
||||||
import { getPathAndMakePDF } from 'src/utils/printTemplates';
|
|
||||||
import { OptionField } from 'schemas/types';
|
|
||||||
import { paperSizeMap, printSizes } from 'src/utils/ui';
|
|
||||||
import Select from 'src/components/Controls/Select.vue';
|
|
||||||
import { showSidebar } from 'src/utils/refs';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { PageHeader, Button, Check, Int, ScaledContainer, Select },
|
components: { PageHeader, Button, Check, Int, ScaledContainer, Select },
|
||||||
@ -276,6 +277,8 @@ export default defineComponent({
|
|||||||
this.size.width,
|
this.size.width,
|
||||||
this.size.height
|
this.size.height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.fyo.telemetry.log(Verb.Printed, this.report!.reportName);
|
||||||
},
|
},
|
||||||
cellClasses(cIdx: number, rIdx: number): string[] {
|
cellClasses(cIdx: number, rIdx: number): string[] {
|
||||||
const classes: string[] = [];
|
const classes: string[] = [];
|
||||||
|
@ -49,6 +49,7 @@ import {
|
|||||||
generateCodeFrame,
|
generateCodeFrame,
|
||||||
SourceLocation,
|
SourceLocation,
|
||||||
} from '@vue/compiler-dom';
|
} from '@vue/compiler-dom';
|
||||||
|
import { Verb } from 'fyo/telemetry/types';
|
||||||
import ErrorBoundary from 'src/components/ErrorBoundary.vue';
|
import ErrorBoundary from 'src/components/ErrorBoundary.vue';
|
||||||
import { getPathAndMakePDF } from 'src/utils/printTemplates';
|
import { getPathAndMakePDF } from 'src/utils/printTemplates';
|
||||||
import { PrintValues } from 'src/utils/types';
|
import { PrintValues } from 'src/utils/types';
|
||||||
@ -66,6 +67,7 @@ export default defineComponent({
|
|||||||
components: { ScaledContainer, ErrorBoundary },
|
components: { ScaledContainer, ErrorBoundary },
|
||||||
props: {
|
props: {
|
||||||
template: { type: String, required: true },
|
template: { type: String, required: true },
|
||||||
|
printSchemaName: { type: String, required: true },
|
||||||
scale: { type: Number, default: 0.65 },
|
scale: { type: Number, default: 0.65 },
|
||||||
width: { type: Number, default: 21 },
|
width: { type: Number, default: 21 },
|
||||||
height: { type: Number, default: 29.7 },
|
height: { type: Number, default: 29.7 },
|
||||||
@ -179,6 +181,8 @@ export default defineComponent({
|
|||||||
this.width,
|
this.width,
|
||||||
this.height
|
this.height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.fyo.telemetry.log(Verb.Printed, this.printSchemaName);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
<div v-if="canDisplayPreview" class="p-4 overflow-auto custom-scroll">
|
<div v-if="canDisplayPreview" class="p-4 overflow-auto custom-scroll">
|
||||||
<PrintContainer
|
<PrintContainer
|
||||||
ref="printContainer"
|
ref="printContainer"
|
||||||
|
:print-schema-name="displayDoc!.schemaName"
|
||||||
:template="doc.template!"
|
:template="doc.template!"
|
||||||
:values="values!"
|
:values="values!"
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
|
Loading…
Reference in New Issue
Block a user