From 1f251ccd63144a0a453c068442685ac756f0d7ab Mon Sep 17 00:00:00 2001 From: Gurinder Singh Date: Thu, 5 Sep 2024 12:24:16 -0400 Subject: [PATCH 1/3] webpack fix and warning fixes --- public/app/core/reducers/fn-slice.ts | 10 ---------- public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx | 11 +++-------- public/microfrontends/fn_dashboard/index.html | 2 +- scripts/webpack/webpack.dev.js | 10 +++++----- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/public/app/core/reducers/fn-slice.ts b/public/app/core/reducers/fn-slice.ts index 0965ba40ebde3..d71ce9aef766e 100644 --- a/public/app/core/reducers/fn-slice.ts +++ b/public/app/core/reducers/fn-slice.ts @@ -41,16 +41,6 @@ export const fnStateProps: FnStateProp[] = [ 'version', ]; -export const fnPropsMappedFromState: readonly FnPropMappedFromState[] = [ - 'FNDashboard', - 'hiddenVariables', - 'mode', - 'uid', - 'queryParams', - 'slug', - 'version', -] as const; - const INITIAL_MODE = GrafanaThemeType.Light; export const FN_STATE_KEY = 'fnGlobalState'; diff --git a/public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx b/public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx index 031c2858941f7..93c50e5d3c52a 100644 --- a/public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx +++ b/public/app/fn-app/fn-dashboard-page/fn-dashboard.tsx @@ -1,8 +1,7 @@ -import { pick } from 'lodash'; import { FC, useMemo } from 'react'; -import { FnPropMappedFromState, fnPropsMappedFromState } from 'app/core/reducers/fn-slice'; -import { StoreState, useSelector } from 'app/types'; +import { FnGlobalState, FnPropMappedFromState } from 'app/core/reducers/fn-slice'; +import { useSelector } from 'app/types'; import { FnAppProvider } from '../fn-app-provider'; import { FNDashboardProps } from '../types'; @@ -20,12 +19,8 @@ export const FNDashboard: FC = (props) => { ); }; -function mapStateToProps() { - return ({ fnGlobalState }: StoreState) => pick(fnGlobalState, ...fnPropsMappedFromState); -} - export const DashboardPortal: FC = (p) => { - const globalFnProps = useSelector(mapStateToProps()); + const globalFnProps = useSelector(({ fnGlobalState }) => fnGlobalState); const props = useMemo( () => ({ diff --git a/public/microfrontends/fn_dashboard/index.html b/public/microfrontends/fn_dashboard/index.html index 3b6cc442ca4f1..e6f062839b699 100644 --- a/public/microfrontends/fn_dashboard/index.html +++ b/public/microfrontends/fn_dashboard/index.html @@ -19,7 +19,7 @@ - + diff --git a/scripts/webpack/webpack.dev.js b/scripts/webpack/webpack.dev.js index da981a5a3839d..fb00414abf529 100644 --- a/scripts/webpack/webpack.dev.js +++ b/scripts/webpack/webpack.dev.js @@ -12,7 +12,7 @@ const path = require('path'); const { DefinePlugin, EnvironmentPlugin } = require('webpack'); const WebpackAssetsManifest = require('webpack-assets-manifest'); const { merge } = require('webpack-merge'); -const WebpackBar = require('webpackbar'); +// const WebpackBar = require('webpackbar'); const getEnvConfig = require('./env-util.js'); const HTMLWebpackCSSChunks = require('./plugins/HTMLWebpackCSSChunks'); @@ -131,10 +131,10 @@ module.exports = (env = {}) => { integrity: true, publicPath: true, }), - new WebpackBar({ - color: '#eb7b18', - name: 'Grafana', - }), + // new WebpackBar({ + // color: '#eb7b18', + // name: 'Grafana', + // }), new EnvironmentPlugin(envConfig), new DefinePlugin({ 'process.env': { From 4a60040a68c627f4030bb9a4b678ca5714c65f96 Mon Sep 17 00:00:00 2001 From: Gurinder Singh Date: Thu, 5 Sep 2024 13:15:57 -0400 Subject: [PATCH 2/3] fix --- .circleci/config.yml | 1 + public/microfrontends/fn_dashboard/index.html | 4 ++-- scripts/webpack/webpack.dev.js | 18 +++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f34e01ee2f49a..768bf87777f3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,7 @@ executors: docker: - image: cimg/node:22.7.0 working_directory: ~/frontend + resource_class: large jobs: go-mod-install: diff --git a/public/microfrontends/fn_dashboard/index.html b/public/microfrontends/fn_dashboard/index.html index e6f062839b699..6093b21cd3c3c 100644 --- a/public/microfrontends/fn_dashboard/index.html +++ b/public/microfrontends/fn_dashboard/index.html @@ -17,9 +17,9 @@ - + - + diff --git a/scripts/webpack/webpack.dev.js b/scripts/webpack/webpack.dev.js index fb00414abf529..c70cdb208e80e 100644 --- a/scripts/webpack/webpack.dev.js +++ b/scripts/webpack/webpack.dev.js @@ -12,7 +12,7 @@ const path = require('path'); const { DefinePlugin, EnvironmentPlugin } = require('webpack'); const WebpackAssetsManifest = require('webpack-assets-manifest'); const { merge } = require('webpack-merge'); -// const WebpackBar = require('webpackbar'); +const WebpackBar = require('webpackbar'); const getEnvConfig = require('./env-util.js'); const HTMLWebpackCSSChunks = require('./plugins/HTMLWebpackCSSChunks'); @@ -29,7 +29,7 @@ const envConfig = getEnvConfig(); module.exports = (env = {}) => { return merge(common, { - devtool: 'eval-source-map', + devtool: false, mode: 'development', entry: { @@ -76,7 +76,6 @@ module.exports = (env = {}) => { // removeEmptyChunks: false, // splitChunks: false, // }, - optimization: { moduleIds: 'named', runtimeChunk: true, @@ -96,6 +95,11 @@ module.exports = (env = {}) => { }, }, + performance: { + hints: false, + }, + parallelism: 2, + plugins: [ parseInt(env.noTsCheck, 10) ? new DefinePlugin({}) // bogus plugin to satisfy webpack API @@ -131,10 +135,10 @@ module.exports = (env = {}) => { integrity: true, publicPath: true, }), - // new WebpackBar({ - // color: '#eb7b18', - // name: 'Grafana', - // }), + new WebpackBar({ + color: '#eb7b18', + name: 'Grafana', + }), new EnvironmentPlugin(envConfig), new DefinePlugin({ 'process.env': { From 6bc5ca96921f603aa8e53fee1626243a02479b76 Mon Sep 17 00:00:00 2001 From: Gurinder Singh Date: Thu, 5 Sep 2024 13:38:59 -0400 Subject: [PATCH 3/3] should log fix --- scripts/webpack/webpack.dev.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/webpack/webpack.dev.js b/scripts/webpack/webpack.dev.js index c70cdb208e80e..2b1a14544fd64 100644 --- a/scripts/webpack/webpack.dev.js +++ b/scripts/webpack/webpack.dev.js @@ -26,7 +26,6 @@ const esbuildOptions = { }; const envConfig = getEnvConfig(); - module.exports = (env = {}) => { return merge(common, { devtool: false, @@ -143,7 +142,7 @@ module.exports = (env = {}) => { new DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('development'), - SHOULD_LOG: JSON.stringify('true'), + SHOULD_LOG: JSON.stringify(process.env.SHOULD_LOG), }, }), ],