All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.account.resources.content.group-page.GroupsPage.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.5
Show newest version
{"version":3,"file":"GroupsPage.js","names":["React","Checkbox","DataList","DataListItem","DataListItemRow","DataListCell","DataListItemCells","ContentPage","AccountServiceContext","Msg","GroupsPage","Component","constructor","props","context","_defineProperty","checked","event","setState","isDirectMembership","state","groups","directGroups","fetchGroups","doGet","then","response","data","groupsPaths","map","s","path","forEach","el","getParents","parentPath","slice","lastIndexOf","indexOf","name","push","emptyGroup","createElement","key","dataListCells","msgKey","renderGroupList","group","appIndex","id","width","isChecked","isDisabled","render","title","localize","isCompact","label","onChange","changeDirectMembership","length"],"sources":["../../../src/app/content/group-page/GroupsPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n  Checkbox,\n  DataList,\n  DataListItem,\n  DataListItemRow,\n  DataListCell,\n  DataListItemCells,\n} from '@patternfly/react-core';\n\nimport { ContentPage } from '../ContentPage';\nimport { HttpResponse } from '../../account-service/account.service';\nimport { AccountServiceContext } from '../../account-service/AccountServiceContext';\nimport { Msg } from '../../widgets/Msg';\n\nexport interface GroupsPageProps {\n}\n\nexport interface GroupsPageState {\n  groups: Group[];\n  directGroups: Group[];\n  isDirectMembership: boolean;\n}\n\ninterface Group {\n  id?: string;\n  name: string;\n  path: string;\n}\n\nexport class GroupsPage extends React.Component {\n  static contextType = AccountServiceContext;\n  context: React.ContextType;\n\n  public constructor(props: GroupsPageProps, context: React.ContextType) {\n    super(props);\n    this.context = context;\n    this.state = {\n      groups: [],\n      directGroups: [],\n      isDirectMembership: false\n    };\n\n    this.fetchGroups();\n  }\n\n  private fetchGroups(): void {\n    this.context!.doGet(\"/groups\")\n      .then((response: HttpResponse) => {\n        const directGroups = response.data || [];\n        const groups = [...directGroups];\n        const groupsPaths = directGroups.map(s => s.path);\n        directGroups.forEach((el) => this.getParents(el, groups, groupsPaths))\n        this.setState({\n          groups: groups,\n          directGroups: directGroups\n        });\n      });\n  }\n\n  private getParents(el: Group, groups: Group[], groupsPaths: string[]): void {\n    const parentPath = el.path.slice(0, el.path.lastIndexOf('/'));\n    if (parentPath && (groupsPaths.indexOf(parentPath) === -1)) {\n\n      el = {\n        name: parentPath.slice(parentPath.lastIndexOf('/')+1),\n        path: parentPath\n      };\n      groups.push(el);\n      groupsPaths.push(parentPath);\n\n      this.getParents(el, groups, groupsPaths);\n    }\n  }\n\n  private changeDirectMembership = (checked: boolean,event: React.FormEvent )=> {\n    this.setState({\n      isDirectMembership: checked\n    });\n  }\n\n  private emptyGroup(): React.ReactNode {\n\n    return (\n      \n        \n          \n          ]} />\n        \n      \n    )\n  }\n\n  private renderGroupList(group: Group, appIndex: number): React.ReactNode {\n\n    return (\n      \n        \n          \n                {group.name}\n              ,\n              \n                {group.path}\n              ,\n              \n                \n              \n            ]}\n          />\n        \n\n      \n    )\n  }\n\n  public render(): React.ReactNode {\n    return (\n      \n        \n          \n            \n              \n                    \n\n                  \n                ]}\n              />\n            \n          \n          \n            \n              \n                    \n                  ,\n                  \n                    \n                  ,\n                  \n                    \n                  ,\n                ]}\n              />\n            \n          \n          {this.state.groups.length === 0\n            ? this.emptyGroup()\n            : (this.state.isDirectMembership ? this.state.directGroups.map((group: Group, appIndex: number) =>\n              this.renderGroupList(group, appIndex)\n            ) : this.state.groups.map((group: Group, appIndex: number) =>\n              this.renderGroupList(group, appIndex)))}\n        \n      \n    );\n  }\n};\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK;AAEjB,SACEC,QAAQ,EACRC,QAAQ,EACRC,YAAY,EACZC,eAAe,EACfC,YAAY,EACZC,iBAAiB;AAGnB,SAASC,WAAW;AAEpB,SAASC,qBAAqB;AAC9B,SAASC,GAAG;AAiBZ,OAAO,MAAMC,UAAU,SAASV,KAAK,CAACW,SAAS,CAAmC;EAIzEC,WAAWA,CAACC,KAAsB,EAAEC,OAAwD,EAAE;IACnG,KAAK,CAACD,KAAK,CAAC;IA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