diff --git a/setup/web_editor_media_dialog_dms/odoo/addons/web_editor_media_dialog_dms b/setup/web_editor_media_dialog_dms/odoo/addons/web_editor_media_dialog_dms new file mode 120000 index 000000000..34f896188 --- /dev/null +++ b/setup/web_editor_media_dialog_dms/odoo/addons/web_editor_media_dialog_dms @@ -0,0 +1 @@ +../../../../web_editor_media_dialog_dms \ No newline at end of file diff --git a/setup/web_editor_media_dialog_dms/setup.py b/setup/web_editor_media_dialog_dms/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_editor_media_dialog_dms/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_editor_media_dialog_dms/README.rst b/web_editor_media_dialog_dms/README.rst new file mode 100644 index 000000000..1af90ac29 --- /dev/null +++ b/web_editor_media_dialog_dms/README.rst @@ -0,0 +1,97 @@ +=========================== +Web Editor Media Dialog DMS +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:61e7939eaa7373b7c5114e669fe2cb623fba465e7f682708680aebee1ceddee2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github + :target: https://github.com/OCA/dms/tree/16.0/web_editor_media_dialog_dms + :alt: OCA/dms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-web_editor_media_dialog_dms + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the option in the web editor to include an image with the +corresponding link to open/download the linked files. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, we need: + +#. Navigate to a model that has an HTML field +#. Edit the field +#. Type /image to open the media dialog +#. Select the DMS tab +#. Select the DMS file to be added + +You can also edit the selected file making a double click on the image added to web +editor. + +If you want to share the file to a public user, you can do it by selecting the option +**Allow open to public users** which is located on DMS tab of media dialog. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Pedro M. Baeza + * Carlos Roca + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/dms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_editor_media_dialog_dms/__init__.py b/web_editor_media_dialog_dms/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/web_editor_media_dialog_dms/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_editor_media_dialog_dms/__manifest__.py b/web_editor_media_dialog_dms/__manifest__.py new file mode 100644 index 000000000..59542e19e --- /dev/null +++ b/web_editor_media_dialog_dms/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web Editor Media Dialog DMS", + "summary": "Integrate DMS with media dialog of web editor", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/dms", + "depends": ["dms", "web_editor"], + "assets": { + "web_editor.assets_media_dialog": [ + "web_editor_media_dialog_dms/static/src/media_dialog/*", + ] + }, +} diff --git a/web_editor_media_dialog_dms/i18n/es.po b/web_editor_media_dialog_dms/i18n/es.po new file mode 100644 index 000000000..e863a1cad --- /dev/null +++ b/web_editor_media_dialog_dms/i18n/es.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_editor_media_dialog_dms +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-22 09:04+0000\n" +"PO-Revision-Date: 2024-08-22 11:05+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.0.1\n" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "All DMS files have been loaded" +msgstr "Todos los archivos DMS han sido cargados" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "Allow open to public users" +msgstr "Permitir abrir enlace a usuarios públicos" + +#. module: web_editor_media_dialog_dms +#: model:ir.model,name:web_editor_media_dialog_dms.model_dms_file +msgid "File" +msgstr "Archivo" + +#. module: web_editor_media_dialog_dms +#: model:ir.model,name:web_editor_media_dialog_dms.model_ir_binary +msgid "File streaming helper model for controllers" +msgstr "Modelo de ayuda para la transmisión de archivos para controladores" + +#. module: web_editor_media_dialog_dms +#. odoo-python +#: code:addons/web_editor_media_dialog_dms/models/dms_file.py:0 +#, python-format +msgid "Invalid access token" +msgstr "Token de acceso inválido" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "Load more..." +msgstr "Cargar más..." + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "No DMS files found." +msgstr "No se encontraron archivos DMS." + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js:0 +#, python-format +msgid "Search a dms file" +msgstr "Buscar un archivo DMS" diff --git a/web_editor_media_dialog_dms/i18n/web_editor_media_dialog_dms.pot b/web_editor_media_dialog_dms/i18n/web_editor_media_dialog_dms.pot new file mode 100644 index 000000000..48d834746 --- /dev/null +++ b/web_editor_media_dialog_dms/i18n/web_editor_media_dialog_dms.pot @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_editor_media_dialog_dms +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-22 09:04+0000\n" +"PO-Revision-Date: 2024-08-22 09:04+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "All DMS files have been loaded" +msgstr "" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "Allow open to public users" +msgstr "" + +#. module: web_editor_media_dialog_dms +#: model:ir.model,name:web_editor_media_dialog_dms.model_dms_file +msgid "File" +msgstr "" + +#. module: web_editor_media_dialog_dms +#: model:ir.model,name:web_editor_media_dialog_dms.model_ir_binary +msgid "File streaming helper model for controllers" +msgstr "" + +#. module: web_editor_media_dialog_dms +#. odoo-python +#: code:addons/web_editor_media_dialog_dms/models/dms_file.py:0 +#, python-format +msgid "Invalid access token" +msgstr "" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "Load more..." +msgstr "" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml:0 +#, python-format +msgid "No DMS files found." +msgstr "" + +#. module: web_editor_media_dialog_dms +#. odoo-javascript +#: code:addons/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js:0 +#, python-format +msgid "Search a dms file" +msgstr "" diff --git a/web_editor_media_dialog_dms/models/__init__.py b/web_editor_media_dialog_dms/models/__init__.py new file mode 100644 index 000000000..078d8008c --- /dev/null +++ b/web_editor_media_dialog_dms/models/__init__.py @@ -0,0 +1,2 @@ +from . import dms_file +from . import ir_binary diff --git a/web_editor_media_dialog_dms/models/dms_file.py b/web_editor_media_dialog_dms/models/dms_file.py new file mode 100644 index 000000000..3b6d4447a --- /dev/null +++ b/web_editor_media_dialog_dms/models/dms_file.py @@ -0,0 +1,26 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import _, models +from odoo.exceptions import AccessError +from odoo.tools import consteq + + +class File(models.Model): + _inherit = "dms.file" + + def get_access_token(self): + self.ensure_one() + return self._portal_ensure_token() + + def validate_access(self, access_token): + # Validate if token provided is correct for the record checked + self.ensure_one() + record_sudo = self.sudo() + if access_token: + tok = record_sudo.with_context(prefetch_fields=False).access_token + valid_token = consteq(tok or "", access_token) + if not valid_token: + raise AccessError(_("Invalid access token")) + return record_sudo + return self diff --git a/web_editor_media_dialog_dms/models/ir_binary.py b/web_editor_media_dialog_dms/models/ir_binary.py new file mode 100644 index 000000000..4ad8de485 --- /dev/null +++ b/web_editor_media_dialog_dms/models/ir_binary.py @@ -0,0 +1,15 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import models + + +class IrBinary(models.AbstractModel): + _inherit = "ir.binary" + + def _find_record_check_access(self, record, access_token): + # The method is overridden to allow access to the media attached to the + # dms.file records using an access_token. + if record._name == "dms.file": + return record.validate_access(access_token) + return super()._find_record_check_access(record, access_token) diff --git a/web_editor_media_dialog_dms/readme/CONTRIBUTORS.rst b/web_editor_media_dialog_dms/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..42f94d59e --- /dev/null +++ b/web_editor_media_dialog_dms/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Pedro M. Baeza + * Carlos Roca diff --git a/web_editor_media_dialog_dms/readme/DESCRIPTION.rst b/web_editor_media_dialog_dms/readme/DESCRIPTION.rst new file mode 100644 index 000000000..8825a2011 --- /dev/null +++ b/web_editor_media_dialog_dms/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds the option in the web editor to include an image with the +corresponding link to open/download the linked files. diff --git a/web_editor_media_dialog_dms/readme/USAGE.rst b/web_editor_media_dialog_dms/readme/USAGE.rst new file mode 100644 index 000000000..37de7e8b4 --- /dev/null +++ b/web_editor_media_dialog_dms/readme/USAGE.rst @@ -0,0 +1,13 @@ +To use this module, we need: + +#. Navigate to a model that has an HTML field +#. Edit the field +#. Type /image to open the media dialog +#. Select the DMS tab +#. Select the DMS file to be added + +You can also edit the selected file making a double click on the image added to web +editor. + +If you want to share the file to a public user, you can do it by selecting the option +**Allow open to public users** which is located on DMS tab of media dialog. \ No newline at end of file diff --git a/web_editor_media_dialog_dms/static/description/index.html b/web_editor_media_dialog_dms/static/description/index.html new file mode 100644 index 000000000..8a7ec333f --- /dev/null +++ b/web_editor_media_dialog_dms/static/description/index.html @@ -0,0 +1,444 @@ + + + + + +Web Editor Media Dialog DMS + + + +
+

