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

web-interface.assets.NewDashboardPage.9472d5d0a285679cf68d.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.js","webpack:///./src/views/pages/NewDashboardPage.jsx"],"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","newQueries","query_string","newSearch","newId","type","View","Type","Dashboard","NewDashboardPage","route","location","loadingViewHooks","executingViewHooks","useState","loaded","setLoaded","undefined","hookComponent","setHookComponent","useEffect","mounted","view","dashboardView","viewTransformer","loadPromise","ViewActions","load","then","processHooks","e","create","permissions","Spinner","propTypes","PropTypes","object","isRequired","withPluginEntities"],"mappings":"0nBAUA,IAoCeA,EApCS,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,WAEL,OAAOf,EAAUc,YACdF,QAAQA,GACRG,WAGCC,EAAa1B,EAAWG,OAAOC,QAAQC,KAC3C,SAACS,GAAD,OAAWA,EAAMU,YAAYV,M,+VAAlB,IAA6BA,EAAMA,MAAnC,CAA0Ca,aAAc,MAAMF,WAErEG,EAAY5B,EAAWG,OAAOqB,YAAYpB,QAAQsB,GAAYD,QAEpE,OAAOzB,EAAWwB,YACfK,QACAC,KAAKC,IAAKC,KAAKC,WACfxB,MAAMD,GACNL,OAAOyB,GACPH,S,siBCjBL,IAAMS,EAAmB,SAAC,GAAqE,IAAnEC,EAAmE,EAAnEA,MAAOC,EAA4D,EAA5DA,SAAUC,EAAkD,EAAlDA,iBAAkBC,EAAgC,EAAhCA,mBAAgC,IACjEC,oBAAS,GADwD,GACtFC,EADsF,KAC9EC,EAD8E,SAEnDF,wBAASG,GAF0C,GAEtFC,EAFsF,KAEvEC,EAFuE,KA6B7F,OAzBAC,qBAAU,WACR,IAAIC,GAAU,EADA,EAESV,EAAf3B,MACMT,QAHA,MAEE,GAFF,GAGN+C,KACR,GAAI/C,GAAcA,EAAWG,OAAQ,KAC3BW,EAAUsB,EAAVtB,MAEFkC,EAAgBC,EAAgBjD,GAChCkD,EAAcC,IAAYC,KAAKJ,GAAe,GAAMK,MAAK,kBAAML,KACrEM,YACEJ,EACAb,EACAC,EACAxB,GACA,WACE8B,OAAiBF,GACjBD,GAAU,MAPd,OASQ,SAACc,GAAD,OAAOX,EAAiBW,WAEhCJ,IAAYK,OAAOzB,IAAKC,KAAKC,WAAWoB,MAAK,kBAAMP,GAAWL,GAAU,MAE1E,OAAO,WAAQK,GAAU,KACxB,IAECH,EACM,oCAAGA,GAGNH,EACH,kBAAC,IAAD,CAAaiB,YAAY,qBAAoB,kBAAC,IAAD,CAAoBtB,MAAOA,KACxE,kBAACuB,EAAA,EAAD,OAGNxB,EAAiByB,UAAY,CAC3BxB,MAAOyB,IAAUC,OAAOC,YAOXC,sBAAmB7B,EAJlB,CACdG,iBAAkB,0BAClBC,mBAAoB","file":"NewDashboardPage.9472d5d0a285679cf68d.js","sourcesContent":["// @flow strict\nimport { List, Map } from 'immutable';\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    });\n    return viewState.toBuilder()\n      .widgets(widgets)\n      .build();\n  });\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  );\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","// @flow strict\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport Spinner from 'components/common/Spinner';\n\nimport type { ViewHook } from 'views/logic/hooks/ViewHook';\nimport { processHooks } from 'views/logic/views/ViewLoader';\nimport withPluginEntities from 'views/logic/withPluginEntities';\nimport viewTransformer from 'views/logic/views/ViewTransformer';\nimport { ViewActions } from 'views/stores/ViewStore';\nimport View from 'views/logic/views/View';\nimport type { ViewJson } from 'views/logic/views/View';\nimport { ExtendedSearchPage } from 'views/pages';\nimport { IfPermitted } from 'components/common';\n\ntype Props = {\n  route: {},\n  location: {\n    state?: {\n      view?: View | ViewJson,\n    },\n    query: { [string]: any },\n  };\n  loadingViewHooks: Array,\n  executingViewHooks: Array,\n};\nconst NewDashboardPage = ({ route, location, loadingViewHooks, executingViewHooks }: Props) => {\n  const [loaded, setLoaded] = useState(false);\n  const [hookComponent, setHookComponent] = useState(undefined);\n\n  useEffect(() => {\n    let mounted = true;\n    const { state = {} } = location;\n    const { view: searchView } = state;\n    if (searchView && searchView.search) {\n      const { query } = location;\n      /* $FlowFixMe the searchView.search is guard enough and instanceof does not work here */\n      const dashboardView = viewTransformer(searchView);\n      const loadPromise = ViewActions.load(dashboardView, true).then(() => dashboardView);\n      processHooks(\n        loadPromise,\n        loadingViewHooks,\n        executingViewHooks,\n        query,\n        () => {\n          setHookComponent(undefined);\n          setLoaded(true);\n        },\n      ).catch((e) => setHookComponent(e));\n    } else {\n      ViewActions.create(View.Type.Dashboard).then(() => mounted && setLoaded(true));\n    }\n    return () => { mounted = false; };\n  }, []);\n\n  if (hookComponent) {\n    return (<>{hookComponent});\n  }\n\n  return loaded\n    ? \n    : ;\n};\n\nNewDashboardPage.propTypes = {\n  route: PropTypes.object.isRequired,\n};\n\nconst mapping = {\n  loadingViewHooks: 'views.hooks.loadingView',\n  executingViewHooks: 'views.hooks.executingView',\n};\nexport default withPluginEntities(NewDashboardPage, mapping);\n"],"sourceRoot":""}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy