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(() =>
import('@/components/rooms/room-entries/EditRoomEntryWizard.vue')
);
const NewProjectEntryWizard = defineAsyncComponent(() =>
import('@/components/portfolio/NewProjectEntryWizard.vue')
);
const EditProjectEntryWizard = defineAsyncComponent(() =>
import('@/components/portfolio/EditProjectEntryWizard.vue')
);
const NewObjectiveWizard = defineAsyncComponent(() =>
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 NewProjectEntryWizard = defineAsyncComponent(() => import('@/components/portfolio/NewProjectEntryWizard.vue'));
const EditProjectEntryWizard = defineAsyncComponent(() => import('@/components/portfolio/EditProjectEntryWizard.vue'));
const NewObjectiveWizard = defineAsyncComponent(() => 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(() =>
import('@/components/snapshots/EditSnapshotTitleWizard.vue')
);
const DefaultLayout = defineAsyncComponent(() => import('@/layouts/DefaultLayout.vue'));
const SimpleLayout = defineAsyncComponent(() => import('@/layouts/SimpleLayout.vue'));
const FullScreenLayout = defineAsyncComponent(() =>
import('@/layouts/FullScreenLayout.vue')
);
const FullScreenLayout = defineAsyncComponent(() => import('@/layouts/FullScreenLayout.vue'));
const PublicLayout = defineAsyncComponent(() => import('@/layouts/PublicLayout.vue'));
const BlankLayout = defineAsyncComponent(() => import('@/layouts/BlankLayout.vue'));
const SplitLayout = defineAsyncComponent(() => import('@/layouts/SplitLayout.vue'));

View File

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

View File

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

View File

@ -19,10 +19,10 @@ export default function(uri, networkErrorCallback) {
});
const consoleLink = new ApolloLink((operation, forward) => {
log.debug('operation', operation.operationName);
// log.debug('operation', operation.operationName);
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;
});
});
@ -43,7 +43,8 @@ export default function(uri, networkErrorCallback) {
const errorLink = onError(({ networkError, graphQLErrors }) => {
if (networkError && networkErrorCallback) {
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;
}
}

View File

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

View File

@ -1,24 +1,29 @@
<template>
<module :module="module" @editNote="editNote" @addNote="addNote" @bookmark="bookmark" />
<module
:module="module"
@editNote="editNote"
@addNote="addNote"
@bookmark="bookmark"
/>
</template>
<script>
import Module from '@/components/modules/Module.vue';
import log from 'loglevel';
import Module from '@/components/modules/Module.vue';
import log from 'loglevel';
import UPDATE_LAST_MODULE_MUTATION from '@/graphql/gql/mutations/updateLastModule.gql';
import UPDATE_MODULE_BOOKMARK_MUTATION from '@/graphql/gql/mutations/updateModuleBookmark.gql';
// import ME_QUERY from '@/graphql/gql/meQuery.gql';
import MODULE_FRAGMENT from '@/graphql/gql/fragments/moduleParts.gql';
import SCROLL_POSITION from '@/graphql/gql/local/scrollPosition.gql';
import SCROLL_TO_MUTATION from '@/graphql/gql/local/mutations/scrollTo.gql';
import UPDATE_LAST_MODULE_MUTATION from '@/graphql/gql/mutations/updateLastModule.gql';
import UPDATE_MODULE_BOOKMARK_MUTATION from '@/graphql/gql/mutations/updateModuleBookmark.gql';
// import ME_QUERY from '@/graphql/gql/meQuery.gql';
import MODULE_FRAGMENT from '@/graphql/gql/fragments/moduleParts.gql';
import SCROLL_POSITION from '@/graphql/gql/local/scrollPosition.gql';
import SCROLL_TO_MUTATION from '@/graphql/gql/local/mutations/scrollTo.gql';
import meMixin from '@/mixins/me';
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
import ME_QUERY from '@/graphql/gql/queries/meQuery.gql';
import {setModuleEditMode} from '@/graphql/cache-operations';
import meMixin from '@/mixins/me';
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
import ME_QUERY from '@/graphql/gql/queries/meQuery.gql';
import { setModuleEditMode } from '@/graphql/cache-operations';
export default {
export default {
mixins: [meMixin],
components: {
@ -49,11 +54,11 @@
},
result({
data: {
module: {id},
module: { id },
},
}) {
if (!this.updateSent) {
log.debug(`=== updating result for module ${id} ===`);
// log.debug(`=== updating result for module ${id} ===`);
this.updateLastVisitedModule(id);
this.updateSent = true;
}
@ -68,7 +73,7 @@
methods: {
updateLastVisitedModule(moduleId) {
log.debug(`updating last visited module for module ${moduleId}`);
// log.debug(`updating last visited module for module ${moduleId}`);
if (!moduleId) {
log.warn('no module id');
return;
@ -90,14 +95,14 @@
store,
{
data: {
updateLastModule: {lastModule},
updateLastModule: { lastModule },
},
}
) => {
const {id, slug} = lastModule;
log.debug('updating last module', id, slug);
const { slug } = lastModule;
// log.debug('updating last module', lastModule.id, slug);
const query = ME_QUERY;
let {me} = store.readQuery({
let { me } = store.readQuery({
query,
});
// me.lastModule = {
@ -224,5 +229,5 @@
}
},
},
};
};
</script>