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
5595fc26
Commit
5595fc26
authored
Jul 05, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(): refactored date handling and locale handling in #5517
parent
c029e47a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
5 deletions
+20
-5
pkg/api/dtos/models.go
+1
-0
pkg/api/index.go
+12
-0
public/app/app.ts
+4
-2
public/app/features/dashboard/timepicker/dropdown.html
+2
-2
public/app/plugins/panel/table/specs/renderer_specs.ts
+1
-1
public/vendor/moment.js
+0
-0
No files found.
pkg/api/dtos/models.go
View file @
5595fc26
...
...
@@ -34,6 +34,7 @@ type CurrentUser struct {
IsGrafanaAdmin
bool
`json:"isGrafanaAdmin"`
GravatarUrl
string
`json:"gravatarUrl"`
Timezone
string
`json:"timezone"`
Locale
string
`json:"locale"`
}
type
DashboardMeta
struct
{
...
...
pkg/api/index.go
View file @
5595fc26
package
api
import
(
"strings"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/middleware"
...
...
@@ -21,6 +23,15 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
}
prefs
:=
prefsQuery
.
Result
// Read locale from acccept-language
acceptLang
:=
c
.
Req
.
Header
.
Get
(
"Accept-Language"
)
locale
:=
"en-US"
if
len
(
acceptLang
)
>
0
{
parts
:=
strings
.
Split
(
acceptLang
,
","
)
locale
=
parts
[
0
]
}
var
data
=
dtos
.
IndexViewData
{
User
:
&
dtos
.
CurrentUser
{
Id
:
c
.
UserId
,
...
...
@@ -35,6 +46,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
IsGrafanaAdmin
:
c
.
IsGrafanaAdmin
,
LightTheme
:
prefs
.
Theme
==
"light"
,
Timezone
:
prefs
.
Timezone
,
Locale
:
locale
,
},
Settings
:
settings
,
AppUrl
:
setting
.
AppUrl
,
...
...
public/app/app.ts
View file @
5595fc26
...
...
@@ -42,13 +42,15 @@ export class GrafanaApp {
var
app
=
angular
.
module
(
'grafana'
,
[]);
app
.
constant
(
'grafanaVersion'
,
"@grafanaVersion@"
);
moment
.
locale
(
config
.
bootData
.
user
.
locale
);
app
.
config
((
$locationProvider
,
$controllerProvider
,
$compileProvider
,
$filterProvider
,
$httpProvider
,
$provide
)
=>
{
if
(
config
.
buildInfo
.
env
!==
'development'
)
{
$compileProvider
.
debugInfoEnabled
(
false
);
}
$httpProvider
.
useApplyAsync
(
true
);
moment
.
locale
(
window
.
navigator
.
userLanguage
||
window
.
navigator
.
languag
e
);
$httpProvider
.
useApplyAsync
(
tru
e
);
this
.
registerFunctions
.
controller
=
$controllerProvider
.
register
;
this
.
registerFunctions
.
directive
=
$compileProvider
.
directive
;
...
...
public/app/features/dashboard/timepicker/dropdown.html
View file @
5595fc26
...
...
@@ -15,7 +15,7 @@
</div>
<div
ng-if=
"openFromPicker"
>
<datepicker
ng-model=
"ctrl.absolute.fromJs"
class=
"gf-timepicker-component"
show-weeks=
"false"
starting-day=
"firstDayOfWeek"
ng-change=
"ctrl.absoluteFromChanged()"
></datepicker>
<datepicker
ng-model=
"ctrl.absolute.fromJs"
class=
"gf-timepicker-component"
show-weeks=
"false"
starting-day=
"
ctrl.
firstDayOfWeek"
ng-change=
"ctrl.absoluteFromChanged()"
></datepicker>
</div>
...
...
@@ -32,7 +32,7 @@
</div>
<div
ng-if=
"openToPicker"
>
<datepicker
ng-model=
"ctrl.absolute.toJs"
class=
"gf-timepicker-component"
show-weeks=
"false"
starting-day=
"firstDayOfWeek"
ng-change=
"ctrl.absoluteToChanged()"
></datepicker>
<datepicker
ng-model=
"ctrl.absolute.toJs"
class=
"gf-timepicker-component"
show-weeks=
"false"
starting-day=
"
ctrl.
firstDayOfWeek"
ng-change=
"ctrl.absoluteToChanged()"
></datepicker>
</div>
<label
class=
"small"
>
Refreshing every:
</label>
...
...
public/app/plugins/panel/table/specs/renderer_specs.ts
View file @
5595fc26
...
...
@@ -55,7 +55,7 @@ describe('when rendering table', () => {
it
(
'time column should be formated'
,
()
=>
{
var
html
=
renderer
.
renderCell
(
0
,
1388556366666
);
expect
(
html
).
to
.
be
(
'<td>2014-01-01T06:06:06
+00:00
</td>'
);
expect
(
html
).
to
.
be
(
'<td>2014-01-01T06:06:06
Z
</td>'
);
});
it
(
'number column with unit specified should ignore style unit'
,
()
=>
{
...
...
public/vendor/moment.js
View file @
5595fc26
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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