theme.keycloak.v2.admin.resources.assets.PageList-s9OtSlkz.js.map Maven / Gradle / Ivy
{"version":3,"file":"PageList-s9OtSlkz.js","sources":["../../src/page/PageList.tsx"],"sourcesContent":["import ComponentRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentRepresentation\";\nimport type { ComponentQuery } from \"@keycloak/keycloak-admin-client/lib/resources/components\";\nimport {\n Button,\n ButtonVariant,\n PageSection,\n ToolbarItem,\n} from \"@patternfly/react-core\";\nimport { IRowData } from \"@patternfly/react-table\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link, useNavigate, useParams } from \"react-router-dom\";\nimport { useAdminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport { useConfirmDialog } from \"../components/confirm-dialog/ConfirmDialog\";\nimport { ListEmptyState } from \"../components/list-empty-state/ListEmptyState\";\nimport { KeycloakDataTable } from \"../components/table-toolbar/KeycloakDataTable\";\nimport { ViewHeader } from \"../components/view-header/ViewHeader\";\nimport { useRealm } from \"../context/realm-context/RealmContext\";\nimport { useServerInfo } from \"../context/server-info/ServerInfoProvider\";\nimport { PageListParams, toDetailPage } from \"./routes\";\n\nexport const PAGE_PROVIDER = \"org.keycloak.services.ui.extend.UiPageProvider\";\nexport const TAB_PROVIDER = \"org.keycloak.services.ui.extend.UiTabProvider\";\n\nconst DetailLink = (obj: ComponentRepresentation) => {\n const { realm } = useRealm();\n return (\n \n {obj.id}\n \n );\n};\nexport default function PageList() {\n const { adminClient } = useAdminClient();\n\n const { t } = useTranslation();\n const { addAlert, addError } = useAlerts();\n const navigate = useNavigate();\n const { providerId } = useParams();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(key + 1);\n\n const { realm: realmName, realmRepresentation: realm } = useRealm();\n const [selectedItem, setSelectedItem] = useState();\n const { componentTypes } = useServerInfo();\n const pages = componentTypes?.[PAGE_PROVIDER];\n\n const page = pages?.find((p) => p.id === providerId)!;\n\n const loader = async () => {\n const params: ComponentQuery = {\n parent: realm?.id,\n type: PAGE_PROVIDER,\n };\n return await adminClient.components.find({ ...params });\n };\n\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"itemDeleteConfirmTitle\",\n messageKey: \"itemDeleteConfirm\",\n continueButtonLabel: \"delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({\n id: selectedItem!.id!,\n });\n addAlert(t(\"itemDeletedSuccess\"));\n refresh();\n } catch (error) {\n addError(\"itemSaveError\", error);\n }\n },\n });\n\n return (\n \n \n \n \n \n \n }\n actionResolver={(item: IRowData) => [\n {\n title: t(\"delete\"),\n onClick() {\n setSelectedItem(item.data);\n toggleDeleteDialog();\n },\n },\n ]}\n searchPlaceholderKey=\"searchItem\"\n loader={loader}\n columns={[\n { name: \"id\", cellRenderer: DetailLink },\n ...page.properties.slice(0, 3).map((p) => ({\n name: `config.${p.name}[0]`,\n displayKey: p.label,\n })),\n ]}\n ariaLabelKey=\"list\"\n emptyState={\n \n navigate(toDetailPage({ realm: realmName, providerId: page.id }))\n }\n />\n }\n />\n \n );\n}\n"],"names":["PAGE_PROVIDER","TAB_PROVIDER","DetailLink","obj","realm","useRealm","jsx","Link","toDetailPage","PageList","adminClient","useAdminClient","useTranslation","addAlert","addError","useAlerts","navigate","useNavigate","providerId","useParams","key","setKey","useState","refresh","realmName","selectedItem","setSelectedItem","componentTypes","useServerInfo","page","p","loader","params","toggleDeleteDialog","DeleteConfirm","useConfirmDialog","ButtonVariant","error","jsxs","PageSection","ViewHeader","KeycloakDataTable","ToolbarItem","Button","props","item","ListEmptyState"],"mappings":"slBAsBO,MAAMA,EAAgB,iDAChBC,GAAe,gDAEtBC,EAAcC,GAAiC,CAC7C,KAAA,CAAE,MAAAC,GAAUC,IAEhB,OAAAC,EAACC,EAAA,CAEC,GAAIC,EAAa,CAAE,MAAAJ,EAAO,WAAYD,EAAI,WAAa,GAAIA,EAAI,GAAK,EAEnE,SAAIA,EA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