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A0B,CAC5E,aAAc,YACd,YAAa,YACb,iBAAkB,yBACpB,CAAC,CACH,GAAG,sBACX,CACF,CACF,EAEF,kBAAmB,CACjB,MAAO,0BACP,KAAME,EAAA,EAAW,MAAM,UACzB,GACV,gBAAC,YAAK,uKAGN,CACF,EAEA,gBAAC,MAAG,CAAC,UAAU,WACb,gBAAC,MAAG,CAAC,GAAI,IACP,gBAAC,GAAkB,IAAC,CACtB,CACF,CACF,CAEJ,C","sources":["webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/DashboardActions.tsx","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/TitleCell.tsx","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/useColumnRenderers.tsx","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/Constants.ts","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/BulkActions.tsx","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/DashboardsOverview.tsx","webpack://graylog-web-interface/./src/views/components/dashboard/DashboardsOverview/index.ts","webpack://graylog-web-interface/./src/views/pages/DashboardsPage.tsx"],"sourcesContent":["/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useState, useCallback, useMemo, useRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { PluginStore } from 'graylog-web-plugin/plugin';\n\nimport { IfPermitted, ShareButton } from 'components/common';\nimport OverlayDropdownButton from 'components/common/OverlayDropdownButton';\nimport { MenuItem } from 'components/bootstrap';\nimport type View from 'views/logic/views/View';\nimport EntityShareModal from 'components/permissions/EntityShareModal';\nimport ViewTypeLabel from 'views/components/ViewTypeLabel';\nimport iterateConfirmationHooks from 'views/hooks/IterateConfirmationHooks';\nimport { ViewManagementActions } from 'views/stores/ViewManagementStore';\nimport usePaginationQueryParameter from 'hooks/usePaginationQueryParameter';\nimport usePluginEntities from 'hooks/usePluginEntities';\nimport { MORE_ACTIONS_TITLE, MORE_ACTIONS_HOVER_TITLE } from 'components/common/EntityDataTable/Constants';\n\n// eslint-disable-next-line no-alert\nconst defaultDashboardDeletionHook = async (view: View) => window.confirm(`Are you sure you want to delete \"${view.title}\"?`);\n\ntype Props = {\n dashboard: View,\n refetchDashboards: () => void,\n}\n\nconst DeleteItem = styled.span(({ theme }) => css`\n color: ${theme.colors.variant.danger};\n`);\n\nconst DashboardActions = ({ dashboard, refetchDashboards }: Props) => {\n const [showShareModal, setShowShareModal] = useState(false);\n const paginationQueryParameter = usePaginationQueryParameter();\n const pluggableDashboardActions = usePluginEntities('views.components.dashboardActions');\n const modalRefs = useRef({});\n const dashboardActions = useMemo(() => pluggableDashboardActions.map(({ component: PluggableDashboardAction, key }) => (\n modalRefs.current[key]} />\n )), [pluggableDashboardActions, dashboard]);\n const dashboardActionModals = useMemo(() => pluggableDashboardActions\n .filter(({ modal }) => !!modal)\n .map(({ modal: ActionModal, key }) => (\n { modalRefs.current[key] = r; }} />\n )), [pluggableDashboardActions, dashboard]);\n\n const onDashboardDelete = useCallback(async () => {\n const pluginDashboardDeletionHooks = PluginStore.exports('views.hooks.confirmDeletingDashboard');\n\n const result = await iterateConfirmationHooks([...pluginDashboardDeletionHooks, defaultDashboardDeletionHook], dashboard);\n\n if (result) {\n await ViewManagementActions.delete(dashboard);\n refetchDashboards();\n paginationQueryParameter.resetPage();\n }\n }, [dashboard, refetchDashboards, paginationQueryParameter]);\n\n return (\n <>\n setShowShareModal(true)} />\n \n {dashboardActions.length > 0 ? (\n <>\n {dashboardActions}\n \n >\n ) : null}\n \n \n \n \n {showShareModal && (\n setShowShareModal(false)} />\n )}\n {dashboardActionModals}\n >\n );\n};\n\nexport default DashboardActions;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React from 'react';\n\nimport type View from 'views/logic/views/View';\nimport type { Requirements } from 'views/logic/views/View';\nimport { HoverForHelp } from 'components/common';\nimport { Link } from 'components/common/router';\nimport Routes from 'routing/Routes';\n\nconst missingRequirements = (requires: Requirements, requirementsProvided: Array) => (\n Object.entries(requires)\n .filter(([require]) => !requirementsProvided.includes(require))\n .reduce((prev, [key, value]) => ({ ...prev, [key]: value }), {})\n);\n\nconst RequirementsList = ({ requirements }: { requirements: Requirements }) => (\n \n {Object.values(requirements).map(({ url, name }) => (\n {name}\n ))}\n \n);\n\ntype Props = {\n dashboard: View,\n requirementsProvided: Array,\n}\n\nconst TitleCell = ({ dashboard: { id, requires, title }, requirementsProvided }: Props) => {\n const _missingRequirements = missingRequirements(requires, requirementsProvided);\n const isMissingRequirements = Object.keys(_missingRequirements).length > 0;\n\n if (isMissingRequirements) {\n return (\n <>\n {title}\n \n >\n );\n }\n\n return {title};\n};\n\nexport default TitleCell;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useMemo } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\n\nimport type { SearchParams } from 'stores/PaginationTypes';\nimport usePluginEntities from 'hooks/usePluginEntities';\nimport type { ColumnRenderers } from 'components/common/EntityDataTable';\nimport type View from 'views/logic/views/View';\nimport TitleCell from 'views/components/dashboard/DashboardsOverview/TitleCell';\nimport FavoriteIcon from 'views/components/FavoriteIcon';\nimport { createGRN } from 'logic/permissions/GRN';\n\nexport const useColumnRenderers = (\n { searchParams }: { searchParams: SearchParams },\n) => {\n const queryClient = useQueryClient();\n const requirementsProvided = usePluginEntities('views.requires.provided');\n const customColumnRenderers: ColumnRenderers = useMemo(() => ({\n attributes: {\n title: {\n renderCell: (_title: string, dashboard) => ,\n },\n favorite: {\n renderCell: (favorite: boolean, dashboard) => (\n {\n queryClient.setQueriesData(['dashboards', 'overview', searchParams], (cur: {\n list: Readonly>,\n pagination: { total: number }\n }) => ({\n ...cur,\n list: cur.list.map((view) => {\n if (view.id === dashboard.id) {\n return view.toBuilder().favorite(newValue).build();\n }\n\n return view;\n }),\n }\n ));\n }} />\n ),\n },\n },\n }), [queryClient, requirementsProvided, searchParams]);\n\n return customColumnRenderers;\n};\n\nexport default useColumnRenderers;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\n\nimport type { Sort } from 'stores/PaginationTypes';\n\nexport const ENTITY_TABLE_ID = 'dashboards';\nexport const DEFAULT_LAYOUT = {\n pageSize: 20,\n sort: { attributeId: 'title', direction: 'asc' } as Sort,\n displayedColumns: ['title', 'description', 'summary', 'favorite'],\n columnsOrder: ['title', 'summary', 'description', 'owner', 'created_at', 'favorite'],\n};\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { useCallback } from 'react';\n\nimport BulkActionsDropdown from 'components/common/EntityDataTable/BulkActionsDropdown';\nimport StringUtils from 'util/StringUtils';\nimport fetch from 'logic/rest/FetchProvider';\nimport { qualifyUrl } from 'util/URLUtils';\nimport UserNotification from 'util/UserNotification';\nimport MenuItem from 'components/bootstrap/MenuItem';\n\nconst VIEWS_BULK_DELETE_API_ROUTE = '/views/bulk_delete';\n\ntype Props = {\n selectedDashboardIds: Array,\n setSelectedDashboardIds: (dashboardIds: Array) => void,\n}\n\nconst BulkActions = ({ selectedDashboardIds, setSelectedDashboardIds }: Props) => {\n const queryClient = useQueryClient();\n\n const selectedItemsAmount = selectedDashboardIds?.length;\n const descriptor = StringUtils.pluralize(selectedItemsAmount, 'dashboard', 'dashboards');\n\n const onDelete = useCallback(() => {\n // eslint-disable-next-line no-alert\n if (window.confirm(`Do you really want to remove ${selectedItemsAmount} ${descriptor}?`)) {\n fetch(\n 'POST',\n qualifyUrl(VIEWS_BULK_DELETE_API_ROUTE),\n { entity_ids: selectedDashboardIds },\n ).then(({ failures }) => {\n if (failures?.length) {\n const notDeletedDashboardIds = failures.map(({ entity_id }) => entity_id);\n setSelectedDashboardIds(notDeletedDashboardIds);\n UserNotification.error(`${notDeletedDashboardIds.length} out of ${selectedItemsAmount} selected ${descriptor} could not be deleted.`);\n } else {\n setSelectedDashboardIds([]);\n UserNotification.success(`${selectedItemsAmount} ${descriptor} ${StringUtils.pluralize(selectedItemsAmount, 'was', 'were')} deleted successfully.`, 'Success');\n }\n }).catch((error) => {\n UserNotification.error(`An error occurred while deleting dashboards. ${error}`);\n }).finally(() => {\n queryClient.invalidateQueries(['dashboards', 'overview']);\n });\n }\n }, [descriptor, queryClient, selectedItemsAmount, selectedDashboardIds, setSelectedDashboardIds]);\n\n return (\n \n \n \n );\n};\n\nexport default BulkActions;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useCallback, useMemo } from 'react';\nimport { useQueryParam, StringParam } from 'use-query-params';\n\nimport type { Sort } from 'stores/PaginationTypes';\nimport { PaginatedList, SearchForm, Spinner, NoSearchResult, NoEntitiesExist } from 'components/common';\nimport QueryHelper from 'components/common/QueryHelper';\nimport EntityDataTable from 'components/common/EntityDataTable';\nimport type View from 'views/logic/views/View';\nimport usePaginationQueryParameter from 'hooks/usePaginationQueryParameter';\nimport useDashboards from 'views/components/dashboard/hooks/useDashboards';\nimport DashboardActions from 'views/components/dashboard/DashboardsOverview/DashboardActions';\nimport useColumnRenderers from 'views/components/dashboard/DashboardsOverview/useColumnRenderers';\nimport { DEFAULT_LAYOUT, ENTITY_TABLE_ID } from 'views/components/dashboard/DashboardsOverview/Constants';\nimport useTableLayout from 'components/common/EntityDataTable/hooks/useTableLayout';\nimport useUpdateUserLayoutPreferences from 'components/common/EntityDataTable/hooks/useUpdateUserLayoutPreferences';\n\nimport BulkActions from './BulkActions';\n\nconst renderBulkActions = (\n selectedDashboardIds: Array,\n setSelectedDashboardIds: (streamIds: Array) => void,\n) => (\n \n);\n\nconst DashboardsOverview = () => {\n const [query, setQuery] = useQueryParam('query', StringParam);\n const { layoutConfig, isInitialLoading: isLoadingLayoutPreferences } = useTableLayout({\n entityTableId: ENTITY_TABLE_ID,\n defaultPageSize: DEFAULT_LAYOUT.pageSize,\n defaultDisplayedAttributes: DEFAULT_LAYOUT.displayedColumns,\n defaultSort: DEFAULT_LAYOUT.sort,\n });\n const paginationQueryParameter = usePaginationQueryParameter(undefined, layoutConfig.pageSize, false);\n const searchParams = useMemo(() => ({\n query,\n page: paginationQueryParameter.page,\n pageSize: layoutConfig.pageSize,\n sort: layoutConfig.sort,\n }), [layoutConfig.pageSize,\n layoutConfig.sort,\n paginationQueryParameter.page,\n query,\n ]);\n const customColumnRenderers = useColumnRenderers({ searchParams });\n const { data: paginatedDashboards, isInitialLoading: isLoadingDashboards, refetch } = useDashboards(searchParams, { enabled: !isLoadingLayoutPreferences });\n const { mutate: updateTableLayout } = useUpdateUserLayoutPreferences(ENTITY_TABLE_ID);\n const onSearch = useCallback((newQuery: string) => {\n paginationQueryParameter.resetPage();\n setQuery(newQuery);\n }, [paginationQueryParameter, setQuery]);\n\n const onColumnsChange = useCallback((displayedAttributes: Array) => {\n updateTableLayout({ displayedAttributes });\n }, [updateTableLayout]);\n\n const renderDashboardActions = useCallback((dashboard: View) => (\n \n ), [refetch]);\n\n const onReset = useCallback(() => {\n onSearch('');\n }, [onSearch]);\n\n const onPageSizeChange = (newPageSize: number) => {\n paginationQueryParameter.resetPage();\n updateTableLayout({ perPage: newPageSize });\n };\n\n const onSortChange = useCallback((newSort: Sort) => {\n updateTableLayout({ sort: newSort });\n paginationQueryParameter.resetPage();\n }, [paginationQueryParameter, updateTableLayout]);\n\n if (isLoadingDashboards || isLoadingLayoutPreferences) {\n return ;\n }\n\n const { list: dashboards, pagination, attributes } = paginatedDashboards;\n\n return (\n \n \n }\n onReset={onReset}\n query={query}\n topMargin={0} />\n \n {!dashboards?.length && !query && (\n \n No dashboards have been created yet.\n \n )}\n {!dashboards?.length && query && (\n No dashboards have been found. \n )}\n {!!dashboards?.length && (\n activeSort={layoutConfig.sort}\n bulkSelection={{ actions: renderBulkActions }}\n columnDefinitions={attributes}\n columnRenderers={customColumnRenderers}\n columnsOrder={DEFAULT_LAYOUT.columnsOrder}\n data={dashboards}\n onColumnsChange={onColumnsChange}\n onPageSizeChange={onPageSizeChange}\n onSortChange={onSortChange}\n pageSize={layoutConfig.pageSize}\n rowActions={renderDashboardActions}\n actionsCellWidth={160}\n visibleColumns={layoutConfig.displayedAttributes} />\n )}\n \n );\n};\n\nexport default DashboardsOverview;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport DashboardsOverview from './DashboardsOverview';\n\nexport default DashboardsOverview;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\n\nimport { LinkContainer } from 'components/common/router';\nimport { Col, Row, Button } from 'components/bootstrap';\nimport { DocumentTitle, PageHeader, IfPermitted } from 'components/common';\nimport Routes from 'routing/Routes';\nimport DocsHelper from 'util/DocsHelper';\nimport DashboardsOverview from 'views/components/dashboard/DashboardsOverview';\nimport useSendTelemetry from 'logic/telemetry/useSendTelemetry';\nimport { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';\n\nconst DashboardsPage = () => {\n const sendTelemetry = useSendTelemetry();\n\n return (\n \n \n \n \n \n \n )}\n documentationLink={{\n title: 'Dashboard documentation',\n path: DocsHelper.PAGES.DASHBOARDS,\n }}>\n \n Use dashboards to create specific views on your messages. Create a new dashboard here and add any graph or\n chart you create in other parts of Graylog with one click.\n \n \n\n \n \n \n \n
\n \n );\n};\n\nexport default DashboardsPage;\n"],"names":["defaultDashboardDeletionHook","view","DeleteItem","theme","dashboard","refetchDashboards","showShareModal","setShowShareModal","paginationQueryParameter","usePaginationQueryParameter","pluggableDashboardActions","usePluginEntities","modalRefs","dashboardActions","PluggableDashboardAction","key","dashboardActionModals","modal","ActionModal","r","onDashboardDelete","pluginDashboardDeletionHooks","OverlayDropdownButton","EntityShareModal","ViewTypeLabel","missingRequirements","requires","requirementsProvided","require","prev","value","RequirementsList","requirements","url","name","id","title","_missingRequirements","Routes","searchParams","queryClient","_title","favorite","FavoriteIcon","newValue","cur","ENTITY_TABLE_ID","DEFAULT_LAYOUT","VIEWS_BULK_DELETE_API_ROUTE","selectedDashboardIds","setSelectedDashboardIds","selectedItemsAmount","descriptor","StringUtils","onDelete","failures","notDeletedDashboardIds","entity_id","UserNotification","error","BulkActionsDropdown","MenuItem","renderBulkActions","query","setQuery","layoutConfig","isLoadingLayoutPreferences","useTableLayout","customColumnRenderers","paginatedDashboards","isLoadingDashboards","refetch","useDashboards","updateTableLayout","useUpdateUserLayoutPreferences","onSearch","newQuery","onColumnsChange","displayedAttributes","renderDashboardActions","onReset","onPageSizeChange","newPageSize","onSortChange","newSort","dashboards","pagination","attributes","QueryHelper","EntityDataTable","sendTelemetry","useSendTelemetry","DocsHelper"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy