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