⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.72
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
grafana
/
public
/
build
/
View File Name :
UserProfileEditPage.7cc4c218d9e4664250e3.js
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2472],{39745:(w,T,t)=>{t.d(T,{A:()=>_,u:()=>r});var e=t(32196),a=t(96540),C=t(97594),I=t(41987),p=t(13544),z=t(14110),F=t(32264),K=t(84167),y=t(88575),B=t(88323),g=t(60029),o=t(20333),$=t(15648),H=t(86460),s=t(55852),A=t(3911),D=t(59429),c=t(44836),j=t(74513),Q=t(65615),V=t(2769);function n(){const O=j.Yj.map(l=>({value:l.code,label:l.name}));return[{value:"",label:(0,c.t)("common.locale.default","Default")},...O]}class r extends a.PureComponent{constructor(h){super(h),this.onSubmitForm=async l=>{if(l.preventDefault(),this.props.onConfirm?await this.props.onConfirm():!0){const{homeDashboardUID:Y,theme:G,timezone:J,weekStart:L,language:W,queryHistory:X}=this.state;await this.service.update({homeDashboardUID:Y,theme:G,timezone:J,weekStart:L,language:W,queryHistory:X}),window.location.reload()}},this.onThemeChanged=l=>{this.setState({theme:l.value}),l.value&&(0,V.K)(l.value,!0)},this.onTimeZoneChanged=l=>{typeof l=="string"&&this.setState({timezone:l})},this.onWeekStartChanged=l=>{this.setState({weekStart:l})},this.onHomeDashboardChanged=l=>{this.setState({homeDashboardUID:l})},this.onLanguageChanged=l=>{this.setState({language:l}),(0,z.rR)("grafana_preferences_language_changed",{toLanguage:l,preferenceType:this.props.preferenceType})},this.service=new Q.W(h.resourceUri),this.state={theme:"",timezone:"",weekStart:"",language:"",queryHistory:{homeTab:""}},this.themeOptions=(0,C.k)(F.$.featureToggles.extraThemes).map(l=>({value:l.id,label:q(l)})),this.themeOptions.unshift({value:"",label:(0,c.t)("shared-preferences.theme.default-label","Default")})}async componentDidMount(){const h=await this.service.load();this.setState({homeDashboardUID:h.homeDashboardUID,theme:h.theme,timezone:h.timezone,weekStart:h.weekStart,language:h.language,queryHistory:h.queryHistory})}render(){const{theme:h,timezone:l,weekStart:R,homeDashboardUID:Y,language:G}=this.state,{disabled:J}=this.props,L=Z(),W=n(),X=this.themeOptions.find(b=>b.value===h)??this.themeOptions[0];return a.createElement("form",{onSubmit:this.onSubmitForm,className:L.form},a.createElement(K.n,{label:a.createElement(c.x6,{i18nKey:"shared-preferences.title"},"Preferences"),disabled:J},a.createElement(y.D,{label:(0,c.t)("shared-preferences.fields.theme-label","Interface theme")},a.createElement(B.l6,{options:this.themeOptions,value:X,onChange:this.onThemeChanged,inputId:"shared-preferences-theme-select"})),a.createElement(y.D,{label:a.createElement(g.J,{htmlFor:"home-dashboard-select"},a.createElement("span",{className:L.labelText},a.createElement(c.x6,{i18nKey:"shared-preferences.fields.home-dashboard-label"},"Home Dashboard"))),"data-testid":"User preferences home dashboard drop down"},a.createElement(D.b,{value:Y,onChange:b=>this.onHomeDashboardChanged(b?.uid??""),defaultOptions:!0,isClearable:!0,placeholder:(0,c.t)("shared-preferences.fields.home-dashboard-placeholder","Default dashboard"),inputId:"home-dashboard-select"})),a.createElement(y.D,{label:(0,c.t)("shared-dashboard.fields.timezone-label","Timezone"),"data-testid":p.Tp.components.TimeZonePicker.containerV2},a.createElement(o.U,{includeInternal:!0,value:l,onChange:this.onTimeZoneChanged,inputId:"shared-preferences-timezone-picker"})),a.createElement(y.D,{label:(0,c.t)("shared-preferences.fields.week-start-label","Week start"),"data-testid":p.Tp.components.WeekStartPicker.containerV2},a.createElement($.l,{value:R||"",onChange:this.onWeekStartChanged,inputId:"shared-preferences-week-start-picker"})),a.createElement(y.D,{label:a.createElement(g.J,{htmlFor:"locale-select"},a.createElement("span",{className:L.labelText},a.createElement(c.x6,{i18nKey:"shared-preferences.fields.locale-label"},"Language")),a.createElement(H.y,{featureState:I.Ay.beta})),"data-testid":"User preferences language drop down"},a.createElement(B.l6,{value:W.find(b=>b.value===G),onChange:b=>this.onLanguageChanged(b.value??""),options:W,placeholder:(0,c.t)("shared-preferences.fields.locale-placeholder","Choose language"),inputId:"locale-select"}))),a.createElement(s.$n,{type:"submit",variant:"primary","data-testid":p.Tp.components.UserProfile.preferencesSaveButton},a.createElement(c.x6,{i18nKey:"common.save"},"Save")))}}const _=r,Z=(0,A.N)(()=>({labelText:(0,e.css)({marginRight:"6px"}),form:(0,e.css)({width:"100%",maxWidth:"600px"})}));function q(O){switch(O.id){case"dark":return(0,c.t)("shared.preferences.theme.dark-label","Dark");case"light":return(0,c.t)("shared.preferences.theme.light-label","Light");case"system":return(0,c.t)("shared.preferences.theme.system-label","System preference");default:return O.name}}},48357:(w,T,t)=>{t.r(T),t.d(T,{UserProfileEditPage:()=>ae,default:()=>de});var e=t(96540),a=t(69733),C=t(4392),I=t(74135),p=t(13544),z=t(4402),F=t(66864),K=t(67061),y=t(63021),B=t(40675),g=t(40980),o=t(36830),$=t(39745),H=t(83277),s=t(44836),A=t(39558),D=t(55852);class c extends e.PureComponent{render(){const{isLoading:v,orgs:E,user:f}=this.props;return v?e.createElement(A._,{text:"Loading organizations..."}):E.length===0?null:e.createElement("div",null,e.createElement("h3",{className:"page-sub-heading"},e.createElement(s.x6,{i18nKey:"user-orgs.title"},"Organizations")),e.createElement("table",{className:"filter-table form-inline","data-testid":p.Tp.components.UserProfile.orgsTable},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-orgs.name-column"},"Name")),e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-orgs.role-column"},"Role")),e.createElement("th",null))),e.createElement("tbody",null,E.map((d,m)=>e.createElement("tr",{key:m},e.createElement("td",null,d.name),e.createElement("td",null,d.role),e.createElement("td",{className:"text-right"},d.orgId===f?.orgId?e.createElement(D.$n,{variant:"secondary",size:"sm",disabled:!0},e.createElement(s.x6,{i18nKey:"user-orgs.current-org-button"},"Current")):e.createElement(D.$n,{variant:"secondary",size:"sm",onClick:()=>{this.props.setUserOrg(d)}},e.createElement(s.x6,{i18nKey:"user-orgs.select-org-button"},"Select organisation"))))))))}}const j=c;var Q=t(51253),V=t(84167),n=t(88575),r=t(10354),_=t(56034),Z=t(14578),q=t(2913);const{disableLoginForm:O}=q.Ay,l=({user:u,isSavingUser:v,updateProfile:E})=>{const f=P=>{E(P)},d=(u&&u.isExternal)??!1,m=d&&u&&u.authLabels?u.authLabels[0]:"",U=m?` (Synced via ${m})`:"",S=O||d;return e.createElement(Q.l,{onSubmit:f,validateOn:"onBlur"},({register:P,errors:N})=>e.createElement(e.Fragment,null,e.createElement(V.n,null,e.createElement(n.D,{label:(0,s.t)("user-profile.fields.name-label","Name")+U,invalid:!!N.name,error:e.createElement(s.x6,{i18nKey:"user-profile.fields.name-error"},"Name is required"),disabled:S},e.createElement(r.p,{...P("name",{required:!0}),id:"edit-user-profile-name",placeholder:(0,s.t)("user-profile.fields.name-label","Name"),defaultValue:u?.name??"",suffix:e.createElement(R,null)})),e.createElement(n.D,{label:(0,s.t)("user-profile.fields.email-label","Email")+U,invalid:!!N.email,error:e.createElement(s.x6,{i18nKey:"user-profile.fields.email-error"},"Email is required"),disabled:S},e.createElement(r.p,{...P("email",{required:!0}),id:"edit-user-profile-email",placeholder:(0,s.t)("user-profile.fields.email-label","Email"),defaultValue:u?.email??"",suffix:e.createElement(R,null)})),e.createElement(n.D,{label:(0,s.t)("user-profile.fields.username-label","Username")+U,disabled:S},e.createElement(r.p,{...P("login"),id:"edit-user-profile-username",defaultValue:u?.login??"",placeholder:(0,s.t)("user-profile.fields.username-label","Username")+U,suffix:e.createElement(R,null)}))),e.createElement(D.$n,{variant:"primary",disabled:v||S,"data-testid":p.Tp.components.UserProfile.profileSaveButton,type:"submit"},e.createElement(s.x6,{i18nKey:"common.save"},"Save"))))},R=()=>O?e.createElement(_.m,{content:"Login details locked because they are managed in another system."},e.createElement(Z.I,{name:"lock"})):null;var Y=t(32196),G=t(72635);class J extends e.PureComponent{render(){const{isLoading:v,sessions:E,revokeUserSession:f}=this.props,d=L();return v?e.createElement(A._,{text:e.createElement(s.x6,{i18nKey:"user-sessions.loading"},"Loading sessions...")}):e.createElement("div",{className:d.wrapper},E.length>0&&e.createElement(e.Fragment,null,e.createElement("h3",{className:"page-sub-heading"},"Sessions"),e.createElement("table",{className:"filter-table form-inline","data-testid":p.Tp.components.UserProfile.sessionsTable},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-session.seen-at-column"},"Last seen")),e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-session.created-at-column"},"Logged on")),e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-session.ip-column"},"IP address")),e.createElement("th",null,e.createElement(s.x6,{i18nKey:"user-session.browser-column"},"Browser & OS")),e.createElement("th",null))),e.createElement("tbody",null,E.map((m,U)=>e.createElement("tr",{key:U},m.isActive?e.createElement("td",null,"Now"):e.createElement("td",null,m.seenAt),e.createElement("td",null,(0,s.Xj)(m.createdAt,{dateStyle:"long"})),e.createElement("td",null,m.clientIp),e.createElement("td",null,m.browser," on ",m.os," ",m.osVersion),e.createElement("td",null,e.createElement(D.$n,{size:"sm",variant:"destructive",onClick:()=>f(m.id),"aria-label":(0,G.t)("user-session.revoke","Revoke user session")},e.createElement(Z.I,{name:"power"})))))))))}}const L=()=>({wrapper:(0,Y.css)({maxWidth:"100%"})}),W=J;class X extends e.PureComponent{render(){const{isLoading:v,teams:E}=this.props;return v?e.createElement(A._,{text:"Loading teams..."}):E.length===0?null:e.createElement("div",null,e.createElement("h3",{className:"page-sub-heading"},"Teams"),e.createElement("table",{className:"filter-table form-inline","aria-label":"User teams table"},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null),e.createElement("th",null,"Name"),e.createElement("th",null,"Email"),e.createElement("th",null,"Members"))),e.createElement("tbody",null,E.map((f,d)=>e.createElement("tr",{key:d},e.createElement("td",{className:"width-4 text-center"},e.createElement("img",{className:"filter-table__avatar",src:f.avatarUrl,alt:""})),e.createElement("td",null,f.name),e.createElement("td",null,f.email),e.createElement("td",null,f.memberCount))))))}}const b=null;var k=t(84969);const ne="tab",ee="general";function ce(u){const v=u.user,{user:E,teams:f,orgs:d,sessions:m,teamsAreLoading:U,orgsAreLoading:S,sessionsAreLoading:P,isUpdating:N}=v;return{orgsAreLoading:S,sessionsAreLoading:P,teamsAreLoading:U,orgs:d,sessions:m,teams:f,isUpdating:N,user:E}}const me={initUserProfilePage:k.Qe,revokeUserSession:k._O,changeUserOrg:k.Aj,updateUserProfile:k.eg},ue=(0,a.connect)(ce,me);function ae({orgsAreLoading:u,sessionsAreLoading:v,teamsAreLoading:E,initUserProfilePage:f,orgs:d,sessions:m,teams:U,isUpdating:S,user:P,revokeUserSession:N,changeUserOrg:Ee,updateUserProfile:fe}){const[ge,he]=(0,H.s)(),re=ge[ne],[te,pe]=(0,e.useState)(typeof re=="string"?re:ee);(0,C.A)(()=>f());const se=(0,e.useMemo)(()=>{const{extensions:i}=(0,z.Dp)({extensionPointId:I.S.UserProfileTab,context:{}});return i},[]),le=se.reduce((i,M)=>{const{title:x}=M;return i[x]?i[x].push(M):i[x]=[M],i},{}),oe=i=>i.toLowerCase(),ve=se.length>0,Pe=[{id:ee,title:(0,s.t)("user-profile.tabs.general","General")},...Object.keys(le).map(i=>({id:oe(i),title:i}))],ie=()=>e.createElement(F.gW,{spacing:"md"},e.createElement(l,{updateProfile:fe,isSavingUser:S,user:P}),e.createElement($.A,{resourceUri:"user",preferenceType:"user"}),e.createElement(K.B,{direction:"column",gap:6},e.createElement(X,{isLoading:E,teams:U}),e.createElement(j,{isLoading:u,setUserOrg:Ee,orgs:d,user:P}),e.createElement(W,{isLoading:v,revokeUserSession:N,sessions:m}))),Ue=()=>e.createElement("div",{"data-testid":p.Tp.components.UserProfile.extensionPointTabs},e.createElement(K.B,{direction:"column",gap:2},e.createElement(y.U,null,Pe.map(({id:i,title:M})=>e.createElement(B.o,{key:i,label:M,active:te===i,onChangeTab:()=>{pe(i),he({[ne]:i})},"data-testid":p.Tp.components.UserProfile.extensionPointTab(i)}))),e.createElement(g.J,null,te===ee&&e.createElement(ie,null),Object.entries(le).map(([i,M])=>{const x=oe(i);return te===x?e.createElement(e.Fragment,{key:x},M.map(({component:ye},Te)=>e.createElement(ye,{key:`${x}-${Te}`}))):null}))));return e.createElement(o.Y,{navId:"profile/settings"},e.createElement(o.Y.Contents,{isLoading:!P},ve?e.createElement(Ue,null):e.createElement(ie,null)))}const de=ue(ae)},84969:(w,T,t)=>{t.d(T,{ec:()=>$,Aj:()=>Q,Qe:()=>H,YW:()=>s,_O:()=>j,eg:()=>V});var e=t(32264),a=t(17172);async function C(n){try{await(0,a.AI)().put("/api/user/password",n)}catch(r){console.error(r)}}function I(){return(0,a.AI)().get("/api/user")}function p(){return(0,a.AI)().get("/api/user/teams")}function z(){return(0,a.AI)().get("/api/user/orgs")}function F(){return(0,a.AI)().get("/api/user/auth-tokens")}async function K(n){await(0,a.AI)().post("/api/user/revoke-auth-token",{authTokenId:n})}async function y(n){await(0,a.AI)().post("/api/user/using/"+n.orgId,{})}async function B(n){try{await(0,a.AI)().put("/api/user",n)}catch(r){console.error(r)}}const g={changePassword:C,revokeUserSession:K,loadUser:I,loadSessions:F,loadOrgs:z,loadTeams:p,setUserOrg:y,updateUserProfile:B};var o=t(81862);function $(n){return async function(r){r((0,o.Nm)({updating:!0})),await g.changePassword(n),r((0,o.Nm)({updating:!1}))}}function H(){return async function(n){await n(s()),n(A()),n(D()),n(c())}}function s(){return async function(n){const r=await g.loadUser();n((0,o.HO)({user:r}))}}function A(){return async function(n){n((0,o.ri)());const r=await g.loadTeams();n((0,o.Q9)({teams:r}))}}function D(){return async function(n){n((0,o.Mj)());const r=await g.loadOrgs();n((0,o.ny)({orgs:r}))}}function c(){return async function(n){n((0,o.uh)());const r=await g.loadSessions();n((0,o.RS)({sessions:r}))}}function j(n){return async function(r){r((0,o.Nm)({updating:!0})),await g.revokeUserSession(n),r((0,o.g$)({tokenId:n}))}}function Q(n){return async function(r){r((0,o.Nm)({updating:!0})),await g.setUserOrg(n),window.location.href=e.$.appSubUrl+"/profile"}}function V(n){return async function(r){r((0,o.Nm)({updating:!0})),await g.updateUserProfile(n),await r(s()),r((0,o.Nm)({updating:!1}))}}},4392:(w,T,t)=>{t.d(T,{A:()=>C});var e=t(94701),a=function(I){(0,e.A)(function(){I()})};const C=a}}]); //# sourceMappingURL=UserProfileEditPage.7cc4c218d9e4664250e3.js.map