Replace logger

This commit is contained in:
Ramon Wenger 2022-11-08 15:28:09 +01:00
parent 8a4f87b662
commit b96c26ce4d
12 changed files with 64 additions and 88 deletions

View File

@ -59,6 +59,7 @@
"jest-transform-stub": "^2.0.0", "jest-transform-stub": "^2.0.0",
"jest-watch-typeahead": "^2.1.2", "jest-watch-typeahead": "^2.1.2",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"loglevel": "^1.8.0",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"mock-apollo-client": "^1.2.0", "mock-apollo-client": "^1.2.0",
"node-sass": "^7.0.3", "node-sass": "^7.0.3",
@ -86,7 +87,6 @@
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.7.13", "vue-template-compiler": "^2.7.13",
"vue-vimeo-player": "^0.2.2", "vue-vimeo-player": "^0.2.2",
"vuejs-logger": "1.5.5",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"webpack": "^5.67.0", "webpack": "^5.67.0",
"webpack-bundle-analyzer": "^4.5.0", "webpack-bundle-analyzer": "^4.5.0",
@ -7945,11 +7945,6 @@
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ=="
}, },
"node_modules/es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
"integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw=="
},
"node_modules/escalade": { "node_modules/escalade": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
@ -14491,6 +14486,18 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/loglevel": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz",
"integrity": "sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA==",
"engines": {
"node": ">= 0.6.0"
},
"funding": {
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/loglevel"
}
},
"node_modules/loose-envify": { "node_modules/loose-envify": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -19741,20 +19748,6 @@
"vue": "^2.5.17" "vue": "^2.5.17"
} }
}, },
"node_modules/vuejs-logger": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/vuejs-logger/-/vuejs-logger-1.5.5.tgz",
"integrity": "sha512-wESz1F4KWk98YANEDg2yeS+fpwk2WrR41ZslLfZgTD+EYFm/7VMMUjRThhHT8CCOLOCQdsS4Ge2C9bIs68v8Ww==",
"dependencies": {
"es6-object-assign": "1.1.0",
"vue": "2.6.11"
}
},
"node_modules/vuejs-logger/node_modules/vue": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz",
"integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ=="
},
"node_modules/vuex": { "node_modules/vuex": {
"version": "3.6.2", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
@ -26476,11 +26469,6 @@
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ=="
}, },
"es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
"integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw=="
},
"escalade": { "escalade": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
@ -31291,6 +31279,11 @@
} }
} }
}, },
"loglevel": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz",
"integrity": "sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA=="
},
"loose-envify": { "loose-envify": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -35148,22 +35141,6 @@
"object-assign": "^4.1.1" "object-assign": "^4.1.1"
} }
}, },
"vuejs-logger": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/vuejs-logger/-/vuejs-logger-1.5.5.tgz",
"integrity": "sha512-wESz1F4KWk98YANEDg2yeS+fpwk2WrR41ZslLfZgTD+EYFm/7VMMUjRThhHT8CCOLOCQdsS4Ge2C9bIs68v8Ww==",
"requires": {
"es6-object-assign": "1.1.0",
"vue": "2.6.11"
},
"dependencies": {
"vue": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz",
"integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ=="
}
}
},
"vuex": { "vuex": {
"version": "3.6.2", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",

View File

@ -76,6 +76,7 @@
"jest-transform-stub": "^2.0.0", "jest-transform-stub": "^2.0.0",
"jest-watch-typeahead": "^2.1.2", "jest-watch-typeahead": "^2.1.2",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"loglevel": "^1.8.0",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"mock-apollo-client": "^1.2.0", "mock-apollo-client": "^1.2.0",
"node-sass": "^7.0.3", "node-sass": "^7.0.3",
@ -103,7 +104,6 @@
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.7.13", "vue-template-compiler": "^2.7.13",
"vue-vimeo-player": "^0.2.2", "vue-vimeo-player": "^0.2.2",
"vuejs-logger": "1.5.5",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"webpack": "^5.67.0", "webpack": "^5.67.0",
"webpack-bundle-analyzer": "^4.5.0", "webpack-bundle-analyzer": "^4.5.0",

View File

@ -1,8 +0,0 @@
import Vue from 'vue';
import {Log} from "vuejs-logger";
declare module 'vue/types/vue' {
interface Vue {
$log: Log
}
}

View File

@ -1,4 +1,5 @@
import {makeVar, InMemoryCache} from '@apollo/client/core'; import {makeVar, InMemoryCache} from '@apollo/client/core';
import log from 'loglevel';
const showNavigationSidebarVar = makeVar(false); const showNavigationSidebarVar = makeVar(false);
const showProfileSidebarVar = makeVar(false); const showProfileSidebarVar = makeVar(false);
@ -7,8 +8,7 @@ const currentFilterVar = makeVar('');
const helloEmailVar = makeVar(''); const helloEmailVar = makeVar('');
const idToRefFactory = (__typename) => (_, {args, toReference}) => { const idToRefFactory = (__typename) => (_, {args, toReference}) => {
// todo: can we log this via Vue.$log somehow? log.debug(`Referencing ${__typename} with ${args.id}`);
console.log(`Referencing ${__typename} with ${args.id}`);
return toReference({ return toReference({
__typename, __typename,
id: args.id id: args.id

View File

@ -7,6 +7,7 @@ import {
import {typeDefs} from '@/graphql/typedefs'; import {typeDefs} from '@/graphql/typedefs';
import {resolvers} from '@/graphql/resolvers'; import {resolvers} from '@/graphql/resolvers';
import cache from './cache'; import cache from './cache';
import log from 'loglevel';
import {router} from '@/router'; import {router} from '@/router';
@ -21,10 +22,10 @@ export default function (uri, networkErrorCallback) {
}); });
const consoleLink = new ApolloLink((operation, forward) => { const consoleLink = new ApolloLink((operation, forward) => {
console.log('operation', operation.operationName); log.debug('operation', operation.operationName);
return forward(operation).map(data => { return forward(operation).map(data => {
console.log(`returned from server for ${operation.operationName}`, data); log.debug(`returned from server for ${operation.operationName}`, data);
return data; return data;
}); });
}); });
@ -49,7 +50,7 @@ export default function (uri, networkErrorCallback) {
if (graphQLErrors) { if (graphQLErrors) {
graphQLErrors.forEach(({message, locations, path}) => graphQLErrors.forEach(({message, locations, path}) =>
console.log( log.warn(
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`, `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`,
), ),
); );

View File

@ -13,23 +13,23 @@ import ME_QUERY from '@/graphql/gql/queries/meQuery.gql';
import VueModal from '@/plugins/modal'; import VueModal from '@/plugins/modal';
import VueRemoveEdges from '@/plugins/edges'; import VueRemoveEdges from '@/plugins/edges';
import VueMatomo from 'vue-matomo'; import VueMatomo from 'vue-matomo';
import VueLogger from 'vuejs-logger';
import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards'; import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards';
import flavorPlugin from '@/plugins/flavor'; import flavorPlugin from '@/plugins/flavor';
import log from 'loglevel';
window.log = log; // make log available in app when built, to change log level: log.setLevel('debug')
Vue.config.productionTip = false; Vue.config.productionTip = false;
const isProduction = process.env.NODE_ENV === 'production'; const isProduction = process.env.NODE_ENV === 'production';
const logLevel = isProduction ? 'error' : 'warn';
log.setDefaultLevel(logLevel);
Vue.use(VueModal); Vue.use(VueModal);
Vue.use(VueRemoveEdges); Vue.use(VueRemoveEdges);
Vue.use(VueApollo); Vue.use(VueApollo);
Vue.use(VueVimeoPlayer); Vue.use(VueVimeoPlayer);
Vue.use(VueLogger, {
isEnabled: true,
logLevel: isProduction ? 'error' : 'debug',
stringifyArguments: false,
showConsoleColors: true,
});
Vue.use(VueScrollTo, { Vue.use(VueScrollTo, {
duration: 500, duration: 500,
@ -84,16 +84,16 @@ function redirectUsersToOnboarding() {
function networkErrorCallback(statusCode) { function networkErrorCallback(statusCode) {
if (statusCode === 402) { if (statusCode === 402) {
Vue.$log.debug('status code 402, redirecting'); log.debug('status code 402, redirecting');
router.push({name: 'licenseActivation'}); router.push({name: 'licenseActivation'});
} }
} }
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
Vue.$log.debug('navigation guard called', to, from); log.debug('navigation guard called', to, from);
if (to.path === '/logout') { if (to.path === '/logout') {
Vue.$log.debug('logout', to); log.debug('logout', to);
publicApolloClient.resetStore(); publicApolloClient.resetStore();
if (process.env.LOGOUT_REDIRECT_URL) { if (process.env.LOGOUT_REDIRECT_URL) {
location.replace(`https://sso.hep-verlag.ch/logout?return_to=${process.env.LOGOUT_REDIRECT_URL}`); location.replace(`https://sso.hep-verlag.ch/logout?return_to=${process.env.LOGOUT_REDIRECT_URL}`);
@ -106,7 +106,7 @@ router.beforeEach(async (to, from, next) => {
} }
if (unauthorizedAccess(to)) { if (unauthorizedAccess(to)) {
Vue.$log.debug('unauthorized', to); log.debug('unauthorized', to);
const postLoginRedirectionUrl = to.path; const postLoginRedirectionUrl = to.path;
const redirectUrl = `/hello/`; const redirectUrl = `/hello/`;
@ -114,32 +114,32 @@ router.beforeEach(async (to, from, next) => {
localStorage.setItem(postLoginRedirectUrlKey, postLoginRedirectionUrl); localStorage.setItem(postLoginRedirectUrlKey, postLoginRedirectionUrl);
} }
Vue.$log.debug('redirecting to hello', to); log.debug('redirecting to hello', to);
next(redirectUrl); next(redirectUrl);
return; return;
} }
if (to.name && to.name !== 'licenseActivation' && loginRequired(to) && await redirectUsersWithoutValidLicense()) { if (to.name && to.name !== 'licenseActivation' && loginRequired(to) && await redirectUsersWithoutValidLicense()) {
Vue.$log.debug('redirecting to licenseActivation', to, null); log.debug('redirecting to licenseActivation', to, null);
console.log('redirecting to licenseActivation', to, null); console.log('redirecting to licenseActivation', to, null);
next({name: 'licenseActivation'}); next({name: 'licenseActivation'});
return; return;
} }
if (!joiningClass(to) && loginRequired(to) && await redirectStudentsWithoutClass()) { if (!joiningClass(to) && loginRequired(to) && await redirectStudentsWithoutClass()) {
Vue.$log.debug('redirecting to join-class', to); log.debug('redirecting to join-class', to);
Vue.$log.debug('await redirectStudentsWithoutClass()', await redirectStudentsWithoutClass()); log.debug('await redirectStudentsWithoutClass()', await redirectStudentsWithoutClass());
next({name: 'join-class'}); next({name: 'join-class'});
return; return;
} }
if ((to.name && to.name.indexOf('onboarding') === -1) && !joiningClass(to) && loginRequired(to) && await redirectUsersToOnboarding()) { if ((to.name && to.name.indexOf('onboarding') === -1) && !joiningClass(to) && loginRequired(to) && await redirectUsersToOnboarding()) {
Vue.$log.debug('redirecting to onboarding-start', to); log.debug('redirecting to onboarding-start', to);
next({name: 'onboarding-start'}); next({name: 'onboarding-start'});
return; return;
} }
Vue.$log.debug('End of Guard reached', to); log.debug('End of Guard reached', to);
next(); next();
}); });

View File

@ -1,11 +1,12 @@
import ME_QUERY from '@/graphql/gql/queries/meQuery'; import ME_QUERY from '@/graphql/gql/queries/meQuery';
import log from 'loglevel';
export default { export default {
methods: { methods: {
addSchoolClass(store, schoolClass) { addSchoolClass(store, schoolClass) {
const query = ME_QUERY; const query = ME_QUERY;
if (schoolClass) { if (schoolClass) {
this.$log.debug('updating school class', schoolClass); log.debug('updating school class', schoolClass);
const {me} = store.readQuery({query}); const {me} = store.readQuery({query});
if (me) { if (me) {
let schoolClasses = [ let schoolClasses = [

View File

@ -1,5 +1,6 @@
import UPDATE_PROJECT_SHARED_STATE_MUTATION from '@/graphql/gql/mutations/updateProjectSharedState.gql'; import UPDATE_PROJECT_SHARED_STATE_MUTATION from '@/graphql/gql/mutations/updateProjectSharedState.gql';
import PROJECT_QUERY from '@/graphql/gql/queries/projectQuery.gql'; import PROJECT_QUERY from '@/graphql/gql/queries/projectQuery.gql';
import log from 'loglevel';
export default { export default {
methods: { methods: {
@ -8,7 +9,7 @@ export default {
slug, slug,
shared, shared,
}; };
this.$log.debug('updateProjectShareState', input); log.debug('updateProjectShareState', input);
this.$apollo.mutate({ this.$apollo.mutate({
mutation: UPDATE_PROJECT_SHARED_STATE_MUTATION, mutation: UPDATE_PROJECT_SHARED_STATE_MUTATION,
variables: { variables: {
@ -22,7 +23,7 @@ export default {
}; };
const {project} = store.readQuery({query, variables}); const {project} = store.readQuery({query, variables});
this.$log.debug(`updating project ${project.id} ${project.title}`); log.debug(`updating project ${project.id} ${project.title}`);
if (project) { if (project) {
const data = { const data = {

View File

@ -32,6 +32,7 @@
<script> <script>
import UserMetaWidget from '@/components/UserMetaWidget'; import UserMetaWidget from '@/components/UserMetaWidget';
import log from 'loglevel';
import ROOM_ENTRY_QUERY from '@/graphql/gql/queries/roomEntryQuery.gql'; import ROOM_ENTRY_QUERY from '@/graphql/gql/queries/roomEntryQuery.gql';
import ADD_COMMENT_MUTATION from 'gql/mutations/addComment.gql'; import ADD_COMMENT_MUTATION from 'gql/mutations/addComment.gql';
@ -80,12 +81,12 @@
methods: { methods: {
createComment(text) { createComment(text) {
this.$log.debug(`createComment ${text}`); log.debug(`createComment ${text}`);
const input = { const input = {
roomEntry: this.roomEntry.id, roomEntry: this.roomEntry.id,
comment: text, comment: text,
}; };
this.$log.debug(`input `, input); log.debug(`input `, input);
this.$apollo.mutate({ this.$apollo.mutate({
mutation: ADD_COMMENT_MUTATION, mutation: ADD_COMMENT_MUTATION,
variables: { variables: {

View File

@ -14,6 +14,7 @@
<script> <script>
import JOIN_CLASS_MUTATION from '@/graphql/gql/mutations/joinClass.gql'; import JOIN_CLASS_MUTATION from '@/graphql/gql/mutations/joinClass.gql';
import MY_SCHOOL_CLASS_QUERY from '@/graphql/gql/queries/mySchoolClass'; import MY_SCHOOL_CLASS_QUERY from '@/graphql/gql/queries/mySchoolClass';
import log from 'loglevel';
import addSchoolClass from '@/mixins/add-school-class'; import addSchoolClass from '@/mixins/add-school-class';
import logout from '@/mixins/logout'; import logout from '@/mixins/logout';
@ -35,7 +36,7 @@
this.error = ''; this.error = '';
}, },
joinClass(code) { joinClass(code) {
this.$log.debug('joining class'); log.debug('joining class');
this.$apollo.mutate({ this.$apollo.mutate({
mutation: JOIN_CLASS_MUTATION, mutation: JOIN_CLASS_MUTATION,
variables: { variables: {
@ -45,7 +46,7 @@
}, },
update: (store, {data: {joinClass: {schoolClass}}}) => { update: (store, {data: {joinClass: {schoolClass}}}) => {
this.addSchoolClass(store, schoolClass); this.addSchoolClass(store, schoolClass);
this.$log.debug('added school class'); log.debug('added school class');
this.$router.push({name: 'my-class'}); this.$router.push({name: 'my-class'});
}, },
refetchQueries: [{query: MY_SCHOOL_CLASS_QUERY}], refetchQueries: [{query: MY_SCHOOL_CLASS_QUERY}],

View File

@ -9,6 +9,7 @@
<script> <script>
import Module from '@/components/modules/Module'; import Module from '@/components/modules/Module';
import log from 'loglevel';
import UPDATE_LAST_MODULE_MUTATION from '@/graphql/gql/mutations/updateLastModule.gql'; import UPDATE_LAST_MODULE_MUTATION from '@/graphql/gql/mutations/updateLastModule.gql';
import UPDATE_MODULE_BOOKMARK_MUTATION from '@/graphql/gql/mutations/updateModuleBookmark.gql'; import UPDATE_MODULE_BOOKMARK_MUTATION from '@/graphql/gql/mutations/updateModuleBookmark.gql';
@ -53,7 +54,7 @@
}, },
result({data: {module: {id}}}) { result({data: {module: {id}}}) {
if (!this.updateSent) { if (!this.updateSent) {
this.$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,14 +69,14 @@
methods: { methods: {
updateLastVisitedModule(moduleId) { updateLastVisitedModule(moduleId) {
this.$log.debug(`updating last visited module for module ${moduleId}`); log.debug(`updating last visited module for module ${moduleId}`);
if (!moduleId) { if (!moduleId) {
this.$log.warn('no module id'); log.warn('no module id');
return; return;
} }
if (this.me.lastModule && this.me.lastModule.id === moduleId) { if (this.me.lastModule && this.me.lastModule.id === moduleId) {
this.$log.debug('same module already set as last module'); log.debug('same module already set as last module');
return; return;
} }
@ -88,7 +89,7 @@
}, },
update: (store, {data: {updateLastModule: {lastModule}}}) => { update: (store, {data: {updateLastModule: {lastModule}}}) => {
const {id, slug} = lastModule; const {id, slug} = lastModule;
this.$log.debug('updating last module', id, slug); log.debug('updating last module', id, slug);
const query = ME_QUERY; const query = ME_QUERY;
let {me} = store.readQuery({ let {me} = store.readQuery({
query, query,

View File

@ -48,6 +48,7 @@
import {newLineToParagraph} from '@/helpers/text'; import {newLineToParagraph} from '@/helpers/text';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import log from 'loglevel';
import StudentSubmissionDocument from '@/components/StudentSubmissionDocument'; import StudentSubmissionDocument from '@/components/StudentSubmissionDocument';
import STUDENT_SUBMISSIONS_QUERY from '@/graphql/gql/queries/studentSubmissionQuery.gql'; import STUDENT_SUBMISSIONS_QUERY from '@/graphql/gql/queries/studentSubmissionQuery.gql';
@ -165,7 +166,7 @@
}, },
update({withText, text, final}) { update({withText, text, final}) {
if (this.readOnly) { if (this.readOnly) {
this.$log.debug('read-only'); log.debug('read-only');
return; return;
} }
let mutation = withText ? UPDATE_FEEDBACK_WITH_TEXT_MUTATION : UPDATE_FEEDBACK_MUTATION; let mutation = withText ? UPDATE_FEEDBACK_WITH_TEXT_MUTATION : UPDATE_FEEDBACK_MUTATION;
@ -184,7 +185,7 @@
}); });
}, },
create() { create() {
this.$log.debug('create'); log.debug('create');
this.update({ this.update({
withText: true, withText: true,
text: '', text: '',
@ -192,7 +193,7 @@
}); });
}, },
turnIn() { turnIn() {
this.$log.debug('turnIn'); log.debug('turnIn');
this.update({ this.update({
withText: true, withText: true,
text: this.studentSubmission.submissionFeedback.text, text: this.studentSubmission.submissionFeedback.text,
@ -200,7 +201,7 @@
}); });
}, },
reopen() { reopen() {
this.$log.debug('reopen'); log.debug('reopen');
if (!this.studentSubmission.id) { if (!this.studentSubmission.id) {
return; return;
} }