class RessourceList { /* A wrapper class for the list.js list. * This class is not meant to be used directly, instead it should be used as * a base class for concrete ressource list implementations. */ static autoInit() { CorpusList.autoInit(); CorpusFileList.autoInit(); JobList.autoInit(); JobInputList.autoInit(); JobResultList.autoInit(); PublicUserList.autoInit(); SpaCyNLPPipelineModelList.autoInit(); TesseractOCRPipelineModelList.autoInit(); UserList.autoInit(); } static options = { listContainerInnerHTMLGenerator: null, ressourceMapper: null, sortParams: null, listjs: { page: 5, pagination: { innerWindow: 2, outerWindow: 2 } } }; constructor(listContainerElement, options={}) { let mergedOptions = _.merge({}, RessourceList.options, options); this.isInitialized = false; this.listContainerInnerHTMLGenerator = mergedOptions.listContainerInnerHTMLGenerator; this.ressourceMapper = mergedOptions.ressourceMapper; this.sortParams = mergedOptions.sortParams; this.userId = listContainerElement.dataset.userId; // #region Make sure listElement has an id if (!listContainerElement.hasAttribute('id')) { let i; for (i = 0; true; i++) { if (document.querySelector(`#ressource-list-${i}`)) {continue;} listContainerElement.id = `ressource-list-${i}`; break; } } // #endregion if (this.listContainerInnerHTMLGenerator !== null && listContainerElement.textContent.trim() === '') { this.listContainerInnerHTMLGenerator(listContainerElement); } this.listjs = new List(listContainerElement, mergedOptions.listjs); this.listjs.list.addEventListener('click', (event) => {this.onClick(event)}); this.listjs.list.innerHTML = `
This list is not initialized yet.
No ressource available.