text: (window.webpackJsonp=window.webpackJsonp||[]).push([[9],{164:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(5),s=a(2),l=a(7);const r=/\w+\[\]/g,i=/\[\]?\./;class o extends s.PureComponent{constructor(){super(...arguments),this.createIndex=e=>Object(l.flatMap)(e,this.extractSuffixes).sort(),this.checkIndex=(e,t)=>{const a=e[Object(l.sortedIndex)(e,t)];return!(!a||!a.includes(t))},this.extractSuffixes=e=>{const t=new Array(e.length),a=e.toLocaleLowerCase();for(let e=0;e<t.length;e++)t[e]=a.slice(e);return t}}render(){return this.props.children(this.sorted)}get sorted(){return Object(l.sortBy)(this.filtered,[e=>{const t=Object(l.get)(e,this.props.sortByKey);return t&&Object(l.isString)(t)?t.toLocaleLowerCase():t}])}get filtered(){const{list:e,labels:t,searchKeys:a}=this.props,{formattedSearchTerm:n}=this;return Object(l.isEmpty)(n)?e:e.filter(e=>{const s=Object.assign(Object.assign({},e),{labels:Object(l.get)(e,"labels",[]).map(e=>t[e])});return a.some(e=>{const t=this.getKey(s,e),a=this.isStringArray(t);if(!a&&Object(l.isObject)(t))throw new Error(`The value at key "${e}" is an object.  Take a look at "searchKeys" and\n             make sure you're indexing onto a primitive value`);if(a){const e=this.createIndex(t);return this.checkIndex(e,n)}return String(t).toLocaleLowerCase().includes(n)})})}isStringArray(e){return!!Object(l.isArray)(e)&&!(!Object(l.isEmpty)(e)&&!Object(l.isString)(e[0]))}get formattedSearchTerm(){return this.props.searchTerm.trimLeft().toLocaleLowerCase()}getKey(e,t){return t.match(r)?this.getInExactKey(e,t):Object(l.get)(e,t,"")}getInExactKey(e,t){return t.split(i).reduce((e,t)=>Object(l.flatMap)(e,e=>Object(l.get)(e,t,[])),[e])}}const c=e=>({labels:e.resources.labels.byID});function d(){return Object(n.c)(c)(o)}},331:function(e,t,a){"use strict";var n=a(6),s=a(2),l=a.n(s),r=a(5),i=a(3),o=a(7),c=a.n(o),d=a(9),m=a.n(d),h=a(10);let p=class extends s.Component{constructor(){super(...arguments),this.handleMouseOver=()=>{const{onMouseOver:e,id:t}=this.props;e(t)},this.handleClick=e=>{e.stopPropagation();const{onClick:t,id:a}=this.props;t(a)}}render(){const{name:e,colorHex:t,description:a,id:n}=this.props;return l.a.createElement("div",{className:this.className,onMouseOver:this.handleMouseOver,onClick:this.handleClick,"data-testid":`label-list--item ${e}`},l.a.createElement(i.Label,{name:e,description:a,id:n,color:t}))}get className(){const{active:e}=this.props;return m()("inline-labels--list-item",{active:e})}};p=Object(n.b)([h.a],p);var u=p;let b=class extends s.Component{constructor(){super(...arguments),this.handleMouseOver=()=>{const{onMouseOver:e,id:t}=this.props;e(t)},this.handleClick=e=>{e.stopPropagation(),this.props.onClick()}}render(){const{name:e}=this.props;return l.a.createElement("div",{className:this.className,onMouseOver:this.handleMouseOver,onClick:this.handleClick,"data-testid":"inline-labels--create-new"},'Create "',l.a.createElement("strong",null,`${e}`),'"')}get className(){const{active:e}=this.props;return m()("inline-labels--list-item inline-labels--create-new",{active:e})}};b=Object(n.b)([h.a],b);var g=b;let C=class extends s.Component{render(){return l.a.createElement("div",{className:"inline-labels--list-container"},l.a.createElement(i.DapperScrollbars,{autoSizeHeight:!0,autoHide:!1,style:{width:"100%",maxHeight:"300px"},noScrollX:!0},l.a.createElement("div",{className:"inline-labels--list","data-testid":"inline-labels--list"},this.menuItems)))}get menuItems(){const{filteredLabels:e,onItemClick:t,onUpdateSelectedItemID:a,selectedItemID:n,allLabelsUsed:s,searchTerm:r,onStartCreatingLabel:o}=this.props;return e.length?e.map(e=>e.id===D?l.a.createElement(g,{active:n===e.id,key:e.id,name:e.name,id:e.id,onClick:o,onMouseOver:a}):l.a.createElement(u,{active:n===e.id,key:e.id,name:e.name,id:e.id,description:e.properties.description,colorHex:e.properties.color,onClick:t,onMouseOver:a})):s?l.a.createElement(i.EmptyState,{size:i.ComponentSize.ExtraSmall,testID:"inline-labels-list--used-all"},l.a.createElement(i.EmptyState.Text,null,"This resource has all available labels,",l.a.createElement("br",null),"start typing to create a new label")):r?void 0:l.a.createElement(i.EmptyState,{size:i.ComponentSize.ExtraSmall,testID:"inline-labels-list--none-exist"},l.a.createElement(i.EmptyState.Text,null,"键入新标签名"))}};C=Object(n.b)([h.a],C);var v,E=C;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(v||(v={}));let f=class extends s.PureComponent{constructor(){super(...arguments),this.handleKeyDown=e=>{const{selectedItemID:t,onAddLabel:a,onStartCreatingLabel:n,onEscapePress:s}=this.props;switch(e.key){case"Enter":if(e.preventDefault(),e.stopPropagation(),t===D){n();break}if(t){a(t);break}case"ArrowUp":this.handleHighlightAdjacentItem(v.Up);break;case"ArrowDown":this.handleHighlightAdjacentItem(v.Down);break;case"Escape":s()}},this.handleHighlightAdjacentItem=e=>{const{selectedItemID:t,filteredLabels:a,onUpdateSelectedItemID:n}=this.props;if(!a.length||!t)return null;const s=c.a.findIndex(a,e=>e.id===t);n(a[Math.min(Math.max(s+e,0),a.length-1)].id)},this.handleRefocusInput=e=>{e.target.focus()}}render(){const{searchTerm:e,allLabelsUsed:t,selectedItemID:a,onAddLabel:n,triggerRef:s,onStartCreatingLabel:r,onUpdateSelectedItemID:o,onInputChange:c,filteredLabels:d,visible:m}=this.props;return l.a.createElement(i.Popover,{appearance:i.Appearance.Outline,position:i.PopoverPosition.Below,triggerRef:s,distanceFromTrigger:8,visible:m,showEvent:i.PopoverInteraction.None,hideEvent:i.PopoverInteraction.None,testID:"inline-labels--popover",className:"inline-labels--popover",contents:()=>l.a.createElement(l.a.Fragment,null,l.a.createElement("h5",{className:"inline-labels--popover-heading"},"新增标签"),l.a.createElement(i.Input,{icon:i.IconFont.Search,placeholder:"搜索标签...",value:e,onKeyDown:this.handleKeyDown,onChange:c,autoFocus:!0,onBlur:this.handleRefocusInput,testID:"inline-labels--popover-field",maxLength:30}),l.a.createElement(E,{searchTerm:e,allLabelsUsed:t,filteredLabels:d,selectedItemID:a,onItemClick:n,onUpdateSelectedItemID:o,onStartCreatingLabel:r}))})}};f=Object(n.b)([h.a],f);var L=f,I=a(423),O=a(302),S=a(4),y=a(483),j=a(201);const D="add-new-label",x={id:D,name:"",properties:{color:"#000000",description:""},status:S.RemoteDataState.NotStarted};let w=class extends s.Component{constructor(e){super(e),this.popoverTrigger=Object(s.createRef)(),this.handleAddPopoverEventListener=()=>{this.popoverTrigger.current&&this.popoverTrigger.current.addEventListener("click",()=>{this.setState({isPopoverVisible:!0})})},this.onClickOutside=e=>{e.target!==this.popoverTrigger.current&&this.hidePopover()},this.handleAddLabel=async e=>{const{onAddLabel:t,labels:a}=this.props,n=a.find(t=>t.id===e);n&&(this.selectAvailableItem(),await t(n))},this.selectAvailableItem=()=>{const{searchTerm:e}=this.state,t=this.filterLabels(e);t.length&&this.handleUpdateSelectedItemID(t[0].id)},this.handleUpdateSelectedItemID=e=>{this.setState({selectedItemID:e})},this.handleInputChange=e=>{const t=e.target.value,a=this.filterLabels(t);if(a.length){const e=a[0].id;this.setState({searchTerm:t,selectedItemID:e})}else this.setState({searchTerm:t})},this.filterLabels=e=>{const t=this.availableLabels.filter(t=>{const a=t.name.toLowerCase(),n=e.toLowerCase();return a.includes(n)});return!t.reduce((t,a)=>!0===t||a.name===e,!1)&&e?this.filteredLabelsWithAddButton(t):this.filteredLabelsWithoutAddButton(t)},this.filteredLabelsWithAddButton=e=>{const{searchTerm:t}=this.state,a=Object.assign(Object.assign({},x),{name:t});return e.find(e=>e.id===a.id)?e.map(e=>e.id===a.id?a:e):[a,...e]},this.filteredLabelsWithoutAddButton=e=>e.filter(e=>e.id!==D),this.handleCreateLabel=async e=>{const{onCreateLabel:t,onAddLabel:a}=this.props,{name:n,properties:s}=e;await t(n,s),a(this.props.labels.find(t=>t.name===e.name))},this.handleStartCreatingLabel=()=>{this.setState({isCreatingLabel:y.a.Open,isPopoverVisible:!1})},this.hidePopover=()=>{this.setState({isPopoverVisible:!1})},this.handleStopCreatingLabel=()=>{this.setState({isCreatingLabel:y.a.Closed,searchTerm:""})},this.handleEnsureUniqueLabelName=e=>{const{labels:t}=this.props,a=t.map(e=>e.name);return Object(O.c)(a,e)},this.state={selectedItemID:null,searchTerm:"",isCreatingLabel:y.a.Closed,isPopoverVisible:!1}}componentDidMount(){this.handleAddPopoverEventListener()}render(){const{isCreatingLabel:e,searchTerm:t}=this.state;return l.a.createElement(l.a.Fragment,null,this.popover,l.a.createElement("div",{className:"inline-labels--editor"},l.a.createElement(i.ButtonBase,{color:i.ComponentColor.Secondary,titleText:"新增标签",shape:i.ButtonShape.Square,className:"inline-labels--add",testID:"inline-labels--add",ref:this.popoverTrigger},l.a.createElement("div",{className:"inline-labels--add-icon"})),this.noLabelsIndicator),l.a.createElement(I.a,{isVisible:e===y.a.Open,onDismiss:this.handleStopCreatingLabel,overrideDefaultName:t,onCreateLabel:this.handleCreateLabel,onNameValidation:this.handleEnsureUniqueLabelName}))}get popover(){const{labels:e,selectedLabels:t}=this.props,{searchTerm:a,selectedItemID:n,isPopoverVisible:s}=this.state,r=e.length>0&&e.length===t.length;return l.a.createElement(i.ClickOutside,{onClickOutside:this.onClickOutside},l.a.createElement(L,{searchTerm:a,triggerRef:this.popoverTrigger,selectedItemID:n,onUpdateSelectedItemID:this.handleUpdateSelectedItemID,allLabelsUsed:r,onStartCreatingLabel:this.handleStartCreatingLabel,onInputChange:this.handleInputChange,filteredLabels:this.filterLabels(a),onAddLabel:this.handleAddLabel,visible:s,onEscapePress:this.hidePopover}))}get noLabelsIndicator(){const{selectedLabels:e}=this.props;if(e.length)return;return l.a.createElement("div",{className:"cf-label cf-label--xs cf-label--colorless",onClick:()=>{this.popoverTrigger.current&&this.popoverTrigger.current.click()},"data-testid":"inline-labels--empty"},l.a.createElement("span",{className:"cf-label--name"},"新增标签"))}get availableLabels(){const{selectedLabels:e,labels:t}=this.props;return c.a.differenceBy(t,e,e=>e.name)}};w=Object(n.b)([h.a,Object(n.d)("design:paramtypes",[Object])],w);const N={onCreateLabel:j.a};var k,T=Object(r.c)(null,N)(w),P=a(11);!function(e){e.Editable="editable",e.Readonly="readonly"}(k||(k={}));let F=class extends s.Component{constructor(){super(...arguments),this.handleLabelClick=e=>{const{onFilterChange:t}=this.props;t(e)},this.handleDeleteLabel=e=>{const{onRemoveLabel:t,selectedLabels:a}=this.props;t(a.find(t=>t.id===e))}}render(){return l.a.createElement("div",{className:"inline-labels"},this.selectedLabels)}get selectedLabels(){const{selectedLabels:e,labels:t,onAddLabel:a}=this.props;return l.a.createElement("div",{className:"inline-labels--container"},this.isEditable&&l.a.createElement(T,{labels:t,selectedLabels:e,onAddLabel:a}),this.currentLabels)}get currentLabels(){const{selectedLabels:e}=this.props,t=this.isEditable?this.handleDeleteLabel:null;if(e.length)return e.map(e=>{const a=Object.assign({},e);return a.hasOwnProperty("properties")||(a.properties={color:"#FF0000",description:""}),l.a.createElement(i.Label,{id:a.id,key:a.id,name:a.name,color:a.properties.color,description:a.properties.description,onDelete:t,onClick:this.handleLabelClick.bind(this,a.name)})})}get isEditable(){return this.props.editMode===k.Editable}};F.defaultProps={editMode:k.Editable},F=Object(n.b)([h.a],F);t.a=Object(r.c)((e,t)=>({labels:Object(P.a)(e,S.ResourceType.Labels),selectedLabels:Object(P.d)(e,t.selectedLabelIDs)}))(F)},384:function(e,t,a){"use strict";var n=a(6),s=a(2),l=a.n(s),r=a(3),i=a(203),o=a(302),c=a(10);let d=class extends s.PureComponent{constructor(){super(...arguments),this.handleNameValidation=e=>this.props.onNameValidation(e)}render(){const{id:e,name:t,color:a,onSubmit:n,buttonText:s,description:i,onCloseModal:o,onInputChange:c,onLabelPropertyChange:d,onColorChange:m,isFormValid:h}=this.props;return l.a.createElement(r.Form,{onSubmit:n,testID:"label-overlay-form"},l.a.createElement(r.Grid,null,l.a.createElement(r.Grid.Row,null,l.a.createElement(r.Grid.Column,{widthXS:r.Columns.Twelve},l.a.createElement(r.Form.Element,{label:"Preview"},l.a.createElement(r.Form.Box,{className:"label-overlay--preview"},l.a.createElement(r.Label,{size:r.ComponentSize.Small,name:this.placeholderLabelName,description:i,color:this.validatedColor,id:e})))),l.a.createElement(r.Grid.Column,{widthSM:r.Columns.Twelve},l.a.createElement(r.Form.ValidationElement,{label:"Name",value:t,required:!0,validationFunc:this.handleNameValidation},e=>l.a.createElement(r.Input,{type:r.InputType.Text,placeholder:"Name this Label",name:"name",autoFocus:!0,value:t,onChange:c,status:e,maxLength:50,testID:"create-label-form--name"}))),l.a.createElement(r.Grid.Column,{widthXS:r.Columns.Twelve},l.a.createElement(r.Form.Element,{label:"Description"},l.a.createElement(r.Input,{type:r.InputType.Text,placeholder:"Add a optional description",name:"description",value:i,onChange:d,testID:"create-label-form--description"}))),l.a.createElement(r.Grid.Column,{widthSM:r.Columns.Twelve},l.a.createElement(r.Form.Element,{label:"Color"},l.a.createElement(r.ColorPicker,{color:a,onChange:m}))),l.a.createElement(r.Grid.Column,{widthXS:r.Columns.Twelve},l.a.createElement(r.Form.Footer,null,l.a.createElement(r.Button,{text:"Cancel",onClick:o,titleText:"Cancel creation of Label and return to list",type:r.ButtonType.Button,testID:"create-label-form--cancel"}),l.a.createElement(r.Button,{text:s,color:r.ComponentColor.Success,type:r.ButtonType.Submit,testID:"create-label-form--submit",status:h?r.ComponentStatus.Default:r.ComponentStatus.Disabled}))))))}get placeholderLabelName(){const{name:e}=this.props;return e||"Name this Label"}get validatedColor(){const{color:e}=this.props;return Object(o.b)(e)?i.d:e}};d=Object(n.b)([c.a],d),t.a=d},423:function(e,t,a){"use strict";var n=a(6),s=a(2),l=a.n(s),r=a(384),i=a(3),o=a(203),c=a(10),d=a(58);let m=class extends s.Component{constructor(e){super(e),this.handleSubmit=()=>{const{onCreateLabel:e,onDismiss:t}=this.props;try{e(this.state.label)}finally{t(),this.resetForm()}},this.handleInputChange=e=>{const{value:t,name:a}=e.target;this.setState(e=>({label:Object.assign(Object.assign({},e.label),{[a]:t})}))},this.handleLabelPropertyChange=e=>{const{value:t,name:a}=e.target;this.setState(e=>({label:Object.assign(Object.assign({},e.label),{properties:Object.assign(Object.assign({},e.label.properties),{[a]:t})})}))},this.handleColorChange=(e,t)=>{const a=Object.assign(Object.assign({},this.state.label.properties),{color:e}),n=Object.assign(Object.assign({},this.state.label),{properties:a});this.setState({label:n,colorStatus:t})},this.state={label:Object.assign(Object.assign({},o.a),{name:this.props.overrideDefaultName}),colorStatus:i.ComponentStatus.Default}}componentDidUpdate(e){if(e.overrideDefaultName!==this.props.overrideDefaultName&&!1===this.props.isVisible){const e=this.props.overrideDefaultName,t=Object.assign(Object.assign({},this.state.label),{name:e});this.setState({label:t})}}render(){const{isVisible:e,onDismiss:t,onNameValidation:a}=this.props,{label:n}=this.state;return l.a.createElement(i.Overlay,{visible:e},l.a.createElement(i.Overlay.Container,{maxWidth:400},l.a.createElement(i.Overlay.Header,{title:"Create Label",onDismiss:t}),l.a.createElement(i.Overlay.Body,null,l.a.createElement(d.a,null,l.a.createElement(r.a,{"data-testid":"create-label--overlay",id:n.id,name:n.name,onCloseModal:t,buttonText:"Create Label",onSubmit:this.handleSubmit,isFormValid:this.isFormValid,color:n.properties.color,onNameValidation:a,onInputChange:this.handleInputChange,onLabelPropertyChange:this.handleLabelPropertyChange,onColorChange:this.handleColorChange,description:n.properties.description})))))}get isFormValid(){const{label:e,colorStatus:t}=this.state,{onNameValidation:a}=this.props,n=null===a(e.name)&&!!e.name,s=t===i.ComponentStatus.Default||t===i.ComponentStatus.Valid;return n&&s}resetForm(){this.setState({label:o.a})}};m=Object(n.b)([c.a,Object(n.d)("design:paramtypes",[Object])],m),t.a=m},47:function(e,t,a){"use strict";var n=a(2),s=a.n(n),l=a(5),r=a(7),i=a(9),o=a.n(i),c=a(3),d=a(75),m=a(8),h=a(65);t.a=Object(l.c)(e=>{const t=Object(r.get)(e,"cloud.orgSettings.settings",[]),a=Object(r.find)(t,e=>e.key===h.e);return a&&a.value===h.f.value?{inView:!1}:{inView:!0}})(({inView:e,size:t=c.ComponentSize.Small,className:a,buttonText:n="Upgrade Now"})=>{const l=o()("upgrade-payg--button",{[`${a}`]:a});return s.a.createElement(d.a,null,e&&s.a.createElement(c.LinkButton,{icon:c.IconFont.CrownSolid,className:l,color:c.ComponentColor.Success,size:t,shape:c.ButtonShape.Default,href:`${m.l}${m.g}`,target:"_self",text:n,testID:"cloud-upgrade--button"}))})},63:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(12),s=a(124),l=a(8);const r=e=>{const t=Object(s.a)().getState(),a=Object(n.a)(t),r=l.e?"InfluxDB Cloud":"InfluxDB";return(a&&a.name?[...e,Object(n.a)(t).name,r]:[...e,r]).join(" | ")}},75:function(e,t,a){"use strict";var n=a(2),s=a(8);t.a=class extends n.PureComponent{render(){const{children:e}=this.props;return s.e?e:null}}},81:function(e,t,a){"use strict";var n=a(2),s=a.n(n),l=a(5),r=a(9),i=a.n(r),o=a(3),c=a(47),d=a(48),m=a(8),h=a(33),p=a(7),u=a(65),b=a(74);const g={onShowOverlay:b.c,onDismissOverlay:b.b};var C=Object(l.c)(e=>{const t=Object(p.get)(e,"cloud.orgSettings.settings",[]),a=Object(p.find)(t,e=>e.key===u.e);return a&&a.value===u.f.value?{showUpgrade:!1}:{showUpgrade:!0}},g)(({className:e,showUpgrade:t,onShowOverlay:a,onDismissOverlay:n})=>{const l=i()("rate-alert--content",{[`${e}`]:e});return t?s.a.createElement("div",{className:`${l} rate-alert--content__free`},s.a.createElement("span",null,"Oh no! You hit the"," ",s.a.createElement("a",{href:"https://docs.influxdata.com/influxdb/v2.0/write-data/best-practices/resolve-high-cardinality/",className:"rate-alert--docs-link",target:"_blank",rel:"noreferrer"},"series cardinality")," ","limit and your data stopped writing. Don’t lose important metrics."),s.a.createElement(o.FlexBox,{justifyContent:o.JustifyContent.Center,className:"rate-alert--button"},s.a.createElement(c.a,{className:"upgrade-payg--button__rate-alert"}))):s.a.createElement("div",{className:`${l} rate-alert--content__payg`},s.a.createElement("span",null,"Data in has stopped because you've hit the"," ",s.a.createElement("a",{href:"https://docs.influxdata.com/influxdb/v2.0/write-data/best-practices/resolve-high-cardinality/",className:"rate-alert--docs-link",target:"_blank",rel:"noreferrer"},"series cardinality")," ","limit. Let's get it flowing again."),s.a.createElement(o.FlexBox,{justifyContent:o.JustifyContent.Center,className:"rate-alert--button"},s.a.createElement(o.Button,{className:"rate-alert-overlay-button",color:o.ComponentColor.Primary,size:o.ComponentSize.Small,onClick:()=>{a("rate-limit",null,n)},text:"Inspect Series Cardinality"})))});t.a=Object(l.c)(e=>{const{cloud:{limits:t}}=e,a=Object(d.k)(t);return{status:Object(d.l)(t),resources:a}})(({status:e,alertOnly:t,className:a,resources:n})=>{const l=i()("rate-alert",{[`${a}`]:a});return m.e&&e===h.b.EXCEEDED&&n.includes("cardinality")?s.a.createElement(o.FlexBox,{direction:o.FlexDirection.Column,alignItems:o.AlignItems.Center,margin:o.ComponentSize.Large,className:l},s.a.createElement(o.BannerPanel,{size:o.ComponentSize.ExtraSmall,gradient:o.Gradients.PolarExpress,icon:o.IconFont.Cloud,hideMobileIcon:!0,textColor:o.InfluxColors.Yeti},s.a.createElement(C,null))):m.e&&!t?s.a.createElement(c.a,{className:"upgrade-payg--button__header"}):null})}}]);
  //# sourceMappingURL=9.d2e2ab5021.js.map