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

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

There is a newer version: 6.1.4
Show newest version
{"version":3,"file":"NewDashboardPage.c82103dd5a5e1cb3fb9a.js","mappings":"wMA2BA,QANyBA,MAA+B,WAAQ,IAAMA,EAAY,KAAK,MAAOC,IAC5F,QAAM,KAAaA,EAAM,MAAM,EAExBA,EACR,EAAG,CAACD,CAAW,CAAC,C,0HCEjB,QAAe,MAAO,CACpB,KAAAE,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,WAAAC,CACF,IAOK,CACH,MAAMC,KAAQ,KAAeJ,EAAU,OAAWC,EAAWC,CAAW,EAClEG,EAAS,IAAO,OAAO,EAAE,UAAU,EAAE,QAAQ,CAACD,CAAK,CAAC,EAAE,WAAWD,CAAU,EAC9E,MAAM,EACHG,EAAY,QAAM,KAAmBP,EAAMC,CAAQ,EAEnDO,EAAO,IAAK,OAAO,EACtB,UAAU,EACV,MAAM,EACN,KAAKR,CAAI,EACT,MAAM,CAAE,CAACK,EAAM,EAAE,EAAGE,CAAU,CAAC,EAC/B,OAAOD,CAAM,EACb,MAAM,EAET,SAAO,KAAuBE,CAAI,CACpC,C,yHCMA,QAnCyBC,GAA2B,CAClD,MAAMC,KAAgC,OAAID,EAAW,OAAO,QAAQ,IAAKE,GAAM,CAACA,EAAE,GAAIA,CAAC,CAAC,CAAC,EACnFC,GAAiCH,EAAW,UAAS,OAAI,GAAG,IAAI,CAACF,EAAsBM,IAAoB,CAC/G,KAAM,CAAE,UAAAC,EAAW,MAAAT,EAAO,OAAAU,KAAS,OAAI,CAAE,EAAIL,EAAS,IAAIG,CAAO,EAE3DG,GAAWD,EAASA,EAAO,IAAI,aAAW,QAAK,CAAC,KAAI,QAAK,GAC5D,OAAQE,GAAU,MAAI,MAAMA,CAAK,GAAKA,EAAM,IAAI,MAAM,IAAM,QAAQ,EACpE,IAAKA,GAAUA,EAAM,IAAI,IAAI,CAAC,EAC9B,OAAO,EACP,QAAQ,EAELC,EAAwBX,EAAU,QAAQ,IAAKY,GAAmBA,EAAO,UAAU,EACtF,UAAUL,CAAS,EACnB,MAAMT,CAAK,EACX,QAAQW,CAAO,EACf,MAAM,CAAC,EAAE,OAAO,EAEnB,OAAOT,EAAU,UAAU,EACxB,QAAQW,CAAO,EACf,MAAM,CACX,CAAC,EAAE,MAAM,EAEHE,EAAaX,EAAW,OAAO,QAAQ,IAC1CJ,GAAUA,EAAM,UAAU,EAAE,MAAM,CAAE,GAAGA,EAAM,MAAO,aAAc,EAAG,CAAC,EAAE,MAAM,CACjF,EAAE,MAAM,EACFgB,EAAYZ,EAAW,OAAO,UAAU,EAAE,QAAQW,CAAU,EAAE,MAAM,EAE1E,OAAOX,EAAW,UAAU,EACzB,MAAM,EACN,KAAKa,EAAA,EAAK,KAAK,SAAS,EACxB,MAAMV,CAAe,EACrB,OAAOS,CAAS,EAChB,MAAM,CACX,E,oFCTA,QAhByB,IAAM,CAlC/B,MAmCE,MAAME,KAA0BC,EAAA,GAAY,EACtCf,GAAa,EAAAc,GAAA,YAAAA,EAAU,QAAV,cAAiB,KAE9BzB,KAAc,WAAQ,IAAOW,GAAA,MAAAA,EAAY,OAC3C,QAAQ,WAAQgB,EAAA,GAAuB,EAAgBhB,CAAU,CAAC,CAAC,KACnEiB,EAAA,GAAc,CAAE,KAAMJ,EAAA,EAAK,KAAK,SAAU,CAAC,EAG/C,CAAC,CAAC,EAEId,KAAOmB,EAAA,GAAgB7B,CAAW,EAExC,OAAO,gBAAC,KAAW,CAAC,YAAY,qBAAoB,gBAAC8B,EAAA,EAAU,CAAC,KAAApB,EAAY,MAAK,GAAC,CAAE,CACtF,C","sources":["webpack://graylog-web-interface/./src/views/hooks/useCreateSearch.tsx","webpack://graylog-web-interface/./src/views/logic/views/ViewGenerator.ts","webpack://graylog-web-interface/./src/views/logic/views/ViewTransformer.ts","webpack://graylog-web-interface/./src/views/pages/NewDashboardPage.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 { useMemo } from 'react';\n\nimport createSearch from 'views/logic/slices/createSearch';\nimport type View from 'views/logic/views/View';\n\nconst useCreateSearch = (viewPromise: Promise) => useMemo(() => viewPromise.then(async (_view) => {\n  await createSearch(_view.search);\n\n  return _view;\n}), [viewPromise]);\n\nexport default useCreateSearch;\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 type { TimeRange, ElasticsearchQueryString } from 'views/logic/queries/Query';\nimport UpdateSearchForWidgets from 'views/logic/views/UpdateSearchForWidgets';\nimport type Parameter from 'views/logic/parameters/Parameter';\n\nimport View from './View';\nimport ViewStateGenerator from './ViewStateGenerator';\nimport type { ViewType } from './View';\n\nimport Search from '../search/Search';\nimport QueryGenerator from '../queries/QueryGenerator';\n\nexport default async ({\n  type,\n  streamId,\n  timeRange,\n  queryString,\n  parameters,\n}: {\n  type: ViewType,\n  streamId?: string | string[],\n  timeRange?: TimeRange,\n  queryString?: ElasticsearchQueryString,\n  parameters?: Array,\n},\n) => {\n  const query = QueryGenerator(streamId, undefined, timeRange, queryString);\n  const search = Search.create().toBuilder().queries([query]).parameters(parameters)\n    .build();\n  const viewState = await ViewStateGenerator(type, streamId);\n\n  const view = View.create()\n    .toBuilder()\n    .newId()\n    .type(type)\n    .state({ [query.id]: viewState })\n    .search(search)\n    .build();\n\n  return UpdateSearchForWidgets(view);\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 { List, Map } from 'immutable';\n\nimport type Widget from 'views/logic/widgets/Widget';\nimport type { QueryId } from 'views/logic/queries/Query';\nimport type Query from 'views/logic/queries/Query';\n\nimport type { ViewStateMap } from './View';\nimport View from './View';\nimport type 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) => widget.toBuilder()\n      .timerange(timerange)\n      .query(query)\n      .streams(streams)\n      .build()).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';\nimport type { Location } from 'react-router-dom';\n\nimport useLocation from 'routing/useLocation';\nimport viewTransformer from 'views/logic/views/ViewTransformer';\nimport View from 'views/logic/views/View';\nimport { IfPermitted } from 'components/common';\nimport ViewGenerator from 'views/logic/views/ViewGenerator';\nimport useCreateSearch from 'views/hooks/useCreateSearch';\nimport UpdateSearchForWidgets from 'views/logic/views/UpdateSearchForWidgets';\n\nimport SearchPage from './SearchPage';\n\ntype LocationState = Location & { state: {\n  view?: View,\n} };\n\nconst NewDashboardPage = () => {\n  const location: LocationState = useLocation();\n  const searchView = location?.state?.view;\n\n  const viewPromise = useMemo(() => (searchView?.search\n    ? Promise.resolve(UpdateSearchForWidgets(viewTransformer(searchView)))\n    : ViewGenerator({ type: View.Type.Dashboard })),\n  // This should be run only once upon mount on purpose.\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  []);\n\n  const view = useCreateSearch(viewPromise);\n\n  return ;\n};\n\nexport default NewDashboardPage;\n"],"names":["viewPromise","_view","type","streamId","timeRange","queryString","parameters","query","search","viewState","view","searchView","queryMap","q","newViewStateMap","queryId","timerange","filter","streams","value","widgets","widget","newQueries","newSearch","View","location","useLocation","UpdateSearchForWidgets","ViewGenerator","useCreateSearch","SearchPage"],"sourceRoot":""}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy