Skip to content

Commit

Permalink
Merge pull request #281 from bnmajor/global-range
Browse files Browse the repository at this point in the history
Global range
  • Loading branch information
bnmajor authored Sep 1, 2023
2 parents 1cfeb5f + 2205035 commit 13721e4
Show file tree
Hide file tree
Showing 21 changed files with 769 additions and 296 deletions.
37 changes: 2 additions & 35 deletions client/src/components/core/App/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ export default {
dataLoaded: false,
forgotPasswordUrl: "/#?dialog=resetpassword",
runId: null,
range: "",
pos: [],
parameter: "",
cancel: false,
showMenu: false,
paramIsJson: false,
};
Expand Down Expand Up @@ -84,37 +81,6 @@ export default {
this.setPaused(should_pause);
},

hoverOut() {
this.range = "";
this.cancel = true;
},

hoverIn: _.debounce(function (event) {
if (this.showMenu) return;

const node = event.target;
const parent = node ? node.parentNode : null;
if (
(parent && parent.classList.value.includes("pl-3")) ||
(node.classList.value.includes("pl-3") &&
node.textContent != parent.textContent)
) {
this.parameter = node.textContent.trim();
this.cancel = false;
// this.getRangeData(event);
}
}, 100),

updateRange(yVals, event) {
this.pos = event ? [event.clientX, event.clientY] : this.pos;
this.range =
"[" +
Math.min(...yVals).toExponential(3) +
", " +
Math.max(...yVals).toExponential(3) +
"]";
},

