Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
26f72ccc
Unverified
Commit
26f72ccc
authored
Jan 17, 2020
by
Emil Tullstedt
Committed by
GitHub
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config: Use license info instead of build info for feature toggling (#21558)
parent
0e3a7b1a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
9 deletions
+16
-9
packages/grafana-runtime/src/config.ts
+8
-1
public/app/features/admin/UserAdminPage.tsx
+1
-1
public/app/features/admin/ldap/LdapPage.tsx
+1
-1
public/app/features/admin/state/actions.ts
+2
-2
public/app/features/datasources/state/navModel.ts
+1
-1
public/app/features/teams/TeamPages.test.tsx
+1
-1
public/app/features/teams/TeamPages.tsx
+1
-1
public/app/features/teams/state/navModel.ts
+1
-1
No files found.
packages/grafana-runtime/src/config.ts
View file @
26f72ccc
...
...
@@ -5,7 +5,7 @@ import { GrafanaTheme, GrafanaThemeType, PanelPluginMeta, DataSourceInstanceSett
export
interface
BuildInfo
{
version
:
string
;
commit
:
string
;
isEnterprise
:
boolean
;
isEnterprise
:
boolean
;
// deprecated: use licenseInfo.hasLicense instead
env
:
string
;
latestVersion
:
string
;
hasUpdate
:
boolean
;
...
...
@@ -17,6 +17,12 @@ interface FeatureToggles {
expressions
:
boolean
;
newEdit
:
boolean
;
}
interface
LicenseInfo
{
hasLicense
:
boolean
;
expiry
:
number
;
}
export
class
GrafanaBootConfig
{
datasources
:
{
[
str
:
string
]:
DataSourceInstanceSettings
}
=
{};
panels
:
{
[
key
:
string
]:
PanelPluginMeta
}
=
{};
...
...
@@ -55,6 +61,7 @@ export class GrafanaBootConfig {
expressions
:
false
,
newEdit
:
false
,
};
licenseInfo
:
LicenseInfo
=
{}
as
LicenseInfo
;
constructor
(
options
:
GrafanaBootConfig
)
{
this
.
theme
=
options
.
bootData
.
user
.
lightTheme
?
getTheme
(
GrafanaThemeType
.
Light
)
:
getTheme
(
GrafanaThemeType
.
Dark
);
...
...
public/app/features/admin/UserAdminPage.tsx
View file @
26f72ccc
...
...
@@ -141,7 +141,7 @@ export class UserAdminPage extends PureComponent<Props, State> {
onUserEnable=
{
this
.
onUserEnable
}
onPasswordChange=
{
this
.
onPasswordChange
}
/>
{
isLDAPUser
&&
config
.
buildInfo
.
isEnterpri
se
&&
ldapSyncInfo
&&
(
{
isLDAPUser
&&
config
.
licenseInfo
.
hasLicen
se
&&
ldapSyncInfo
&&
(
<
UserLdapSyncInfo
ldapSyncInfo=
{
ldapSyncInfo
}
user=
{
user
}
onUserSync=
{
this
.
onUserSync
}
/>
)
}
<
UserPermissions
isGrafanaAdmin=
{
user
.
isGrafanaAdmin
}
onGrafanaAdminChange=
{
this
.
onGrafanaAdminChange
}
/>
...
...
public/app/features/admin/ldap/LdapPage.tsx
View file @
26f72ccc
...
...
@@ -91,7 +91,7 @@ export class LdapPage extends PureComponent<Props, State> {
<
LdapConnectionStatus
ldapConnectionInfo=
{
ldapConnectionInfo
}
/>
{
config
.
buildInfo
.
isEnterpri
se
&&
ldapSyncInfo
&&
<
LdapSyncInfo
ldapSyncInfo=
{
ldapSyncInfo
}
/>
}
{
config
.
licenseInfo
.
hasLicen
se
&&
ldapSyncInfo
&&
<
LdapSyncInfo
ldapSyncInfo=
{
ldapSyncInfo
}
/>
}
<
h3
className=
"page-heading"
>
Test user mapping
</
h3
>
<
div
className=
"gf-form-group"
>
...
...
public/app/features/admin/state/actions.ts
View file @
26f72ccc
...
...
@@ -28,7 +28,7 @@ export function loadAdminUserPage(userId: number): ThunkResult<void> {
await
dispatch
(
loadUserProfile
(
userId
));
await
dispatch
(
loadUserOrgs
(
userId
));
await
dispatch
(
loadUserSessions
(
userId
));
if
(
config
.
ldapEnabled
&&
config
.
buildInfo
.
isEnterpri
se
)
{
if
(
config
.
ldapEnabled
&&
config
.
licenseInfo
.
hasLicen
se
)
{
await
dispatch
(
loadLdapSyncStatus
());
}
dispatch
(
userAdminPageLoadedAction
(
true
));
...
...
@@ -171,7 +171,7 @@ export function revokeAllSessions(userId: number): ThunkResult<void> {
export
function
loadLdapSyncStatus
():
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
// Available only in enterprise
if
(
config
.
buildInfo
.
isEnterpri
se
)
{
if
(
config
.
licenseInfo
.
hasLicen
se
)
{
const
syncStatus
=
await
getBackendSrv
().
get
(
`/api/admin/ldap-sync-status`
);
dispatch
(
ldapSyncStatusLoadedAction
(
syncStatus
));
}
...
...
public/app/features/datasources/state/navModel.ts
View file @
26f72ccc
...
...
@@ -45,7 +45,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
});
}
if
(
config
.
buildInfo
.
isEnterpri
se
)
{
if
(
config
.
licenseInfo
.
hasLicen
se
)
{
navModel
.
children
.
push
({
active
:
false
,
icon
:
'fa fa-fw fa-lock'
,
...
...
public/app/features/teams/TeamPages.test.tsx
View file @
26f72ccc
...
...
@@ -7,7 +7,7 @@ import { User } from 'app/core/services/context_srv';
import
{
NavModel
}
from
'@grafana/data'
;
jest
.
mock
(
'app/core/config'
,
()
=>
({
buildInfo
:
{
isEnterpri
se
:
true
},
licenseInfo
:
{
hasLicen
se
:
true
},
}));
const
setup
=
(
propOverrides
?:
object
)
=>
{
...
...
public/app/features/teams/TeamPages.tsx
View file @
26f72ccc
...
...
@@ -45,7 +45,7 @@ export class TeamPages extends PureComponent<Props, State> {
this
.
state
=
{
isLoading
:
false
,
isSyncEnabled
:
config
.
buildInfo
.
isEnterpri
se
,
isSyncEnabled
:
config
.
licenseInfo
.
hasLicen
se
,
};
}
...
...
public/app/features/teams/state/navModel.ts
View file @
26f72ccc
...
...
@@ -28,7 +28,7 @@ export function buildNavModel(team: Team): NavModelItem {
],
};
if
(
config
.
buildInfo
.
isEnterpri
se
)
{
if
(
config
.
licenseInfo
.
hasLicen
se
)
{
navModel
.
children
.
push
({
active
:
false
,
icon
:
'fa fa-fw fa-refresh'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment