Skip to content

Commit 1f35125

Browse files
committed
DM-5387: in response to reviewer's comments
- added rowHeight property to control the height of the table's row. - default to unselectable table when type is not specify. - added help_id property to table. set to 'tables' for old api - set expandable to false for old api call
1 parent b69f977 commit 1f35125

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

buildScript/loadScript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ function loadScript(loader, script, callback){
2525
document.getElementsByTagName('head')[0].appendChild(scriptTag);
2626
}
2727

28-
function getScriptURL(loader = 'firefly_loader.js') {
28+
function getScriptURL(loader) {
29+
loader = loader || 'firefly_loader.js';
2930
var scripts = document.getElementsByTagName('script');
3031
var url = '/';
3132
for (var i = 0; (i < scripts.length); i++) {

src/firefly/html/demo/ffapi-highlevel-test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@
205205
type: 'selectable',
206206
Title: 'old api: selectable table',
207207
pageSize: 50,
208+
rowHeight: 30,
208209
tableOptions: "show-filter=true,show-title=true,show-toolbar=true,show-options=true,show-paging=true,show-save=true"
209210
};
210211
firefly.showTable(tblParams, 'oldSelectable');
211212
var tblParams2 = {
212213
source: 'http://web.ipac.caltech.edu/staff/roby/demo/WiseDemoTable.tbl',
213-
type: 'basic',
214214
Title: 'old api: basic table',
215215
pageSize: 1000,
216216
tableOptions: "show-toolbar=false"

src/firefly/js/api/ApiHighlevelBuild.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ function oldApi(llApi, params, options) {
7272
// options.?? = getBoolean(oldOpts, 'show-popout');
7373
// options.?? = getBoolean(oldOpts, 'show-table-view');
7474

75-
var {Title, source, alt_source, type, filters, sortInfo, pageSize, startIdx, fixedLength} = params;
75+
var {Title, source, alt_source, type, filters, sortInfo, pageSize, startIdx, fixedLength, expandable, rowHeight} = params;
7676
var request = makeFileRequest(Title, source, alt_source, {filters, sortInfo, pageSize, startIdx});
77-
if (type === 'basic') {
78-
options.selectable = false;
79-
}
77+
options.selectable = type === 'selectable';
78+
options.help_id = 'tables';
79+
options.expandable = !!expandable;
80+
options.rowHeight = rowHeight;
8081
return request;
8182
}
8283

src/firefly/js/tables/ui/TablePanel.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {SelectInfo} from '../SelectInfo.js';
1616
import {PagingBar} from '../../ui/PagingBar.jsx';
1717
import {ToolbarButton} from '../../ui/ToolbarButton.jsx';
1818
import {LO_MODE, LO_VIEW, dispatchSetLayoutMode} from '../../core/LayoutCntlr.js';
19+
import {HelpIcon} from '../../ui/HelpIcon.jsx';
1920
import FILTER from 'html/images/icons-2014/24x24_Filter.png';
2021
import OUTLINE_EXPAND from 'html/images/icons-2014/24x24_ExpandArrowsWhiteOutline.png';
2122

@@ -92,7 +93,7 @@ export class TablePanel extends Component {
9293
}
9394

9495
render() {
95-
const {selectable, expandable, expandedMode, border, renderers, title, removable,
96+
const {selectable, expandable, expandedMode, border, renderers, title, removable, rowHeight, help_id,
9697
showToolbar, showTitle, showOptionButton, showPaging, showSave, showFilterButton} = this.state;
9798
var {totalRows, showLoading, columns, showOptions, showUnits, showFilters, textView, colSortDir} = this.state;
9899
const {tbl_id, error, startIdx, hlRowIdx, currentPage, pageSize, selectInfo, showMask,
@@ -132,6 +133,7 @@ export class TablePanel extends Component {
132133
<button onClick={this.expandTable}>
133134
<img src={OUTLINE_EXPAND} title='Expand this panel to take up a larger area'/>
134135
</button>}
136+
{ help_id && <div style={{marginTop:-10}}> <HelpIcon helpId={help_id} /> </div>}
135137
</div>
136138
</div>
137139
}
@@ -140,6 +142,7 @@ export class TablePanel extends Component {
140142
columns={columns}
141143
data={data}
142144
hlRowIdx={hlRowIdx}
145+
rowHeight = {rowHeight}
143146
selectable={selectable}
144147
showUnits={showUnits}
145148
showFilters={showFilters}
@@ -175,11 +178,13 @@ TablePanel.propTypes = {
175178
tbl_ui_id: PropTypes.string,
176179
tableModel: PropTypes.object,
177180
pageSize: PropTypes.number,
181+
rowHeight: PropTypes.number,
178182
selectable: PropTypes.bool,
179183
expandedMode: PropTypes.bool,
180184
expandable: PropTypes.bool,
181185
border: PropTypes.bool,
182186
title: PropTypes.string,
187+
help_id: PropTypes.string,
183188
removable: PropTypes.bool,
184189
showUnits: PropTypes.bool,
185190
showFilters: PropTypes.bool,

0 commit comments

Comments
 (0)