Skip to content

Commit 1894d21

Browse files
committed
DM-7016: Image loading feedback
- includes a fix to Target Panel, the automatic active target was not working correctly
1 parent 49df438 commit 1894d21

File tree

4 files changed

+51
-23
lines changed

4 files changed

+51
-23
lines changed

src/firefly/js/core/layout/FireflyLayoutManager.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
2727

2828
while (true) {
2929
const action = yield take([
30-
ImagePlotCntlr.PLOT_IMAGE, ImagePlotCntlr.DELETE_PLOT_VIEW, REPLACE_IMAGES,
30+
ImagePlotCntlr.PLOT_IMAGE_START, ImagePlotCntlr.PLOT_IMAGE,
31+
ImagePlotCntlr.DELETE_PLOT_VIEW, REPLACE_IMAGES,
3132
TBL_RESULTS_ADDED, TABLE_REMOVE, TABLE_NEW,
3233
SHOW_DROPDOWN, SET_LAYOUT_MODE
3334
]);
@@ -60,6 +61,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
6061

6162
case REPLACE_IMAGES :
6263
case ImagePlotCntlr.PLOT_IMAGE :
64+
case ImagePlotCntlr.PLOT_IMAGE_START :
6365
[showImages, images, ignore] = handleNewImage(action, images);
6466
break;
6567
}
@@ -73,6 +75,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
7375
case TBL_RESULTS_ADDED:
7476
case REPLACE_IMAGES :
7577
case ImagePlotCntlr.PLOT_IMAGE :
78+
case ImagePlotCntlr.PLOT_IMAGE_START :
7679
case TABLE_REMOVE:
7780
case ImagePlotCntlr.DELETE_PLOT_VIEW:
7881
if (count === 1) {
@@ -92,6 +95,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
9295
case TBL_RESULTS_ADDED:
9396
case REPLACE_IMAGES :
9497
case ImagePlotCntlr.PLOT_IMAGE :
98+
case ImagePlotCntlr.PLOT_IMAGE_START :
9599
dropDown = {visible: count === 0};
96100
break;
97101
case SHOW_DROPDOWN:

src/firefly/js/ui/TargetPanel.jsx

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,37 @@ import {parseTarget, getFeedback, formatPosForTextField} from './TargetPanelWork
88
import TargetFeedback from './TargetFeedback.jsx';
99
import {InputFieldView} from './InputFieldView.jsx';
1010
import {fieldGroupConnector} from './FieldGroupConnector.jsx';
11+
import FieldGroupUtils, {getFieldGroupState} from '../fieldGroup/FieldGroupUtils.js';
1112
import {dispatchActiveTarget, getActiveTarget} from '../core/AppDataCntlr.js';
1213
import {isValidPoint, parseWorldPt} from '../visualize/Point.js';
1314

1415

1516

16-
function TargetPanelView({showHelp, feedback, valid, message, onChange, value, labelWidth}) {
17-
return (
18-
<div>
19-
<InputFieldView
20-
valid={valid}
21-
visible= {true}
22-
message={message}
23-
onChange={onChange}
24-
label='Name or Position:'
25-
value={value}
26-
tooltip='Enter a target'
27-
labelWidth={labelWidth}
28-
/>
29-
<TargetFeedback showHelp={showHelp} feedback={feedback}/>
30-
</div>
31-
);
17+
class TargetPanelView extends Component {
18+
19+
componentWillUnmount() {
20+
const {onUnmountCB, fieldKey, groupKey}= this.props;
21+
if (onUnmountCB) onUnmountCB(fieldKey,groupKey);
22+
}
23+
24+
render() {
25+
const {showHelp, feedback, valid, message, onChange, value, labelWidth}= this.props;
26+
return (
27+
<div>
28+
<InputFieldView
29+
valid={valid}
30+
visible= {true}
31+
message={message}
32+
onChange={onChange}
33+
label='Name or Position:'
34+
value={value}
35+
tooltip='Enter a target'
36+
labelWidth={labelWidth}
37+
/>
38+
<TargetFeedback showHelp={showHelp} feedback={feedback}/>
39+
</div>
40+
);
41+
}
3242
}
3343

3444

@@ -39,10 +49,21 @@ TargetPanelView.propTypes = {
3949
message: PropTypes.string.isRequired,
4050
onChange: PropTypes.func.isRequired,
4151
value : PropTypes.string.isRequired,
42-
labelWidth : PropTypes.number
52+
labelWidth : PropTypes.number,
53+
onUnmountCB : PropTypes.func,
4354
};
4455

4556

57+
function didUnmount(fieldKey,groupKey) {
58+
// console.log(`did unmount: ${fieldKey}, ${groupKey}`);
59+
// console.log(`value: ${FieldGroupUtils.getFldValue(FieldGroupUtils.getGroupFields(groupKey),fieldKey)}`);
60+
61+
const wp= parseWorldPt(FieldGroupUtils.getFldValue(FieldGroupUtils.getGroupFields(groupKey),fieldKey));
62+
63+
if (isValidPoint(wp)) {
64+
if (wp) dispatchActiveTarget(wp);
65+
}
66+
}
4667

4768

4869

@@ -54,7 +75,7 @@ function getProps(params, fireValueChange) {
5475
const wpStr= params.value;
5576
const wp= parseWorldPt(wpStr);
5677

57-
if (isValidPoint(wp)) {
78+
if (isValidPoint(wp) && !value) {
5879
feedback= getFeedback(wp);
5980
value= wp.objName || formatPosForTextField(wp);
6081
showHelp= false;
@@ -68,7 +89,8 @@ function getProps(params, fireValueChange) {
6889
tooltip: 'Enter a target',
6990
value,
7091
feedback,
71-
showHelp
92+
showHelp,
93+
onUnmountCB: didUnmount
7294
});
7395
}
7496

@@ -103,7 +125,6 @@ function handleOnChange(ev, params, fireValueChange) {
103125
function makePayloadAndUpdateActive(displayValue, parseResults, resolvePromise) {
104126
const {wpt}= parseResults;
105127
const wpStr= parseResults && wpt ? wpt.toString() : null;
106-
if (wpt) dispatchActiveTarget(wpt);
107128

108129
return {
109130
message : 'Could not resolve object: Enter valid object',
@@ -128,7 +149,7 @@ function replaceValue(v,props) {
128149
const t= getActiveTarget();
129150
var retVal= v;
130151
if (t && t.worldPt) {
131-
console.log(`value: ${v}, but I could use: ${t.worldPt}`);
152+
// console.log(`value: ${v}, but I could use: ${t.worldPt}`);
132153
if (get(t,'worldPt')) retVal= t.worldPt.toString();
133154
}
134155
return retVal;

src/firefly/js/visualize/MultiViewCntlr.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ function reducer(state=initState(), action={}) {
290290
case ImagePlotCntlr.PLOT_IMAGE_START:
291291
if (payload.viewerId) {
292292
if (payload.plotId) {
293-
retState= addImages(state,payload.viewerId,[payload.plotId]);
293+
state= addImages(state,payload.viewerId,[payload.plotId]);
294+
retState= addImages(state,EXPANDED_MODE_RESERVED,[payload.plotId]);
294295
}
295296
}
296297
break;

src/firefly/js/visualize/ui/ImageSelectPanelResult.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {parseWorldPt} from '../Point.js';
1212
import {panelCatalogs} from './ImageSelectPanelProp.js';
1313
import {showInfoPopup} from '../../ui/PopupUtil.jsx';
1414
import {sizeFromDeg} from '../../ui/SizeInputField.jsx';
15+
import {ZoomType} from '../ZoomType.js';
1516
import {get} from 'lodash';
1617
import {dispatchHideDropDown} from '../../core/LayoutCntlr.js';
1718
import {getPlotViewById} from '../PlotViewUtil.js';
@@ -262,6 +263,7 @@ export function resultSuccess(plotInfo, hideDropdown = false) {
262263
default:
263264
wpr = imagePlotOnSurvey(cId, rq);
264265
}
266+
wpr.setZoomType(ZoomType.TO_WIDTH);
265267
return wpr;
266268
};
267269

0 commit comments

Comments
 (0)