Skip to content

DM-7016: Image loading feedback #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2016
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
6 changes: 5 additions & 1 deletion src/firefly/js/core/layout/FireflyLayoutManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {

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

case REPLACE_IMAGES :
case ImagePlotCntlr.PLOT_IMAGE :
case ImagePlotCntlr.PLOT_IMAGE_START :
[showImages, images, ignore] = handleNewImage(action, images);
break;
}
Expand All @@ -73,6 +75,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
case TBL_RESULTS_ADDED:
case REPLACE_IMAGES :
case ImagePlotCntlr.PLOT_IMAGE :
case ImagePlotCntlr.PLOT_IMAGE_START :
case TABLE_REMOVE:
case ImagePlotCntlr.DELETE_PLOT_VIEW:
if (count === 1) {
Expand All @@ -92,6 +95,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
case TBL_RESULTS_ADDED:
case REPLACE_IMAGES :
case ImagePlotCntlr.PLOT_IMAGE :
case ImagePlotCntlr.PLOT_IMAGE_START :
dropDown = {visible: count === 0};
break;
case SHOW_DROPDOWN:
Expand Down
63 changes: 42 additions & 21 deletions src/firefly/js/ui/TargetPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,37 @@ import {parseTarget, getFeedback, formatPosForTextField} from './TargetPanelWork
import TargetFeedback from './TargetFeedback.jsx';
import {InputFieldView} from './InputFieldView.jsx';
import {fieldGroupConnector} from './FieldGroupConnector.jsx';
import FieldGroupUtils, {getFieldGroupState} from '../fieldGroup/FieldGroupUtils.js';
import {dispatchActiveTarget, getActiveTarget} from '../core/AppDataCntlr.js';
import {isValidPoint, parseWorldPt} from '../visualize/Point.js';



function TargetPanelView({showHelp, feedback, valid, message, onChange, value, labelWidth}) {
return (
<div>
<InputFieldView
valid={valid}
visible= {true}
message={message}
onChange={onChange}
label='Name or Position:'
value={value}
tooltip='Enter a target'
labelWidth={labelWidth}
/>
<TargetFeedback showHelp={showHelp} feedback={feedback}/>
</div>
);
class TargetPanelView extends Component {

componentWillUnmount() {
const {onUnmountCB, fieldKey, groupKey}= this.props;
if (onUnmountCB) onUnmountCB(fieldKey,groupKey);
}

render() {
const {showHelp, feedback, valid, message, onChange, value, labelWidth}= this.props;
return (
<div>
<InputFieldView
valid={valid}
visible= {true}
message={message}
onChange={onChange}
label='Name or Position:'
value={value}
tooltip='Enter a target'
labelWidth={labelWidth}
/>
<TargetFeedback showHelp={showHelp} feedback={feedback}/>
</div>
);
}
}


Expand All @@ -39,10 +49,21 @@ TargetPanelView.propTypes = {
message: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
value : PropTypes.string.isRequired,
labelWidth : PropTypes.number
labelWidth : PropTypes.number,
onUnmountCB : PropTypes.func,
};


function didUnmount(fieldKey,groupKey) {
// console.log(`did unmount: ${fieldKey}, ${groupKey}`);
// console.log(`value: ${FieldGroupUtils.getFldValue(FieldGroupUtils.getGroupFields(groupKey),fieldKey)}`);

const wp= parseWorldPt(FieldGroupUtils.getFldValue(FieldGroupUtils.getGroupFields(groupKey),fieldKey));

if (isValidPoint(wp)) {
if (wp) dispatchActiveTarget(wp);
}
}



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

if (isValidPoint(wp)) {
if (isValidPoint(wp) && !value) {
feedback= getFeedback(wp);
value= wp.objName || formatPosForTextField(wp);
showHelp= false;
Expand All @@ -68,7 +89,8 @@ function getProps(params, fireValueChange) {
tooltip: 'Enter a target',
value,
feedback,
showHelp
showHelp,
onUnmountCB: didUnmount
});
}

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

return {
message : 'Could not resolve object: Enter valid object',
Expand All @@ -128,7 +149,7 @@ function replaceValue(v,props) {
const t= getActiveTarget();
var retVal= v;
if (t && t.worldPt) {
console.log(`value: ${v}, but I could use: ${t.worldPt}`);
// console.log(`value: ${v}, but I could use: ${t.worldPt}`);
if (get(t,'worldPt')) retVal= t.worldPt.toString();
}
return retVal;
Expand Down
3 changes: 2 additions & 1 deletion src/firefly/js/visualize/MultiViewCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ function reducer(state=initState(), action={}) {
case ImagePlotCntlr.PLOT_IMAGE_START:
if (payload.viewerId) {
if (payload.plotId) {
retState= addImages(state,payload.viewerId,[payload.plotId]);
state= addImages(state,payload.viewerId,[payload.plotId]);
retState= addImages(state,EXPANDED_MODE_RESERVED,[payload.plotId]);
}
}
break;
Expand Down
2 changes: 2 additions & 0 deletions src/firefly/js/visualize/ui/ImageSelectPanelResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {parseWorldPt} from '../Point.js';
import {panelCatalogs} from './ImageSelectPanelProp.js';
import {showInfoPopup} from '../../ui/PopupUtil.jsx';
import {sizeFromDeg} from '../../ui/SizeInputField.jsx';
import {ZoomType} from '../ZoomType.js';
import {get} from 'lodash';
import {dispatchHideDropDown} from '../../core/LayoutCntlr.js';
import {getPlotViewById} from '../PlotViewUtil.js';
Expand Down Expand Up @@ -262,6 +263,7 @@ export function resultSuccess(plotInfo, hideDropdown = false) {
default:
wpr = imagePlotOnSurvey(cId, rq);
}
wpr.setZoomType(ZoomType.TO_WIDTH);
return wpr;
};

Expand Down