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
b8724ae0
Unverified
Commit
b8724ae0
authored
Jul 02, 2018
by
Torkel Ödegaard
Committed by
GitHub
Jul 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: enterprise build/hooks refactorings (#12478)
parent
2941dff4
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
55 deletions
+73
-55
pkg/api/dtos/index.go
+1
-0
pkg/api/frontendsettings.go
+1
-1
pkg/api/index.go
+1
-0
pkg/cmd/grafana-server/main.go
+2
-3
pkg/extensions/main.go
+1
-1
pkg/metrics/metrics.go
+9
-0
pkg/setting/setting.go
+4
-3
public/app/core/config.ts
+16
-3
public/app/core/services/context_srv.ts
+0
-4
public/app/features/dashboard/specs/exporter.jest.ts
+1
-3
public/app/features/org/partials/team_details.html
+33
-33
public/app/features/org/team_details_ctrl.ts
+3
-3
public/views/index.template.html
+1
-1
No files found.
pkg/api/dtos/index.go
View file @
b8724ae0
...
...
@@ -13,6 +13,7 @@ type IndexViewData struct {
Theme
string
NewGrafanaVersionExists
bool
NewGrafanaVersion
string
AppName
string
}
type
PluginCss
struct
{
...
...
pkg/api/frontendsettings.go
View file @
b8724ae0
...
...
@@ -132,7 +132,6 @@ func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
}
jsonObj
:=
map
[
string
]
interface
{}{
"enterprise"
:
setting
.
Enterprise
,
"defaultDatasource"
:
defaultDatasource
,
"datasources"
:
datasources
,
"panels"
:
panels
,
...
...
@@ -154,6 +153,7 @@ func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
"latestVersion"
:
plugins
.
GrafanaLatestVersion
,
"hasUpdate"
:
plugins
.
GrafanaHasUpdate
,
"env"
:
setting
.
Env
,
"isEnterprise"
:
setting
.
IsEnterprise
,
},
}
...
...
pkg/api/index.go
View file @
b8724ae0
...
...
@@ -76,6 +76,7 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) {
BuildCommit
:
setting
.
BuildCommit
,
NewGrafanaVersion
:
plugins
.
GrafanaLatestVersion
,
NewGrafanaVersionExists
:
plugins
.
GrafanaHasUpdate
,
AppName
:
setting
.
ApplicationName
,
}
if
setting
.
DisableGravatar
{
...
...
pkg/cmd/grafana-server/main.go
View file @
b8724ae0
...
...
@@ -18,7 +18,7 @@ import (
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/setting"
_
"github.com/grafana/grafana/pkg/extensions"
extensions
"github.com/grafana/grafana/pkg/extensions"
_
"github.com/grafana/grafana/pkg/services/alerting/conditions"
_
"github.com/grafana/grafana/pkg/services/alerting/notifiers"
_
"github.com/grafana/grafana/pkg/tsdb/cloudwatch"
...
...
@@ -35,7 +35,6 @@ import (
var
version
=
"5.0.0"
var
commit
=
"NA"
var
buildstamp
string
var
enterprise
string
var
configFile
=
flag
.
String
(
"config"
,
""
,
"path to config file"
)
var
homePath
=
flag
.
String
(
"homepath"
,
""
,
"path to grafana install/home path, defaults to working directory"
)
...
...
@@ -78,7 +77,7 @@ func main() {
setting
.
BuildVersion
=
version
setting
.
BuildCommit
=
commit
setting
.
BuildStamp
=
buildstampInt64
setting
.
Enterprise
,
_
=
strconv
.
ParseBool
(
enterprise
)
setting
.
IsEnterprise
=
extensions
.
IsEnterprise
metrics
.
M_Grafana_Version
.
WithLabelValues
(
version
)
.
Set
(
1
)
...
...
pkg/extensions/main.go
View file @
b8724ae0
package
extensions
import
_
"github.com/pkg/errors"
var
IsEnterprise
bool
=
false
pkg/metrics/metrics.go
View file @
b8724ae0
...
...
@@ -334,6 +334,14 @@ func updateTotalStats() {
var
usageStatsURL
=
"https://stats.grafana.org/grafana-usage-report"
func
getEdition
()
string
{
if
setting
.
IsEnterprise
{
return
"enterprise"
}
else
{
return
"oss"
}
}
func
sendUsageStats
()
{
if
!
setting
.
ReportingEnabled
{
return
...
...
@@ -349,6 +357,7 @@ func sendUsageStats() {
"metrics"
:
metrics
,
"os"
:
runtime
.
GOOS
,
"arch"
:
runtime
.
GOARCH
,
"edition"
:
getEdition
(),
}
statsQuery
:=
models
.
GetSystemStatsQuery
{}
...
...
pkg/setting/setting.go
View file @
b8724ae0
...
...
@@ -18,9 +18,10 @@ import (
"github.com/go-macaron/session"
"time"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/util"
"time"
)
type
Scheme
string
...
...
@@ -49,7 +50,7 @@ var (
BuildVersion
string
BuildCommit
string
BuildStamp
int64
Enterprise
bool
IsEnterprise
bool
ApplicationName
string
// Paths
...
...
@@ -517,7 +518,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
Raw
=
cfg
.
Raw
ApplicationName
=
"Grafana"
if
Enterprise
{
if
Is
Enterprise
{
ApplicationName
+=
" Enterprise"
}
...
...
public/app/core/config.ts
View file @
b8724ae0
import
_
from
'lodash'
;
class
Settings
{
export
interface
BuildInfo
{
version
:
string
;
commit
:
string
;
isEnterprise
:
boolean
;
env
:
string
;
}
export
class
Settings
{
datasources
:
any
;
panels
:
any
;
appSubUrl
:
string
;
window_title_prefix
:
string
;
buildInfo
:
any
;
buildInfo
:
BuildInfo
;
new_panel_title
:
string
;
bootData
:
any
;
externalUserMngLinkUrl
:
string
;
...
...
@@ -22,7 +29,6 @@ class Settings {
disableUserSignUp
:
boolean
;
loginHint
:
any
;
loginError
:
any
;
enterprise
:
boolean
;
constructor
(
options
)
{
var
defaults
=
{
...
...
@@ -33,7 +39,14 @@ class Settings {
playlist_timespan
:
'1m'
,
unsaved_changes_warning
:
true
,
appSubUrl
:
''
,
buildInfo
:
{
version
:
'v1.0'
,
commit
:
'1'
,
env
:
'production'
,
isEnterprise
:
false
,
},
};
_
.
extend
(
this
,
defaults
,
options
);
}
}
...
...
public/app/core/services/context_srv.ts
View file @
b8724ae0
...
...
@@ -34,14 +34,10 @@ export class ContextSrv {
constructor
()
{
this
.
sidemenu
=
store
.
getBool
(
'grafana.sidemenu'
,
true
);
if
(
!
config
.
buildInfo
)
{
config
.
buildInfo
=
{};
}
if
(
!
config
.
bootData
)
{
config
.
bootData
=
{
user
:
{},
settings
:
{}
};
}
this
.
version
=
config
.
buildInfo
.
version
;
this
.
user
=
new
User
();
this
.
isSignedIn
=
this
.
user
.
isSignedIn
;
this
.
isGrafanaAdmin
=
this
.
user
.
isGrafanaAdmin
;
...
...
public/app/features/dashboard/specs/exporter.jest.ts
View file @
b8724ae0
...
...
@@ -86,9 +86,7 @@ describe('given dashboard with repeated panels', () => {
],
};
config
.
buildInfo
=
{
version
:
'3.0.2'
,
};
config
.
buildInfo
.
version
=
'3.0.2'
;
//Stubs test function calls
var
datasourceSrvStub
=
{
get
:
jest
.
fn
(
arg
=>
getStub
(
arg
))
};
...
...
public/app/features/org/partials/team_details.html
View file @
b8724ae0
...
...
@@ -67,39 +67,39 @@
</div>
<div
class=
"gf-form-group"
ng-if=
"ctrl.
enterprise
"
>
<div
class=
"gf-form-group"
ng-if=
"ctrl.
isMappingsEnabled
"
>
<h3
class=
"page-heading"
>
Team Group Mapping
</h3>
<form
name=
"ctrl.addGroupForm"
class=
"gf-form-group"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-10"
>
Add group
</span>
<input
class=
"gf-form-input max-width-22"
type=
"text"
ng-model=
"ctrl.newGroupId"
>
</div>
<div
class=
"gf-form-button-row"
>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"ctrl.addGroup()"
>
Add
</button>
</div>
</form>
<h3
class=
"page-heading"
>
Mappings to external groups
</h3>
<form
name=
"ctrl.addGroupForm"
class=
"gf-form-group"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-10"
>
Add group
</span>
<input
class=
"gf-form-input max-width-22"
type=
"text"
ng-model=
"ctrl.newGroupId"
>
</div>
<div
class=
"gf-form-button-row"
>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"ctrl.addGroup()"
>
Add
</button>
</div>
</form>
<table
class=
"filter-table"
ng-show=
"ctrl.teamGroups.length > 0"
>
<thead>
<tr>
<th>
Group
</th>
<th></th>
</tr>
</thead>
<tr
ng-repeat=
"group in ctrl.teamGroups"
>
<td>
{{group.groupId}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"ctrl.removeGroup(group)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
<div>
<em
class=
"muted"
ng-hide=
"ctrl.teamGroups.length > 0"
>
This team has no associated groups yet.
</em>
</div>
<table
class=
"filter-table"
ng-show=
"ctrl.teamGroups.length > 0"
>
<thead>
<tr>
<th>
Group
</th>
<th></th>
</tr>
</thead>
<tr
ng-repeat=
"group in ctrl.teamGroups"
>
<td>
{{group.groupId}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"ctrl.removeGroup(group)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
<div>
<em
class=
"muted"
ng-hide=
"ctrl.teamGroups.length > 0"
>
This team has no associated groups yet.
</em>
</div>
</div>
</div>
public/app/features/org/team_details_ctrl.ts
View file @
b8724ae0
...
...
@@ -7,7 +7,7 @@ export default class TeamDetailsCtrl {
navModel
:
any
;
teamGroups
:
TeamGroup
[]
=
[];
newGroupId
:
string
;
enterprise
:
boolean
;
isMappingsEnabled
:
boolean
;
/** @ngInject **/
constructor
(
private
$scope
,
private
backendSrv
,
private
$routeParams
,
navModelSrv
)
{
...
...
@@ -15,7 +15,7 @@ export default class TeamDetailsCtrl {
this
.
userPicked
=
this
.
userPicked
.
bind
(
this
);
this
.
get
=
this
.
get
.
bind
(
this
);
this
.
newGroupId
=
''
;
this
.
enterprise
=
config
.
e
nterprise
;
this
.
isMappingsEnabled
=
config
.
buildInfo
.
isE
nterprise
;
this
.
get
();
}
...
...
@@ -29,7 +29,7 @@ export default class TeamDetailsCtrl {
this
.
teamMembers
=
result
;
});
if
(
config
.
enterprise
)
{
if
(
this
.
isMappingsEnabled
)
{
this
.
backendSrv
.
get
(
`/api/teams/
${
this
.
$routeParams
.
id
}
/groups`
).
then
(
result
=>
{
this
.
teamGroups
=
result
;
});
...
...
public/views/index.template.html
View file @
b8724ae0
...
...
@@ -65,7 +65,7 @@
</a>
</li>
<li>
<a
href=
"https://grafana.com"
target=
"_blank"
>
Grafana
</a>
<a
href=
"https://grafana.com"
target=
"_blank"
>
[[.AppName]]
</a>
<span>
v[[.BuildVersion]] (commit: [[.BuildCommit]])
</span>
</li>
[[if .NewGrafanaVersionExists]]
...
...
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