Skip to content

Commit

Permalink
fn_init fix and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gurinder39 committed Oct 13, 2023
1 parent 97bee45 commit b6d4abc
Show file tree
Hide file tree
Showing 13 changed files with 374 additions and 97 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ vendor

# Auto-generated icon file
/packages/grafana-ui/src/components/Icon/iconBundle.ts

# Sankey panel
/public/app/plugins/panel/sankey-panel-0.5.0/module.js
45 changes: 45 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

call_lefthook()
{
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/')

if lefthook -h >/dev/null 2>&1
then
lefthook "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif command -v npx >/dev/null 2>&1
then
npx @evilmartians/lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
}

call_lefthook run "prepare-commit-msg" "$@"
35 changes: 35 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
pre-push:
commands:
packages-audit:
tags: frontend security
run: yarn audit
gems-audit:
tags: backend security
run: bundle audit

pre-commit:
parallel: true
commands:
eslint:
glob: "*.{js,ts,jsx,tsx}"
run: yarn eslint {staged_files}
rubocop:
tags: backend style
glob: "*.rb"
exclude: "application.rb|routes.rb"
run: bundle exec rubocop --force-exclusion {all_files}
govet:
tags: backend style
files: git ls-files -m
glob: "*.go"
run: go vet {files}
scripts:
"hello.js":
runner: node
"any.go":
runner: go run
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"jest-fail-on-console": "3.1.1",
"jest-junit": "16.0.0",
"jest-matcher-utils": "29.3.1",
"lefthook": "^1.5.2",
"lerna": "5.5.4",
"lint-staged": "13.2.3",
"mini-css-extract-plugin": "2.7.2",
Expand Down
4 changes: 2 additions & 2 deletions public/app/fn-app/fn-app-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, FC } from 'react';
import React, { useState, useEffect, FC, PropsWithChildren } from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';

Expand All @@ -15,7 +15,7 @@ import { FNDashboardProps } from './types';

type FnAppProviderProps = Pick<FNDashboardProps, 'fnError'>;

export const FnAppProvider: FC<FnAppProviderProps> = (props) => {
export const FnAppProvider: FC<PropsWithChildren<FnAppProviderProps>> = (props) => {
const { children, fnError = null } = props;

const [ready, setReady] = useState(false);
Expand Down
40 changes: 20 additions & 20 deletions public/app/fn_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ import { Echo } from './core/services/echo/Echo';
import { reportPerformance } from './core/services/echo/EchoSrv';
import { PerformanceBackend } from './core/services/echo/backends/PerformanceBackend';
import { ApplicationInsightsBackend } from './core/services/echo/backends/analytics/ApplicationInsightsBackend';
import { GA4EchoBackend } from './core/services/echo/backends/analytics/GA4Backend';
import { GAEchoBackend } from './core/services/echo/backends/analytics/GABackend';
// import { GA4EchoBackend } from './core/services/echo/backends/analytics/GA4Backend';
// import { GAEchoBackend } from './core/services/echo/backends/analytics/GABackend';
import { RudderstackBackend } from './core/services/echo/backends/analytics/RudderstackBackend';
import { GrafanaJavascriptAgentBackend } from './core/services/echo/backends/grafana-javascript-agent/GrafanaJavascriptAgentBackend';
import { KeybindingSrv } from './core/services/keybindingSrv';
import { startMeasure, stopMeasure } from './core/utils/metrics';
import { initDevFeatures } from './dev';
import { getTimeSrv } from './features/dashboard/services/TimeSrv';
import { initGrafanaLive } from './features/live';
// import { initGrafanaLive } from './features/live';
import { PanelDataErrorView } from './features/panel/components/PanelDataErrorView';
import { PanelRenderer } from './features/panel/components/PanelRenderer';
import { DatasourceSrv } from './features/plugins/datasource_srv';
Expand Down Expand Up @@ -135,7 +135,7 @@ export class GrafanaApp {
setPanelDataErrorView(PanelDataErrorView);
setLocationSrv(locationService);
setTimeZoneResolver(() => config.bootData.user.timezone);
initGrafanaLive();
// initGrafanaLive();

// Expose the app-wide eventbus
setAppEvents(appEvents);
Expand Down Expand Up @@ -285,22 +285,22 @@ function initEchoSrv() {
);
}

if (config.googleAnalyticsId) {
registerEchoBackend(
new GAEchoBackend({
googleAnalyticsId: config.googleAnalyticsId,
})
);
}

if (config.googleAnalytics4Id) {
registerEchoBackend(
new GA4EchoBackend({
googleAnalyticsId: config.googleAnalytics4Id,
googleAnalytics4SendManualPageViews: config.googleAnalytics4SendManualPageViews,
})
);
}
// if (config.googleAnalyticsId) {
// registerEchoBackend(
// new GAEchoBackend({
// googleAnalyticsId: config.googleAnalyticsId,
// })
// );
// }

// if (config.googleAnalytics4Id) {
// registerEchoBackend(
// new GA4EchoBackend({
// googleAnalyticsId: config.googleAnalytics4Id,
// googleAnalytics4SendManualPageViews: config.googleAnalytics4SendManualPageViews,
// })
// );
// }

if (config.rudderstackWriteKey && config.rudderstackDataPlaneUrl) {
registerEchoBackend(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { QueryBuilderProps } from '../types';

import { Aggregation } from './';


export const Filtered = (props: QueryBuilderProps) => {
const scopedProps = useScopedQueryBuilderFieldProps(props, Filtered);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { QueryBuilderProps } from '../types';

import { FilterTuning } from '.';


export const Spatial = (props: QueryBuilderProps) => {
const scopedProps = useScopedQueryBuilderFieldProps(props, Spatial);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { QuerySettingsProps } from './types';

import { DruidQueryRequestSettings, DruidQueryResponseSettings } from './';


export const DruidQueryDefaultSettings = (props: QuerySettingsProps) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { QuerySettingsProps } from './types';

import { DruidQueryRequestSettings, DruidQueryResponseSettings } from './';


export const DruidQuerySettings = (props: QuerySettingsProps) => {
return (
<>
Expand Down
Loading

0 comments on commit b6d4abc

Please sign in to comment.