Remove debug logs, refactor some problematic code

This commit is contained in:
Ramon Wenger 2023-07-27 15:40:23 +02:00
parent b664e97b1a
commit e726dcc073
6 changed files with 225 additions and 235 deletions

View File

@ -35,35 +35,19 @@ const EditContentBlockWizard = defineAsyncComponent(() =>
const EditRoomEntryWizard = defineAsyncComponent(() => const EditRoomEntryWizard = defineAsyncComponent(() =>
import('@/components/rooms/room-entries/EditRoomEntryWizard.vue') import('@/components/rooms/room-entries/EditRoomEntryWizard.vue')
); );
const NewProjectEntryWizard = defineAsyncComponent(() => const NewProjectEntryWizard = defineAsyncComponent(() => import('@/components/portfolio/NewProjectEntryWizard.vue'));
import('@/components/portfolio/NewProjectEntryWizard.vue') const EditProjectEntryWizard = defineAsyncComponent(() => import('@/components/portfolio/EditProjectEntryWizard.vue'));
); const NewObjectiveWizard = defineAsyncComponent(() => import('@/components/objective-groups/NewObjectiveWizard.vue'));
const EditProjectEntryWizard = defineAsyncComponent(() => const NewNoteWizard = defineAsyncComponent(() => import('@/components/notes/NewNoteWizard.vue'));
import('@/components/portfolio/EditProjectEntryWizard.vue') const EditNoteWizard = defineAsyncComponent(() => import('@/components/notes/EditNoteWizard.vue'));
); const EditClassNameWizard = defineAsyncComponent(() => import('@/components/school-class/EditClassNameWizard.vue'));
const NewObjectiveWizard = defineAsyncComponent(() => const EditTeamNameWizard = defineAsyncComponent(() => import('@/components/profile/EditTeamNameWizard.vue'));
import('@/components/objective-groups/NewObjectiveWizard.vue')
);
const NewNoteWizard = defineAsyncComponent(() =>
import('@/components/notes/NewNoteWizard.vue')
);
const EditNoteWizard = defineAsyncComponent(() =>
import('@/components/notes/EditNoteWizard.vue')
);
const EditClassNameWizard = defineAsyncComponent(() =>
import('@/components/school-class/EditClassNameWizard.vue')
);
const EditTeamNameWizard = defineAsyncComponent(() =>
import('@/components/profile/EditTeamNameWizard.vue')
);
const EditSnapshotTitleWizard = defineAsyncComponent(() => const EditSnapshotTitleWizard = defineAsyncComponent(() =>
import('@/components/snapshots/EditSnapshotTitleWizard.vue') import('@/components/snapshots/EditSnapshotTitleWizard.vue')
); );
const DefaultLayout = defineAsyncComponent(() => import('@/layouts/DefaultLayout.vue')); const DefaultLayout = defineAsyncComponent(() => import('@/layouts/DefaultLayout.vue'));
const SimpleLayout = defineAsyncComponent(() => import('@/layouts/SimpleLayout.vue')); const SimpleLayout = defineAsyncComponent(() => import('@/layouts/SimpleLayout.vue'));
const FullScreenLayout = defineAsyncComponent(() => const FullScreenLayout = defineAsyncComponent(() => import('@/layouts/FullScreenLayout.vue'));
import('@/layouts/FullScreenLayout.vue')
);
const PublicLayout = defineAsyncComponent(() => import('@/layouts/PublicLayout.vue')); const PublicLayout = defineAsyncComponent(() => import('@/layouts/PublicLayout.vue'));
const BlankLayout = defineAsyncComponent(() => import('@/layouts/BlankLayout.vue')); const BlankLayout = defineAsyncComponent(() => import('@/layouts/BlankLayout.vue'));
const SplitLayout = defineAsyncComponent(() => import('@/layouts/SplitLayout.vue')); const SplitLayout = defineAsyncComponent(() => import('@/layouts/SplitLayout.vue'));

View File

@ -22,7 +22,7 @@ import { getUniqueId } from '@/helpers/id';
interface Props { interface Props {
label: string; label: string;
type: string; type?: string;
value: string; value: string;
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {

View File

@ -16,7 +16,7 @@ const PlusIcon = defineAsyncComponent(() => import('@/components/icons/PlusIcon.
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
module: boolean; module?: boolean;
}>(), }>(),
{ {
module: false, module: false,

View File

@ -19,10 +19,10 @@ export default function(uri, networkErrorCallback) {
}); });
const consoleLink = new ApolloLink((operation, forward) => { const consoleLink = new ApolloLink((operation, forward) => {
log.debug('operation', operation.operationName); // log.debug('operation', operation.operationName);
return forward(operation).map((data) => { return forward(operation).map((data) => {
log.debug(`returned from server for ${operation.operationName}`, data); // log.debug(`returned from server for ${operation.operationName}`, data);
return data; return data;
}); });
}); });
@ -43,7 +43,8 @@ export default function(uri, networkErrorCallback) {
const errorLink = onError(({ networkError, graphQLErrors }) => { const errorLink = onError(({ networkError, graphQLErrors }) => {
if (networkError && networkErrorCallback) { if (networkError && networkErrorCallback) {
networkErrorCallback(networkError.statusCode); networkErrorCallback(networkError.statusCode);
if (networkError.statusCode == 402) { // not authenticated, we don't need to continue here if (networkError.statusCode == 402) {
// not authenticated, we don't need to continue here
return; return;
} }
} }

View File

@ -27,7 +27,7 @@ export function matomoTrackPageView(absolutePath: string = '/', title?: string)
if (matomoLastUrl !== url) { if (matomoLastUrl !== url) {
// do not track the same url twice // do not track the same url twice
log.debug('trackMatomoPageView', { url, matomoLastUrl, title }); // log.debug('trackMatomoPageView', { url, matomoLastUrl, title });
window._paq.push(['setCustomUrl', url]); window._paq.push(['setCustomUrl', url]);
window._paq.push(['trackPageView', title]); window._paq.push(['trackPageView', title]);
matomoLastUrl = url; matomoLastUrl = url;
@ -39,7 +39,7 @@ export function matomoTrackEvent(category: string, action: string, name?: string
const dataJSON = JSON.stringify(data); const dataJSON = JSON.stringify(data);
if (matomoLastEventData !== dataJSON) { if (matomoLastEventData !== dataJSON) {
log.debug('matomoTrackEvent', { category, action, name, value }); // log.debug('matomoTrackEvent', { category, action, name, value });
// @ts-ignore // @ts-ignore
window._paq.push(['trackEvent', category, action, name, value]); window._paq.push(['trackEvent', category, action, name, value]);
matomoLastEventData = dataJSON; matomoLastEventData = dataJSON;
@ -79,7 +79,7 @@ export function matomoTrackModuleVisibilityEvent(blockType: string, block: any,
export function matomoTrackUser(userId: string, role: matomoUserRole = 'Student') { export function matomoTrackUser(userId: string, role: matomoUserRole = 'Student') {
// see https://developer.matomo.org/guides/tracking-javascript-guide#user-id for the process // see https://developer.matomo.org/guides/tracking-javascript-guide#user-id for the process
if (matomoLastUserId !== userId) { if (matomoLastUserId !== userId) {
log.debug('matomoTrackUser', { userId, matomoLastUserId, role }); // log.debug('matomoTrackUser', { userId, matomoLastUserId, role });
if (userId) { if (userId) {
// @ts-ignore // @ts-ignore

View File

@ -1,5 +1,10 @@
<template> <template>
<module :module="module" @editNote="editNote" @addNote="addNote" @bookmark="bookmark" /> <module
:module="module"
@editNote="editNote"
@addNote="addNote"
@bookmark="bookmark"
/>
</template> </template>
<script> <script>
@ -53,7 +58,7 @@
}, },
}) { }) {
if (!this.updateSent) { if (!this.updateSent) {
log.debug(`=== updating result for module ${id} ===`); // log.debug(`=== updating result for module ${id} ===`);
this.updateLastVisitedModule(id); this.updateLastVisitedModule(id);
this.updateSent = true; this.updateSent = true;
} }
@ -68,7 +73,7 @@
methods: { methods: {
updateLastVisitedModule(moduleId) { updateLastVisitedModule(moduleId) {
log.debug(`updating last visited module for module ${moduleId}`); // log.debug(`updating last visited module for module ${moduleId}`);
if (!moduleId) { if (!moduleId) {
log.warn('no module id'); log.warn('no module id');
return; return;
@ -94,8 +99,8 @@
}, },
} }
) => { ) => {
const {id, slug} = lastModule; const { slug } = lastModule;
log.debug('updating last module', id, slug); // log.debug('updating last module', lastModule.id, slug);
const query = ME_QUERY; const query = ME_QUERY;
let { me } = store.readQuery({ let { me } = store.readQuery({
query, query,