From 535baff2aa177ed5b23eb22b5da06e43a9cb017d Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 14 Jun 2023 23:35:37 +0300 Subject: [PATCH] cleanup --- client/src/action-handler.js | 91 ------------------------------------ client/src/view.js | 73 ++--------------------------- 2 files changed, 4 insertions(+), 160 deletions(-) diff --git a/client/src/action-handler.js b/client/src/action-handler.js index 9196a770ff..fc081c405e 100644 --- a/client/src/action-handler.js +++ b/client/src/action-handler.js @@ -44,97 +44,6 @@ class ActionHandler { */ this.view = view; } - - /** - * @deprecated Use `this.view`. - */ - getConfig() { - return this.view.getConfig(); - } - - /** - * @deprecated Use `this.view`. - */ - getMetadata() { - return this.view.getMetadata(); - } - - /** - * @deprecated Use `this.view`. - */ - getAcl() { - return this.view.getAcl(); - } - - /** - * @deprecated Use `this.view`. - */ - getUser() { - return this.view.getUser(); - } - - /** - * @deprecated Use `this.view`. - */ - getRouter() { - return this.view.getRouter(); - } - - /** - * @deprecated Use `this.view`. - */ - getHelper() { - return this.view.getHelper(); - } - - /** - * @deprecated Use `this.view`. - */ - getLanguage() { - return this.view.getLanguage(); - } - - /** - * @deprecated Use `this.view`. - */ - getModelFactory() { - return this.view.getModelFactory(); - } - - /** - * @deprecated Use `this.view`. - */ - getCollectionFactory() { - return this.view.getCollectionFactory(); - } - - /** - * @deprecated Use `Espo.Ajax`. - */ - ajaxPostRequest() { - return Espo.Ajax.postRequest.apply(this.view, arguments); - } - - /** - * @deprecated Use `Espo.Ajax`. - */ - ajaxPutRequest() { - return Espo.Ajax.putRequest.apply(this.view, arguments); - } - - /** - * @deprecated Use `Espo.Ajax`. - */ - ajaxGetRequest() { - return Espo.Ajax.getRequest.apply(this.view, arguments); - } - - /** - * @deprecated Use `this.view`. - */ - confirm() { - return this.view.confirm.apply(this.view, arguments); - } } ActionHandler.extend = BullView.extend; diff --git a/client/src/view.js b/client/src/view.js index 10e5fad752..34739fa397 100644 --- a/client/src/view.js +++ b/client/src/view.js @@ -113,7 +113,7 @@ class View extends BullView { timeout = timeout || 2000; if (!type) { - timeout = null; + timeout = void 0; } let text = this.getLanguage().translate(label, 'labels', scope); @@ -333,17 +333,7 @@ class View extends BullView { * @returns {Promise} */ ajaxRequest(url, type, data, options) { - options = options || {}; - - options.type = type; - options.url = url; - options.context = this; - - if (data) { - options.data = data; - } - - return $.ajax(options); + return Espo.Ajax.request(url, type, data, options); } /** @@ -356,45 +346,7 @@ class View extends BullView { * @returns {Promise} */ ajaxPostRequest(url, data, options) { - if (data) { - data = JSON.stringify(data); - } - - return this.ajaxRequest(url, 'POST', data, options); - } - - /** - * PATCH request. - * - * @deprecated Use `Espo.Ajax.patchRequest`. - * @param {string} url An URL. - * @param {any} [data] Data. - * @param {Object} [options] Options. - * @returns {Promise} - */ - ajaxPatchRequest(url, data, options) { - if (data) { - data = JSON.stringify(data); - } - - return this.ajaxRequest(url, 'PATCH', data, options); - } - - /** - * PUT request. - * - * @deprecated Use `Espo.Ajax.putRequest`. - * @param {string} url An URL. - * @param {any} [data] Data. - * @param {Object} [options] Options. - * @returns {Promise} - */ - ajaxPutRequest(url, data, options) { - if (data) { - data = JSON.stringify(data); - } - - return this.ajaxRequest(url, 'PUT', data, options); + return Espo.Ajax.postRequest(url, data, options); } /** @@ -407,24 +359,7 @@ class View extends BullView { * @returns {Promise} */ ajaxGetRequest(url, data, options) { - return this.ajaxRequest(url, 'GET', data, options); - } - - /** - * DELETE request. - * - * @deprecated Use `Espo.Ajax.deleteRequest`. - * @param {string} url An URL. - * @param {any} [data] Data. - * @param {Object} [options] Options. - * @returns {Promise} - */ - ajaxDeleteRequest(url, data, options) { - if (data) { - data = JSON.stringify(data); - } - - return this.ajaxRequest(url, 'DELETE', data, options); + return Espo.Ajax.getRequest(url, data, options); } /**