"use strict";(self.webpackChunkinfluxdb_ui=self.webpackChunkinfluxdb_ui||[]).push([[390],{87544:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var o=n(67294),a=n(47886),r=n(88453),l=n(98555),c=n(46581),i=n(42448),s=n(96486),u=n(86836);const m=()=>{const{pathname:e,setSearchTerm:t}=(0,o.useContext)(r.NU),[n,a]=(0,o.useState)(""),c=(0,o.useRef)((0,s.debounce)(t,300)),i=e.includes(u.W6.organizations)?"organizations":"accounts";return o.createElement(l.Input,{icon:l.IconFont.Search_New,placeholder:`Filter ${i} by ${"organizations"===i?"id":"email"} ...`,inputStyle:{width:"500px"},value:n,onChange:e=>{a(e.target.value),c.current(e.target.value)},testID:"operator-resource--searchbar"})};var p=n(76);const d=()=>{const{pathname:e}=(0,o.useContext)(r.NU);return o.createElement(l.Tabs,{size:l.ComponentSize.Large},o.createElement(l.Tabs.Tab,{id:"accounts",text:"Accounts",active:e===u.W6.accounts||e===u.W6.default,testID:"accountTab",linkElement:e=>o.createElement(p.rU,{className:e,to:u.W6.accounts})}),o.createElement(l.Tabs.Tab,{id:"organizations",text:"Organizations",active:e===u.W6.organizations,testID:"orgTab",linkElement:e=>o.createElement(p.rU,{className:e,to:u.W6.organizations})}))};var E=n(50102);const g=["cancelled","contract","free","pay_as_you_go"],h=()=>{const{accountTypes:e,setAccountTypes:t}=(0,o.useContext)(r.NU);return o.createElement(l.MultiSelectDropdown,{style:{width:"220px",marginRight:"20px"},options:g,selectedOptions:e,onSelect:n=>{return o=n,e.includes(o)?t((e=>e.filter((e=>e!==o)))):t((e=>[o,...e]));var o},menuTheme:l.DropdownMenuTheme.Onyx,emptyText:"Account Types",buttonColor:l.ComponentColor.Primary})};var T=n(30235);const x={width:"220px",marginRight:"10px"},b={width:"220px",marginRight:"20px"},v=()=>{const{providerInfo:e,providers:t,regions:n,setProviders:a,setRegions:c}=(0,o.useContext)(r.NU),i=t.length>0,s=e.providers.map((e=>e.provider)),u=t.flatMap((t=>(0,T.JL)(t,e.regions))).map((e=>e.region));return o.createElement(o.Fragment,null,o.createElement(l.MultiSelectDropdown,{style:x,options:s,selectedOptions:t,onSelect:e=>{c([]),t.includes(e)?a((t=>t.filter((t=>t!==e)))):a((t=>[e,...t]))},menuTheme:l.DropdownMenuTheme.Onyx,emptyText:"Cloud Provider",buttonColor:l.ComponentColor.Primary}),i&&o.createElement(l.MultiSelectDropdown,{style:b,options:u,selectedOptions:n,onSelect:e=>n.includes(e)?c((t=>t.filter((t=>t!==e)))):c((t=>[e,...t])),menuTheme:l.DropdownMenuTheme.Onyx,emptyText:"Cloud Region",buttonColor:l.ComponentColor.Primary}))},C=()=>{const{accounts:e,organizations:t,pathname:n,status:a}=(0,o.useContext)(r.NU),c=n.includes(u.W6.organizations),s=c?t:e,p=c?u.sL:u.FJ,g=c?u.MO:u.Ce;return o.createElement(l.Tabs.Container,{orientation:l.Orientation.Horizontal},o.createElement(d,null),o.createElement(l.Tabs.TabContents,null,o.createElement(l.FlexBox,{direction:l.FlexDirection.Row},o.createElement(h,null),c&&o.createElement(v,null),o.createElement(m,null)),o.createElement(E.Z,{loading:a},(null==s?void 0:s.length)?o.createElement(l.Table,null,o.createElement(l.Table.Header,null,o.createElement(l.Table.Row,null,p.map((e=>o.createElement(l.Table.HeaderCell,{key:e},e))))),o.createElement(l.Table.Body,null,null==s?void 0:s.map((e=>o.createElement(i.Z,{key:e.id,resource:e,infos:g})))),o.createElement(l.Table.Footer,null)):o.createElement(l.EmptyState,{size:l.ComponentSize.Medium},o.createElement(l.EmptyState.Text,null,"Looks like there were no"," ",o.createElement("b",null,c?"organizations":"accounts")," that matched your search.")))))};var y=n(46458),w=n(16603);const f=()=>{const e=(0,y.v9)(w.WV),{user:t}=e;return o.createElement(l.ReflessPopover,{position:l.PopoverPosition.ToTheLeft,showEvent:l.PopoverInteraction.Click,hideEvent:l.PopoverInteraction.Click,contents:()=>o.createElement(o.Fragment,null,o.createElement("p",null,t.email),o.createElement(p.rU,{to:"/logout","data-testid":"logout-button"},"Logout")),appearance:l.Appearance.Outline,className:"operator-nav-popover"},o.createElement(l.SquareButton,{className:"operator-nav-button",icon:l.IconFont.User,testID:"operator-nav-button"}))};var z=n(65710);const D=()=>o.createElement(l.AppWrapper,null,o.createElement(l.Page,{titleTag:"Operator UI",testID:"operator-page--title"},o.createElement(l.FlexBox,{direction:l.FlexDirection.Row},o.createElement(l.FlexBoxChild,null,o.createElement(c.Z,{title:"Cloud 2.0 Resources"})),o.createElement(f,null)),o.createElement(l.Page.Contents,{scrollable:!0},o.createElement(C,null)),o.createElement(a.AW,{path:"/operator/orgs/:orgID",component:z.HO}))),S=()=>o.createElement(r.ZP,null,o.createElement(a.rs,null,o.createElement(a.AW,{exact:!0,path:"/operator/accounts/:accountID",component:z.w1}),o.createElement(a.AW,{path:"/operator",component:D})))}}]);
//# sourceMappingURL=51aefb169d.js.map