Skip to content

Commit 91850b4

Browse files
committed
DM-7520: XY plot is not shown after closing one of the catalog tab
- fixed TabPanel onSelect called after tab has been removed. also: minor jsdoc errors and build script updates.
1 parent d08d9a4 commit 91850b4

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

buildScript/webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ export default function makeWebpackConfig(config) {
139139
`${config.firefly_root}/node_modules/react-component-resizable/`],
140140
loader: 'babel',
141141
query: {
142-
presets: ['es2015', 'react', 'stage-2']
142+
presets: ['es2015', 'react', 'stage-2'],
143+
plugins: ['transform-runtime']
143144
}
144145
},
145146
{ test : /\.css$/,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"babel-preset-react": "6.11.1",
1616
"babel-preset-stage-2": "6.13.0",
1717
"babel-runtime" : "6.9.2",
18+
"babel-plugin-transform-runtime": "6.12.0",
1819
"babel-plugin-react-transform": "2.0.2",
1920
"enum": "2.3.0",
2021
"fixed-data-table": "0.6.3",

src/firefly/js/tables/FilterInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class FilterInfo {
116116
* validate the filterInfo string
117117
* @param {string} filterInfo
118118
* @param {TableColumn[]} columns array of column definitions
119-
* @returns {[boolean, string]} isValid plus an error message if isValid is false.
119+
* @returns {Array.<boolean, string>} isValid plus an error message if isValid is false.
120120
*/
121121
static isValid(filterInfo, columns = []) {
122122
const rval = [true, ''];

src/firefly/js/tables/SelectInfo.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
/**
2-
* Created by loi on 1/15/16.
3-
*/
4-
5-
61
/*
72
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
83
*/
4+
95
import {isEmpty} from 'lodash';
106

117
import {getTblById} from './TableUtil.js';
@@ -35,7 +31,7 @@ export class SelectInfo {
3531
exceptions.delete(idx);
3632
} else {
3733
exceptions.add(idx);
38-
if (exceptions.size == rowCount) {
34+
if (exceptions.size === rowCount) {
3935
this.setSelectAll(true);
4036
}
4137
}
@@ -85,7 +81,7 @@ export class SelectInfo {
8581
}
8682

8783
isSelectAll() {
88-
return this.data.selectAll && (this.data.exceptions.size == 0);
84+
return this.data.selectAll && (this.data.exceptions.size === 0);
8985
}
9086

9187
toString() {
@@ -95,7 +91,7 @@ export class SelectInfo {
9591
parse(s) {
9692
var selecInfo = {};
9793
var parts = s.split('-');
98-
if (parts.length == 3) {
94+
if (parts.length === 3) {
9995
selecInfo.selectAll = Boolean(parts[0]);
10096
if (!isEmpty(parts[1])) {
10197
selecInfo.exceptions = parts[1].reduce( (res, cval) => {
@@ -109,10 +105,11 @@ export class SelectInfo {
109105

110106
/**
111107
* Destructing of the SelectInfo's data.
112-
* @param {number=0} rowCount IMPORTANT!!. Total number of rows in the table. defaults to zero.
113-
* @param {boolean} [selectAll] boolean. Indicates selectAll mode. defaults to false.
114-
* @param {Set} [exceptions] A set of exceptions based on selectAll mode.
115-
* @param {number} [offset] All indices passed into this class's funtion will be offsetted by this given value.
108+
* @param {Object} p
109+
* @param {number} p.rowCount IMPORTANT!!. Total number of rows in the table. defaults to zero.
110+
* @param {boolean} p.selectAll boolean. Indicates selectAll mode. defaults to false.
111+
* @param {Set} p.exceptions A set of exceptions based on selectAll mode.
112+
* @param {number} offset All indices passed into this class's funtion will be offsetted by this given value.
116113
* @returns {SelectInfo}
117114
*/
118115
static newInstance({selectAll=false, exceptions=(new Set()), rowCount=0}, offset) {

src/firefly/js/tables/reducer/TableUiReducer.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
33
*/
44

5-
import {set, has, get, isEmpty, cloneDeep, findKey} from 'lodash';
5+
import {set, has, get, isEmpty, cloneDeep, findKey, omit} from 'lodash';
66

77
import {updateSet, updateMerge} from '../../util/WebUtil.js';
88
import * as Cntlr from '../TablesCntlr.js';
@@ -58,8 +58,7 @@ function removeTable(root, action) {
5858
Object.keys(root).filter( (ui_id) => {
5959
return get(root, [ui_id, 'tbl_id']) === tbl_id;
6060
}).forEach( (ui_id) => {
61-
root = Object.assign({}, root);
62-
Reflect.deleteProperty(root, [ui_id]);
61+
root = omit(root, [ui_id]);
6362
});
6463
return root;
6564
}

src/firefly/js/ui/panel/TabPanel.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,18 @@ export class Tab extends Component {
194194
const textStyle = maxTitleWidth ? {float: 'left', width: maxTitleWidth-(removable?14:0)} : {};
195195

196196
return (
197-
<li className={tabClassName} onClick={() => onSelect(id,name)}>
197+
<li className={tabClassName} onClick={() => !this.removed && onSelect(id,name)}>
198198
<div>
199199
<div style={textStyle} className='text-ellipsis' title={name}>
200200
{name}
201201
</div>
202202
{removable &&
203203
<div style={{right: -4, top: -2}} className='btn-close'
204204
title='Remove Tab'
205-
onClick={() => onTabRemove && onTabRemove(name)}/>
205+
onClick={() => {
206+
onTabRemove && onTabRemove(name);
207+
this.removed = true;
208+
}}/>
206209
}
207210
</div>
208211
</li>);

0 commit comments

Comments
 (0)