updateTimeStep(val) {
if (this.minTimeStep <= val && val <= this.maxTimeStep) {
this.setCurrentTimeStep(parseInt(val));
Expand Down Expand Up @@ -206,6 +172,7 @@ export default {
},

applyView() {
this.updateNumReady(0);
this.$refs.plots.forEach((cell) => {
const { row, col } = cell;
const item = this.items[`${row}::${col}`];
Expand Down Expand Up @@ -271,7 +238,7 @@ export default {
viewTimeStep: "VIEW_SAVED_TIME_STEP",
numReady: "VIEW_NUM_READY",
loadedFromSaved: "VIEW_LOADING_FROM_SAVED",
lastSaved: "VIEW_LAST_SAVED",
lastSaved: "VIEWS_LAST_SAVED",
creator: "VIEWS_CREATOR",
gridSize: "VIEWS_GRID_SIZE",
items: "VIEWS_ITEMS",
Expand Down
37 changes: 9 additions & 28 deletions client/src/components/core/App/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,9 @@
<v-col v-bind:style="{padding: '0 10px'}">
<!-- Girder data table browser. -->
<div class="girder-placeholder" v-if="!location" />
<div>
<v-tooltip
right
light
v-if="range"
:value="range"
:position-x="pos[0]"
:position-y="pos[1]"
>
<span v-if="range">{{range}}</span>
</v-tooltip>
</div>
<girder-file-manager
ref="girderFileManager"
v-if="location && !showSettings"
v-on:mouseover.native="hoverIn($event)"
v-on:mouseout.native="hoverOut"
:location.sync="location"
:selectable="false"
:drag-enabled="true"
Expand All @@ -42,9 +28,8 @@
v-if="!showSettings"
:fluid="true"
class="playback-controls"
v-on:mouseover="hoverOut"
>
<v-row class="ma-0 pa-0" :style="{height: '25px'}">
<v-row class="mx-0 my-1 pa-0" style="height: 25px">
<v-slider
dense
hide-details
Expand Down Expand Up @@ -72,7 +57,7 @@
</template>
</v-slider>
</v-row>
<v-row class="ma-0 pa-0" :style="{height: '25px'}">
<v-row class="mx-0 my-1 pa-0" style="height: 25px">
<v-col :sm="4">
<v-text-field
dense
Expand All @@ -83,7 +68,8 @@
:max="maxTimeStep"
:disabled="!dataLoaded"
:value="currentTimeStep"
@change="(e) => {updateTimeStep(e.target.value)}"
@change="updateTimeStep"
style="min-width: 110px"
>
<template>
<v-icon
Expand All @@ -106,7 +92,7 @@
</v-text-field>
</v-col>
</v-row>
<v-row class="ma-0 pa-0" :style="{height: '25px'}">
<v-row class="mx-0 mt-4 mb-0 pa-0" style="height: 25px">
<v-col :sm="6">
<v-row class="align-center justify-space-evenly">
<v-icon v-on:click="removeRow()" :disabled="numrows < 2">
Expand All @@ -130,7 +116,7 @@
</v-row>
</v-col>
</v-row>
<v-row class="ma-0 pa-0" :style="{height: '25px'}">
<v-row class="mx-0 my-1 pa-0" style="height: 25px">
<v-col class="align-center">
<v-tooltip top>
<template v-slot:activator="{on, attrs}">
Expand All @@ -149,7 +135,8 @@
</v-row>
<v-row
v-show="lastSaved"
:style="{height: '5px', alignContent: 'start'}"
class="mx-0 my-1 pa-0"
style="height: 25px"
>
<span v-bind:style="{fontSize: 'small', opacity: '0.5'}">
View Autosaved: {{ new Date(lastSaved).toLocaleTimeString() }}
Expand All @@ -160,13 +147,7 @@
</v-row>
</pane>
<!-- Scientific data on the right. -->
<pane
id="mainContent"
min-size="50"
:size="85"
class="main-content"
v-on:mouseover.native="hoverOut"
>
<pane id="mainContent" min-size="50" :size="85" class="main-content">
<!-- image gallery grid. -->
<render-window ref="renderWindow" id="renderWindow" class="plots" />
<v-container v-bind:style="{padding: '0', maxWidth: '100%'}">
Expand Down
17 changes: 17 additions & 0 deletions client/src/components/widgets/ContextMenu/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ export default {
this.$store.getters[`${this.itemInfo?.id}/PLOT_DATA_COMPLETE`] || {}
);
},
logScaling() {
if (!this.itemInfo?.id) {
return false;
}

return (
this.$store.getters[`${this.itemInfo?.id}/PLOT_LOG_SCALING`] || false
);
},
},

methods: {
Expand Down Expand Up @@ -189,5 +198,13 @@ export default {
const xAxis = this.itemInfo?.xAxis || "";
return !xAxis.toLowerCase().includes("time") && this.itemInfo?.isPlotly;
},
toggleLogScale() {
if (this.itemInfo?.id) {
this.$store.commit(
`${this.itemInfo.id}/PLOT_LOG_SCALING_SET`,
!this.logScaling,
);
}
},
},
};
5 changes: 5 additions & 0 deletions client/src/components/widgets/ContextMenu/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<v-list-item dense @click="showRangeDialog=true">
<v-list-item-title> Set global range </v-list-item-title>
</v-list-item>
<v-list-item dense @click="toggleLogScale">
<v-list-item-title>
{{logScaling ? "Clear" : "Apply"}} log scaling
</v-list-item-title>
</v-list-item>
</v-list>
<v-divider v-if="itemInfo && itemInfo.isPlotly" />
<v-list>
Expand Down
13 changes: 7 additions & 6 deletions client/src/components/widgets/DownloadOptions/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from "lodash";
import { mapGetters, mapMutations } from "vuex";
import { extractRange } from "../../../utils/helpers";

export default {
inject: ["girderRest"],
Expand Down Expand Up @@ -61,17 +62,17 @@ export default {
},
minStep() {
if (this.id) {
return Math.min(
...this.$store.getters[`${this.id}/PLOT_AVAILABLE_TIME_STEPS`],
);
let ats = this.$store.getters[`${this.id}/PLOT_AVAILABLE_TIME_STEPS`];
let [min] = extractRange(ats);
return min;
}
return 0;
},
maxStep() {
if (this.id) {
return Math.max(
...this.$store.getters[`${this.id}/PLOT_AVAILABLE_TIME_STEPS`],
);
let ats = this.$store.getters[`${this.id}/PLOT_AVAILABLE_TIME_STEPS`];
let [, max] = extractRange(ats);
return max;
}
return 0;
},
Expand Down
1 change: 0 additions & 1 deletion client/src/components/widgets/LoadDialog/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export default {
log: data ? value.log : false,
xAxis: data ? value.xAxis : "",
range: data ? value.range : null,
legend: data ? value.legend : false,
};
}
}
Expand Down
Loading

0 comments on commit 13721e4

Please sign in to comment.