Skip to content

Commit

Permalink
Merge pull request #101 from mendix/feat/removing-warnings
Browse files Browse the repository at this point in the history
Removing warnings
  • Loading branch information
diego-antonelli committed Jun 22, 2021
2 parents 329419a + b1eced2 commit f1d42a6
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 40 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## 1.3.14 - 2021-06-22

### Fixed

- We fixed all `logger` deprecated warnings being thrown during the execution.

## 1.3.13 - 2021-06-02

### Fixed

- Fixed an issue introduced in v1.3.12 where if the list view's search is not enabled, then the widget would error on any list view control widget interaction.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "list-view-controls",
"widgetName": "ListViewControls",
"version": "1.3.13",
"version": "1.3.14",
"description": "Search and filter Mendix list views",
"copyright": "Mendix BV",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/CheckBoxFilter/components/CheckBoxFilterContainer.ts
Expand Up @@ -127,7 +127,7 @@ export default class CheckboxFilterContainer extends Component<ContainerProps, C

private applyFilter(isChecked: boolean, restoreState = false) {
if (this.dataSourceHelper) {
logger.debug(this.props.uniqueid, "applyFilter", isChecked, this.props.group);
mx.logger.debug(this.props.uniqueid, "applyFilter", isChecked, this.props.group);
this.dataSourceHelper.setConstraint(this.props.uniqueid, this.getConstraint(isChecked), this.props.group, restoreState);
this.setState({ isChecked });
}
Expand Down
2 changes: 1 addition & 1 deletion src/DropDownFilter/components/DropDownFilterContainer.ts
Expand Up @@ -148,7 +148,7 @@ export default class DropDownFilterContainer extends Component<ContainerProps, C
private applyFilter(selectedFilter: FilterProps, restoreState = false) {
const constraint = this.getConstraint(selectedFilter);
if (this.dataSourceHelper) {
logger.debug(this.props, this.props.uniqueid, "applyFilter", constraint);
mx.logger.debug(this.props, this.props.uniqueid, "applyFilter", constraint);
this.dataSourceHelper.setConstraint(this.props.uniqueid, constraint, undefined, restoreState);
}
this.setState({ selectedOption: selectedFilter });
Expand Down
2 changes: 1 addition & 1 deletion src/DropDownSort/components/DropDownSortContainer.ts
Expand Up @@ -162,7 +162,7 @@ export default class DropDownSortContainer extends Component<ContainerProps, Con
const { targetListView } = this.state;

if (targetListView && this.dataSourceHelper) {
logger.debug(this.props.uniqueid, "updateSort", selectedOption.name, selectedOption.sort);
mx.logger.debug(this.props.uniqueid, "updateSort", selectedOption.name, selectedOption.sort);
this.dataSourceHelper.setSorting(this.props.uniqueid, [ selectedOption.name, selectedOption.sort ], restoreState);
this.setState({ selectedOption });
this.publishWidgetChanges(selectedOption);
Expand Down
30 changes: 15 additions & 15 deletions src/Pagination/components/PaginationContainer.ts
Expand Up @@ -52,7 +52,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
constructor(props: ModelerProps) {
super(props);

logger.debug(this.props.uniqueid, ".constructor");
mx.logger.debug(this.props.uniqueid, ".constructor");

this.updateListView = this.updateListView.bind(this);
this.translateMessageStatus = this.translateMessageStatus.bind(this);
Expand All @@ -76,21 +76,21 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

async componentDidMount() {
logger.debug(this.props.uniqueid, ".componentDidMount");
mx.logger.debug(this.props.uniqueid, ".componentDidMount");
const isValidConfig = !!mx.session.getConfig("uiconfig.translations");
if (!isValidConfig) {
try {
await getTranslations();
} catch (e) {
logger.debug(this.props.uniqueid, ".loadingTranslations", e.message);
mx.logger.debug(this.props.uniqueid, ".loadingTranslations", e.message);
}
this.setState({ loadTranslations: true });
}
SharedUtils.delay(this.connectToListView.bind(this), this.checkListViewAvailable.bind(this), 20);
}

render() {
logger.debug(this.props.uniqueid, ".render");
mx.logger.debug(this.props.uniqueid, ".render");
return createElement("div",
{
className: classNames("widget-pagination", this.props.class),
Expand All @@ -105,7 +105,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

componentWillUnmount() {
logger.debug(this.props.uniqueid, ".componentWillUnmount");
mx.logger.debug(this.props.uniqueid, ".componentWillUnmount");
showLoadMoreButton(this.state.targetListView);
this.viewStateManager.destroy();
}
Expand All @@ -115,7 +115,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

private checkListViewAvailable(): boolean {
logger.debug(this.props.uniqueid, ".checkListViewAvailable");
mx.logger.debug(this.props.uniqueid, ".checkListViewAvailable");
if (!this.widgetDom) {
return false;
}
Expand All @@ -129,11 +129,11 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

private renderPageButton(): ReactNode {
logger.debug(this.props.uniqueid, ".renderPageButton");
mx.logger.debug(this.props.uniqueid, ".renderPageButton");

if (this.state.validationPassed && this.state.pageSize && this.state.targetListView!._datasource.getSetSize() > 0) {
const { offset, pageSize } = this.state;
logger.debug(this.props.uniqueid, ".renderPageButton pagesize, offset, listsize", pageSize, offset, this.state.targetListView!._datasource.getSetSize());
mx.logger.debug(this.props.uniqueid, ".renderPageButton pagesize, offset, listsize", pageSize, offset, this.state.targetListView!._datasource.getSetSize());

return createElement(Pagination, {
getMessageStatus: this.translateMessageStatus,
Expand All @@ -152,7 +152,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

public updateListView(offSet?: number, pageSize?: number) {
logger.debug(this.props.uniqueid, ".updateListView");
mx.logger.debug(this.props.uniqueid, ".updateListView");
if (this.state.validationPassed) {
this.setState({
offset: offSet !== undefined ? offSet : this.state.offset,
Expand Down Expand Up @@ -194,10 +194,10 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

private beforeListViewDataRender(targetListView: DataSourceHelperListView) {
logger.debug(this.props.uniqueid, ".beforeListViewDataRender");
mx.logger.debug(this.props.uniqueid, ".beforeListViewDataRender");

dojoAspect.before(targetListView, "_renderData", () => {
logger.debug(this.props.uniqueid, "_renderData.before");
mx.logger.debug(this.props.uniqueid, "_renderData.before");

const datasource = targetListView._datasource;
if (datasource.getSetSize() === 0) {
Expand Down Expand Up @@ -229,7 +229,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
listSize: datasource.getSetSize()
});
} else {
logger.debug(this.props.uniqueid, ".initialLoading False, pagingLoading False");
mx.logger.debug(this.props.uniqueid, ".initialLoading False, pagingLoading False");
const previousOffset = this.state.offset;
const listSize = datasource.getSetSize();
let offset = previousOffset;
Expand Down Expand Up @@ -258,7 +258,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

private afterListViewLoaded(targetListView: DataSourceHelperListView) {
logger.debug(this.props.uniqueid, ".afterListViewLoad");
mx.logger.debug(this.props.uniqueid, ".afterListViewLoad");
// Initial load of list view, also take in account the previous page state
const datasource = targetListView._datasource;
const pageSize = this.state.pageSize ? this.state.pageSize : datasource.getPageSize() && datasource.getPageSize() || 10;
Expand All @@ -271,9 +271,9 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
}

private afterListViewDataRender(targetListView: DataSourceHelperListView) {
logger.debug(this.props.uniqueid, ".afterListViewDataRender");
mx.logger.debug(this.props.uniqueid, ".afterListViewDataRender");
dojoAspect.after(targetListView, "_renderData", () => {
logger.debug(this.props.uniqueid, "_renderData.after");
mx.logger.debug(this.props.uniqueid, "_renderData.after");
resetListViewHeight(targetListView.domNode as HTMLElement);
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/Pagination/utils/ContainerUtils.ts
Expand Up @@ -44,7 +44,7 @@ export const getListNode = (targetNode: HTMLElement): HTMLUListElement => {
};

export const setListNodeToEmpty = (targetNode: HTMLElement) => {
logger.debug("setListNodeToEmpty");
mx.logger.debug("setListNodeToEmpty");
// Explicitly remove children as IE does not like listNode.innerHTML = "";
const listNode = targetNode.querySelector("ul") as HTMLUListElement;
while (listNode.firstChild) {
Expand All @@ -53,12 +53,12 @@ export const setListNodeToEmpty = (targetNode: HTMLElement) => {
};

export const showLoader = (targetListView: DataSourceHelperListView) => {
logger.debug("showLoader");
mx.logger.debug("showLoader");
targetListView.domNode.classList.add("widget-pagination-loading");
};

export const hideLoader = (targetListView: DataSourceHelperListView) => {
logger.debug("hideLoader");
mx.logger.debug("hideLoader");
targetListView.domNode.classList.remove("widget-pagination-loading");
};

Expand All @@ -84,6 +84,6 @@ export const getTranslations = async (): Promise<void> => {
const localeIndex = metadataJson.languages.indexOf(localeCode);
window.__widgets_translations = Object.keys(systemTexts).reduce((translations, currentKey) => ({ ...translations, [currentKey]: systemTexts[currentKey][localeIndex] }), {});
} else {
logger.error("Error while loading translations");
mx.logger.error("Error while loading translations");
}
};
18 changes: 9 additions & 9 deletions src/Shared/DataSourceHelper/DataSourceHelper.ts
Expand Up @@ -47,7 +47,7 @@ export class DataSourceHelper {
this.originalSort = window.mx.isOffline() ? this.widget._datasource._sort : this.widget._datasource._sorting;

aspect.after(widget, "storeState", (store: (key: string, value: any) => void) => {
logger.debug("after storeState");
mx.logger.debug("after storeState");
if (widget.__customWidgetDataSourceHelper) {
const sorting = widget.__customWidgetDataSourceHelper.sorting && widget.__customWidgetDataSourceHelper.originalSort;
store("lvcSorting", sorting);
Expand Down Expand Up @@ -98,13 +98,13 @@ export class DataSourceHelper {
}

private registerUpdate(restoreState: boolean) {
logger.debug("DataSourceHelper .registerUpdate");
mx.logger.debug("DataSourceHelper .registerUpdate");
if (this.timeoutHandle) {
window.clearTimeout(this.timeoutHandle);
}
if (!this.updateInProgress) {
this.timeoutHandle = window.setTimeout(() => {
logger.debug("DataSourceHelper .execute");
mx.logger.debug("DataSourceHelper .execute");
this.updateInProgress = true;
// TODO Check if there's currently no update happening on the listView coming from another
// Feature/functionality/widget which does not use DataSourceHelper
Expand Down Expand Up @@ -215,12 +215,12 @@ export class DataSourceHelper {
} else {
this.widget._datasource._sorting = sorting;
}
logger.debug("DataSourceHelper .set sort and constraint");
mx.logger.debug("DataSourceHelper .set sort and constraint");
const offset = this.widget._datasource.getOffset();
const pageSize = this.widget._datasource.getPageSize();
if (!this.widget.__lvcPagingEnabled && offset > 0) {
// In case load more is used, the data source have to reload the full content
logger.debug("reset offset");
mx.logger.debug("reset offset");
this.widget._datasource.setOffset(0);
this.widget._datasource.setPageSize(pageSize + offset);
}
Expand All @@ -229,9 +229,9 @@ export class DataSourceHelper {
}

this.widget.update(null, () => {
logger.debug("DataSourceHelper .updated");
mx.logger.debug("DataSourceHelper .updated");
if (!this.widget.__lvcPagingEnabled && offset > 0) {
logger.debug("restore offset");
mx.logger.debug("restore offset");
// Restore the original paging and offset for load more.
this.widget._datasource.setOffset(offset);
this.widget._datasource.setPageSize(pageSize);
Expand Down Expand Up @@ -291,13 +291,13 @@ export class DataSourceHelper {
};

if (changed) {
logger.debug(".updateDatasource changed", offset, pageSize);
mx.logger.debug(".updateDatasource changed", offset, pageSize);
this.widget.__customWidgetPagingLoading = true;
this.showLoader();
this.widget.sequence([ "_sourceReload", "_renderData" ], () => {
this.widget.__customWidgetPagingLoading = false;
resetListViewHeight(this.widget.domNode);
logger.debug(".updateDatasource updated");
mx.logger.debug(".updateDatasource updated");
this.hideLoader();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/FormViewState.ts
Expand Up @@ -14,7 +14,7 @@ export class FormViewState<T> {
const mxform = this.form;
const widgetViewState = mxform && mxform.viewState ? mxform.viewState[this.widgetId] : void 0;
const state = widgetViewState && widgetViewState[key] !== undefined ? widgetViewState[key] : defaultValue;
logger.debug("getPageState", this.widgetId, key, defaultValue, state);
mx.logger.debug("getPageState", this.widgetId, key, defaultValue, state);
return state;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Shared/ListViewPrototype.ts
Expand Up @@ -13,7 +13,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH
ListView.prototype.__lvcPrototypeUpdated = true;
ListView.prototype.__postCreateOriginal = ListView.prototype.postCreate;
ListView.prototype.postCreate = function(this: DataSourceHelperListView) {
logger.debug("list view control, overwrites postCreate prototype");
mx.logger.debug("list view control, overwrites postCreate prototype");
this.__postCreateOriginal();
if (!listviewInstanceCompatible(this)) return;

Expand All @@ -40,7 +40,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH

ListView.prototype.__loadDataOriginal = ListView.prototype._loadData;
ListView.prototype._loadData = function(this: DataSourceHelperListView, callback: () => void) {
logger.debug("List view control, overwrites _loadData prototype");
mx.logger.debug("List view control, overwrites _loadData prototype");
if (!listviewInstanceCompatible(this)) {
this.__loadDataOriginal(callback);
return;
Expand All @@ -67,7 +67,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH
});
};
} else {
logger.debug("Prototype update called unexpected again");
mx.logger.debug("Prototype update called unexpected again");
}

function listviewPrototypeCompatible(listview: DataSourceHelperListView) {
Expand All @@ -79,7 +79,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH
&& listview._renderData
);
if (!compatible) {
logger.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated.");
mx.logger.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated.");
}
return compatible;
}
Expand All @@ -102,7 +102,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH
&& listview._datasource.getOffset
);
if (!compatible) {
logger.error("This Mendix version is not compatible with list view controls. The List view controls use is limited.");
mx.logger.error("This Mendix version is not compatible with list view controls. The List view controls use is limited.");
}
return compatible;
}
Expand Down
2 changes: 1 addition & 1 deletion src/package.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="ListViewControls" version="1.3.13" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="ListViewControls" version="1.3.14" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="CheckBoxFilter/CheckBoxFilter.xml"/>
<widgetFile path="DropDownFilter/DropDownFilter.xml"/>
Expand Down
5 changes: 5 additions & 0 deletions typings/mendix.d.ts
@@ -0,0 +1,5 @@
declare namespace mx {
export interface MxInterface extends mendix.MendixInterface {
logger: mendix.Logger;
}
}

0 comments on commit f1d42a6

Please sign in to comment.