Web Editor Media Dialog DMS

+ + +

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

+

This module adds the option in the web editor to include an image with the +corresponding link to open/download the linked files.

+

Table of contents

+ +
+

Usage

+

To use this module, we need:

+
    +
  1. Navigate to a model that has an HTML field
  2. +
  3. Edit the field
  4. +
  5. Type /image to open the media dialog
  6. +
  7. Select the DMS tab
  8. +
  9. Select the DMS file to be added
  10. +
+

You can also edit the selected file making a double click on the image added to web +editor.

+

If you want to share the file to a public user, you can do it by selecting the option +Allow open to public users which is located on DMS tab of media dialog.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Pedro M. Baeza
    • +
    • Carlos Roca
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/dms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js b/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js new file mode 100644 index 000000000..a4352a85a --- /dev/null +++ b/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.esm.js @@ -0,0 +1,209 @@ +/** @odoo-module */ + +import {SearchMedia} from "@web_editor/components/media_dialog/search_media"; +import {KeepLast} from "@web/core/utils/concurrency"; +import {useDebounced} from "@web/core/utils/timing"; +import {useService} from "@web/core/utils/hooks"; +import {Component, onWillStart, useRef, useState} from "@odoo/owl"; + +export class DMSFile extends Component {} +DMSFile.template = "web_editor_media_dialog_dms.DMSFile"; + +export class DMSSelector extends Component { + setup() { + this.orm = useService("orm"); + this.keepLast = new KeepLast(); + this.loadMoreButtonRef = useRef("load-more-button"); + this.state = useState({ + dmsFiles: [], + canLoadMoreFiles: true, + isFetchingFiles: false, + needle: "", + }); + this.allowOpenPublic = false; + this.NUMBER_OF_FILES_TO_DISPLAY = 30; + this.searchPlaceholder = this.env._t("Search a dms file"); + onWillStart(async () => { + this.state.dmsFiles = await this.fetchFiles( + this.NUMBER_OF_FILES_TO_DISPLAY, + 0 + ); + }); + this.debouncedScroll = useDebounced(this.scrollToLoadMoreButton, 500); + } + + get canLoadMore() { + return this.state.canLoadMoreFiles; + } + + get hasContent() { + return this.state.dmsFiles.length; + } + + get isFetching() { + return this.state.isFetchingFiles; + } + + get selectedFileIds() { + return this.props.selectedMedia[this.props.id] + .filter((media) => media.mediaType === "dms") + .map(({id}) => id); + } + + async fetchFiles(limit, offset) { + this.state.isFetchingFiles = true; + let files = []; + try { + files = await this.orm.searchRead( + "dms.file", + [["name", "ilike", this.state.needle]], + ["name", "mimetype"], + { + order: "id desc", + limit, + offset, + } + ); + } catch (e) { + if (e.exceptionName !== "odoo.exceptions.AccessError") { + throw e; + } + } + this.state.canLoadMoreFiles = files.length >= this.NUMBER_OF_FILES_TO_DISPLAY; + this.state.isFetchingFiles = false; + if (this.selectInitialMedia()) { + for (const file of files) { + if ( + `/web/content/dms.file/${file.id}/content` === + this.props.media.getAttribute("href").replace(/[?].*/, "") + ) { + this.selectFile(file); + } + } + } + for (const file of files) { + file.allowOpenPublic = this.allowOpenPublic; + } + return files; + } + + async handleLoadMore() { + await this.loadMore(); + this.debouncedScroll(); + } + + async loadMore() { + return this.keepLast + .add( + this.fetchFiles( + this.NUMBER_OF_FILES_TO_DISPLAY, + this.state.dmsFiles.length + ) + ) + .then((newFiles) => { + // This is never reached if another search or loadMore occurred. + this.state.dmsFiles.push(...newFiles); + }); + } + + async handleSearch(needle) { + await this.search(needle); + this.debouncedScroll(); + } + + search(needle) { + this.state.dmsFiles = []; + this.state.needle = needle; + return this.keepLast + .add(this.fetchFiles(this.NUMBER_OF_FILES_TO_DISPLAY, 0)) + .then((files) => { + this.state.dmsFiles = files; + }); + } + + scrollToLoadMoreButton() { + if ( + this.state.needle || + this.state.dmsFiles.length > this.NUMBER_OF_FILES_TO_DISPLAY + ) { + this.loadMoreButtonRef.el.scrollIntoView({ + block: "end", + inline: "nearest", + behavior: "smooth", + }); + } + } + + async onClickFile(file) { + this.props.selectMedia({...file, mediaType: "dms"}); + await this.props.save(); + } + + static async createElements(selectedMedia, {orm}) { + return Promise.all( + selectedMedia.map(async (file) => { + const linkEl = document.createElement("a"); + let href = `/web/content/dms.file/${encodeURIComponent( + file.id + )}/content`; + // Download svg images because are considered images but are not + // visualized correctly on new tab. Other files than pdf or image are + // downloaded by default + var extra_added = false; + if (file.mimetype === "image/svg+xml") { + href += "?download=true"; + extra_added = true; + } + if (file.allowOpenPublic) { + const accessToken = await orm.call("dms.file", "get_access_token", [ + file.id, + ]); + href += `${ + extra_added ? "&" : "?" + }access_token=${encodeURIComponent(accessToken)}`; + extra_added = true; + } + linkEl.href = href; + linkEl.title = file.name; + linkEl.dataset.mimetype = file.mimetype; + return linkEl; + }) + ); + } + + selectFile(file) { + this.props.selectMedia({...file, mediaType: "dms"}); + } + + selectInitialMedia() { + return ( + this.props.media && + this.constructor.tagNames.includes(this.props.media.tagName) && + !this.selectedFileIds.length + ); + } + + async handleChangeAllowOpenPublic() { + await this.changeAllowOpenPublic(); + this.debouncedScroll(); + } + + changeAllowOpenPublic() { + this.allowOpenPublic = !this.allowOpenPublic; + return this.keepLast + .add(this.fetchFiles(this.state.dmsFiles.length, 0)) + .then((files) => { + this.state.dmsFiles = files; + }); + } +} + +DMSSelector.template = "web_editor_media_dialog_dms.DMSSelector"; +DMSSelector.mediaSpecificClasses = ["o_image", "o_dms_file"]; +DMSSelector.mediaSpecificStyles = []; +DMSSelector.mediaExtraClasses = []; +DMSSelector.tagNames = ["A"]; +DMSSelector.components = { + DMSFile, + SearchMedia, +}; diff --git a/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml b/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml new file mode 100644 index 000000000..1e1b4d5d5 --- /dev/null +++ b/web_editor_media_dialog_dms/static/src/media_dialog/dms_selector.xml @@ -0,0 +1,75 @@ + + + +
+ + + +
+
+ +
+
+ + +
+
+
+
+

No DMS files found.

+
+
+ + + +
+
+ +
+ All DMS files have been loaded +
+
+
+
+ diff --git a/web_editor_media_dialog_dms/static/src/media_dialog/media_dialog.esm.js b/web_editor_media_dialog_dms/static/src/media_dialog/media_dialog.esm.js new file mode 100644 index 000000000..ebc67492a --- /dev/null +++ b/web_editor_media_dialog_dms/static/src/media_dialog/media_dialog.esm.js @@ -0,0 +1,43 @@ +/** @odoo-module **/ + +import {MediaDialog, TABS} from "@web_editor/components/media_dialog/media_dialog"; +import {DMSSelector} from "./dms_selector.esm"; +import {patch} from "@web/core/utils/patch"; + +patch(TABS, "web_editor_media_dialog_dms.TABS", { + DMS: { + id: "DMS", + title: "DMS", + Component: DMSSelector, + }, +}); + +patch(MediaDialog.prototype, "web_editor_media_dialog_dms.MediaDialog", { + get initialActiveTab() { + const dmsTab = this.tabs.find((tab) => tab.id === "DMS"); + if ( + !this.props.activeTab && + dmsTab && + this.props.media && + this.props.media.classList.contains("o_dms_file") + ) { + return dmsTab.id; + } + return this._super(...arguments); + }, + addTabs() { + const res = this._super(...arguments); + const onlyImages = + this.props.onlyImages || + this.props.multiImages || + (this.props.media && + this.props.media.parentElement && + (this.props.media.parentElement.dataset.oeField === "image" || + this.props.media.parentElement.dataset.oeType === "image")); + const noDMS = onlyImages || this.props.noDMS; + if (!noDMS) { + this.addTab(TABS.DMS); + } + return res; + }, +});