Skip to content

Commit ea4f51d

Browse files
authored
DM-7547: Remove the extra column on far right-hand side of a table. Merge pr #179
DM-7547: Remove the extra column on far right-hand side of a table
2 parents 20de5d4 + e90362b commit ea4f51d

File tree

7 files changed

+61
-37
lines changed

7 files changed

+61
-37
lines changed

src/firefly/js/charts/ui/ColSelectView.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ export function showColSelectPopup(colValStats,onColSelected,popupTitle,buttonTe
6868
columns[3] = {name: 'Description', prefWidth: widths[3], visibility: 'show'};
6969
}
7070

71-
const request = {pageSize:10000};
72-
var tableModel = {totalRows: data.length, request, tbl_id:TBL_ID, tableData: {columns, data }, highlightedRow: hlRowNum};
73-
71+
var tableModel = {totalRows: data.length, tbl_id:TBL_ID, tableData: {columns, data }, highlightedRow: hlRowNum};
7472

73+
const minWidth = columns.reduce((rval, c) => rval + c.prefWidth, 0) * 7;
7574
var popup = (<PopupPanel title={popupTitle}>
76-
{popupForm(tableModel,onColSelected,buttonText,popupId)}
75+
{popupForm(tableModel,onColSelected,buttonText,popupId, minWidth)}
7776
</PopupPanel>
7877

7978
);
@@ -88,8 +87,9 @@ export function hideColSelectPopup() {
8887
}
8988
}
9089

