Skip to content
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
5 changes: 0 additions & 5 deletions src/firefly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ jar {
includes = ['edu/caltech/ipac/**/*']
}

gwt {
modules = 'edu.caltech.ipac.jsinterop'
module_name = 'jsinterop'
}

ext.appConfig = {
BuildMajor = "1"
BuildMinor = "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@
import edu.caltech.ipac.firefly.server.util.Logger;
import edu.caltech.ipac.firefly.server.util.StopWatch;
import edu.caltech.ipac.firefly.server.util.multipart.UploadFileInfo;
import edu.caltech.ipac.firefly.server.visualize.FitsCacher;
import edu.caltech.ipac.util.FileUtil;
import edu.caltech.ipac.util.IpacTableUtil;
import edu.caltech.ipac.util.StringUtils;
import edu.caltech.ipac.util.cache.StringKey;
import edu.caltech.ipac.visualize.plot.FitsRead;
import nom.tam.fits.Fits;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;

/**
Expand Down Expand Up @@ -77,37 +73,15 @@ protected void processRequest(HttpServletRequest req, HttpServletResponse res) t
String ext = resolveExt(fileName);
FileType fType = resolveType(fileType, ext, file.getContentType());
File destDir = resolveDestDir(dest, fType);
boolean doPreload = resolvePreload(preload, fType);
// boolean doPreload = resolvePreload(preload, fType); // we are no longer pre-loading fits files. performance gain was not significant.

File uf = File.createTempFile("upload_", ext, destDir); // other parts of system depend on file name starting with "upload_"
String rPathInfo = ServerContext.replaceWithPrefix(uf);

UploadFileInfo fi= new UploadFileInfo(rPathInfo,uf,fileName,file.getContentType());
String fileCacheKey= overrideCacheKey!=null ? overrideCacheKey : rPathInfo;
UserCache.getInstance().put(new StringKey(fileCacheKey), fi);

if (doPreload && fType == FileType.FITS) {

BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(uf), IpacTableUtil.FILE_IO_BUFFER_SIZE);
ByteArrayOutputStream pipe = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[IpacTableUtil.FILE_IO_BUFFER_SIZE];
int read;
while ((read = inStream.read(buffer)) != -1) {
bos.write(buffer, 0, read);
pipe.write(buffer, 0, read);
}

final Fits fits = new Fits(new ByteArrayInputStream(pipe.toByteArray()));
FitsRead[] frAry = FitsRead.createFitsReadArray(fits);
FitsCacher.addFitsReadToCache(uf, frAry);

} finally {
FileUtil.silentClose(bos);
}
} else {
FileUtil.writeToFile(inStream, uf);
}
FileUtil.writeToFile(inStream, uf);
sendReturnMsg(res, 200, null, fileCacheKey);
Counters.getInstance().increment(Counters.Category.Upload, fi.getContentType());

Expand Down
29 changes: 0 additions & 29 deletions src/firefly/java/edu/caltech/ipac/jsinterop.gwt.xml

This file was deleted.

8 changes: 1 addition & 7 deletions src/firefly/js/Firefly.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'isomorphic-fetch';
import React from 'react';
import 'styles/global.css';

import {APP_LOAD, dispatchUpdateAppData} from './core/AppDataCntlr.js';
import {APP_LOAD} from './core/AppDataCntlr.js';
import {ExtensionJavaInterface } from './gwtinterface/ExtensionJavaInterface.js';
import {ExtensionResult } from './gwtinterface/ExtensionResult.js';
import {PlotCmdExtension } from './visualize/PlotCmdExtension.js';
Expand Down Expand Up @@ -47,12 +47,6 @@ const appFlux= {

function fireflyInit() {

if (! window.ffgwt ) {
window.ffgwt = {
onLoaded: () => dispatchUpdateAppData({gwtLoaded: true})
};
}

if (! (window.firefly && window.firefly.initialized) ) {
flux.bootstrap();
var touch= false; // ToDo: determine if we are on a touch device
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/core/AppDataCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export function dispatchOnAppReady(callback) {
/*---------------------------- EXPORTED FUNTIONS -----------------------------*/
export function isAppReady() {
return getWsChannel() && get(flux.getState(), [APP_DATA_PATH, 'isReady']) &&
(get(window, 'firefly.noGWT') || get(flux.getState(), [APP_DATA_PATH, 'gwtLoaded']));
(!window.ffgwt || get(flux.getState(), [APP_DATA_PATH, 'gwtLoaded']));
}

export function getMenu() {
Expand Down
1 change: 1 addition & 0 deletions src/firefly/js/core/layout/FireflyLayoutManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
case ImagePlotCntlr.PLOT_IMAGE :
dropDown = {visible: count === 0};
break;
case SHOW_DROPDOWN:
case TABLE_REMOVE:
case ImagePlotCntlr.DELETE_PLOT_VIEW:
if (!get(dropDown, 'visible', false)) {
Expand Down
9 changes: 8 additions & 1 deletion src/firefly/js/fireflyJSLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/

import {firefly} from 'firefly/Firefly.js';
import {firefly} from './Firefly.js';
import {GwtEventHandler} from './core/messaging/MessageHandlers.js';
import {dispatchUpdateAppData} from './core/AppDataCntlr.js';

if (! window.ffgwt ) {
window.ffgwt = {
onLoaded: () => dispatchUpdateAppData({gwtLoaded: true})
};
}

firefly.bootstrap();
if (window.firefly.wsClient) {
Expand Down
17 changes: 0 additions & 17 deletions src/firefly/js/visualize/ImagePlotCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,20 +876,3 @@ function deletePlotView(state,action) {
//============ end private functions =================================
//============ end private functions =================================




//============ TEMPORARY interface with GWT=================================

/*globals ffgwt*/

if (window.ffgwt) {
const allPlots= ffgwt.Visualize.AllPlots.getInstance();
allPlots.addListener({
eventNotify(ev) {
if (ev.getName().getName()==='Replot') {
flux.process({type: ANY_CHANGE, payload: { } });
}
}
});
}
8 changes: 1 addition & 7 deletions src/firefly/js/visualize/VisUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ import {doConv} from '../astro/conv/CoordConv.js';

var {AllPlots} = window.ffgwt ? window.ffgwt.Visualize : {AllPlots:null};

export const USE_GWT= false;

const doCoordConversion= USE_GWT ? window.ffgwt.astro.CoordConv.doConv : doConv;



export const DtoR = Math.PI / 180.0;
export const RtoD = 180.0 / Math.PI;

Expand Down Expand Up @@ -101,7 +95,7 @@ export function convert(wpt, to= CoordinateSys.EQ_J2000) {
if (!to || from==to) return wpt;

const tobs= (from===CoordinateSys.EQ_B1950) ? 1983.5 : 0;
const ll = doCoordConversion(
const ll = doConv(
from.getJsys(), from.getEquinox(),
wpt.getLon(), wpt.getLat(),
to.getJsys(), to.getEquinox(), tobs);
Expand Down
4 changes: 1 addition & 3 deletions src/firefly/js/visualize/WebPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import {RequestType} from './RequestType.js';
import {isString} from 'lodash';
import CoordinateSys from './CoordSys.js';
import {makeProjectionGWT} from './Projection.js';
import {makeProjection} from './projection/Projection.js';
import PlotState from './PlotState.js';
import {USE_GWT} from './VisUtil.js';



Expand Down Expand Up @@ -121,7 +119,7 @@ export const WebPlot= {
*/
makeWebPlotData(plotId, wpInit, asOverlay= false) {

const projection= USE_GWT ? makeProjectionGWT(wpInit.projection) : makeProjection(wpInit.projectionJson);
const projection= makeProjection(wpInit.projectionJson);
var plotState= PlotState.makePlotStateWithJson(wpInit.plotState);
var zf= plotState.getZoomLevel();

Expand Down