(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/log-browser/files"],{1163:(t,e,s)=>{"use strict";s.r(e);var i=s(143),o=s(505);e.default=class extends i.List{_initConfiguration(t){super._initConfiguration({id:"log-file-list",locale:i.Locale.getSection("smb.components.lists.logfiles"),searchOveral:"name",isDisabledItem:t=>t.readOnly,...t}),this._webspaceId=this._getConfigParam("webspaceId",""),this._urls=this._getConfigParam("urls",{}),this._initActions(),this._initColumns(),this._initOperations()}_initColumns(){this._columns=[i.list.COLUMN_SELECTION,{header:this.lmsg("modificationDate"),sortable:!0,dataIndex:"modificationDate",cls:"t-r number",renderer:t=>(0,i.escapeHtml)(t.modificationDisplayDate)},{header:this.lmsg("name"),sortable:!0,dataIndex:"name",renderer:({id:t,name:e})=>'<span class="tooltipData">'.concat(this.lmsg("viewHint"),"</span>")+'<a href="'.concat(this._urls.browser,"?file=").concat(encodeURIComponent(t),'" class="log-file-name">').concat((0,i.escapeHtml)(e),"</a>")},{header:this.lmsg("path"),sortable:!0,dataIndex:"path"},{header:this.lmsg("fileSize"),sortable:!0,dataIndex:"fileSize",cls:"t-r number",renderer:t=>(0,i.escapeHtml)(t.fileDisplaySize)},{header:"",sortable:!1,cls:"action-icon-set t-r min",renderer:this._renderTools.bind(this)}]}_renderTools(t){const e=[];return t.isCustom&&e.push((0,i.createElement)("span",(0,i.createElement)("span",{class:"tooltipData"},this.lmsg("buttonUnlinkHint")),(0,i.createElement)("a",{class:"i-link",href:"#","data-action-name":"unlinkCustomLog"},(0,i.createElement)("i",{class:"icon-unlink"})))),e.push((0,i.createElement)("span",(0,i.createElement)("span",{class:"tooltipData"},this.lmsg("buttonViewHint")),(0,i.createElement)("a",{class:"i-link",href:"#","data-action-name":"viewLog"},(0,i.createElement)("i",{class:"icon-logs"})))),e.push((0,i.createElement)("span",(0,i.createElement)("span",{class:"tooltipData"},this.lmsg("buttonDownloadHint")),(0,i.createElement)("a",{href:"".concat(this._urls.download,"?filename=").concat(encodeURIComponent(t.id)),class:"i-link"},(0,i.createElement)("i",{class:"icon-download"})))),e}_initOperations(){this._operations=[],this._operations.push({componentType:i.SmallButton,id:"buttonAddCustomLog",title:this.lmsg("addCustomLog"),description:this.lmsg("addCustomLogHint"),addCls:"sb-add-new",handler:this._addCustomLog.bind(this)}),this._urls.logRotation&&(this._operations.push({componentType:i.SmallButton,id:"buttonSettings",title:this.lmsg("logRotation"),description:this.lmsg("logRotationHint"),addCls:"sb-log-rotation",handler:()=>{new i.AjaxPopupForm({cls:"popup-panel",title:this.lmsg("logRotationTitle"),url:this._urls.logRotation,locale:{waitMsg:this.lmsg("loadingTitle")}})}}),this._operations.push({componentType:i.bar.Separator})),this._operations.push({componentType:i.SmallButton,id:"buttonRemoveLogFiles",title:this.lmsg("remove"),description:this.lmsg("hintRemove"),addCls:"sb-remove-selected",handler:t=>{this.execGroupOperation({url:this._urls.deleteFile,subtype:"delete",mouseEvent:t,locale:{confirmOnGroupOperation:this.lmsg("confirmOnDelete")}})}})}_addCustomLog(){new i.DirectoryBrowser({subscriptionId:this._webspaceId,showFiles:!0,treeConfig:{filterNodes:t=>t.isDirectory||o.FTYPE_TEXT===t.type||o.FTYPE_UNKNOWN_TEXT===t.type},locale:{title:this.lmsg("customLogPopupTitle"),buttonOk:i.Locale.getSection("components.buttons").lmsg("ok"),buttonCancel:i.Locale.getSection("components.buttons").lmsg("cancel")},onSubmit:t=>{new Ajax.Request(this._urls.addCustom,{method:"post",parameters:{file:"/".concat(t)},onCreate:()=>{this.disable()},onComplete:t=>{this.reload();JSON.parse(t.responseText).isUnsupportedLog&&(0,i.addStatusMessage)("warning",this.lmsg("invalidLogFormat"))}})}})}_unlinkCustomLog(t){i.messageBox.show({subtype:"unlink",text:this.lmsg("buttonUnlinkConfirmationDescription"),type:i.messageBox.TYPE_YESNO,buttonTitles:{yes:this.lmsg("buttonUnlinkConfirmationYes"),no:this.lmsg("buttonUnlinkConfirmationNo")},onYesClick:()=>{new Ajax.Request(this._urls.unlink,{method:"post",parameters:{file:t.id},onCreate:()=>{this.disable()},onComplete:()=>{this.reload()}})}})}_initActions(){this._itemActions.unlinkCustomLog=this._unlinkCustomLog.bind(this),this._itemActions.viewLog=t=>{const e="".concat(this._urls.view,"?filename=").concat(encodeURIComponent(t.id));window.open(e,"_blank","toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=500,innerWidth=1000,innerHeight=500")}}}}}]);
//# sourceMappingURL=files.js.map?31fad4f5cb593c27326d