Skip to content

Commit d7f0ec9

Browse files
committed
fix: replace deprecated mx logger
1 parent e516e50 commit d7f0ec9

9 files changed

Lines changed: 38 additions & 38 deletions

File tree

src/CheckBoxFilter/components/CheckBoxFilterContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default class CheckboxFilterContainer extends Component<ContainerProps, C
127127

128128
private applyFilter(isChecked: boolean, restoreState = false) {
129129
if (this.dataSourceHelper) {
130-
mx.logger.debug(this.props.uniqueid, "applyFilter", isChecked, this.props.group);
130+
console.debug(this.props.uniqueid, "applyFilter", isChecked, this.props.group);
131131
this.dataSourceHelper.setConstraint(this.props.uniqueid, this.getConstraint(isChecked), this.props.group, restoreState);
132132
this.setState({ isChecked });
133133
}

src/DropDownFilter/components/DropDownFilterContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default class DropDownFilterContainer extends Component<ContainerProps, C
148148
private applyFilter(selectedFilter: FilterProps, restoreState = false) {
149149
const constraint = this.getConstraint(selectedFilter);
150150
if (this.dataSourceHelper) {
151-
mx.logger.debug(this.props, this.props.uniqueid, "applyFilter", constraint);
151+
console.debug(this.props, this.props.uniqueid, "applyFilter", constraint);
152152
this.dataSourceHelper.setConstraint(this.props.uniqueid, constraint, undefined, restoreState);
153153
}
154154
this.setState({ selectedOption: selectedFilter });

src/DropDownSort/components/DropDownSortContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default class DropDownSortContainer extends Component<ContainerProps, Con
162162
const { targetListView } = this.state;
163163

164164
if (targetListView && this.dataSourceHelper) {
165-
mx.logger.debug(this.props.uniqueid, "updateSort", selectedOption.name, selectedOption.sort);
165+
console.debug(this.props.uniqueid, "updateSort", selectedOption.name, selectedOption.sort);
166166
this.dataSourceHelper.setSorting(this.props.uniqueid, [ selectedOption.name, selectedOption.sort ], restoreState);
167167
this.setState({ selectedOption });
168168
this.publishWidgetChanges(selectedOption);

src/Pagination/components/PaginationContainer.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
5252
constructor(props: ModelerProps) {
5353
super(props);
5454

55-
mx.logger.debug(this.props.uniqueid, ".constructor");
55+
console.debug(this.props.uniqueid, ".constructor");
5656

5757
this.updateListView = this.updateListView.bind(this);
5858
this.translateMessageStatus = this.translateMessageStatus.bind(this);
@@ -76,21 +76,21 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
7676
}
7777

7878
async componentDidMount() {
79-
mx.logger.debug(this.props.uniqueid, ".componentDidMount");
79+
console.debug(this.props.uniqueid, ".componentDidMount");
8080
const isValidConfig = !!mx.session.getConfig("uiconfig.translations");
8181
if (!isValidConfig) {
8282
try {
8383
await getTranslations();
8484
} catch (e) {
85-
mx.logger.debug(this.props.uniqueid, ".loadingTranslations", e.message);
85+
console.debug(this.props.uniqueid, ".loadingTranslations", e.message);
8686
}
8787
this.setState({ loadTranslations: true });
8888
}
8989
SharedUtils.delay(this.connectToListView.bind(this), this.checkListViewAvailable.bind(this), 20);
9090
}
9191

9292
render() {
93-
mx.logger.debug(this.props.uniqueid, ".render");
93+
console.debug(this.props.uniqueid, ".render");
9494
return createElement("div",
9595
{
9696
className: classNames("widget-pagination", this.props.class),
@@ -105,7 +105,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
105105
}
106106

107107
componentWillUnmount() {
108-
mx.logger.debug(this.props.uniqueid, ".componentWillUnmount");
108+
console.debug(this.props.uniqueid, ".componentWillUnmount");
109109
showLoadMoreButton(this.state.targetListView);
110110
this.viewStateManager.destroy();
111111
}
@@ -115,7 +115,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
115115
}
116116

117117
private checkListViewAvailable(): boolean {
118-
mx.logger.debug(this.props.uniqueid, ".checkListViewAvailable");
118+
console.debug(this.props.uniqueid, ".checkListViewAvailable");
119119
if (!this.widgetDom) {
120120
return false;
121121
}
@@ -129,11 +129,11 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
129129
}
130130

131131
private renderPageButton(): ReactNode {
132-
mx.logger.debug(this.props.uniqueid, ".renderPageButton");
132+
console.debug(this.props.uniqueid, ".renderPageButton");
133133

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

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

154154
public updateListView(offSet?: number, pageSize?: number) {
155-
mx.logger.debug(this.props.uniqueid, ".updateListView");
155+
console.debug(this.props.uniqueid, ".updateListView");
156156
if (this.state.validationPassed) {
157157
this.setState({
158158
offset: offSet !== undefined ? offSet : this.state.offset,
@@ -194,10 +194,10 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
194194
}
195195

196196
private beforeListViewDataRender(targetListView: DataSourceHelperListView) {
197-
mx.logger.debug(this.props.uniqueid, ".beforeListViewDataRender");
197+
console.debug(this.props.uniqueid, ".beforeListViewDataRender");
198198

199199
dojoAspect.before(targetListView, "_renderData", () => {
200-
mx.logger.debug(this.props.uniqueid, "_renderData.before");
200+
console.debug(this.props.uniqueid, "_renderData.before");
201201

202202
const datasource = targetListView._datasource;
203203
if (datasource.getSetSize() === 0) {
@@ -229,7 +229,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
229229
listSize: datasource.getSetSize()
230230
});
231231
} else {
232-
mx.logger.debug(this.props.uniqueid, ".initialLoading False, pagingLoading False");
232+
console.debug(this.props.uniqueid, ".initialLoading False, pagingLoading False");
233233
const previousOffset = this.state.offset;
234234
const listSize = datasource.getSetSize();
235235
let offset = previousOffset;
@@ -258,7 +258,7 @@ class PaginationContainer extends Component<ModelerProps, PaginationContainerSta
258258
}
259259

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

273273
private afterListViewDataRender(targetListView: DataSourceHelperListView) {
274-
mx.logger.debug(this.props.uniqueid, ".afterListViewDataRender");
274+
console.debug(this.props.uniqueid, ".afterListViewDataRender");
275275
dojoAspect.after(targetListView, "_renderData", () => {
276-
mx.logger.debug(this.props.uniqueid, "_renderData.after");
276+
console.debug(this.props.uniqueid, "_renderData.after");
277277
resetListViewHeight(targetListView.domNode as HTMLElement);
278278
});
279279
}

src/Pagination/utils/ContainerUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const getListNode = (targetNode: HTMLElement): HTMLUListElement => {
4444
};
4545

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

5555
export const showLoader = (targetListView: DataSourceHelperListView) => {
56-
mx.logger.debug("showLoader");
56+
console.debug("showLoader");
5757
targetListView.domNode.classList.add("widget-pagination-loading");
5858
};
5959

6060
export const hideLoader = (targetListView: DataSourceHelperListView) => {
61-
mx.logger.debug("hideLoader");
61+
console.debug("hideLoader");
6262
targetListView.domNode.classList.remove("widget-pagination-loading");
6363
};
6464

@@ -84,6 +84,6 @@ export const getTranslations = async (): Promise<void> => {
8484
const localeIndex = metadataJson.languages.indexOf(localeCode);
8585
window.__widgets_translations = Object.keys(systemTexts).reduce((translations, currentKey) => ({ ...translations, [currentKey]: systemTexts[currentKey][localeIndex] }), {});
8686
} else {
87-
mx.logger.error("Error while loading translations");
87+
console.error("Error while loading translations");
8888
}
8989
};

src/Shared/DataSourceHelper/DataSourceHelper.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class DataSourceHelper {
4848
this.originalSort = window.mx.isOffline() ? this.widget._datasource._sort : this.widget._datasource._sorting;
4949

5050
aspect.after(widget, "storeState", (store: (key: string, value: any) => void) => {
51-
mx.logger.debug("after storeState");
51+
console.debug("after storeState");
5252
if (widget.__customWidgetDataSourceHelper) {
5353
const sorting = widget.__customWidgetDataSourceHelper.sorting.length > 0 ? widget.__customWidgetDataSourceHelper.sorting : widget.__customWidgetDataSourceHelper.originalSort;
5454
store("lvcSorting", sorting);
@@ -99,13 +99,13 @@ export class DataSourceHelper {
9999
}
100100

101101
private registerUpdate(restoreState: boolean) {
102-
mx.logger.debug("DataSourceHelper .registerUpdate");
102+
console.debug("DataSourceHelper .registerUpdate");
103103
if (this.timeoutHandle) {
104104
window.clearTimeout(this.timeoutHandle);
105105
}
106106
if (!this.updateInProgress) {
107107
this.timeoutHandle = window.setTimeout(() => {
108-
mx.logger.debug("DataSourceHelper .execute");
108+
console.debug("DataSourceHelper .execute");
109109
this.updateInProgress = true;
110110
// TODO Check if there's currently no update happening on the listView coming from another
111111
// Feature/functionality/widget which does not use DataSourceHelper
@@ -216,12 +216,12 @@ export class DataSourceHelper {
216216
} else {
217217
this.widget._datasource._sorting = sorting;
218218
}
219-
mx.logger.debug("DataSourceHelper .set sort and constraint");
219+
console.debug("DataSourceHelper .set sort and constraint");
220220
const offset = this.widget._datasource.getOffset();
221221
const pageSize = this.widget._datasource.getPageSize();
222222
if (!this.widget.__lvcPagingEnabled && offset > 0) {
223223
// In case load more is used, the data source have to reload the full content
224-
mx.logger.debug("reset offset");
224+
console.debug("reset offset");
225225
this.widget._datasource.setOffset(0);
226226
this.widget._datasource.setPageSize(pageSize + offset);
227227
}
@@ -230,9 +230,9 @@ export class DataSourceHelper {
230230
}
231231

232232
this.widget.update(null, () => {
233-
mx.logger.debug("DataSourceHelper .updated");
233+
console.debug("DataSourceHelper .updated");
234234
if (!this.widget.__lvcPagingEnabled && offset > 0) {
235-
mx.logger.debug("restore offset");
235+
console.debug("restore offset");
236236
// Restore the original paging and offset for load more.
237237
this.widget._datasource.setOffset(offset);
238238
this.widget._datasource.setPageSize(pageSize);
@@ -292,13 +292,13 @@ export class DataSourceHelper {
292292
};
293293

294294
if (changed) {
295-
mx.logger.debug(".updateDatasource changed", offset, pageSize);
295+
console.debug(".updateDatasource changed", offset, pageSize);
296296
this.widget.__customWidgetPagingLoading = true;
297297
this.showLoader();
298298
this.widget.sequence([ "_sourceReload", "_renderData" ], () => {
299299
this.widget.__customWidgetPagingLoading = false;
300300
resetListViewHeight(this.widget.domNode);
301-
mx.logger.debug(".updateDatasource updated");
301+
console.debug(".updateDatasource updated");
302302
this.hideLoader();
303303
});
304304
}

src/Shared/FormViewState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class FormViewState<T> {
1414
const mxform = this.form;
1515
const widgetViewState = mxform && mxform.viewState ? mxform.viewState[this.widgetId] : void 0;
1616
const state = widgetViewState && widgetViewState[key] !== undefined ? widgetViewState[key] : defaultValue;
17-
mx.logger.debug("getPageState", this.widgetId, key, defaultValue, state);
17+
console.debug("getPageState", this.widgetId, key, defaultValue, state);
1818
return state;
1919
}
2020

src/Shared/ListViewPrototype.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { v4 as uuid } from "uuid";
1414
ListView.prototype.__lvcPrototypeUpdated = true;
1515
ListView.prototype.__postCreateOriginal = ListView.prototype.postCreate;
1616
ListView.prototype.postCreate = function(this: DataSourceHelperListView) {
17-
mx.logger.debug("list view control, overwrites postCreate prototype");
17+
console.debug("list view control, overwrites postCreate prototype");
1818
this.__postCreateOriginal();
1919
if (!listviewInstanceCompatible(this)) return;
2020

@@ -41,7 +41,7 @@ import { v4 as uuid } from "uuid";
4141

4242
ListView.prototype.__loadDataOriginal = ListView.prototype._loadData;
4343
ListView.prototype._loadData = function(this: DataSourceHelperListView, callback: () => void) {
44-
mx.logger.debug("List view control, overwrites _loadData prototype");
44+
console.debug("List view control, overwrites _loadData prototype");
4545
if (!listviewInstanceCompatible(this)) {
4646
this.__loadDataOriginal(callback);
4747
return;
@@ -78,7 +78,7 @@ import { v4 as uuid } from "uuid";
7878
});
7979
};
8080
} else {
81-
mx.logger.debug("Prototype update called unexpected again");
81+
console.debug("Prototype update called unexpected again");
8282
}
8383

8484
function listviewPrototypeCompatible(listview: DataSourceHelperListView) {
@@ -90,7 +90,7 @@ import { v4 as uuid } from "uuid";
9090
&& listview._renderData
9191
);
9292
if (!compatible) {
93-
mx.logger.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated.");
93+
console.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated.");
9494
}
9595
return compatible;
9696
}
@@ -113,7 +113,7 @@ import { v4 as uuid } from "uuid";
113113
&& listview._datasource.getOffset
114114
);
115115
if (!compatible) {
116-
mx.logger.error("This Mendix version is not compatible with list view controls. The List view controls use is limited.");
116+
console.error("This Mendix version is not compatible with list view controls. The List view controls use is limited.");
117117
}
118118
return compatible;
119119
}

tslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"no-bitwise": true,
2323
"no-conditional-assignment": true,
2424
"no-console": [
25-
true
25+
false
2626
],
2727
"no-debugger": true,
2828
"no-duplicate-variable": true,

0 commit comments

Comments
 (0)