DatabaseTools.eb13efea.js 12.8 KB
import{m as r,c as u}from"./vuex.esm.8fdeb4b6.js";import{d as _,c as n}from"./WpTable.ee9185a7.js";import"./default-i18n.3a91e0e5.js";import"./constants.0d8c074c.js";import{n as a}from"./_plugin-vue2_normalizer.61652a7c.js";import"./index.ec9852b3.js";import"./SaveChanges.e40a9083.js";import{C as l}from"./Card.27307535.js";import{B as h}from"./Checkbox.60ba2f56.js";import{C as p}from"./index.3c70e00e.js";import{C as m}from"./Index.6dd703b2.js";import{C as i}from"./SettingsRow.edbb3005.js";import{G as f,a as $}from"./Row.830f6397.js";import{S as b}from"./Caret.19b10233.js";import{S as k}from"./Checkmark.f26f6201.js";import{C as v}from"./Blur.f36c594d.js";import{C as L}from"./Index.235069bb.js";import"./helpers.de7566d0.js";import"./attachments.6af710f9.js";import"./cleanForSlug.51ef7354.js";import"./isArrayLikeObject.9b4b678d.js";import"./html.14f2a8b9.js";import"./Tooltip.68a8a92b.js";import"./_commonjsHelpers.f84db168.js";import"./Slide.15a07930.js";import"./client.e62d6c37.js";import"./translations.c394afe3.js";import"./portal-vue.esm.98f2e05b.js";const S={components:{BaseCheckbox:h,CoreAlert:p,CoreModal:m,CoreSettingsRow:i,GridColumn:f,GridRow:$,SvgClose:b},mixins:[_],props:{site:Object},data(){return{showSuccess:!1,showModal:!1,loading:!1,options:{},strings:{selectSettings:this.$t.__("Select Settings",this.$td),selectSettingsToReset:this.$t.__("Select settings that you would like to reset:",this.$td),resetSelectedSettings:this.$t.__("Reset Selected Settings to Default",this.$td),resetSuccess:this.$t.__("Your settings have been reset successfully!",this.$td),areYouSureReset:this.$t.__("Are you sure you want to reset the selected settings to default?",this.$td),actionCannotBeUndone:this.$t.sprintf(this.$t.__("This action cannot be undone. Before taking this action, we recommend that you make a %1$sfull website backup first%2$s.",this.$td),"<strong>","</strong>"),yesIHaveBackup:this.$t.__("Yes, I have a backup and want to reset the settings",this.$td),noBackup:this.$t.__("No, I need to make a backup",this.$td),allSettings:this.$t.sprintf(this.$t.__("All %1$s Settings",this.$td),"AIOSEO")}}},computed:{canReset(){if(this.$aioseo.data.isNetworkAdmin&&!this.site)return!1;const e=[];return Object.keys(this.options).forEach(t=>{e.push(this.options[t])}),!e.some(t=>t)}},methods:{...r(["resetSettings"]),processResetSettings(){const e=[];this.options.all?this.toolsSettings.filter(t=>t.value!=="all").forEach(t=>{e.push(t.value)}):Object.keys(this.options).forEach(t=>{this.options[t]&&e.push(t)}),this.loading=!0,this.resetSettings({payload:e,siteId:this.site?this.site.blog_id:null}).then(()=>{this.showModal=!1,this.loading=!1,this.showSuccess=!0,this.options={},setTimeout(()=>{this.showSuccess=!1},5e3)})}}};var y=function(){var t=this,s=t._self._c;return s("div",{staticClass:"aioseo-core-reset-settings"},[s("core-settings-row",{staticClass:"no-border",attrs:{name:t.strings.selectSettings},scopedSlots:t._u([{key:"content",fn:function(){return[t.showSuccess?s("core-alert",{staticClass:"reset-success",attrs:{type:"green"}},[t._v(" "+t._s(t.strings.resetSuccess)+" ")]):t._e(),s("div",{staticClass:"reset-settings"},[t._v(" "+t._s(t.strings.selectSettingsToReset)+" "),s("br"),s("br"),s("grid-row",{staticClass:"settings"},[s("grid-column",[s("base-checkbox",{attrs:{size:"medium",disabled:t.$aioseo.data.isNetworkAdmin&&!t.site},model:{value:t.options.all,callback:function(o){t.$set(t.options,"all",o)},expression:"options.all"}},[t._v(" "+t._s(t.strings.allSettings)+" ")])],1),t._l(t.toolsSettings,function(o,d){return s("grid-column",{key:d,attrs:{xl:"3",md:"4",sm:"6"}},[t.options.all?t._e():s("base-checkbox",{attrs:{size:"medium",disabled:t.$aioseo.data.isNetworkAdmin&&!t.site},model:{value:t.options[o.value],callback:function(g){t.$set(t.options,o.value,g)},expression:"options[setting.value]"}},[t._v(" "+t._s(o.label)+" ")]),o.value!=="all"&&t.options.all?s("base-checkbox",{attrs:{size:"medium",value:!0,disabled:""}},[t._v(" "+t._s(o.label)+" ")]):t._e()],1)})],2),s("base-button",{attrs:{type:"gray",size:"medium",disabled:t.canReset},on:{click:function(o){t.showModal=!0}}},[t._v(" "+t._s(t.strings.resetSelectedSettings)+" ")])],1)]},proxy:!0}])}),t.showModal?s("core-modal",{attrs:{"no-header":""},on:{close:function(o){t.showModal=!1}},scopedSlots:t._u([{key:"body",fn:function(){return[s("div",{staticClass:"aioseo-modal-body"},[s("button",{staticClass:"close",on:{click:function(o){o.stopPropagation(),t.showModal=!1}}},[s("svg-close",{on:{click:function(o){t.showModal=!1}}})],1),s("h3",[t._v(t._s(t.strings.areYouSureReset))]),s("div",{staticClass:"reset-description",domProps:{innerHTML:t._s(t.strings.actionCannotBeUndone)}}),s("base-button",{attrs:{type:"blue",size:"medium",loading:t.loading},on:{click:t.processResetSettings}},[t._v(" "+t._s(t.strings.yesIHaveBackup)+" ")]),s("base-button",{attrs:{type:"gray",size:"medium"},on:{click:function(o){t.showModal=!1}}},[t._v(" "+t._s(t.strings.noBackup)+" ")])],1)]},proxy:!0}],null,!1,2298756748)}):t._e()],1)},B=[],w=a(S,y,B,!1,null,null,null,null);const c=w.exports;const C={mixins:[n],components:{CoreCard:l,CoreResetSettings:c,CoreSettingsRow:i,SvgCheckmark:k},data(){return{site:null,selectedSite:null,clearedLogs:{badBotBlockerLogs:!1,redirectLogs:!1,logs404:!1},loadingLog:null,strings:{selectSite:this.$t.__("Select Site",this.$td),resetRestoreSettings:this.$t.__("Reset / Restore Settings",this.$td),logs:this.$t.__("Logs",this.$td),badBotBlockerLogs:this.$t.__("Bad Bot Blocker Logs",this.$td),cleared:this.$t.__("Cleared",this.$td),clearBadBotBlockerLogs:this.$t.__("Clear Bad Bot Blocker Logs",this.$td),logs404:this.$t.__("404 Logs",this.$td),clear404Logs:this.$t.__("Clear 404 Logs",this.$td),redirectLogs:this.$t.__("Redirect Logs",this.$td),clearRedirectLogs:this.$t.__("Clear Redirect Logs",this.$td),logsTooltip:this.$t.__(`Log sizes may fluctuate and not always be 100% accurate since the results can be cached. Also after clearing a log, it may not show as "0" since database tables also include additional information such as indexes that we don't clear.`,this.$td)}}},watch:{site(e){this.selectedSite=this.$aioseo.data.network.sites.sites.find(t=>this.getUniqueSiteId(t)===e.value)}},computed:{canReset(){const e=[];return Object.keys(this.options).forEach(t=>{e.push(this.options[t])}),!e.some(t=>t)},showLogs(){return!this.$aioseo.data.isNetworkAdmin&&(this.showBadBotBlockerLogs||this.$aioseo.data.logSizes.redirectLogs||this.$aioseo.data.logSizes.logs404)},showBadBotBlockerLogs(){return window.aioseo.internalOptions.internal.deprecatedOptions.includes("badBotBlocker")},sites(){return this.getSites.filter(e=>!e.parentDomain).map(e=>({value:this.getUniqueSiteId(e),label:`${e.domain}${e.path}`}))}},methods:{...r(["clearLog"]),getSizeClass(e){let t="green";return 262144e3<e?t="orange":1073741274<e&&(t="red"),t},processClearLog(e){this.loadingLog=e,this.clearLog(e).then(()=>{this.loadingLog=null,this.clearedLogs[e]=!0})},disabledLog(e){return!this.$aioseo.data.logSizes[e].original||this.clearedLogs[e]}}};var x=function(){var t=this,s=t._self._c;return s("div",{staticClass:"aioseo-tools-database-tools"},[s("core-card",{attrs:{slug:"databaseTools","header-text":t.strings.resetRestoreSettings}},[t.$aioseo.data.isNetworkAdmin?s("core-settings-row",{attrs:{name:t.strings.selectSite},scopedSlots:t._u([{key:"content",fn:function(){return[s("base-select",{attrs:{size:"medium",options:t.sites},model:{value:t.site,callback:function(o){t.site=o},expression:"site"}})]},proxy:!0}],null,!1,375472348)}):t._e(),s("core-reset-settings",{attrs:{site:t.selectedSite}})],1),t.showLogs?s("core-card",{attrs:{slug:"databaseToolsLogs","header-text":t.strings.logs},scopedSlots:t._u([{key:"tooltip",fn:function(){return[t._v(" "+t._s(t.strings.logsTooltip)+" ")]},proxy:!0}],null,!1,3934548655)},[t.$aioseo.data.logSizes.logs404?s("core-settings-row",{attrs:{name:t.strings.logs404,align:""},scopedSlots:t._u([{key:"content",fn:function(){return[s("base-button",{staticClass:"clear-log",attrs:{type:"gray",size:"medium",loading:t.loadingLog==="logs404",disabled:t.disabledLog("logs404")},on:{click:function(o){return t.processClearLog("logs404")}}},[t.disabledLog("logs404")?s("span",[s("svg-checkmark"),t._v(" "+t._s(t.strings.cleared)+" ")],1):t._e(),t.disabledLog("logs404")?t._e():s("span",[t._v(" "+t._s(t.strings.clear404Logs)+" ")])]),s("div",{staticClass:"log-size"},[s("span",{staticClass:"size-dot",class:t.getSizeClass(t.$aioseo.data.logSizes.logs404.original)}),t._v(" "+t._s(t.$aioseo.data.logSizes.logs404.readable)+" ")])]},proxy:!0}],null,!1,1716809233)}):t._e(),t.$aioseo.data.logSizes.redirectLogs?s("core-settings-row",{attrs:{name:t.strings.redirectLogs,align:""},scopedSlots:t._u([{key:"content",fn:function(){return[s("base-button",{staticClass:"clear-log",attrs:{type:"gray",size:"medium",loading:t.loadingLog==="redirectLogs",disabled:t.disabledLog("redirectLogs")},on:{click:function(o){return t.processClearLog("redirectLogs")}}},[t.disabledLog("redirectLogs")?s("span",[s("svg-checkmark"),t._v(" "+t._s(t.strings.cleared)+" ")],1):t._e(),t.disabledLog("redirectLogs")?t._e():s("span",[t._v(" "+t._s(t.strings.clearRedirectLogs)+" ")])]),s("div",{staticClass:"log-size"},[s("span",{staticClass:"size-dot",class:t.getSizeClass(t.$aioseo.data.logSizes.redirectLogs.original)}),t._v(" "+t._s(t.$aioseo.data.logSizes.redirectLogs.readable)+" ")])]},proxy:!0}],null,!1,4167017073)}):t._e(),t.showBadBotBlockerLogs?s("core-settings-row",{attrs:{name:t.strings.badBotBlockerLogs,align:""},scopedSlots:t._u([{key:"content",fn:function(){return[s("base-button",{staticClass:"clear-log",attrs:{type:"gray",size:"medium",loading:t.loadingLog==="badBotBlockerLog",disabled:t.disabledLog("badBotBlockerLog")},on:{click:function(o){return t.processClearLog("badBotBlockerLog")}}},[t.disabledLog("badBotBlockerLog")?s("span",[s("svg-checkmark"),t._v(" "+t._s(t.strings.cleared)+" ")],1):t._e(),t.disabledLog("badBotBlockerLog")?t._e():s("span",[t._v(" "+t._s(t.strings.clearBadBotBlockerLogs)+" ")])]),s("div",{staticClass:"log-size"},[s("span",{staticClass:"size-dot",class:t.getSizeClass(t.$aioseo.data.logSizes.badBotBlockerLog.original)}),t._v(" "+t._s(t.$aioseo.data.logSizes.badBotBlockerLog.readable)+" ")])]},proxy:!0}],null,!1,649968002)}):t._e()],1):t._e()],1)},z=[],R=a(C,x,z,!1,null,null,null,null);const T=R.exports;const A={mixins:[n],components:{CoreBlur:v,CoreCard:l,CoreResetSettings:c,CoreSettingsRow:i,Cta:L},data(){return{strings:{selectSite:this.$t.__("Select Site",this.$td),resetRestoreSettings:this.$t.__("Reset / Restore Settings",this.$td),logs:this.$t.__("Logs",this.$td),badBotBlockerLogs:this.$t.__("Bad Bot Blocker Logs",this.$td),cleared:this.$t.__("Cleared",this.$td),clearBadBotBlockerLogs:this.$t.__("Clear Bad Bot Blocker Logs",this.$td),logs404:this.$t.__("404 Logs",this.$td),clear404Logs:this.$t.__("Clear 404 Logs",this.$td),redirectLogs:this.$t.__("Redirect Logs",this.$td),clearRedirectLogs:this.$t.__("Clear Redirect Logs",this.$td),logsTooltip:this.$t.__(`Log sizes may fluctuate and not always be 100% accurate since the results can be cached. Also after clearing a log, it may not show as "0" since database tables also include additional information such as indexes that we don't clear.`,this.$td),ctaHeader:this.$t.sprintf(this.$t.__("This feature is not available in your current plan.",this.$td),"AIOSEO","Pro"),ctaButtonText:this.$t.__("Upgrade Your Plan and Unlock Network Tools",this.$td),networkDatabaseToolsDescription:this.$t.__("Unlock network-level tools to manage all your sites from one easy-to-use location. Migrate data or create backups without the need to visit each dashboard.",this.$td)}}}};var U=function(){var t=this,s=t._self._c;return s("div",{staticClass:"aioseo-tools-database-tools"},[s("core-card",{attrs:{slug:"databaseTools","header-text":t.strings.resetRestoreSettings}},[s("core-blur",[s("core-settings-row",{attrs:{name:t.strings.selectSite},scopedSlots:t._u([{key:"content",fn:function(){return[s("base-select",{attrs:{size:"medium",value:{value:"",label:""},options:[]}})]},proxy:!0}])}),s("core-reset-settings")],1),s("cta",{attrs:{"cta-link":t.$links.getPricingUrl("network-tools","database-tools"),"button-text":t.strings.ctaButtonText,"learn-more-link":t.$links.getUpsellUrl("network-tools","database-tools","home")},scopedSlots:t._u([{key:"header-text",fn:function(){return[t._v(" "+t._s(t.strings.ctaHeader)+" ")]},proxy:!0},{key:"description",fn:function(){return[t._v(" "+t._s(t.strings.networkDatabaseToolsDescription)+" ")]},proxy:!0}])})],1)],1)},D=[],M=a(A,U,D,!1,null,null,null,null);const N=M.exports,O={components:{DatabaseTools:T,LiteDatabaseTools:N},computed:{...u(["isUnlicensed"])}};var I=function(){var t=this,s=t._self._c;return s("div",[!t.$aioseo.data.isNetworkAdmin||!t.isUnlicensed&&t.$license.hasCoreFeature("tools","network-tools-database")?s("database-tools"):t._e(),t.$aioseo.data.isNetworkAdmin&&(t.isUnlicensed||!t.$license.hasCoreFeature("tools","network-tools-database"))?s("lite-database-tools"):t._e()],1)},E=[],F=a(O,I,E,!1,null,null,null,null);const pt=F.exports;export{pt as default};