Fix datatables issue and indicator not loading for Table API > Entities. Upgrade jquery. Fix right panel resize issue. (#1713)
* Fix datatables issue and indicator not loading for Table API > Entities * Fix jquery and datatables compile issues. Add patch for datatables.net-colreorder error in types * Fix side panel size. Fix bug resizing side panel. * Update PanelContainerComponent unit test snapshot * Fix commented code
This commit is contained in:
parent
c91ac39248
commit
e9181f19d7
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
|
@ -55,8 +55,8 @@
|
|||
"crossroads": "0.12.2",
|
||||
"css-element-queries": "1.1.1",
|
||||
"d3": "6.1.1",
|
||||
"datatables.net-colreorder-dt": "1.5.1",
|
||||
"datatables.net-dt": "1.10.19",
|
||||
"datatables.net-colreorder-dt": "1.7.0",
|
||||
"datatables.net-dt": "1.13.8",
|
||||
"date-fns": "1.29.0",
|
||||
"dayjs": "1.8.19",
|
||||
"dom-to-image": "2.6.0",
|
||||
|
@ -71,13 +71,14 @@
|
|||
"iframe-resizer-react": "1.1.0",
|
||||
"immutable": "4.0.0-rc.12",
|
||||
"is-ci": "2.0.0",
|
||||
"jquery": "3.5.1",
|
||||
"jquery-typeahead": "2.10.6",
|
||||
"jquery-ui-dist": "1.12.1",
|
||||
"jquery": "3.7.1",
|
||||
"jquery-typeahead": "2.11.1",
|
||||
"jquery-ui-dist": "1.13.2",
|
||||
"knockout": "3.5.1",
|
||||
"mkdirp": "1.0.4",
|
||||
"monaco-editor": "0.44.0",
|
||||
"ms": "2.1.3",
|
||||
"patch-package": "8.0.0",
|
||||
"p-retry": "4.6.2",
|
||||
"plotly.js-cartesian-dist-min": "1.52.3",
|
||||
"post-robot": "10.0.42",
|
||||
|
@ -114,11 +115,14 @@
|
|||
"@types/codemirror": "0.0.56",
|
||||
"@types/crossroads": "0.0.30",
|
||||
"@types/d3": "5.9.2",
|
||||
"@types/datatables.net": "1.10.28",
|
||||
"@types/datatables.net-colreorder": "1.4.5",
|
||||
"@types/dom-to-image": "2.6.2",
|
||||
"@types/enzyme": "3.10.7",
|
||||
"@types/enzyme-adapter-react-16": "1.0.6",
|
||||
"@types/hasher": "0.0.31",
|
||||
"@types/jest": "26.0.20",
|
||||
"@types/jquery": "3.5.29",
|
||||
"@types/node": "12.11.1",
|
||||
"@types/post-robot": "10.0.1",
|
||||
"@types/q": "1.5.1",
|
||||
|
@ -187,6 +191,7 @@
|
|||
"webpack-dev-server": "4.15.1"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "patch-package",
|
||||
"start": "webpack serve --mode development",
|
||||
"dev": "echo \"WARNING: npm run dev has been deprecated\" && npm run build",
|
||||
"build:dataExplorer:ci": "npm run build:ci",
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/node_modules/datatables.net-colreorder/types/types.d.ts b/node_modules/datatables.net-colreorder/types/types.d.ts
|
||||
index e5dc283..1930c2b 100644
|
||||
--- a/node_modules/datatables.net-colreorder/types/types.d.ts
|
||||
+++ b/node_modules/datatables.net-colreorder/types/types.d.ts
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
-import DataTables, {Api} from 'datatables.net';
|
||||
+import DataTables, { Api } from 'datatables.net';
|
||||
|
||||
export default DataTables;
|
||||
|
||||
@@ -40,6 +40,8 @@ declare module 'datatables.net' {
|
||||
/**
|
||||
* Create a new ColReorder instance for the target DataTable
|
||||
*/
|
||||
+ // Ignore this error: error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
+ // @ts-ignore
|
||||
new (dt: Api<any>, settings: boolean | ConfigColReorder);
|
||||
|
||||
/**
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
|||
* https://github.com/running-coder/jquery-typeahead/issues/156
|
||||
* TODO: Replace this minimum definition by the official one when it comes out.
|
||||
*/
|
||||
/// <reference path="jquery.d.ts" />
|
||||
/// <reference types="jquery" />
|
||||
|
||||
interface JQueryTypeaheadParam {
|
||||
input: string;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="jquery.d.ts"/>
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
declare namespace JQueryUI {
|
||||
// Accordion //////////////////////////////////////////////////
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1163,15 +1163,12 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
|
|||
)}"`,
|
||||
).then(
|
||||
(documents: DataModels.DocumentId[]) => {
|
||||
$.each(
|
||||
documents,
|
||||
(index: number, doc: { _graph_icon_property_value: string; icon: string; format: string }) => {
|
||||
newIconsMap[doc["_graph_icon_property_value"]] = {
|
||||
data: doc["icon"],
|
||||
format: doc["format"],
|
||||
};
|
||||
},
|
||||
);
|
||||
$.each(documents, (index: number, doc: any) => {
|
||||
newIconsMap[doc["_graph_icon_property_value"]] = {
|
||||
data: doc["icon"],
|
||||
format: doc["format"],
|
||||
};
|
||||
});
|
||||
|
||||
// Update graph configuration
|
||||
this.setState({
|
||||
|
|
|
@ -29,7 +29,7 @@ export class PanelContainerComponent extends React.Component<PanelContainerProps
|
|||
};
|
||||
}
|
||||
|
||||
omponentDidMount(): void {
|
||||
componentDidMount(): void {
|
||||
window.addEventListener("resize", () => this.setState({ height: this.getPanelHeight() }));
|
||||
}
|
||||
|
||||
|
@ -62,12 +62,12 @@ export class PanelContainerComponent extends React.Component<PanelContainerProps
|
|||
customWidth={this.props.panelWidth ? this.props.panelWidth : "440px"}
|
||||
headerClassName="panelHeader"
|
||||
onRenderNavigationContent={this.props.onRenderNavigationContent}
|
||||
isFooterAtBottom={true}
|
||||
styles={{
|
||||
navigation: { borderBottom: "1px solid #cccccc" },
|
||||
content: { padding: 0, height: "100%" },
|
||||
scrollableContent: { height: "100%" },
|
||||
content: { padding: 0 },
|
||||
header: { padding: "0 0 8px 34px" },
|
||||
commands: { marginTop: 8 },
|
||||
commands: { marginTop: 8, paddingTop: 0 },
|
||||
}}
|
||||
style={{ height: this.state.height }}
|
||||
>
|
||||
|
|
|
@ -6,6 +6,7 @@ exports[`PaneContainerComponent test should be resize if notification console is
|
|||
customWidth="440px"
|
||||
headerClassName="panelHeader"
|
||||
headerText="test"
|
||||
isFooterAtBottom={true}
|
||||
isLightDismiss={true}
|
||||
isOpen={true}
|
||||
onDismiss={[Function]}
|
||||
|
@ -18,9 +19,9 @@ exports[`PaneContainerComponent test should be resize if notification console is
|
|||
Object {
|
||||
"commands": Object {
|
||||
"marginTop": 8,
|
||||
"paddingTop": 0,
|
||||
},
|
||||
"content": Object {
|
||||
"height": "100%",
|
||||
"padding": 0,
|
||||
},
|
||||
"header": Object {
|
||||
|
@ -29,9 +30,6 @@ exports[`PaneContainerComponent test should be resize if notification console is
|
|||
"navigation": Object {
|
||||
"borderBottom": "1px solid #cccccc",
|
||||
},
|
||||
"scrollableContent": Object {
|
||||
"height": "100%",
|
||||
},
|
||||
}
|
||||
}
|
||||
type={7}
|
||||
|
@ -48,6 +46,7 @@ exports[`PaneContainerComponent test should render with panel content and header
|
|||
customWidth="440px"
|
||||
headerClassName="panelHeader"
|
||||
headerText="test"
|
||||
isFooterAtBottom={true}
|
||||
isLightDismiss={true}
|
||||
isOpen={true}
|
||||
onDismiss={[Function]}
|
||||
|
@ -60,9 +59,9 @@ exports[`PaneContainerComponent test should render with panel content and header
|
|||
Object {
|
||||
"commands": Object {
|
||||
"marginTop": 8,
|
||||
"paddingTop": 0,
|
||||
},
|
||||
"content": Object {
|
||||
"height": "100%",
|
||||
"padding": 0,
|
||||
},
|
||||
"header": Object {
|
||||
|
@ -71,9 +70,6 @@ exports[`PaneContainerComponent test should render with panel content and header
|
|||
"navigation": Object {
|
||||
"borderBottom": "1px solid #cccccc",
|
||||
},
|
||||
"scrollableContent": Object {
|
||||
"height": "100%",
|
||||
},
|
||||
}
|
||||
}
|
||||
type={7}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import * as ko from "knockout";
|
||||
import * as _ from "underscore";
|
||||
|
||||
import * as DataTable from "datatables.net-dt";
|
||||
import loadingIndicator3Squares from "../../../../images/LoadingIndicator_3Squares.gif";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import * as Constants from "../Constants";
|
||||
import * as Entities from "../Entities";
|
||||
|
@ -94,7 +96,7 @@ function createDataTable(
|
|||
});
|
||||
}
|
||||
|
||||
tableEntityListViewModel.table = DataTableBuilder.createDataTable($dataTable, <DataTables.Settings>{
|
||||
tableEntityListViewModel.table = DataTableBuilder.createDataTable($dataTable, <DataTable.Config>{
|
||||
// WARNING!!! SECURITY: If you add new columns, make sure you encode them if they are user strings from Azure (see encodeText)
|
||||
// so that they don't get interpreted as HTML in our page.
|
||||
colReorder: true,
|
||||
|
@ -116,7 +118,7 @@ function createDataTable(
|
|||
sPrevious: "<",
|
||||
sLast: ">>",
|
||||
},
|
||||
sProcessing: '<img style="width: 28px; height: 6px; " src="images/LoadingIndicator_3Squares.gif">',
|
||||
sProcessing: `<img style="width: 28px; height: 6px; " src="${loadingIndicator3Squares}">`,
|
||||
oAria: {
|
||||
sSortAscending: "",
|
||||
sSortDescending: "",
|
||||
|
@ -345,7 +347,7 @@ function updateSelectionStatus(oSettings: any): void {
|
|||
// TODO consider centralizing this "post-command" logic into some sort of Command Manager entity.
|
||||
// See VSO:166520: "[Storage Explorer] Consider adding a 'command manager' to track command post-effects."
|
||||
function updateDataTableFocus(queryTablesTabId: string): void {
|
||||
var $activeElement: JQuery = $(document.activeElement);
|
||||
var $activeElement: JQuery<Element> = $(document.activeElement);
|
||||
var isFocusLost: boolean = $activeElement.is("body"); // When focus is lost, "body" becomes the active element.
|
||||
var storageExplorerFrameHasFocus: boolean = document.hasFocus();
|
||||
var operationManager = tableEntityListViewModelMap[queryTablesTabId].operationManager;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as DataTable from "datatables.net-dt";
|
||||
import * as Utilities from "../Utilities";
|
||||
|
||||
/**
|
||||
|
@ -8,7 +9,7 @@ import * as Utilities from "../Utilities";
|
|||
* @param{$dataTableElem} JQuery data table element
|
||||
* @param{$settings} Settings to use when creating the data table
|
||||
*/
|
||||
export function createDataTable($dataTableElem: JQuery, settings: any): DataTables.DataTable {
|
||||
export function createDataTable($dataTableElem: JQuery, settings: any): DataTable.Api<HTMLElement> {
|
||||
return $dataTableElem.DataTable(applyDefaultRendering(settings));
|
||||
}
|
||||
|
||||
|
@ -18,14 +19,14 @@ export function createDataTable($dataTableElem: JQuery, settings: any): DataTabl
|
|||
* @param{settings} The settings to check
|
||||
* @return The given settings with all columns having a rendering function
|
||||
*/
|
||||
function applyDefaultRendering(settings: any): DataTables.SettingsLegacy {
|
||||
var tableColumns: DataTables.ColumnLegacy[] = null;
|
||||
function applyDefaultRendering(settings: DataTable.Config): any {
|
||||
var tableColumns: any[] = null;
|
||||
|
||||
if (settings.aoColumns) {
|
||||
tableColumns = settings.aoColumns;
|
||||
} else if (settings.aoColumnDefs) {
|
||||
if (settings.columns) {
|
||||
tableColumns = settings.columns;
|
||||
} else if (settings.columnDefs) {
|
||||
// for tables we use aoColumnDefs instead of aoColumns
|
||||
tableColumns = settings.aoColumnDefs;
|
||||
tableColumns = settings.columnDefs;
|
||||
}
|
||||
|
||||
// either the settings had no columns defined, or they were called
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import ko from "knockout";
|
||||
|
||||
import * as DataTableOperations from "./DataTableOperations";
|
||||
import * as Constants from "../Constants";
|
||||
import * as Entities from "../Entities";
|
||||
import * as Utilities from "../Utilities";
|
||||
import * as DataTableOperations from "./DataTableOperations";
|
||||
import TableCommands from "./TableCommands";
|
||||
import TableEntityListViewModel from "./TableEntityListViewModel";
|
||||
import * as Utilities from "../Utilities";
|
||||
import * as Entities from "../Entities";
|
||||
|
||||
/*
|
||||
* Base class for data table row selection.
|
||||
|
@ -13,9 +13,9 @@ import * as Entities from "../Entities";
|
|||
export default class DataTableOperationManager {
|
||||
private _tableEntityListViewModel: TableEntityListViewModel;
|
||||
private _tableCommands: TableCommands;
|
||||
private dataTable: JQuery;
|
||||
private dataTable: JQuery<Element>;
|
||||
|
||||
constructor(table: JQuery, viewModel: TableEntityListViewModel, tableCommands: TableCommands) {
|
||||
constructor(table: JQuery<Element>, viewModel: TableEntityListViewModel, tableCommands: TableCommands) {
|
||||
this.dataTable = table;
|
||||
this._tableEntityListViewModel = viewModel;
|
||||
this._tableCommands = tableCommands;
|
||||
|
@ -25,7 +25,7 @@ export default class DataTableOperationManager {
|
|||
}
|
||||
|
||||
private click = (event: JQueryEventObject) => {
|
||||
var elem: JQuery = $(event.currentTarget);
|
||||
var elem: JQuery<Element> = $(event.currentTarget);
|
||||
this.updateLastSelectedItem(elem, event.shiftKey);
|
||||
|
||||
if (Utilities.isEnvironmentCtrlPressed(event)) {
|
||||
|
@ -48,7 +48,7 @@ export default class DataTableOperationManager {
|
|||
|
||||
if (isUpArrowKey || isDownArrowKey) {
|
||||
var lastSelectedItem: Entities.ITableEntity = this._tableEntityListViewModel.lastSelectedItem;
|
||||
var dataTableRows: JQuery = $(Constants.htmlSelectors.dataTableAllRowsSelector);
|
||||
var dataTableRows: JQuery<Element> = $(Constants.htmlSelectors.dataTableAllRowsSelector);
|
||||
var maximumIndex = dataTableRows.length - 1;
|
||||
|
||||
// If can't find an index for lastSelectedItem, then either no item is previously selected or it goes across page.
|
||||
|
@ -60,7 +60,7 @@ export default class DataTableOperationManager {
|
|||
: -1;
|
||||
var nextIndex: number = isUpArrowKey ? lastSelectedItemIndex - 1 : lastSelectedItemIndex + 1;
|
||||
var safeIndex: number = Utilities.ensureBetweenBounds(nextIndex, 0, maximumIndex);
|
||||
var selectedRowElement: JQuery = dataTableRows.eq(safeIndex);
|
||||
var selectedRowElement: JQuery<Element> = dataTableRows.eq(safeIndex);
|
||||
|
||||
if (selectedRowElement) {
|
||||
if (event.shiftKey) {
|
||||
|
@ -143,13 +143,13 @@ export default class DataTableOperationManager {
|
|||
return handled;
|
||||
}
|
||||
|
||||
private getEntityIdentity($elem: JQuery): Entities.ITableEntityIdentity {
|
||||
private getEntityIdentity($elem: JQuery<Element>): Entities.ITableEntityIdentity {
|
||||
return {
|
||||
RowKey: $elem.attr(Constants.htmlAttributeNames.dataTableRowKeyAttr),
|
||||
};
|
||||
}
|
||||
|
||||
private updateLastSelectedItem($elem: JQuery, isShiftSelect: boolean) {
|
||||
private updateLastSelectedItem($elem: JQuery<Element>, isShiftSelect: boolean) {
|
||||
var entityIdentity: Entities.ITableEntityIdentity = this.getEntityIdentity($elem);
|
||||
var entity = this._tableEntityListViewModel.getItemFromCurrentPage(
|
||||
this._tableEntityListViewModel.getTableEntityKeys(entityIdentity.RowKey),
|
||||
|
@ -162,7 +162,7 @@ export default class DataTableOperationManager {
|
|||
}
|
||||
}
|
||||
|
||||
private applySingleSelection($elem: JQuery) {
|
||||
private applySingleSelection($elem: JQuery<Element>) {
|
||||
if ($elem) {
|
||||
var entityIdentity: Entities.ITableEntityIdentity = this.getEntityIdentity($elem);
|
||||
|
||||
|
@ -179,7 +179,7 @@ export default class DataTableOperationManager {
|
|||
);
|
||||
}
|
||||
|
||||
private applyCtrlSelection($elem: JQuery): void {
|
||||
private applyCtrlSelection($elem: JQuery<Element>): void {
|
||||
var koSelected: ko.ObservableArray<Entities.ITableEntity> = this._tableEntityListViewModel
|
||||
? this._tableEntityListViewModel.selected
|
||||
: null;
|
||||
|
@ -200,7 +200,7 @@ export default class DataTableOperationManager {
|
|||
}
|
||||
}
|
||||
|
||||
private applyShiftSelection($elem: JQuery): void {
|
||||
private applyShiftSelection($elem: JQuery<Element>): void {
|
||||
var anchorItem = this._tableEntityListViewModel.lastSelectedAnchorItem;
|
||||
|
||||
// If anchor item doesn't exist, use the first available item of current page instead
|
||||
|
@ -228,7 +228,7 @@ export default class DataTableOperationManager {
|
|||
}
|
||||
}
|
||||
|
||||
private applyContextMenuSelection($elem: JQuery) {
|
||||
private applyContextMenuSelection($elem: JQuery<Element>) {
|
||||
var entityIdentity: Entities.ITableEntityIdentity = this.getEntityIdentity($elem);
|
||||
|
||||
if (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as DataTables from "datatables.net";
|
||||
import Q from "q";
|
||||
import _ from "underscore";
|
||||
import * as QueryBuilderConstants from "../Constants";
|
||||
|
@ -13,7 +14,7 @@ export function getRowSelector(selectorSchema: Entities.IProperty[]): string {
|
|||
return QueryBuilderConstants.htmlSelectors.dataTableAllRowsSelector + selector;
|
||||
}
|
||||
|
||||
export function isRowVisible(dataTableScrollBodyQuery: JQuery, element: HTMLElement): boolean {
|
||||
export function isRowVisible(dataTableScrollBodyQuery: JQuery<Element>, element: Element): boolean {
|
||||
let isVisible = false;
|
||||
|
||||
if (dataTableScrollBodyQuery.length && element) {
|
||||
|
@ -26,16 +27,18 @@ export function isRowVisible(dataTableScrollBodyQuery: JQuery, element: HTMLElem
|
|||
return isVisible;
|
||||
}
|
||||
|
||||
export function scrollToRowIfNeeded(dataTableRows: JQuery, currentIndex: number, isScrollUp: boolean): void {
|
||||
export function scrollToRowIfNeeded(dataTableRows: JQuery<Element>, currentIndex: number, isScrollUp: boolean): void {
|
||||
if (dataTableRows.length) {
|
||||
const dataTableScrollBodyQuery: JQuery = $(QueryBuilderConstants.htmlSelectors.dataTableScrollBodySelector),
|
||||
selectedRowElement: HTMLElement = dataTableRows.get(currentIndex);
|
||||
const dataTableScrollBodyQuery: JQuery<Element> = $(
|
||||
QueryBuilderConstants.htmlSelectors.dataTableScrollBodySelector,
|
||||
),
|
||||
selectedRowElement: Element = dataTableRows.get(currentIndex);
|
||||
|
||||
if (dataTableScrollBodyQuery.length && selectedRowElement) {
|
||||
const isVisible: boolean = isRowVisible(dataTableScrollBodyQuery, selectedRowElement);
|
||||
|
||||
if (!isVisible) {
|
||||
const selectedRowQuery: JQuery = $(selectedRowElement),
|
||||
const selectedRowQuery: JQuery<Element> = $(selectedRowElement),
|
||||
scrollPosition: number = dataTableScrollBodyQuery.scrollTop(),
|
||||
selectedElementPosition: number = selectedRowQuery.position().top;
|
||||
let newScrollPosition = 0;
|
||||
|
@ -54,8 +57,8 @@ export function scrollToRowIfNeeded(dataTableRows: JQuery, currentIndex: number,
|
|||
}
|
||||
|
||||
export function scrollToTopIfNeeded(): void {
|
||||
const $dataTableRows: JQuery = $(QueryBuilderConstants.htmlSelectors.dataTableAllRowsSelector),
|
||||
$dataTableScrollBody: JQuery = $(QueryBuilderConstants.htmlSelectors.dataTableScrollBodySelector);
|
||||
const $dataTableRows: JQuery<Element> = $(QueryBuilderConstants.htmlSelectors.dataTableAllRowsSelector),
|
||||
$dataTableScrollBody: JQuery<Element> = $(QueryBuilderConstants.htmlSelectors.dataTableScrollBodySelector);
|
||||
|
||||
if ($dataTableRows.length && $dataTableScrollBody.length) {
|
||||
$dataTableScrollBody.scrollTop(0);
|
||||
|
@ -71,7 +74,7 @@ export function setPaginationButtonEventHandlers(): void {
|
|||
.attr("role", "button");
|
||||
}
|
||||
|
||||
export function filterColumns(table: DataTables.DataTable, settings: boolean[]): void {
|
||||
export function filterColumns(table: DataTables.Api<HTMLElement>, settings: boolean[]): void {
|
||||
settings &&
|
||||
settings.forEach((value: boolean, index: number) => {
|
||||
table.column(index).visible(value, false);
|
||||
|
@ -84,7 +87,7 @@ export function filterColumns(table: DataTables.DataTable, settings: boolean[]):
|
|||
* If no current order is specified, reorder the columns based on intial order.
|
||||
*/
|
||||
export function reorderColumns(
|
||||
table: DataTables.DataTable,
|
||||
table: DataTables.Api<HTMLElement>,
|
||||
targetOrder: number[],
|
||||
currentOrder?: number[],
|
||||
//eslint-disable-next-line
|
||||
|
@ -108,7 +111,9 @@ export function reorderColumns(
|
|||
? calculateTransformationOrder(currentOrder, targetOrder)
|
||||
: targetOrder;
|
||||
try {
|
||||
$.fn.dataTable.ColReorder(table).fnOrder(transformationOrder);
|
||||
// TODO: This possibly does not work with the new version of datatables.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
($.fn.dataTable as any).ColReorder(table).fnOrder(transformationOrder);
|
||||
} catch (err) {
|
||||
return Q.reject(err);
|
||||
}
|
||||
|
@ -116,9 +121,9 @@ export function reorderColumns(
|
|||
return Q.resolve(null);
|
||||
}
|
||||
|
||||
export function resetColumns(table: DataTables.DataTable): void {
|
||||
$.fn.dataTable.ColReorder(table).fnReset();
|
||||
}
|
||||
// export function resetColumns(table: DataTables.DataTable): void {
|
||||
// $.fn.dataTable.ColReorder(table).fnReset();
|
||||
// }
|
||||
|
||||
/**
|
||||
* A table's initial order is described in the form of a natural ascending order.
|
||||
|
@ -133,8 +138,10 @@ export function getInitialOrder(columnsCount: number): number[] {
|
|||
* Initial order: I = [0, 1, 2, 3, 4, 5, 6, 7, 8] <----> {prop0, prop1, prop2, prop3, prop4, prop5, prop6, prop7, prop8}
|
||||
* Current order: C = [0, 1, 2, 6, 7, 3, 4, 5, 8] <----> {prop0, prop1, prop2, prop6, prop7, prop3, prop4, prop5, prop8}
|
||||
*/
|
||||
export function getCurrentOrder(table: DataTables.DataTable): number[] {
|
||||
return $.fn.dataTable.ColReorder(table).fnOrder();
|
||||
export function getCurrentOrder(table: DataTables.Api<HTMLElement>): number[] {
|
||||
// TODO: This possibly does not work with the new version of datatables.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return ($.fn.dataTable as any).ColReorder(table).fnOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,8 +185,8 @@ export function calculateTransformationOrder(currentOrder: number[], targetOrder
|
|||
return transformationOrder;
|
||||
}
|
||||
|
||||
export function getDataTableHeaders(table: DataTables.DataTable): string[] {
|
||||
const columns: DataTables.ColumnsMethods = table.columns();
|
||||
export function getDataTableHeaders(table: DataTables.Api<HTMLElement>): string[] {
|
||||
const columns = table.columns();
|
||||
let headers: string[] = [];
|
||||
if (columns) {
|
||||
// table.columns() return ColumnsMethods which is an array of arrays
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import * as ko from "knockout";
|
||||
import * as _ from "underscore";
|
||||
|
||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import CacheBase from "./CacheBase";
|
||||
import { ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||
import * as DataTables from "datatables.net";
|
||||
import * as CommonConstants from "../../../Common/Constants";
|
||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import * as Constants from "../Constants";
|
||||
import * as Entities from "../Entities";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { QueryIterator, ItemDefinition, Resource } from "@azure/cosmos";
|
||||
import CacheBase from "./CacheBase";
|
||||
|
||||
// This is the format of the data we will have to pass to Datatable render callback,
|
||||
// and property names are defined by Datatable as well.
|
||||
|
@ -27,7 +28,7 @@ abstract class DataTableViewModel {
|
|||
public items = ko.observableArray<Entities.ITableEntity>();
|
||||
public selected = ko.observableArray<Entities.ITableEntity>();
|
||||
|
||||
public table: DataTables.DataTable;
|
||||
public table: DataTables.Api<HTMLElement>;
|
||||
|
||||
// The anchor item is for shift selection. i.e., select all items between anchor item and a give item.
|
||||
public lastSelectedAnchorItem: Entities.ITableEntity;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as DataTables from "datatables.net";
|
||||
import * as ko from "knockout";
|
||||
import Q from "q";
|
||||
import * as _ from "underscore";
|
||||
|
@ -131,7 +132,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
|
|||
return [{ key: Constants.EntityKeyNames.RowKey, value: rowKey }];
|
||||
}
|
||||
|
||||
public reloadTable(useSetting: boolean = true, resetHeaders: boolean = true): DataTables.DataTable {
|
||||
public reloadTable(useSetting: boolean = true, resetHeaders: boolean = true): DataTables.Api<Element> {
|
||||
this.clearCache();
|
||||
this.clearSelection();
|
||||
this.isCancelled = false;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as DataTable from "datatables.net-dt";
|
||||
import * as ko from "knockout";
|
||||
import { KeyCodes } from "../../../Common/Constants";
|
||||
import { userContext } from "../../../UserContext";
|
||||
|
@ -643,7 +644,7 @@ export default class QueryBuilderViewModel {
|
|||
return groupViewModels;
|
||||
};
|
||||
|
||||
public runQuery = (): DataTables.DataTable => {
|
||||
public runQuery = (): DataTable.Api<Element> => {
|
||||
return this._queryViewModel.runQuery();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import * as DataTables from "datatables.net";
|
||||
import * as ko from "knockout";
|
||||
import React from "react";
|
||||
import * as _ from "underscore";
|
||||
import { KeyCodes } from "../../../Common/Constants";
|
||||
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||
import { userContext } from "../../../UserContext";
|
||||
import { useSidePanel } from "../../../hooks/useSidePanel";
|
||||
import { TableQuerySelectPanel } from "../../Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
||||
import QueryTablesTab from "../../Tabs/QueryTablesTab";
|
||||
import { getQuotedCqlIdentifier } from "../CqlUtilities";
|
||||
|
@ -158,7 +159,7 @@ export default class QueryViewModel {
|
|||
notify: "always",
|
||||
});
|
||||
|
||||
public runQuery = (): DataTables.DataTable => {
|
||||
public runQuery = (): DataTables.Api<Element> => {
|
||||
let filter = this.setFilter();
|
||||
if (filter && userContext.apiType !== "Cassandra") {
|
||||
filter = filter.replace(/"/g, "'");
|
||||
|
@ -176,7 +177,7 @@ export default class QueryViewModel {
|
|||
return this._tableEntityListViewModel.reloadTable(/*useSetting*/ false, /*resetHeaders*/ false);
|
||||
};
|
||||
|
||||
public clearQuery = (): DataTables.DataTable => {
|
||||
public clearQuery = (): DataTables.Api<Element> => {
|
||||
this.queryText();
|
||||
this.topValue();
|
||||
this.selectText();
|
||||
|
|
|
@ -281,7 +281,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||
query,
|
||||
paginationToken,
|
||||
},
|
||||
beforeSend: this.setAuthorizationHeader,
|
||||
beforeSend: this.setAuthorizationHeader as any,
|
||||
cache: false,
|
||||
});
|
||||
shouldNotify &&
|
||||
|
@ -423,7 +423,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||
keyspaceId: collection.databaseId,
|
||||
tableId: collection.id(),
|
||||
},
|
||||
beforeSend: this.setAuthorizationHeader,
|
||||
beforeSend: this.setAuthorizationHeader as any,
|
||||
cache: false,
|
||||
})
|
||||
.then(
|
||||
|
@ -463,7 +463,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||
keyspaceId: collection.databaseId,
|
||||
tableId: collection.id(),
|
||||
},
|
||||
beforeSend: this.setAuthorizationHeader,
|
||||
beforeSend: this.setAuthorizationHeader as any,
|
||||
cache: false,
|
||||
})
|
||||
.then(
|
||||
|
@ -496,7 +496,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||
resourceId: resourceId,
|
||||
query: query,
|
||||
},
|
||||
beforeSend: this.setAuthorizationHeader,
|
||||
beforeSend: this.setAuthorizationHeader as any,
|
||||
cache: false,
|
||||
}).then(
|
||||
(data: any) => {
|
||||
|
|
Loading…
Reference in New Issue