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
58e94fc0
Commit
58e94fc0
authored
Oct 30, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved state
parent
7a10bf01
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
59 additions
and
32 deletions
+59
-32
public/app/core/actions/user.ts
+28
-0
public/app/core/reducers/index.ts
+2
-0
public/app/core/reducers/user.ts
+15
-0
public/app/features/dashboard/state/actions.ts
+0
-12
public/app/features/org/OrgDetailsPage.tsx
+1
-1
public/app/features/org/OrgPreferences.tsx
+1
-1
public/app/features/org/state/actions.ts
+1
-8
public/app/features/org/state/reducers.ts
+1
-5
public/app/types/index.ts
+3
-1
public/app/types/organization.ts
+0
-3
public/app/types/user.ts
+7
-1
No files found.
public/app/core/actions/user.ts
0 → 100644
View file @
58e94fc0
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
getBackendSrv
}
from
'../services/backend_srv'
;
import
{
DashboardAcl
,
DashboardSearchHit
,
StoreState
}
from
'../../types'
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
any
>
;
export
type
Action
=
LoadStarredDashboardsAction
;
export
enum
ActionTypes
{
LoadStarredDashboards
=
'LOAD_STARRED_DASHBOARDS'
,
}
interface
LoadStarredDashboardsAction
{
type
:
ActionTypes
.
LoadStarredDashboards
;
payload
:
DashboardSearchHit
[];
}
const
starredDashboardsLoaded
=
(
dashboards
:
DashboardAcl
[])
=>
({
type
:
ActionTypes
.
LoadStarredDashboards
,
payload
:
dashboards
,
});
export
function
loadStarredDashboards
():
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
const
starredDashboards
=
await
getBackendSrv
().
search
({
starred
:
true
});
dispatch
(
starredDashboardsLoaded
(
starredDashboards
));
};
}
public/app/core/reducers/index.ts
View file @
58e94fc0
import
{
navIndexReducer
as
navIndex
}
from
'./navModel'
;
import
{
locationReducer
as
location
}
from
'./location'
;
import
{
appNotificationsReducer
as
appNotifications
}
from
'./appNotification'
;
import
{
userReducer
as
user
}
from
'./user'
;
export
default
{
navIndex
,
location
,
appNotifications
,
user
,
};
public/app/core/reducers/user.ts
0 → 100644
View file @
58e94fc0
import
{
DashboardSearchHit
,
UserState
}
from
'../../types'
;
import
{
Action
,
ActionTypes
}
from
'../actions/user'
;
const
initialState
:
UserState
=
{
starredDashboards
:
[]
as
DashboardSearchHit
[],
};
export
const
userReducer
=
(
state
:
UserState
=
initialState
,
action
:
Action
):
UserState
=>
{
switch
(
action
.
type
)
{
case
ActionTypes
.
LoadStarredDashboards
:
return
{
...
state
,
starredDashboards
:
action
.
payload
};
}
return
state
;
};
public/app/features/dashboard/state/actions.ts
View file @
58e94fc0
...
...
@@ -35,11 +35,6 @@ export const loadDashboardPermissions = (items: DashboardAclDTO[]): LoadDashboar
payload
:
items
,
});
const
starredDashboardsLoaded
=
(
dashboards
:
DashboardAcl
[])
=>
({
type
:
ActionTypes
.
LoadStarredDashboards
,
payload
:
dashboards
,
});
export
function
getDashboardPermissions
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
const
permissions
=
await
getBackendSrv
().
get
(
`/api/dashboards/id/
${
id
}
/permissions`
);
...
...
@@ -47,13 +42,6 @@ export function getDashboardPermissions(id: number): ThunkResult<void> {
};
}
export
function
loadStarredDashboards
():
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
const
starredDashboards
=
await
getBackendSrv
().
search
({
starred
:
true
});
dispatch
(
starredDashboardsLoaded
(
starredDashboards
));
};
}
function
toUpdateItem
(
item
:
DashboardAcl
):
DashboardAclUpdateDTO
{
return
{
userId
:
item
.
userId
,
...
...
public/app/features/org/OrgDetailsPage.tsx
View file @
58e94fc0
...
...
@@ -11,7 +11,7 @@ import {
setOrganizationName
,
updateOrganization
,
}
from
'./state/actions'
;
import
{
loadStarredDashboards
}
from
'../
dashboard/state/actions
'
;
import
{
loadStarredDashboards
}
from
'../
../core/actions/user
'
;
import
{
NavModel
,
Organization
,
OrganizationPreferences
,
StoreState
}
from
'app/types'
;
import
{
getNavModel
}
from
'../../core/selectors/navModel'
;
...
...
public/app/features/org/OrgPreferences.tsx
View file @
58e94fc0
...
...
@@ -99,7 +99,7 @@ export class OrgPreferences extends PureComponent<Props> {
function
mapStateToProps
(
state
)
{
return
{
preferences
:
state
.
organization
.
preferences
,
starredDashboards
:
state
.
organization
.
starredDashboards
,
starredDashboards
:
state
.
user
.
starredDashboards
,
};
}
...
...
public/app/features/org/state/actions.ts
View file @
58e94fc0
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
DashboardSearchHit
,
Organization
,
OrganizationPreferences
,
StoreState
}
from
'app/types'
;
import
{
Organization
,
OrganizationPreferences
,
StoreState
}
from
'app/types'
;
import
{
getBackendSrv
}
from
'../../../core/services/backend_srv'
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
any
>
;
...
...
@@ -7,7 +7,6 @@ type ThunkResult<R> = ThunkAction<R, StoreState, undefined, any>;
export
enum
ActionTypes
{
LoadOrganization
=
'LOAD_ORGANISATION'
,
LoadPreferences
=
'LOAD_PREFERENCES'
,
LoadStarredDashboards
=
'LOAD_STARRED_DASHBOARDS'
,
SetOrganizationName
=
'SET_ORGANIZATION_NAME'
,
SetOrganizationTheme
=
'SET_ORGANIZATION_THEME'
,
SetOrganizationHomeDashboard
=
'SET_ORGANIZATION_HOME_DASHBOARD'
,
...
...
@@ -24,11 +23,6 @@ interface LoadPreferencesAction {
payload
:
OrganizationPreferences
;
}
interface
LoadStarredDashboardsAction
{
type
:
ActionTypes
.
LoadStarredDashboards
;
payload
:
DashboardSearchHit
[];
}
interface
SetOrganizationNameAction
{
type
:
ActionTypes
.
SetOrganizationName
;
payload
:
string
;
...
...
@@ -82,7 +76,6 @@ export const setOrganizationTimezone = (timezone: string) => ({
export
type
Action
=
|
LoadOrganizationAction
|
LoadPreferencesAction
|
LoadStarredDashboardsAction
|
SetOrganizationNameAction
|
SetOrganizationThemeAction
|
SetOrganizationHomeDashboardAction
...
...
public/app/features/org/state/reducers.ts
View file @
58e94fc0
import
{
DashboardSearchHit
,
Organization
,
OrganizationPreferences
,
OrganizationState
}
from
'app/types'
;
import
{
Organization
,
OrganizationPreferences
,
OrganizationState
}
from
'app/types'
;
import
{
Action
,
ActionTypes
}
from
'./actions'
;
const
initialState
:
OrganizationState
=
{
organization
:
{}
as
Organization
,
preferences
:
{}
as
OrganizationPreferences
,
starredDashboards
:
[]
as
DashboardSearchHit
[],
};
const
organizationReducer
=
(
state
=
initialState
,
action
:
Action
):
OrganizationState
=>
{
...
...
@@ -15,9 +14,6 @@ const organizationReducer = (state = initialState, action: Action): Organization
case
ActionTypes
.
LoadPreferences
:
return
{
...
state
,
preferences
:
action
.
payload
};
case
ActionTypes
.
LoadStarredDashboards
:
return
{
...
state
,
starredDashboards
:
action
.
payload
};
case
ActionTypes
.
SetOrganizationName
:
return
{
...
state
,
organization
:
{
...
state
.
organization
,
name
:
action
.
payload
}
};
...
...
public/app/types/index.ts
View file @
58e94fc0
...
...
@@ -6,7 +6,7 @@ import { FolderDTO, FolderState, FolderInfo } from './folders';
import
{
DashboardState
}
from
'./dashboard'
;
import
{
DashboardAcl
,
OrgRole
,
PermissionLevel
}
from
'./acl'
;
import
{
ApiKey
,
ApiKeysState
,
NewApiKey
}
from
'./apiKeys'
;
import
{
Invitee
,
OrgUser
,
User
,
UsersState
}
from
'./user'
;
import
{
Invitee
,
OrgUser
,
User
,
UsersState
,
UserState
}
from
'./user'
;
import
{
DataSource
,
DataSourcesState
}
from
'./datasources'
;
import
{
TimeRange
,
...
...
@@ -86,6 +86,7 @@ export {
AppNotificationSeverity
,
AppNotificationTimeout
,
DashboardSearchHit
,
UserState
,
};
export
interface
StoreState
{
...
...
@@ -100,4 +101,5 @@ export interface StoreState {
users
:
UsersState
;
organization
:
OrganizationState
;
appNotifications
:
AppNotificationsState
;
user
:
UserState
;
}
public/app/types/organization.ts
View file @
58e94fc0
import
{
DashboardSearchHit
}
from
'./search'
;
export
interface
Organization
{
name
:
string
;
id
:
number
;
...
...
@@ -14,5 +12,4 @@ export interface OrganizationPreferences {
export
interface
OrganizationState
{
organization
:
Organization
;
preferences
:
OrganizationPreferences
;
starredDashboards
:
DashboardSearchHit
[];
}
public/app/types/user.ts
View file @
58e94fc0
export
interface
OrgUser
{
import
{
DashboardSearchHit
}
from
'./search'
;
export
interface
OrgUser
{
avatarUrl
:
string
;
email
:
string
;
lastSeenAt
:
string
;
...
...
@@ -43,3 +45,7 @@ export interface UsersState {
externalUserMngInfo
:
string
;
hasFetched
:
boolean
;
}
export
interface
UserState
{
starredDashboards
:
DashboardSearchHit
[];
}
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