mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
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>
This commit is contained in:
parent
85ae144a87
commit
2f22781cd8
@ -9,7 +9,7 @@ import tinycolor from 'tinycolor2';
|
||||
import { css } from 'emotion';
|
||||
import { HorizontalGroup } from '..';
|
||||
|
||||
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange';
|
||||
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple';
|
||||
|
||||
export interface BadgeProps {
|
||||
text: string;
|
||||
|
@ -9,6 +9,7 @@ interface FeatureInfoBox extends Omit<InfoBoxProps, 'branded' | 'title' | 'urlTi
|
||||
title: string;
|
||||
featureState?: FeatureState;
|
||||
}
|
||||
|
||||
export const FeatureInfoBox = React.memo(
|
||||
React.forwardRef<HTMLDivElement, FeatureInfoBox>(({ title, featureState, ...otherProps }, ref) => {
|
||||
const theme = useTheme();
|
||||
|
@ -101,6 +101,11 @@ func (ss *SqlStore) Init() error {
|
||||
ss.addUserQueryAndCommandHandlers()
|
||||
ss.addAlertNotificationUidByIdHandler()
|
||||
|
||||
err = ss.logOrgsNotice()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if ss.skipEnsureDefaultOrgAndUser {
|
||||
return nil
|
||||
}
|
||||
@ -108,6 +113,30 @@ func (ss *SqlStore) Init() error {
|
||||
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 {
|
||||
err := ss.InTransaction(context.Background(), func(ctx context.Context) error {
|
||||
systemUserCountQuery := models.GetSystemUserCountStatsQuery{}
|
||||
|
@ -3,7 +3,7 @@ import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { StoreState } from 'app/types/store';
|
||||
import { LinkButton } from '@grafana/ui';
|
||||
import { LinkButton, InfoBox, VerticalGroup } from '@grafana/ui';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { AdminOrgsTable } from './AdminOrgsTable';
|
||||
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
||||
@ -29,6 +29,21 @@ export const AdminListOrgsPages: FC = () => {
|
||||
<Page.Contents>
|
||||
<>
|
||||
<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>
|
||||
<LinkButton icon="plus" href="org/new">
|
||||
New org
|
||||
|
Loading…
Reference in New Issue
Block a user