From 38c53f193d719e8150c5d1f87a59e2a4005c1454 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 24 Mar 2022 16:30:04 -0400 Subject: [PATCH 1/5] Remove locks held by demoted reviewers --- miqa/core/models/project.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miqa/core/models/project.py b/miqa/core/models/project.py index bfa8d62b..78e08bd6 100644 --- a/miqa/core/models/project.py +++ b/miqa/core/models/project.py @@ -1,5 +1,6 @@ from uuid import uuid4 +from django.apps import apps from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import models @@ -111,6 +112,14 @@ def update_group(self, group_name, user_list): for previously_permitted_user in old_list: if previously_permitted_user.username not in user_list: remove_perm(group_name, previously_permitted_user, self) + if 'reviewer' in group_name: + Experiment = apps.get_model('core', 'Experiment') + locked_experiments = Experiment.objects.filter( + project=self, lock_owner=previously_permitted_user + ) + for locked_experiment in locked_experiments: + locked_experiment.lock_owner = None + locked_experiment.save() for username in user_list: new_permitted_user = User.objects.get(username=username) From b1f5302b9b93453295e8e372075cbfc81e4c14c6 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 24 Mar 2022 16:43:44 -0400 Subject: [PATCH 2/5] Define switchLock for DecisionButtons --- client/src/components/ControlPanel.vue | 1 + client/src/components/DecisionButtons.vue | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/ControlPanel.vue b/client/src/components/ControlPanel.vue index 1ec1be0d..57fd839c 100644 --- a/client/src/components/ControlPanel.vue +++ b/client/src/components/ControlPanel.vue @@ -577,6 +577,7 @@ export default { :lock-owner="lockOwner" :loading-lock="loadingLock" @handleKeyPress="handleKeyPress" + @switchLock="switchLock" /> diff --git a/client/src/components/DecisionButtons.vue b/client/src/components/DecisionButtons.vue index 257ac8dd..c197a97f 100644 --- a/client/src/components/DecisionButtons.vue +++ b/client/src/components/DecisionButtons.vue @@ -176,6 +176,9 @@ export default { (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(), ); }, + switchLock() { + this.$emit('switchLock', this.currentViewData.experimentId, null, true); + }, getCurrentChipState(artifact) { // this function determines the styling of the four chip states. // four states of a chip are: @@ -487,7 +490,7 @@ export default { :loading="loadingLock" :disabled="loadingLock" color="primary" - @click="switchLock(experimentId, null, force=true)" + @click="switchLock" > {{ lockOwner ?"Steal edit access" :"Claim edit access" }} From 98419998c4e8af24bd721a34cce642783ef0f2da Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 24 Mar 2022 17:04:29 -0400 Subject: [PATCH 3/5] Fix window width & level jumps --- client/src/components/ControlPanel.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/components/ControlPanel.vue b/client/src/components/ControlPanel.vue index 57fd839c..7d17269b 100644 --- a/client/src/components/ControlPanel.vue +++ b/client/src/components/ControlPanel.vue @@ -68,8 +68,11 @@ export default { return (this.representation && Math.ceil(this.representation.getPropertyDomainByName('windowWidth').max)) || 0; }, autoWindow() { - return this.currentViewData.autoWindow - || Math.ceil((this.winMax * 0.3) / 10) * 10; + return this.currentViewData.autoWindow || this.winMax; + }, + autoLevel() { + return this.currentViewData.autoLevel + || Math.ceil((this.levMax * 0.4) / 10) * 10; }, levMin() { return (this.representation && this.representation.getPropertyDomainByName('windowLevel').min) || 0; @@ -77,10 +80,6 @@ export default { levMax() { return (this.representation && Math.ceil(this.representation.getPropertyDomainByName('windowLevel').max)) || 0; }, - autoLevel() { - return this.currentViewData.autoLevel - || Math.ceil((this.levMax * 0.2) / 10) * 10; - }, }, watch: { window(value) { @@ -175,6 +174,8 @@ export default { updateWinLev() { this.window = this.autoWindow; this.level = this.autoLevel; + this.representation.setWindowWidth(this.window); + this.representation.setWindowLevel(this.level); }, navigateToFrame(frameId) { if (frameId && frameId !== this.$route.params.frameId) { From cd1121351eaaaf08c3012e962d5e92c5ba82b062 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 24 Mar 2022 17:05:43 -0400 Subject: [PATCH 4/5] Lint fix --- miqa/core/models/project.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/miqa/core/models/project.py b/miqa/core/models/project.py index 78e08bd6..9869b934 100644 --- a/miqa/core/models/project.py +++ b/miqa/core/models/project.py @@ -113,8 +113,7 @@ def update_group(self, group_name, user_list): if previously_permitted_user.username not in user_list: remove_perm(group_name, previously_permitted_user, self) if 'reviewer' in group_name: - Experiment = apps.get_model('core', 'Experiment') - locked_experiments = Experiment.objects.filter( + locked_experiments = apps.get_model('core', 'Experiment').objects.filter( project=self, lock_owner=previously_permitted_user ) for locked_experiment in locked_experiments: From 18b6d4416881b99256773af6e23001d7e020c4a5 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 24 Mar 2022 17:47:35 -0400 Subject: [PATCH 5/5] Use mousetrap for decision keybindings --- client/src/components/DecisionButtons.vue | 29 ++++++++--------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/client/src/components/DecisionButtons.vue b/client/src/components/DecisionButtons.vue index c197a97f..78d9162c 100644 --- a/client/src/components/DecisionButtons.vue +++ b/client/src/components/DecisionButtons.vue @@ -37,6 +37,12 @@ export default { newComment: '', confirmedPresent: [], confirmedAbsent: [], + decisionShortcuts: { + U: 'u', + UE: 'i', + 'Q?': 'o', + UN: 'p', + }, }; }, computed: { @@ -131,25 +137,6 @@ export default { if (!this.currentViewData.currentAutoEvaluation) { this.pollInterval = setInterval(this.pollForEvaluation, 1000 * 10); } - const decisionShortcuts = { - u: 'U', - i: 'UE', - o: 'Q?', - p: 'UN', - }; - window.addEventListener('keydown', (event) => { - if ( - (this.$refs.commentInput && !this.$refs.commentInput.isFocused) - && Object.keys(decisionShortcuts).includes(event.key) - ) { - const code = decisionShortcuts[event.key]; - if (this.options.map( - (option) => option.code, - ).includes(code)) { - this.handleCommentSave(decisionShortcuts[event.key]); - } - } - }); }, beforeUnmount() { clearInterval(this.pollInterval); @@ -454,6 +441,10 @@ export default { style="text-align: center" >