Viewing File: /usr/local/cpanel/base/frontend/jupiter/domains/views/listDomains.min.js
define(["angular","cjt/util/locale","app/services/domains","app/directives/domainSearchModalDirective","app/directives/tldPriorityInputDirective","cjt/services/cpanel/componentSettingSaverService"],(function(e,o){"use strict";var t=e.module("cpanel.domains"),a="listDomainsView";return t.controller("listDomains",["$scope","$location","$filter","componentSettingSaverService","currentDomains","ITEM_LISTER_CONSTANTS","PAGE","domains","alertService","DOMAIN_TYPE_CONSTANTS","domainSearchModalService","$document","$timeout",function(t,i,n,r,s,m,d,c,u,l,h,p,f){var g=[],D="hideAssociatedSubdomains",b="showAssociatedSubdomains",S=null,y=null,v=null,F=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(", ");function A(){var e=p[0].querySelector(".domain-chooser");if(!e)return[];var o=p[0].defaultView;return Array.prototype.filter.call(e.querySelectorAll(F),(function(e){if(!o)return!0;var t=o.getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility}))}function w(){p[0].body.classList.remove("domain-chooser-open"),y&&(p[0].removeEventListener("keydown",y),y=null),v&&(f.cancel(v),v=null)}var x=s.some((function(e){return!!e.associatedAddonDomain}));function R(e){return!!t.showAssociatedSubdomains||!e.associatedAddonDomain}var T=!0;function k(){var e=n("filter")(s,R);T=t.showAssociatedSubdomains,t.filteredDomains=e}function N(){t.showAssociatedSubdomains=!t.showAssociatedSubdomains,r.set(a,{showAssociatedSubdomains:t.showAssociatedSubdomains}),k(),O()}function O(){g.splice(0),x&&(t.showAssociatedSubdomains?g.push({label:o.maketext("Hide Associated Subdomains"),event:D}):g.push({label:o.maketext("Show Associated Subdomains"),event:b}))}t.$on(m.TABLE_ITEM_BUTTON_EVENT,(function(e,o){if("manage"===o.actionType)t=o.item.domain,i.path("manage").search("domain",t);var t})),t.$on(m.ITEM_LISTER_UPDATED_EVENT,(function(e,o){t.itemListerMeta=o.meta,t.currentSearchFilterValue=t.itemListerMeta.filterValue})),t.$on(b,N),t.$on(D,N),t.domains=s,t.filteredDomains=s,t.showAssociatedSubdomains=!1,t.temporaryDomainBannerText=o.maketext("You cannot create an email account for a temporary domain."),t.hasTemporaryDomainInList=!d.isDisabledTempDomains&&s.some((function(e){return e.is_temporary})),t.tableHeaderItems=[],t.tableHeaderItems.push({field:"batchSelect",sortable:!1,label:null}),t.tableHeaderItems.push({field:"domain",sortable:!0,label:o.maketext("Domain")}),d.hasWebServerRole&&(t.tableHeaderItems.push({field:"documentRoot",sortable:!0,label:o.maketext("Document Root"),hiddenInSmall:!0}),t.tableHeaderItems.push({field:"redirectsTo",sortable:!0,label:o.maketext("Redirects To"),hiddenInSmall:!0}),t.tableHeaderItems.push({field:"HTTPSRedirect",sortable:!0,label:o.maketext("Force HTTPS Redirect"),hiddenInSmall:!0})),t.tableHeaderItems.push({field:"actions",label:o.maketext("Actions"),hiddenInSmall:!0}),O();var I=!(!d.features||!d.features.domain_recommendation),L=!(!d.features||!d.features.alias),P=c.getMainDomain()||{},C=P.documentRoot||"/home/user/public_html",E=P.domain||"";function H(){t.showDomainChooser||(S=p[0].activeElement||null,t.showDomainChooser=!0,t.selectedDomainOption=null,p[0].body.classList.add("domain-chooser-open"),y=function(e){if("Escape"!==e.key){if("Tab"===e.key){var o=A();if(o.length){var a=o[0],i=o[o.length-1],n=p[0].querySelector(".domain-chooser");n&&n.contains(p[0].activeElement)?e.shiftKey?p[0].activeElement===a&&(e.preventDefault(),i.focus()):p[0].activeElement===i&&(e.preventDefault(),a.focus()):(e.preventDefault(),e.shiftKey?i.focus():a.focus())}else e.preventDefault()}}else t.$apply((function(){t.creatingDomain||q()}))},p[0].addEventListener("keydown",y),v=f((function(){v=null;var e=A();e.length&&e[0].focus()})))}var M=0;function $(){M++}function q(){$(),t.showDomainChooser=!1,t.selectedDomainOption=null,t.registeredForm.domainName="",t.registeredForm.shareDocRoot=L,t.registeredForm.documentRootPath="",Y(),w(),S&&"function"==typeof S.focus&&(S.focus(),S=null)}function Y(){t.purchaseForm.searchQuery="",t.purchaseForm.showSearchOptions=!1,t.purchaseForm.tldFilters=[]}var U=null;function B(e){t.selectedDomainOption=e,"registered"===e?(t.registeredForm.domainName="",t.registeredForm.shareDocRoot=L,t.registeredForm.documentRootPath="",t.registeredForm.subdomain="",t.registeredForm.rootDomain="",t.registeredForm.domainType=""):"purchase"===e&&(Y(),function(){if(V)return;V=!0,c.fetchSupportedTlds().then((function(e){t.supportedTlds=e})).catch((function(){t.supportedTlds=[]}))}(),U=c.getPrioritizedTlds().then((function(e){e&&e.length&&!t.purchaseForm.tldFilters.length&&(t.purchaseForm.tldFilters=e)})))}t.supportedTlds=null;var V=!1;function j(){if(t.registeredForm.documentRootPath="",t.registeredForm.subdomain="",t.registeredForm.rootDomain="",t.registeredForm.domainType="",t.registeredForm.domainName){t.registeredForm.domainName=t.registeredForm.domainName.toLowerCase();var e=t.registeredForm.domainName,o="",a="";if(t.registeredForm.shareDocRoot&&L)o=l.ALIAS;else{var i=e.split(".");if(i.length>2)for(var n=1;n<i.length;n++){var r=i.slice(n).join(".");if(c.findDomainByName(r)){o=l.SUBDOMAIN,a=r;break}}o||(o=l.ADDON,a=E)}t.registeredForm.domainType=o,t.registeredForm.rootDomain=a,t.registeredForm.shareDocRoot||(t.registeredForm.documentRootPath=e.replace("*","_wildcard_")),t.registeredForm.subdomain=e}}function Q(){var e=t.selectedDomainOption;e&&("purchase"!==e?"temporary"!==e?"registered"!==e?(t.showDomainChooser=!1,t.selectedDomainOption=null,i.path("/create").search("mode",e)):function(){var e=(t.registeredForm.domainName||"").trim().toLowerCase();if(!e)return;t.creatingDomain=!0;var a,i,n=t.registeredForm.domainType,r=t.registeredForm.rootDomain;if(!n)if(t.registeredForm.shareDocRoot&&L)n=l.ALIAS;else{var s=e.split(".");if(s.length>2)for(var m=1;m<s.length;m++){var h=s.slice(m).join(".");if(c.findDomainByName(h)){n=l.SUBDOMAIN,r=h;break}}n||(n=l.ADDON,r=c.getMainDomain().domain)}d.hasWebServerRole||(n=l.ALIAS);n===l.ALIAS?(i=C,a=C.replace(P.homedir+"/","")):(a=t.registeredForm.documentRootPath||e.replace("*","_wildcard_"),i=c.generateFullDocumentRoot(a));var p=t.registeredForm.subdomain||e,f={domainType:n,newDomainName:e,subdomain:p,domain:r,documentRoot:a,fullDocumentRoot:i,inheritDocumentRoot:t.registeredForm.shareDocRoot};c.add(f).then((function(t){var a,i=t.domain||e;a=d.hasWebServerRole?o.maketext("You have successfully created the new “[_1]” domain with the document root of “[_2]”.",_.escape(i),_.escape(t.documentRoot)):o.maketext("You have successfully created the new “[_1]” domain.",_.escape(i)),u.add({type:"success",message:a,autoClose:1e4}),k(),q()})).finally((function(){t.creatingDomain=!1}))}():function(){t.creatingDomain=!0;var e={domainType:l.ADDON,createTemporaryDomain:"1",newDomainName:null,documentRoot:null,subdomain:null,domain:null,fullDocumentRoot:null};c.add(e).then((function(e){var a,i=e.domain;a=d.hasWebServerRole?o.maketext("You have successfully created the new “[_1]” domain with the document root of “[_2]”.",i,_.escape(e.documentRoot)):o.maketext("You have successfully created the new “[_1]” domain.",i),u.add({type:"success",message:a,autoClose:1e4}),k(),t.hasTemporaryDomainInList=!0})).finally((function(){t.creatingDomain=!1,q()}))}():function(){var e=(t.purchaseForm.searchQuery||"").trim();if(!e)return;var o=++M;function a(){if(o===M){var a=t.purchaseForm.tldFilters.slice();q(),h.open({initialQuery:e,initialTldFilters:a,autoSearch:!0,source:"create",onAddDomain:W})}}U&&"function"==typeof U.finally?U.finally(a):a()}())}function W(e){e&&f((function(){H(),B("registered"),t.registeredForm.domainName=e,j()}))}t.$on("openDomainChooser",H),e.extend(t,{getFilteredDomains:function(){return T!==t.showAssociatedSubdomains&&k(),t.filteredDomains},showAssociatedSubdomains:!1,toggleShowAssociatedSubdomains:N,tableConfigurationOptions:g,showDomainChooser:!1,selectedDomainOption:null,creatingDomain:!1,registeredForm:{domainName:"",shareDocRoot:L,documentRootPath:"",subdomain:"",rootDomain:"",domainType:""},purchaseForm:{searchQuery:"",showSearchOptions:!1,tldFilters:[]},togglePurchaseSearchOptions:function(){t.purchaseForm.showSearchOptions=!t.purchaseForm.showSearchOptions},handlePurchaseSearchKeyup:function(e){"Enter"===e.key&&t.purchaseForm.searchQuery&&!t.creatingDomain&&(e.preventDefault(),e.stopPropagation(),Q())},canCreateAlias:L,domainRecommendationsEnabled:I,documentRootPattern:c.getDocumentRootPattern(),DOMAIN_TYPE_CONSTANTS:l,openDomainChooser:H,closeDomainChooser:q,selectDomainOption:B,cancelDomainOption:function(){$(),t.selectedDomainOption=null,t.registeredForm.domainName="",t.registeredForm.shareDocRoot=L,t.registeredForm.documentRootPath="",t.registeredForm.subdomain="",t.registeredForm.rootDomain="",t.registeredForm.domainType="",Y()},confirmDomainOption:Q,onUpdateRegisteredDomainName:j,onToggleShareDocRoot:function(){t.registeredForm.domainName&&(t.registeredForm.shareDocRoot&&L?(t.registeredForm.domainType=l.ALIAS,t.registeredForm.documentRootPath=C.replace(P.homedir+"/","")):j())},domainChooserStrings:{dialogLabel:o.maketext("Choose Domain Type"),closeLabel:o.maketext("Close"),heading:o.maketext("What kind of domain do you want to use?"),temporaryAlt:o.maketext("Temporary domain illustration."),temporarySubtitle:o.maketext("Find a domain later."),temporaryHeading:o.maketext("Temporary Domain"),registeredAlt:o.maketext("Registered domain illustration."),registeredSubtitle:o.maketext("Use a domain you own."),registeredHeading:o.maketext("Registered Domain"),purchaseAlt:o.maketext("Purchase a domain illustration."),purchaseSubtitle:o.maketext("Search for a new domain."),purchaseHeading:o.maketext("Purchase a Domain"),cancelLabel:o.maketext("Cancel"),continueLabel:o.maketext("Continue"),creatingLabel:o.maketext("Creating …"),registeredFormLabel:o.maketext("Registered Domain"),registeredFormDescription:o.maketext("Add a domain that is already registered. You can also create a subdomain for an existing domain."),shareDocRootLabel:o.maketext("Share document root ([_1]) with “[_2]”?",C,E),shareDocRootHelp:o.maketext("If the document root is shared, the new domain will serve the same content as “[_1]”. [output,strong,You cannot change this setting once you create the domain].",E),docRootHeading:o.maketext("Document Root (File System Location)"),docRootDescription:o.maketext("Specify the directory where you want the files for this domain to exist."),domainRequired:o.maketext("The Domain field is required."),domainNotUnique:o.maketext("This domain already exists on this account."),docRootPatternError:o.maketext("Directory paths cannot be empty, contain spaces, or contain the following characters: [output,chr,92] ? % * : | [output,quot] [output,gt] [output,lt]"),subdomainHeading:o.maketext("Subdomain"),subdomainDescription:o.maketext("An addon domain requires a subdomain in order to use a separate document root."),subdomainRequired:o.maketext("A subdomain is required."),purchaseFormLabel:o.maketext("Search for a domain"),purchaseFormDescription:"",searchLabel:o.maketext("Search"),showOptions:o.maketext("Show Options"),hideOptions:o.maketext("Hide Options"),purchaseSearchPlaceholder:o.maketext("Use exact terms or let our AI find unique suggestions based on your input.")}});var K=c.consumePendingAddDomain();K&&W(K);var z=r.register(a);z&&z.then((function(e){e&&t.showAssociatedSubdomains!==e.showAssociatedSubdomains&&(t.showAssociatedSubdomains=e.showAssociatedSubdomains,k(),O())})),t.$on("$destroy",(function(){r.unregister(a),w()}))}])}));Back to Directory