Cleanup of eslint warnings

This commit is contained in:
PMKuipers 2024-06-05 23:27:00 +02:00
parent b60e5065f0
commit 6b9826934f
6 changed files with 817 additions and 774 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,9 @@
/* eslint no-console: "off"*/ /* eslint no-console: "off"*/
/* eslint no-unused-vars: warn */ /* eslint no-unused-vars: warn */
/* eslint max-len: ["error", { "code": 160 }] */ /* eslint max-len: ["error", { "code": 160 }] */
/* eslint-disable no-trailing-spaces */ /* eslint no-trailing-spaces: warn */
/* eslint max-depth: ["error", 6] */ /* eslint max-depth: ["error", 6] */
/* eslint-env es6*/ /* eslint-env es6*/
// Put this file in path/to/plugin/amd/src
import {SimpleLine} from "./simpleline/simpleline"; import {SimpleLine} from "./simpleline/simpleline";
import {call} from 'core/ajax'; import {call} from 'core/ajax';
@ -134,8 +132,8 @@ export default {
'advanced_warning': 'advanced_warning', 'advanced_warning': 'advanced_warning',
'advanced_pick_scale': 'advanced_pick_scale', 'advanced_pick_scale': 'advanced_pick_scale',
'advanced_course_manipulation_title': 'advanced_course_manipulation_title', 'advanced_course_manipulation_title': 'advanced_course_manipulation_title',
'advanced_bulk_course_timing': 'advanced_bulk_course_timing', 'advanced_bulk_course_timing': 'advanced_bulk_course_timing',
'advanced_bulk_course_timing_desc': 'advanced_bulk_course_timing_desc', 'advanced_bulk_course_timing_desc': 'advanced_bulk_course_timing_desc',
'advanced_force_scale_title': 'advanced_force_scale_title', 'advanced_force_scale_title': 'advanced_force_scale_title',
'advanced_force_scale_desc': 'advanced_force_scale_desc', 'advanced_force_scale_desc': 'advanced_force_scale_desc',
'advanced_force_scale_button': 'advanced_force_scale_button', 'advanced_force_scale_button': 'advanced_force_scale_button',
@ -692,9 +690,9 @@ export default {
template: template:
` `
<span class='s-studyplan-edit'> <span class='s-studyplan-edit'>
<mform <mform
name="studyplanEditform" name="studyplanEditform"
:params="{studyplan_id: value.id, mode: mode, contextid: contextid }" :params="{studyplan_id: value.id, mode: mode, contextid: contextid }"
@saved="planSaved" @saved="planSaved"
:variant="variant" :variant="variant"
:type="type" :type="type"
@ -770,9 +768,9 @@ export default {
template: template:
` `
<span class='s-studyplan-page-edit'> <span class='s-studyplan-page-edit'>
<mform <mform
name="studyplanpage_editform" name="studyplanpage_editform"
:params="{page_id: value.id, studyplan_id: studyplan.id, mode: mode }" :params="{page_id: value.id, studyplan_id: studyplan.id, mode: mode }"
@saved="planSaved" @saved="planSaved"
:variant="variant" :variant="variant"
:type="type" :type="type"
@ -1383,10 +1381,10 @@ export default {
* T-STUDYPLAN * T-STUDYPLAN
*/ */
Vue.component('t-studyplan', { Vue.component('t-studyplan', {
props: { props: {
'value': { 'value': {
type: Object, type: Object,
}, },
'coaching': { 'coaching': {
type: Boolean, type: Boolean,
'default': false, 'default': false,
@ -1718,7 +1716,7 @@ export default {
for (let i = 0; i < periods; i++) { for (let i = 0; i < periods; i++) {
if (line.slots[index - i] && line.slots[index - i].courses) { if (line.slots[index - i] && line.slots[index - i].courses) {
const list = line.slots[index - i].courses; const list = line.slots[index - i].courses;
for (const ix in list) { for (const ix in list) {
const item = list[ix]; const item = list[ix];
if (item.layer == layeridx) { if (item.layer == layeridx) {
if (forGradable) { if (forGradable) {
@ -1900,11 +1898,11 @@ export default {
v-model="edit.studyline.editmode" class="sw-studyplan-toolbar" switch v-model="edit.studyline.editmode" class="sw-studyplan-toolbar" switch
@change="toolboxSwitched(edit.toolbox_shown && !edit.studyline.editmode); " @change="toolboxSwitched(edit.toolbox_shown && !edit.studyline.editmode); "
>{{ text.studyline_editmode }}</b-form-checkbox> >{{ text.studyline_editmode }}</b-form-checkbox>
<b-form-checkbox <b-form-checkbox
v-if="!edit.studyline.editmode" v-model="edit.toolbox_shown" class="sw-studyplan-toolbar" switch v-if="!edit.studyline.editmode" v-model="edit.toolbox_shown" class="sw-studyplan-toolbar" switch
@change="toolboxSwitched" @change="toolboxSwitched"
>{{ text.toolbox_toggle}}</b-form-checkbox> >{{ text.toolbox_toggle}}</b-form-checkbox>
<drop <drop
mode='copy' mode='copy'
class='t-item-deletebox text-danger border-danger' class='t-item-deletebox text-danger border-danger'
@drop='deleteStudyItem' @drop='deleteStudyItem'
@ -1921,7 +1919,7 @@ export default {
v-model="value"><i class='fa fa-users'></i> {{text.associations}}</t-studyplan-associate> v-model="value"><i class='fa fa-users'></i> {{text.associations}}</t-studyplan-associate>
</span> </span>
<span class='control editable'> <span class='control editable'>
<t-studyplan-edit v-model="value" @moved="movedStudyplan" <t-studyplan-edit v-model="value" @moved="movedStudyplan"
><i class='fa fa-gear'></i> {{text.edit}}</t-studyplan-edit> ><i class='fa fa-gear'></i> {{text.edit}}</t-studyplan-edit>
</span> </span>
<span class='control deletable'> <span class='control deletable'>
@ -1931,13 +1929,13 @@ export default {
</div> </div>
</div> </div>
<b-card no-body> <b-card no-body>
<b-tabs <b-tabs
v-model='selectedpageindex' v-model='selectedpageindex'
@activate-tab='selectedpageChanged' @activate-tab='selectedpageChanged'
content-class="mt-1"> content-class="mt-1">
<!-- New Tab Button (Using tabs-end slot) --> <!-- New Tab Button (Using tabs-end slot) -->
<template #tabs-end> <template #tabs-end>
<t-studyplan-page-edit <t-studyplan-page-edit
v-if="!coaching" v-if="!coaching"
:studyplan="value" :studyplan="value"
v-model="create.page" v-model="create.page"
@ -1952,14 +1950,14 @@ export default {
> >
<template #title> <template #title>
{{page.shortname}} {{page.shortname}}
<t-studyplan-page-edit <t-studyplan-page-edit
v-if="!coaching && (pageindex == selectedpageindex)" v-if="!coaching && (pageindex == selectedpageindex)"
v-model="value.pages[pageindex]" v-model="value.pages[pageindex]"
:studyplan="value" :studyplan="value"
type="link" type="link"
></t-studyplan-page-edit> ></t-studyplan-page-edit>
</template> </template>
<div class='t-studyplan-content-edit' <div class='t-studyplan-content-edit'
v-if="edit.studyline.editmode"> v-if="edit.studyline.editmode">
<drop-list <drop-list
:items="page.studylines" :items="page.studylines"
@ -2008,7 +2006,7 @@ export default {
</template> </template>
<t-studyline-heading v-else <t-studyline-heading v-else
@resize="headingresized(0,$event)" @resize="headingresized(0,$event)"
:layers="1" :layers="1"
:class="'odd first last'" :class="'odd first last'"
></t-studyline-heading> ></t-studyline-heading>
@ -2016,12 +2014,12 @@ export default {
<!-- Next, paint all the cells in the scrollable --> <!-- Next, paint all the cells in the scrollable -->
<div class="t-studyplan-scrollable" > <div class="t-studyplan-scrollable" >
<div class="t-studyplan-timeline" :style="columnsStylerule(page)"> <div class="t-studyplan-timeline" :style="columnsStylerule(page)">
<!-- add period information --> <!-- add period information -->
<template v-for="(n,index) in (page.periods+1)"> <template v-for="(n,index) in (page.periods+1)">
<s-studyline-header-period <s-studyline-header-period
mode="edit" mode="edit"
:x-index="index" :x-index="index"
:style="'grid-area: 1 / '+ ((2*index)) +';'" :style="'grid-area: 1 / '+ ((2*index)) +';'"
:identifier='Number(page.id)' :identifier='Number(page.id)'
v-if="index > 0" v-if="index > 0"
v-model="page.perioddesc[index-1]" v-model="page.perioddesc[index-1]"
@ -2034,9 +2032,9 @@ export default {
:maxend="(index < page.periods) ? subDay(page.perioddesc[index].enddate,2) : null" :maxend="(index < page.periods) ? subDay(page.perioddesc[index].enddate,2) : null"
></t-period-edit ></t-period-edit
></s-studyline-header-period> ></s-studyline-header-period>
<div class="s-studyline-header-filter" <div class="s-studyline-header-filter"
:x-index="index" :x-index="index"
:style="'grid-area: 1 / '+ ((2*index)+1) +';'" :style="'grid-area: 1 / '+ ((2*index)+1) +';'"
></div> ></div>
</template> </template>
@ -2047,10 +2045,10 @@ export default {
><template v-for="(n,index) in (page.periods+1)" ><template v-for="(n,index) in (page.periods+1)"
><t-studyline-slot ><t-studyline-slot
v-if="index > 0 && showslot(page,line, index, layeridx, 'gradable')" v-if="index > 0 && showslot(page,line, index, layeridx, 'gradable')"
:style="'grid-area: '+ (1+sumLineLayers(lineindex,page)+layernr) :style="'grid-area: '+ (1+sumLineLayers(lineindex,page)+layernr)
+ ' / ' + (2 * index) + ' / ' + (2 * index)
+ ' / ' + (1 + sumLineLayers(lineindex,page)+layernr) + ' / ' + (1 + sumLineLayers(lineindex,page)+layernr)
+ ' / ' + ( (2 * index) + (2*span(line,index,layeridx) - 1)) + ';'" + ' / ' + ( (2 * index) + (2*span(line,index,layeridx) - 1)) + ';'"
type='gradable' type='gradable'
v-model="line.slots[index].courses" v-model="line.slots[index].courses"
:key="'c-'+lineindex+'-'+index+'-'+layernr" :key="'c-'+lineindex+'-'+index+'-'+layernr"
@ -2068,7 +2066,7 @@ export default {
></t-studyline-slot ></t-studyline-slot
><t-studyline-slot ><t-studyline-slot
type='filter' type='filter'
:style="'grid-area: '+ (1+sumLineLayers(lineindex,page)+layernr) + ' / ' + (2*index+1) +';'" :style="'grid-area: '+ (1+sumLineLayers(lineindex,page)+layernr) + ' / ' + (2*index+1) +';'"
v-if="showslot(page,line, index, layeridx, 'filter')" v-if="showslot(page,line, index, layeridx, 'filter')"
v-model="line.slots[index].filters" v-model="line.slots[index].filters"
:key="'f-'+lineindex+'-'+index+'-'+layernr" :key="'f-'+lineindex+'-'+index+'-'+layernr"
@ -2091,20 +2089,20 @@ export default {
><template v-for="(line,lineindex) in page.studylines" ><template v-for="(line,lineindex) in page.studylines"
><template v-for="(n,index) in (page.periods+1)" ><template v-for="(n,index) in (page.periods+1)"
><drop v-if="index > 0" ><drop v-if="index > 0"
:style="'grid-area: '+ (2 + sumLineLayers(lineindex,page)) :style="'grid-area: '+ (2 + sumLineLayers(lineindex,page))
+ ' / ' + (2 * index) + ' / ' + (2 * index)
+ ' / ' + (1 + sumLineLayers(lineindex + 1,page)) + ' / ' + (1 + sumLineLayers(lineindex + 1,page))
+ ' / ' + (2 * index) + '; overflow: hidden;'" + ' / ' + (2 * index) + '; overflow: hidden;'"
:class="'t-slot-drop t-slot-linedrop course hiviz'" :class="'t-slot-drop t-slot-linedrop course hiviz'"
:accepts-type="checkTypeCourse" :accepts-type="checkTypeCourse"
@drop="onDrop($event,line,index)" @drop="onDrop($event,line,index)"
mode="cut" mode="cut"
><span>{{text.drophere}}</span></drop ><span>{{text.drophere}}</span></drop
><drop ><drop
:style="'grid-area: '+ (2 + sumLineLayers(lineindex,page)) :style="'grid-area: '+ (2 + sumLineLayers(lineindex,page))
+ ' / ' + ((2 * index) + 1) + ' / ' + ((2 * index) + 1)
+ ' / ' + (1 + sumLineLayers(lineindex + 1,page)) + ' / ' + (1 + sumLineLayers(lineindex + 1,page))
+ ' / ' + ( (2 * index) + 1 ) + '; overflow: hidden;'" + ' / ' + ( (2 * index) + 1 ) + '; overflow: hidden;'"
:class="'t-slot-drop t-slot-linedrop filter hiviz'" :class="'t-slot-drop t-slot-linedrop filter hiviz'"
:accepts-type="checkTypeFilter" :accepts-type="checkTypeFilter"
@drop="onDrop($event,line,index)" @drop="onDrop($event,line,index)"
@ -2156,7 +2154,7 @@ export default {
<b-col cols="3">{{ text.studyline_enrollable}}</b-col> <b-col cols="3">{{ text.studyline_enrollable}}</b-col>
<b-col> <b-col>
<b-form-select v-model="create.studyline.enrol.enrollable"> <b-form-select v-model="create.studyline.enrol.enrollable">
<b-form-select-option <b-form-select-option
v-for="(nr,n) in 4" v-for="(nr,n) in 4"
:value="n" :value="n"
:key="n" :key="n"
@ -2167,7 +2165,7 @@ export default {
<b-row v-if='[2,3].includes(create.studyline.enrol.enrollable)'> <b-row v-if='[2,3].includes(create.studyline.enrol.enrollable)'>
<b-col cols="3">{{ text.studyline_enrolroles}}</b-col> <b-col cols="3">{{ text.studyline_enrolroles}}</b-col>
<b-col> <b-col>
<b-form-select <b-form-select
v-model="create.studyline.enrol.enrolroles" v-model="create.studyline.enrol.enrolroles"
:options="availableroles" :options="availableroles"
multiple multiple
@ -2177,7 +2175,7 @@ export default {
></b-form-select> ></b-form-select>
</b-col> </b-col>
</b-row> </b-row>
</template> </template>
</b-container> </b-container>
</b-modal> </b-modal>
<b-modal <b-modal
@ -2216,7 +2214,7 @@ export default {
<b-col cols="3">{{ text.studyline_enrollable}}</b-col> <b-col cols="3">{{ text.studyline_enrollable}}</b-col>
<b-col> <b-col>
<b-form-select v-model="edit.studyline.data.enrol.enrollable"> <b-form-select v-model="edit.studyline.data.enrol.enrollable">
<b-form-select-option <b-form-select-option
v-for="(nr,n) in 4" v-for="(nr,n) in 4"
:value="n" :value="n"
>{{text['line_enrollable_'+n]}}</b-form-select-option> >{{text['line_enrollable_'+n]}}</b-form-select-option>
@ -2226,7 +2224,7 @@ export default {
<b-row v-if='[2,3].includes(edit.studyline.data.enrol.enrollable)'> <b-row v-if='[2,3].includes(edit.studyline.data.enrol.enrollable)'>
<b-col cols="3">{{ text.studyline_enrolroles}}</b-col> <b-col cols="3">{{ text.studyline_enrolroles}}</b-col>
<b-col> <b-col>
<b-form-select <b-form-select
v-model="edit.studyline.data.enrol.enrolroles" v-model="edit.studyline.data.enrol.enrolroles"
:options="availableroles" :options="availableroles"
multiple multiple
@ -2901,7 +2899,7 @@ export default {
const busyCourse = this.checkCourseSlotBusy(i); const busyCourse = this.checkCourseSlotBusy(i);
if (busyCourse && busyCourse.id != this.value.id) { if (busyCourse && busyCourse.id != this.value.id) {
const nextlyr = this.nextFreeCourseLayer(i); const nextlyr = this.nextFreeCourseLayer(i);
items.push({ items.push({
id: busyCourse.id, id: busyCourse.id,
layer: nextlyr, layer: nextlyr,
'line_id': this.line.id, 'line_id': this.line.id,
@ -3756,8 +3754,8 @@ export default {
</div> </div>
</template> </template>
<s-course-extrafields <s-course-extrafields
v-if="value.course.extrafields" v-if="value.course.extrafields"
v-model="value.course.extrafields" v-model="value.course.extrafields"
position="above" position="above"
></s-course-extrafields> ></s-course-extrafields>
@ -3775,8 +3773,8 @@ export default {
v-model='value.course.competency' v-model='value.course.competency'
:item='value' :item='value'
></t-item-course-competency> ></t-item-course-competency>
<s-course-extrafields <s-course-extrafields
v-if="value.course.extrafields" v-if="value.course.extrafields"
v-model="value.course.extrafields" v-model="value.course.extrafields"
position="below" position="below"
></s-course-extrafields> ></s-course-extrafields>
@ -4028,12 +4026,11 @@ export default {
s += " / "; s += " / ";
} }
let url; let url;
if (p.type == 'competency') { if (p.type == 'competency') {
url = `/admin/tool/lp/competencies.php?competencyid=${p.id}`; url = `/admin/tool/lp/competencies.php?competencyid=${p.id}`;
} else { } else {
url = `/admin/tool/lp/competencies.php?competencyframeworkid=${p.id}&pagecontextid=${p.contextid}`; url = `/admin/tool/lp/competencies.php?competencyframeworkid=${p.id}&pagecontextid=${p.contextid}`;
} }
s += `<a href="${url}">${p.title}</a>`; s += `<a href="${url}">${p.title}</a>`;
} }
return s; return s;
@ -4418,7 +4415,7 @@ export default {
}, },
data() { data() {
return { return {
toolboxright: !(settings("toolboxleft")), toolboxright: !(settings("toolboxleft")),
text: strings.toolbox, text: strings.toolbox,
relatedbadges: [], relatedbadges: [],
systembadges: [], systembadges: [],
@ -4480,7 +4477,7 @@ export default {
const clone = Object.assign({}, cat); const clone = Object.assign({}, cat);
clone.courses = []; clone.courses = [];
if (cat.courses) { if (cat.courses) {
for (const course of cat.courses) { for (const course of cat.courses) {
if (search.test(course.shortname) || search.test(course.fullname)) { if (search.test(course.shortname) || search.test(course.fullname)) {
clone.courses.push(course); clone.courses.push(course);
@ -4502,7 +4499,7 @@ export default {
return; return;
}).catch(notification.exception); }).catch(notification.exception);
} }
if (cat.children) { if (cat.children) {
clone.children = self.filterCategories(cat.children); clone.children = self.filterCategories(cat.children);
} else if (cat.haschildren && !(self.loadingcategories.includes(cat.id))) { } else if (cat.haschildren && !(self.loadingcategories.includes(cat.id))) {
@ -4520,7 +4517,7 @@ export default {
return; return;
}).catch(notification.exception); }).catch(notification.exception);
} }
if ((clone.children && clone.children.length) || clone.courses.length) { if ((clone.children && clone.children.length) || clone.courses.length) {
list.push(clone); list.push(clone);
} }
@ -4549,7 +4546,7 @@ export default {
const self = this; const self = this;
call([{ call([{
methodname: 'local_treestudyplan_search_badges', methodname: 'local_treestudyplan_search_badges',
args: { args: {
search: this.filters.systembadges || "", search: this.filters.systembadges || "",
} }
}])[0].then((response) => { }])[0].then((response) => {
@ -4562,7 +4559,7 @@ export default {
if (this.activepage) { if (this.activepage) {
call([{ call([{
methodname: 'local_treestudyplan_search_related_badges', methodname: 'local_treestudyplan_search_related_badges',
args: { args: {
'page_id': this.activepage.id, 'page_id': this.activepage.id,
search: this.filters.relatedbadges || "" search: this.filters.relatedbadges || ""
} }
@ -4637,7 +4634,7 @@ export default {
</ul> </ul>
</b-tab> </b-tab>
<b-tab :title="text.badges" class="t-toolbox-tab"> <b-tab :title="text.badges" class="t-toolbox-tab">
<b-tabs content-class='mt-2 ml-2' class="t-toolbox-badges"> <b-tabs content-class='mt-2 ml-2' class="t-toolbox-badges">
<b-tab :title="text.relatedbages"> <b-tab :title="text.relatedbages">
<div class="t-toolbox-badges-filter"> <div class="t-toolbox-badges-filter">
@ -4652,7 +4649,7 @@ export default {
:type="filterComponentType" :type="filterComponentType"
:data="{type: 'badge', badge: b}" :data="{type: 'badge', badge: b}"
@cut="" @cut=""
><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name"> ><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name">
<span :class="(!b.active)?'disabled':''">{{b.name}}</span> <span :class="(!b.active)?'disabled':''">{{b.name}}</span>
<template v-slot:drag-image="{data}" <template v-slot:drag-image="{data}"
><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name" ><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name"
@ -4674,7 +4671,7 @@ export default {
:type="filterComponentType" :type="filterComponentType"
:data="{type: 'badge', badge: b}" :data="{type: 'badge', badge: b}"
@cut="" @cut=""
><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name"> ><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name">
<span :class="(!b.active)?'disabled':''">{{b.name}}</span> <span :class="(!b.active)?'disabled':''">{{b.name}}</span>
<template v-slot:drag-image="{data}" <template v-slot:drag-image="{data}"
><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name" ><img :class="(!b.active)?'disabled':''" :src="b.imageurl" :alt="b.name"
@ -4692,5 +4689,5 @@ export default {
}); });
}, },
}; };