Skip to content

Commit

Permalink
Merge pull request #8 from intergral/update_grafusion
Browse files Browse the repository at this point in the history
Update grafusion
  • Loading branch information
Umaaz committed Apr 26, 2024
2 parents 9242d37 + 048d806 commit 3c2e9a3
Show file tree
Hide file tree
Showing 27 changed files with 138 additions and 89 deletions.
1 change: 1 addition & 0 deletions .github/workflows/on_push_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_push_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ permissions:
contents: write

jobs:
goreleaser:
release:
name: Release
runs-on: ubuntu-latest-m
steps:
- name: Checkout
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ golangci-lint: $(GOLANGCI_LINT)
--config .golangci.toml \
$(GO_FILES)

lint-fix: $(GOLANGCI_LINT)
@echo "lint via golangci-lint"
$(GOLANGCI_LINT) run \
--config .golangci.toml \
--fix \
$(GO_FILES)

lint-go: golangci-lint ## Run all code checks for backend. You can use GO_FILES to specify exact files to check

# with disabled SC1071 we are ignored some TCL,Expect `/usr/bin/env expect` scripts
Expand Down
4 changes: 4 additions & 0 deletions conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,10 @@ news_feed_enabled = true
# Set the number of data source queries that can be executed concurrently in mixed queries. Default is the number of CPUs.
concurrent_query_limit =

[kiosk]
# Enable the kiosk section
mode = off

#################################### Query History #############################
[query_history]
# Enable the Query history
Expand Down
1 change: 1 addition & 0 deletions packages/grafana-data/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export interface GrafanaConfig {
alertingMinInterval: number;
authProxyEnabled: boolean;
exploreEnabled: boolean;
kioskMode: string;
queryHistoryEnabled: boolean;
helpEnabled: boolean;
profileEnabled: boolean;
Expand Down
1 change: 1 addition & 0 deletions packages/grafana-runtime/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
angularSupportEnabled = false;
authProxyEnabled = false;
exploreEnabled = false;
kioskMode = 'off';
queryHistoryEnabled = false;
helpEnabled = false;
profileEnabled = false;
Expand Down
19 changes: 10 additions & 9 deletions pkg/api/dtos/frontend_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,16 @@ type FrontendSettingsDTO struct {
LiveEnabled bool `json:"liveEnabled"`
AutoAssignOrg bool `json:"autoAssignOrg"`

VerifyEmailEnabled bool `json:"verifyEmailEnabled"`
SigV4AuthEnabled bool `json:"sigV4AuthEnabled"`
AzureAuthEnabled bool `json:"azureAuthEnabled"`
RbacEnabled bool `json:"rbacEnabled"`
ExploreEnabled bool `json:"exploreEnabled"`
HelpEnabled bool `json:"helpEnabled"`
ProfileEnabled bool `json:"profileEnabled"`
NewsFeedEnabled bool `json:"newsFeedEnabled"`
QueryHistoryEnabled bool `json:"queryHistoryEnabled"`
VerifyEmailEnabled bool `json:"verifyEmailEnabled"`
SigV4AuthEnabled bool `json:"sigV4AuthEnabled"`
AzureAuthEnabled bool `json:"azureAuthEnabled"`
RbacEnabled bool `json:"rbacEnabled"`
ExploreEnabled bool `json:"exploreEnabled"`
KioskMode string `json:"kioskMode"`
HelpEnabled bool `json:"helpEnabled"`
ProfileEnabled bool `json:"profileEnabled"`
NewsFeedEnabled bool `json:"newsFeedEnabled"`
QueryHistoryEnabled bool `json:"queryHistoryEnabled"`

GoogleAnalyticsId string `json:"googleAnalyticsId"`
GoogleAnalytics4Id string `json:"googleAnalytics4Id"`
Expand Down
1 change: 1 addition & 0 deletions pkg/api/frontendsettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
ProfileEnabled: setting.ProfileEnabled,
NewsFeedEnabled: setting.NewsFeedEnabled,
QueryHistoryEnabled: hs.Cfg.QueryHistoryEnabled,
KioskMode: setting.KioskMode,
GoogleAnalyticsId: hs.Cfg.GoogleAnalyticsID,
GoogleAnalytics4Id: hs.Cfg.GoogleAnalytics4ID,
GoogleAnalytics4SendManualPageViews: hs.Cfg.GoogleAnalytics4SendManualPageViews,
Expand Down
8 changes: 4 additions & 4 deletions pkg/services/navtree/navtreeimpl/navtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import (
"fmt"
"sort"

"github.com/grafana/grafana/pkg/models/roletype"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"

"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/infra/kvstore"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models/roletype"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/apikey"
"github.com/grafana/grafana/pkg/services/auth/identity"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/licensing"
"github.com/grafana/grafana/pkg/services/navtree"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
pref "github.com/grafana/grafana/pkg/services/preference"
Expand Down Expand Up @@ -476,7 +477,6 @@ func (s *ServiceImpl) buildAlertNavLinks(c *contextmodel.ReqContext) *navtree.Na

return &alertNav
}

return nil
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ var (
// Explore UI
ExploreEnabled bool

//kiosk mode
KioskMode string

// Help UI
HelpEnabled bool

Expand Down Expand Up @@ -1156,6 +1159,9 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
explore := iniFile.Section("explore")
ExploreEnabled = explore.Key("enabled").MustBool(true)

kiosk := iniFile.Section("kiosk")
KioskMode = valueAsString(kiosk, "mode", "off")

help := iniFile.Section("help")
HelpEnabled = help.Key("enabled").MustBool(true)

Expand Down
6 changes: 3 additions & 3 deletions public/app/core/components/AppChrome/AppChrome.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const mockSearchResult: QueryResponse = {
view: new DataFrameView<DashboardQueryResult>(searchData),
};

const setup = (children: ReactNode) => {
const setup = (children: ReactNode, hideSearch?: boolean) => {
config.bootData.navTree = [
{
id: HOME_NAV_ID,
Expand All @@ -67,7 +67,7 @@ const setup = (children: ReactNode) => {
const renderResult = render(
<KBarProvider>
<TestProvider grafanaContext={context}>
<AppChrome>
<AppChrome hideSearchBar={hideSearch}>
<div data-testid="page-children">{children}</div>
</AppChrome>
</TestProvider>
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('AppChrome', () => {
});

it('should focus the skip link on initial tab before carrying on with normal tab order', async () => {
setup(<Page navId="child1">Children</Page>);
setup(<Page navId="child1">Children</Page>, false);
await userEvent.keyboard('{tab}');
const skipLink = await screen.findByRole('link', { name: 'Skip to main content' });
expect(skipLink).toHaveFocus();
Expand Down
8 changes: 5 additions & 3 deletions public/app/core/components/AppChrome/AppChrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui';
import config from 'app/core/config';
import { useGrafana } from 'app/core/context/GrafanaContext';
import { CommandPalette } from 'app/features/commandPalette/CommandPalette';
import { useOpspilotMetadata } from 'app/intergral/useOpspilotMetadata';
import { KioskMode } from 'app/types';

import { AppChromeMenu } from './AppChromeMenu';
Expand All @@ -17,14 +18,15 @@ import { SectionNav } from './SectionNav/SectionNav';
import { TopSearchBar } from './TopBar/TopSearchBar';
import { TOP_BAR_LEVEL_HEIGHT } from './types';

export interface Props extends PropsWithChildren<{}> {}
export interface Props extends PropsWithChildren<{hideSearchBar?: boolean}> {}

export function AppChrome({ children }: Props) {
export function AppChrome({ children, hideSearchBar }: Props) {
const { chrome } = useGrafana();
const state = chrome.useState();
const searchBarHidden = state.searchBarHidden || state.kioskMode === KioskMode.TV;
const searchBarHidden = state.searchBarHidden || state.kioskMode === KioskMode.TV || (hideSearchBar ?? true);
const theme = useTheme2();
const styles = useStyles2(getStyles);
useOpspilotMetadata();

const contentClass = cx({
[styles.content]: true,
Expand Down
4 changes: 4 additions & 0 deletions public/app/core/components/AppChrome/AppChromeService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ export class AppChromeService {
this.update({ kioskMode: KioskMode.TV });
break;
case '1':
case 'embed':
this.update({kioskMode: KioskMode.Embed });
case true:
this.update({ kioskMode: KioskMode.Full });
}
Expand All @@ -150,6 +152,8 @@ export class AppChromeService {
switch (mode) {
case KioskMode.TV:
return 'tv';
case KioskMode.Embed:
return 'embed';
case KioskMode.Full:
return true;
default:
Expand Down
15 changes: 0 additions & 15 deletions public/app/core/components/AppChrome/NavToolbar/NavToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ export function NavToolbar({

return (
<div data-testid={Components.NavToolbar.container} className={styles.pageToolbar}>
<div className={styles.menuButton}>
<IconButton
id={TOGGLE_BUTTON_ID}
name="bars"
tooltip={
state.megaMenu === 'closed' || (state.megaMenu === 'docked' && isTooSmallForDockedMenu)
? t('navigation.toolbar.open-menu', 'Open menu')
: t('navigation.toolbar.close-menu', 'Close menu')
}
tooltipPlacement="bottom"
size="xl"
onClick={onToggleMegaMenu}
data-testid={Components.NavBar.Toggle.button}
/>
</div>
<Breadcrumbs breadcrumbs={breadcrumbs} className={styles.breadcrumbsWrapper} />
<div className={styles.actions}>
{actions}
Expand Down
16 changes: 1 addition & 15 deletions public/app/core/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,7 @@ export interface Props {
}

export const Footer = React.memo(({ customLinks, hideEdition }: Props) => {
const links = (customLinks || getFooterLinks()).concat(getVersionLinks(hideEdition));

return (
<footer className="footer">
<div className="text-center">
<ul>
{links.map((link) => (
<li key={link.text}>
<FooterItem item={link} />
</li>
))}
</ul>
</div>
</footer>
);
return <footer className="footer"></footer>;
});

Footer.displayName = 'Footer';
Expand Down
34 changes: 25 additions & 9 deletions public/app/core/navigation/kiosk.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import { UrlQueryMap } from '@grafana/data';

import { KioskMode } from '../../types';
import config from '../config';

// TODO Remove after topnav feature toggle is permanent and old NavBar is removed
export function getKioskMode(queryParams: UrlQueryMap): KioskMode | null {
switch (queryParams.kiosk) {
case 'tv':
return KioskMode.TV;
// legacy support
case '1':
case true:
return KioskMode.Full;
default:
return null;
if (config.kioskMode === 'off') {
switch (queryParams.kiosk) {
case 'tv':
return KioskMode.TV;
// legacy support
case '1':
case 'full':
case true:
return KioskMode.Full;
case 'embed':
return KioskMode.Embed;
default:
return null;
}
} else {
switch (config.kioskMode) {
// legacy support
case 'full':
return KioskMode.Full;
case 'embed':
return KioskMode.Embed;
default:
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ export default (navBarTree: NavModelItem[]): CommandPaletteAction[] => {

const navBarActions = navTreeToActions(navBarTree);

return [...globalActions, ...navBarActions];
return [...navBarActions];
};
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const DashNav = React.memo<Props>((props) => {
const { canStar, canShare, isStarred } = dashboard.meta;
const buttons: ReactNode[] = [];

if (kioskMode || isPlaylistRunning()) {
if ((kioskMode && kioskMode !== KioskMode.Embed) || isPlaylistRunning()) {
return [];
}

Expand Down
4 changes: 2 additions & 2 deletions public/app/features/dashboard/containers/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
}

const inspectPanel = this.getInspectPanel();
const showSubMenu = !editPanel && !kioskMode && !this.props.queryParams.editview;
const showSubMenu = !editPanel && (!kioskMode || kioskMode === KioskMode.Embed) && !this.props.queryParams.editview;

const showToolbar = kioskMode !== KioskMode.Full && !queryParams.editview;
const showToolbar = kioskMode !== KioskMode.Full && !queryParams.editview;

const pageClassName = cx({
'panel-in-fullscreen': Boolean(viewPanel),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ export default function TracePageActions(props: TracePageActionsProps) {

return (
<div className={styles.TracePageActions}>
<a
href="https://forms.gle/RZDEx8ScyZNguDoC8"
className={styles.feedback}
title="Share your thoughts about tracing in Grafana."
target="_blank"
rel="noreferrer noopener"
>
<Icon name="comment-alt-message" /> Give feedback
</a>

<ActionButton
onClick={copyTraceId}
Expand Down
3 changes: 2 additions & 1 deletion public/app/features/logs/components/LogDetailsRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@grafana/data';
import { reportInteraction } from '@grafana/runtime';
import { ClipboardButton, DataLinkButton, IconButton, Themeable2, withTheme2 } from '@grafana/ui';
import { OpspilotDataLinkButton } from 'app/intergral/OpspilotDataLinkButton';

import { logRowToSingleRowDataFrame } from '../logsModel';

Expand Down Expand Up @@ -323,7 +324,7 @@ class UnThemedLogDetailsRow extends PureComponent<Props, State> {
<div className={cx((singleVal || isMultiParsedValueWithNoContent) && styles.adjoiningLinkButton)}>
{links?.map((link, i) => (
<span key={`${link.title}-${i}`}>
<DataLinkButton link={link} />
{link.title === "OpsPilot AI" ? <OpspilotDataLinkButton link={link} /> : <DataLinkButton link={link} />}
</span>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion public/app/features/templating/template_srv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class TemplateSrv implements BaseTemplateSrv {
for (const variable of this.getAdHocVariables()) {
const variableUid = variable.datasource?.uid;

if (variableUid === ds.uid) {
if (variableUid === ds.uid || variableUid === ds.name) {
filters = filters.concat(variable.filters);
} else if (variableUid?.indexOf('$') === 0) {
if (this.replace(variableUid) === ds.uid) {
Expand Down
Loading

0 comments on commit 3c2e9a3

Please sign in to comment.