Commit 2f22781c by Torkel Ödegaard Committed by GitHub

Orgs: Add future deprecation notice (#24502)

* Orgs: Fist draft of orgs deprecation infobox

* adds warning about potentially deprecating orgs (#24512)

* Updates

* Fixed ts issue

Co-authored-by: Carl Bergquist <carl@grafana.com>
parent 85ae144a
...@@ -9,7 +9,7 @@ import tinycolor from 'tinycolor2'; ...@@ -9,7 +9,7 @@ import tinycolor from 'tinycolor2';
import { css } from 'emotion'; import { css } from 'emotion';
import { HorizontalGroup } from '..'; import { HorizontalGroup } from '..';
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange'; export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple';
export interface BadgeProps { export interface BadgeProps {
text: string; text: string;
......
...@@ -9,6 +9,7 @@ interface FeatureInfoBox extends Omit<InfoBoxProps, 'branded' | 'title' | 'urlTi ...@@ -9,6 +9,7 @@ interface FeatureInfoBox extends Omit<InfoBoxProps, 'branded' | 'title' | 'urlTi
title: string; title: string;
featureState?: FeatureState; featureState?: FeatureState;
} }
export const FeatureInfoBox = React.memo( export const FeatureInfoBox = React.memo(
React.forwardRef<HTMLDivElement, FeatureInfoBox>(({ title, featureState, ...otherProps }, ref) => { React.forwardRef<HTMLDivElement, FeatureInfoBox>(({ title, featureState, ...otherProps }, ref) => {
const theme = useTheme(); const theme = useTheme();
......
...@@ -101,6 +101,11 @@ func (ss *SqlStore) Init() error { ...@@ -101,6 +101,11 @@ func (ss *SqlStore) Init() error {
ss.addUserQueryAndCommandHandlers() ss.addUserQueryAndCommandHandlers()
ss.addAlertNotificationUidByIdHandler() ss.addAlertNotificationUidByIdHandler()
err = ss.logOrgsNotice()
if err != nil {
return err
}
if ss.skipEnsureDefaultOrgAndUser { if ss.skipEnsureDefaultOrgAndUser {
return nil return nil
} }
...@@ -108,6 +113,30 @@ func (ss *SqlStore) Init() error { ...@@ -108,6 +113,30 @@ func (ss *SqlStore) Init() error {
return ss.ensureMainOrgAndAdminUser() return ss.ensureMainOrgAndAdminUser()
} }
func (ss *SqlStore) logOrgsNotice() error {
type targetCount struct {
Count int64
}
return ss.WithDbSession(context.Background(), func(session *DBSession) error {
resp := make([]*targetCount, 0)
if err := session.SQL("select count(id) as Count from org").Find(&resp); err != nil {
return err
}
if resp[0].Count > 1 {
ss.log.Warn(`[Deprecation notice]`)
ss.log.Warn(`Fewer than 1% of Grafana installations use organizations, and we feel that most of those`)
ss.log.Warn(`users would have a better experience using Teams instead. As such, we are considering de-emphasizing`)
ss.log.Warn(`and eventually deprecating Organizations in a future Grafana release. If you would like to provide`)
ss.log.Warn(`feedback or describe your need, please do so in the issue linked below`)
ss.log.Warn(`https://github.com/grafana/grafana/issues/24588`)
}
return nil
})
}
func (ss *SqlStore) ensureMainOrgAndAdminUser() error { func (ss *SqlStore) ensureMainOrgAndAdminUser() error {
err := ss.InTransaction(context.Background(), func(ctx context.Context) error { err := ss.InTransaction(context.Background(), func(ctx context.Context) error {
systemUserCountQuery := models.GetSystemUserCountStatsQuery{} systemUserCountQuery := models.GetSystemUserCountStatsQuery{}
......
...@@ -3,7 +3,7 @@ import { getNavModel } from 'app/core/selectors/navModel'; ...@@ -3,7 +3,7 @@ import { getNavModel } from 'app/core/selectors/navModel';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { StoreState } from 'app/types/store'; import { StoreState } from 'app/types/store';
import { LinkButton } from '@grafana/ui'; import { LinkButton, InfoBox, VerticalGroup } from '@grafana/ui';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
import { AdminOrgsTable } from './AdminOrgsTable'; import { AdminOrgsTable } from './AdminOrgsTable';
import useAsyncFn from 'react-use/lib/useAsyncFn'; import useAsyncFn from 'react-use/lib/useAsyncFn';
...@@ -29,6 +29,21 @@ export const AdminListOrgsPages: FC = () => { ...@@ -29,6 +29,21 @@ export const AdminListOrgsPages: FC = () => {
<Page.Contents> <Page.Contents>
<> <>
<div className="page-action-bar"> <div className="page-action-bar">
<InfoBox branded>
<VerticalGroup spacing="xs">
<p>
Fewer than 1% of Grafana installations use organizations, and we think that most of those would have a
better experience with Teams instead. As such, we are considering de-emphasizing and eventually
deprecating Organizations in a future Grafana release. If you would like to provide feedback or
describe your need, please do so{' '}
<a className="external-link" href="https://github.com/grafana/grafana/issues/24588">
here
</a>
.{' '}
</p>
</VerticalGroup>
</InfoBox>
<div className="page-action-bar__spacer"></div> <div className="page-action-bar__spacer"></div>
<LinkButton icon="plus" href="org/new"> <LinkButton icon="plus" href="org/new">
New org New org
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment