Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export default [
...pluginVue.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
globals: {
APP_VERSION: 'readonly',
},
},
rules: {
'no-unused-vars': [
'error',
Expand Down
27 changes: 11 additions & 16 deletions frontend/src/assets/assessmentScore.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,21 @@ export function calculateAssessmentScore(config, scores = {}) {
rubric_max = Number(rubric_max) || 0;

// 5. Compute rubric raw score according to calculation
let rubric_raw_score = 0;
const sumCrit = crit_scores.reduce((acc, v) => acc + v, 0);

if (!crit_scores.length) {
rubric_raw_score = 0;
} else if (calc === "sum") {
rubric_raw_score = sumCrit;
} else if (calc === "min") {
rubric_raw_score = Math.min(sumCrit, rubric_max);
} else if (calc === "max") {
const base = Number(rubric.defaultPoints) || 0;
let computed = base + sumCrit;
if (computed < 0) computed = 0;
rubric_raw_score = computed;
} else {
const rubric_raw_score = (() => {
if (!crit_scores.length) return 0;
if (calc === "sum") return sumCrit;
if (calc === "min") return Math.min(sumCrit, rubric_max);
if (calc === "max") {
const base = Number(rubric.defaultPoints) || 0;
const computed = base + sumCrit;
return computed < 0 ? 0 : computed;
}
warnings.push(
`Unknown calculation '${calc}' for rubric '${rubric_name}', falling back to 'sum'.`
);
rubric_raw_score = sumCrit;
}
return sumCrit;
})();

// 6. Clamp rubric score
let rubric_score = rubric_raw_score;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/assets/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FileSaver } from "file-saver"; // DO NOT delete this import, required for window.saveAs to work
import "file-saver"; // DO NOT delete this import, required for window.saveAs to work
import Papa from "papaparse";
import yaml from "js-yaml";

Expand Down
5 changes: 4 additions & 1 deletion frontend/src/auth/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ export default {
const p = this.formData.password || "";
return p.length >= 8
&& !/^\s*$/.test(p)
&& !/[\x00-\x1F\x7F]/.test(p)
&& ![...p].some((c) => {
const codePoint = c.codePointAt(0) || 0;
return codePoint <= 31 || codePoint === 127;
})
&& ![...p].some((c) => (c.codePointAt(0) || 0) > 0xFFFF);
},
validTerms() {
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/auth/ResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ export default {
const p = this.formData.newPassword || "";
return p.length >= 8
&& !/^\s*$/.test(p)
&& !/[\x00-\x1F\x7F]/.test(p)
&& ![...p].some((c) => {
const codePoint = c.codePointAt(0) || 0;
return codePoint <= 31 || codePoint === 127;
})
&& ![...p].some((c) => (c.codePointAt(0) || 0) > 0xFFFF);
},
validConfirmPassword() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/auth/TwoFactorSettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export default {
margin: 1,
});
this.totpQrCodeError = false;
} catch (error) {
} catch (_error) {
this.totpQrCode = null;
this.totpQrCodeError = true;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/auth/TwoFactorVerifyEmail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default {
this.errorMessage =
response.data.message || "Failed to resend code. Please try again.";
}
} catch (error) {
} catch (_error) {
this.showError = true;
this.errorMessage = "Failed to resend code. Please try again.";
} finally {
Expand Down
26 changes: 13 additions & 13 deletions frontend/src/basic/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ export default {
progress: false,
progressData: null,
progressId: null,
_suspendedByChild: false,
_closeRequestHandled: false,
_hideWaiting: false,
suspendedByChild: false,
closeRequestHandled: false,
hideWaiting: false,
isShown: false,
};
},
Expand Down Expand Up @@ -234,8 +234,8 @@ export default {
data: {name: this.name, props: this.props}
});
}
if (this._hideWaiting) {
this._hideWaiting = false;
if (this.hideWaiting) {
this.hideWaiting = false;
this.hide();
}
},
Expand All @@ -252,16 +252,16 @@ export default {
this.modal.show();
},
handleCloseClick() {
this._closeRequestHandled = false;
this.closeRequestHandled = false;
this.$emit('close-requested');
this.$nextTick(() => {
if (!this._closeRequestHandled) {
if (!this.closeRequestHandled) {
this.close();
}
});
},
markCloseRequestHandled() {
this._closeRequestHandled = true;
this.closeRequestHandled = true;
},
close() {
this.hide();
Expand All @@ -270,7 +270,7 @@ export default {
if (this.isShown) {
this.modal.hide();
} else {
this._hideWaiting = true;
this.hideWaiting = true;
}
this.resumeParentModal();
},
Expand All @@ -285,20 +285,20 @@ export default {
}
},
suspendParentModal() {
if (!this.parentModal || this.parentModal._suspendedByChild) return;
if (!this.parentModal || this.parentModal.suspendedByChild) return;
const el = this.parentModal.$refs && this.parentModal.$refs.Modal;
if (el) {
el.classList.add('nested-suspended');
}
this.parentModal._suspendedByChild = true;
this.parentModal.suspendedByChild = true;
},
resumeParentModal() {
if (!this.parentModal || !this.parentModal._suspendedByChild) return;
if (!this.parentModal || !this.parentModal.suspendedByChild) return;
const el = this.parentModal.$refs && this.parentModal.$refs.Modal;
if (el) {
el.classList.remove('nested-suspended');
}
this.parentModal._suspendedByChild = false;
this.parentModal.suspendedByChild = false;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/download/DownloadSet.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<!-- todo opt. show progress bar -->
<span hidden></span>
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/download/DownloadSingle.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>

<span hidden></span>
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/editor/CommandEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default {
config: {
type: Object,
required: false,
default: {}
default: () => ({})
},
service: {
type: String,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/form/Collapsible.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import LoadIcon from "@/basic/Icon.vue";
*
*/
export default {
name: "Collapsible",
name: "FormCollapsible",
components: { LoadIcon },
props: {
title: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/form/File.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<FormElement ref="formElement" :data-table="dataTable" :options="options">
<template #element="{blur}">
<template #element>
<input
ref="fileUpload"
type="file"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/basic/form/JsonTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default {
required: true,
},
modelValue: {
type: [Object, Array, String, Number, Boolean],
required: false,
default: null,
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/form/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
return parseInt(this.$store.getters["settings/getValue"]("projects.default"));
},
selectOptions() {
let baseOptions = [];
let baseOptions;

if (Array.isArray(this.options.options)) {
baseOptions = this.options.options;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/basic/modal/ConfigurationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,22 @@ export default {
},
documentId: {
type: Number,
required: true,
required: false,
default: 0,
},
studyStepId: {
type: Number,
required: true,
required: false,
default: null,
},
stepNumber: {
type: Number,
required: true,
required: false,
default: 0,
},
workflowSteps: {
type: Array,
required: true,
required: false,
default: () => [],
},
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/basic/modal/ConfirmModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Confirm {{ name }}
</template>
<template #body>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="message"></div>
<div
v-if="warning"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/modal/GeneralSettingStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
props: {
modelValue: {
type: Object,
required: true,
required: false,
default: () => ({})
}
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/modal/InformationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>
<template #body>
<div class="information-container p-3">
<dl v-for="(value, key) in this.data" :key="key" class="row align-items-center">
<dl v-for="(value, key) in data" :key="key" class="row align-items-center">
<dt class="col-sm-4 fw-bold text-secondary">{{ formatKey(key) }}</dt>
<dd class="col-sm-8">
<template v-if="isObject(value)">
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/basic/modal/PasswordModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ export default {
});
return false;
}
if (/^\s*$/.test(password) || /[\x00-\x1F\x7F]/.test(password) || [...password].some((c) => (c.codePointAt(0) || 0) > 0xFFFF)) {
const hasInvalidCharacter = [...password].some((c) => {
const codePoint = c.codePointAt(0) || 0;
return codePoint <= 31 || codePoint === 127 || codePoint > 0xFFFF;
});
if (/^\s*$/.test(password) || hasInvalidCharacter) {
this.eventBus.emit("toast", {
title: "Validation Error",
message: "Password cannot contain only spaces, control characters, or emojis. Use letters, numbers, and standard punctuation.",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/basic/modal/PlaceholdersStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- Short Preview -->
<div v-if="shortPreview" class="short-preview mb-4">
<h6 class="section-title">Document Preview</h6>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="preview-content" v-html="shortPreview"></div>
</div>

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/basic/modal/StepperModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default {
data() {
return {
currentStep: 0,
_closeRequestHandled: false,
closeRequestHandled: false,
}
},
watch: {
Expand All @@ -140,16 +140,16 @@ export default {
},
handleCloseRequest() {
this.$refs.stepperModal.markCloseRequestHandled();
this._closeRequestHandled = false;
this.closeRequestHandled = false;
this.$emit('close-requested');
this.$nextTick(() => {
if (!this._closeRequestHandled) {
if (!this.closeRequestHandled) {
this.close();
}
});
},
markCloseRequestHandled() {
this._closeRequestHandled = true;
this.closeRequestHandled = true;
},
close() {
this.$refs.stepperModal.hide();
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/basic/modal/configuration/Placeholder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ export default {
props: {
placeholder: {
type: Object,
required: true,
required: false,
default: () => ({})
},
fields: {
type: Array,
required: true,
required: false,
default: () => []
},
index: {
type: Number,
required: true,
required: false,
default: 0
},
formData: {
type: Object,
required: true,
required: false,
default: () => ({})
},
placeholderColor: {
type: String,
required: true,
required: false,
default: "#000"
}
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/modal/skills/InputGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<FormSelect
v-model="baseFileSelections[group.validationConfigurationId]"
:options="group.fileTypeOptions"
@update:modelValue="updateBaseFileSelection(group.validationConfigurationId, $event)"
@update:model-value="updateBaseFileSelection(group.validationConfigurationId, $event)"
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/annotator/Annotator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default {
},
documentId: {
type: Number,
required: true,
required: false,
default: 0,
},
studyStepId: {
Expand Down
Loading
Loading