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

web-interface.assets.NewDashboardPage.472622149827c1587209.js.map Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
{"version":3,"sources":["webpack:///./src/views/logic/views/ViewTransformer.ts","webpack:///./src/views/pages/NewDashboardPage.tsx","webpack:///./src/views/logic/views/UseLoadView.ts"],"names":["ViewTransformer","searchView","queryMap","Map","search","queries","map","q","id","newViewStateMap","state","viewState","queryId","get","timerange","query","filter","streams","List","value","isMap","toList","toArray","widgets","widget","toBuilder","build","toMap","newQueries","query_string","toSet","newSearch","newId","type","View","Type","Dashboard","NewDashboardPage","location","view","loadedView","useMemo","dashboardView","viewTransformer","ViewActions","load","then","create","useLoadView","loaded","HookComponent","permissions","SearchPage","Spinner","propTypes","withLocation","loadingViewHooks","usePluginEntities","executingViewHooks","useState","setLoaded","undefined","hookComponent","setHookComponent","useEffect","processHooks","e","Error"],"mappings":"63BA0BA,IAqCeA,EArCS,SAACC,GACvB,IAAMC,EAAgCC,cAAIF,EAAWG,OAAOC,QAAQC,KAAI,SAACC,GAAD,MAAO,CAACA,EAAEC,GAAID,OAChFE,GAAiCR,EAAWS,OAASP,iBAAOG,KAAI,SAACK,EAAsBC,GAAoB,MAClEV,EAASW,IAAID,GAAlDE,EADuG,EACvGA,UAAWC,EAD4F,EAC5FA,MAD4F,IACrFC,cADqF,MAC5Eb,gBAD4E,EAGzGc,GAAWD,EAASA,EAAOH,IAAI,UAAWK,kBAAUA,kBACvDF,QAAO,SAACG,GAAD,OAAWhB,MAAIiB,MAAMD,IAAgC,WAAtBA,EAAMN,IAAI,WAChDP,KAAI,SAACa,GAAD,OAAWA,EAAMN,IAAI,SACzBQ,SACAC,UAEGC,EAAwBZ,EAAUY,QAAQjB,KAAI,SAACkB,GACnD,OAAOA,EAAOC,YACXX,UAAUA,GACVC,MAAMA,GACNE,QAAQA,GACRS,WACFL,SAEH,OAAOV,EAAUc,YACdF,QAAQA,GACRG,WACFC,QAEGC,EAAa3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Qa","file":"NewDashboardPage.472622149827c1587209.js","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 { List, Map } from 'immutable';\n\nimport Widget from 'views/logic/widgets/Widget';\nimport type { QueryId } from 'views/logic/queries/Query';\nimport Query from 'views/logic/queries/Query';\n\nimport type { ViewStateMap } from './View';\nimport View from './View';\nimport ViewState from './ViewState';\n\nconst ViewTransformer = (searchView: View): View => {\n  const queryMap: Map = Map(searchView.search.queries.map((q) => [q.id, q]));\n  const newViewStateMap: ViewStateMap = (searchView.state || Map()).map((viewState: ViewState, queryId: string) => {\n    const { timerange, query, filter = Map() } = queryMap.get(queryId);\n\n    const streams = (filter ? filter.get('filters', List()) : List())\n      .filter((value) => Map.isMap(value) && value.get('type') === 'stream')\n      .map((value) => value.get('id'))\n      .toList()\n      .toArray();\n\n    const widgets: List = viewState.widgets.map((widget: Widget) => {\n      return widget.toBuilder()\n        .timerange(timerange)\n        .query(query)\n        .streams(streams)\n        .build();\n    }).toList();\n\n    return viewState.toBuilder()\n      .widgets(widgets)\n      .build();\n  }).toMap();\n  // Remove query string attached to the existing search query\n  const newQueries = searchView.search.queries.map(\n    (query) => query.toBuilder().query({ ...query.query, query_string: '' }).build(),\n  ).toSet();\n  const newSearch = searchView.search.toBuilder().queries(newQueries).build();\n\n  return searchView.toBuilder()\n    .newId()\n    .type(View.Type.Dashboard)\n    .state(newViewStateMap)\n    .search(newSearch)\n    .build();\n};\n\nexport default ViewTransformer;\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 { useMemo } from 'react';\n\nimport withLocation from 'routing/withLocation';\nimport type { Location } from 'routing/withLocation';\nimport Spinner from 'components/common/Spinner';\nimport viewTransformer from 'views/logic/views/ViewTransformer';\nimport { ViewActions } from 'views/stores/ViewStore';\nimport View from 'views/logic/views/View';\nimport { IfPermitted } from 'components/common';\nimport useLoadView from 'views/logic/views/UseLoadView';\n\nimport SearchPage from './SearchPage';\n\ntype Props = {\n  location: Location & {\n    state?: {\n      view?: View,\n    },\n  },\n};\n\nconst NewDashboardPage = ({ location }: Props) => {\n  const { state = {} } = location;\n  const { view: searchView } = state;\n  const loadedView = useMemo(() => {\n    if (searchView?.search) {\n      const dashboardView = viewTransformer(searchView);\n\n      return ViewActions.load(dashboardView, true).then(() => dashboardView);\n    }\n\n    return ViewActions.create(View.Type.Dashboard).then(({ view }) => view);\n    // This should be run only once upon mount on purpose.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  const [loaded, HookComponent] = useLoadView(loadedView, location.query);\n\n  if (HookComponent) {\n    return HookComponent;\n  }\n\n  return loaded\n    ? \n    : ;\n};\n\nNewDashboardPage.propTypes = {};\nexport default withLocation(NewDashboardPage);\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 { useEffect, useState } from 'react';\n\nimport View from './View';\nimport { processHooks } from './ViewLoader';\n\nimport usePluginEntities from '../usePluginEntities';\n\nconst useLoadView = (view: Promise, query: { [key: string]: any }) => {\n  const loadingViewHooks = usePluginEntities('views.hooks.loadingView');\n  const executingViewHooks = usePluginEntities('views.hooks.executingView');\n\n  const [loaded, setLoaded] = useState(false);\n  const [hookComponent, setHookComponent] = useState(undefined);\n\n  useEffect(() => {\n    processHooks(\n      view,\n      loadingViewHooks,\n      executingViewHooks,\n      query,\n      () => {\n        setLoaded(true);\n        setHookComponent(undefined);\n      },\n    ).catch((e) => {\n      if (e instanceof Error) {\n        throw e;\n      }\n\n      setHookComponent(e);\n    });\n  },\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  [executingViewHooks, loadingViewHooks, view]);\n\n  return [loaded, hookComponent];\n};\n\nexport default useLoadView;\n"],"sourceRoot":""}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy