Skip to content

Commit

Permalink
Merge pull request #401 from OpenImaging/pre-release-fixes
Browse files Browse the repository at this point in the history
Pre release fixes
  • Loading branch information
dchiquito authored Mar 24, 2022
2 parents 42bd0c2 + 18b6d44 commit 4e65785
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
14 changes: 8 additions & 6 deletions client/src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,18 @@ 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;
},
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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -577,6 +578,7 @@ export default {
:lock-owner="lockOwner"
:loading-lock="loadingLock"
@handleKeyPress="handleKeyPress"
@switchLock="switchLock"
/>
</v-col>
</v-row>
Expand Down
34 changes: 14 additions & 20 deletions client/src/components/DecisionButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export default {
newComment: '',
confirmedPresent: [],
confirmedAbsent: [],
decisionShortcuts: {
U: 'u',
UE: 'i',
'Q?': 'o',
UN: 'p',
},
};
},
computed: {
Expand Down Expand Up @@ -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);
Expand All @@ -176,6 +163,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:
Expand Down Expand Up @@ -451,6 +441,10 @@ export default {
style="text-align: center"
>
<v-btn
v-mousetrap="[
{ bind: decisionShortcuts[option.code],
handler: () => handleCommentSave(option.code) },
]"
:color="option.color"
@click="handleCommentSave(option.code)"
>
Expand Down Expand Up @@ -487,7 +481,7 @@ export default {
:loading="loadingLock"
:disabled="loadingLock"
color="primary"
@click="switchLock(experimentId, null, force=true)"
@click="switchLock"
>
{{ lockOwner ?"Steal edit access" :"Claim edit access" }}
</v-btn>
Expand Down
8 changes: 8 additions & 0 deletions miqa/core/models/project.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -111,6 +112,13 @@ 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:
locked_experiments = apps.get_model('core', '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)
Expand Down

0 comments on commit 4e65785

Please sign in to comment.