91-
function popupForm(tableModel, onColSelected,buttonText,popupId) {
90+
function popupForm(tableModel, onColSelected,buttonText,popupId, minWidth) {
9291
const tblId = tableModel.tbl_id;
92+
popupPanelResizableStyle.minWidth = Math.min(minWidth, 560);
9393
return (
9494
<div style={ popupPanelResizableStyle}>
9595
{ renderTable(tableModel,popupId)}
@@ -106,11 +106,12 @@ function popupForm(tableModel, onColSelected,buttonText,popupId) {
106106
* @return table section
107107
*/
108108
function renderTable(tableModel,popupId) {
109-
109+
const tbl_ui_id = (tableModel.tbl_id || 'ColSelectView') + '-ui';
110110
return (
111111
<div style={tableStyle}>
112112
<TablePanel
113113
key={popupId}
114+
tbl_ui_id = {tbl_ui_id}
114115
tableModel={tableModel}
115116
showToolbar={false}
116117
selectable={false}

src/firefly/js/tables/TableUtil.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {fetchUrl, encodeServerUrl, encodeParams} from '../util/WebUtil.js';
1111
import {getRootURL} from '../util/BrowserUtil.js';
1212

1313
export const SEARCH_SRV_PATH = getRootURL() + 'search/json';
14+
export const MAX_ROW = Math.pow(2,31) - 1;
1415
const SAVE_TABLE_URL = getRootURL() + 'servlet/SaveAsIpacTable';
15-
const INT_MAX = Math.pow(2,31) - 1;
1616

1717
/**
1818
* @public
@@ -178,7 +178,7 @@ export function doFetchTable(tableRequest, hlRowIdx) {
178178

179179
const def = {
180180
startIdx: 0,
181-
pageSize : INT_MAX
181+
pageSize : MAX_ROW
182182
};
183183
var params = Object.assign(def, tableRequest);
184184
// encoding for method post
@@ -617,7 +617,7 @@ export function getTblInfo(tableModel, aPageSize) {
617617
if (!tableModel) return {};
618618
var {tbl_id, request, highlightedRow=0, totalRows=0, tableMeta={}, selectInfo, error} = tableModel;
619619
const {title} = tableMeta;
620-
const pageSize = aPageSize || get(request, 'pageSize', 1); // there should be a pageSize.. default to 1 in case of error. pageSize cannot be 0 because it'll overflow.
620+
const pageSize = aPageSize || get(request, 'pageSize', MAX_ROW); // there should be a pageSize.. default to 1 in case of error. pageSize cannot be 0 because it'll overflow.
621621
if (highlightedRow < 0 ) {
622622
highlightedRow = 0;
623623
} else if (highlightedRow >= totalRows-1) {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
border-bottom-right-radius: 4px;
8383
padding-right: 7px;
8484
background-color: #E3E3E3;
85+
display: inline-block;
8586
}
8687

8788
.TablePanel__header {
@@ -92,7 +93,9 @@
9293
align-items: center;
9394
justify-content: space-between;
9495
padding: 2px;
95-
box-sizing: border-box;}
96+
box-sizing: border-box;
97+
background-image: linear-gradient(#fff, #dcdcdc);
98+
}
9699

97100
button.paging_bar {
98101
height: 16px;
@@ -145,8 +148,8 @@ button.tablepanel.clearFilters {
145148
.TablePanel__options--small {
146149
z-index: 1;
147150
position: absolute;
148-
top: -2px;
149-
right: -2px;
151+
top: 0;
152+
right: 0;
150153
width: 20px;
151154
height: 20px;
152155
}
@@ -230,8 +233,6 @@ button.tablepanel.clearFilters {
230233

231234
.public_fixedDataTable_header, .public_fixedDataTable_header .public_fixedDataTableCell_main {
232235
background-color: #f6f7f8;
233-
background-image: -webkit-linear-gradient(#fff, #dcdcdc);
234-
background-image: linear-gradient(#fff, #dcdcdc);
235236
text-align: center;
236237
}
237238

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class TablePanel extends Component {
120120
const {onTableChanged} = this.props;
121121

122122
if (error) return <div className='TablePanel__error'>{error}</div>;
123-
if (isEmpty(columns)) return <div style={{position: 'relative', width: '100%', height: '100%'}}><div className='loading-mask'/></div>;
123+
if (isEmpty(columns)) return <Loading {...{showTitle, tbl_id, title, removable}}/>;
124124

125125
const selectInfoCls = SelectInfo.newInstance(selectInfo, startIdx);
126126
const viewIcoStyle = 'tablepanel ' + (textView ? 'tableView' : 'textView');
@@ -257,4 +257,14 @@ function TableTitle({tbl_id, title, removable}) {
257257
</div>
258258
);
259259
} else return <div/>;
260+
}
261+
262+
// eslint-disable-next-line
263+
function Loading({showTitle, tbl_id, title, removable}) {
264+
return (
265+
<div style={{position: 'relative', width: '100%', height: '100%'}}>
266+
<div className='loading-mask'/>
267+
{showTitle ? <TableTitle {...{tbl_id, title, removable}} /> : <div className='group'/>}
268+
</div>
269+
);
260270
}

src/firefly/js/ui/PagingBar.jsx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {omit} from 'lodash';
55
import {InputField} from './InputField.jsx';
66
import {intValidator} from '../util/Validate.js';
77
import LOADING from 'html/images/gxt/loading.gif';
8+
import {MAX_ROW} from '../tables/TableUtil.js';
89

910
export class PagingBar extends Component {
1011
constructor(props) {
@@ -18,7 +19,7 @@ export class PagingBar extends Component {
1819
render() {
1920
const {currentPage, totalRows, pageSize, showLoading, callbacks} = this.props;
2021

21-
// const currentPage = highlightedRow >= 0 ? Math.floor(highlightedRow / pageSize)+1 : 1;
22+
const showAll = pageSize === MAX_ROW;
2223
const startIdx = (currentPage-1) * pageSize;
2324
const endIdx = Math.min(startIdx+pageSize, totalRows);
2425
var totalPages = Math.ceil((totalRows || 0)/pageSize);
@@ -28,27 +29,34 @@ export class PagingBar extends Component {
2829
callbacks.onGotoPage(pageNum.value);
2930
}
3031
};
31-
32-
return (
33-
<div className='group'>
34-
<button onClick={() => callbacks.onGotoPage(1)} className='paging_bar first' title='First Page'/>
35-
<button onClick={() => callbacks.onGotoPage(currentPage - 1)} className='paging_bar previous' title='Previous Page'/>
36-
<InputField
37-
style={{textAlign: 'right'}}
38-
validator = {intValidator(1,totalPages, 'Page Number')}
39-
tooltip = 'Jump to this page'
40-
size = {2}
41-
value = {currentPage+''}
42-
onChange = {onPageChange}
43-
actOn={['blur','enter']}
44-
showWarning={false}
45-
/> <div style={{fontSize: 'smaller', marginLeft: 3}} > of {totalPages}</div>
46-
<button onClick={() => callbacks.onGotoPage(currentPage + 1)} className='paging_bar next' title='Next Page'/>
47-
<button onClick={() => callbacks.onGotoPage(totalPages)} className='paging_bar last' title='Last Page'/>
48-
<div style={{fontSize: 'smaller', marginLeft: 3}} > ({(startIdx+1).toLocaleString()} - {endIdx.toLocaleString()} of {totalRows.toLocaleString()})</div>
49-
{showLoading ? <img style={{width:14,height:14,marginTop: '3px'}} src={LOADING}/> : false}
50-
</div>
51-
);
32+
const showingLabel = ( <div style={{fontSize: 'smaller', marginLeft: 3}} >
33+
({(startIdx+1).toLocaleString()} - {endIdx.toLocaleString()} of {totalRows.toLocaleString()})
34+
</div>
35+
);
36+
if (showAll) {
37+
return showingLabel;
38+
} else {
39+
return (
40+
<div className='group'>
41+
<button onClick={() => callbacks.onGotoPage(1)} className='paging_bar first' title='First Page'/>
42+
<button onClick={() => callbacks.onGotoPage(currentPage - 1)} className='paging_bar previous' title='Previous Page'/>
43+
<InputField
44+
style={{textAlign: 'right'}}
45+
validator = {intValidator(1,totalPages, 'Page Number')}
46+
tooltip = 'Jump to this page'
47+
size = {2}
48+
value = {currentPage+''}
49+
onChange = {onPageChange}
50+
actOn={['blur','enter']}
51+
showWarning={false}
52+
/> <div style={{fontSize: 'smaller', marginLeft: 3}} > of {totalPages}</div>
53+
<button onClick={() => callbacks.onGotoPage(currentPage + 1)} className='paging_bar next' title='Next Page'/>
54+
<button onClick={() => callbacks.onGotoPage(totalPages)} className='paging_bar last' title='Last Page'/>
55+
{showingLabel}
56+
{showLoading ? <img style={{width:14,height:14,marginTop: '3px'}} src={LOADING}/> : false}
57+
</div>
58+
);
59+
}
5260
}
5361
}
5462

src/firefly/js/visualize/ui/CatalogConstraintsPanel.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ function ConstraintPanel({tableModel, fieldKey, onChange, ontablechanged}) {
246246
overflow: 'hidden',
247247
position: 'relative'
248248
};
249+
const tbl_ui_id = tableModel.tbl_id + '-ui';
249250
return (
250251

251252
<div
@@ -262,6 +263,7 @@ function ConstraintPanel({tableModel, fieldKey, onChange, ontablechanged}) {
262263
showMask={true}
263264
showOptionButton={false}
264265
key={tableModel.tbl_id}
266+
tbl_ui_id = {tbl_ui_id}
265267
tableModel={tableModel}
266268
renderers={
267269
{

src/firefly/js/visualize/ui/FitsHeaderView.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ function renderTable(band, fitsHeaderInfo, isPlacedOnTab) {
203203

204204
const tableModel = fitsHeaderInfo[band];
205205
var myTableStyle= isPlacedOnTab?tableOnTabStyle:tableStyle;
206+
const tbl_ui_id = tableModel.tbl_id + '-ui';
206207
return (
207208
<div style={ myTableStyle}>
208209
<TablePanel
209210
key={tableModel.tbl_id}
211+
tbl_ui_id = {tbl_ui_id}
210212
tableModel={tableModel}
211213
height='calc(100% - 42px)'
212214
showToolbar={false}

0 commit comments

Comments
 (0)