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
a83beac5
Commit
a83beac5
authored
Sep 12, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redux: moved folders to it's own features folder
parent
7c27a87d
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
80 additions
and
140 deletions
+80
-140
public/app/containers/ContainerProps.ts
+0
-12
public/app/features/folders/FolderPermissions.tsx
+4
-2
public/app/features/folders/FolderSettingsPage.test.tsx
+2
-1
public/app/features/folders/FolderSettingsPage.tsx
+0
-1
public/app/features/folders/__snapshots__/FolderSettingsPage.test.tsx.snap
+0
-0
public/app/features/folders/state/actions.ts
+12
-39
public/app/features/folders/state/navModel.ts
+35
-0
public/app/features/folders/state/reducers.ts
+0
-0
public/app/features/teams/state/actions.ts
+19
-55
public/app/routes/routes.ts
+2
-2
public/app/stores/configureStore.ts
+2
-2
yarn.lock
+4
-26
No files found.
public/app/containers/ContainerProps.ts
deleted
100644 → 0
View file @
7c27a87d
import
{
NavStore
}
from
'./../stores/NavStore/NavStore'
;
import
{
PermissionsStore
}
from
'./../stores/PermissionsStore/PermissionsStore'
;
import
{
ViewStore
}
from
'./../stores/ViewStore/ViewStore'
;
interface
ContainerProps
{
nav
:
typeof
NavStore
.
Type
;
permissions
:
typeof
PermissionsStore
.
Type
;
view
:
typeof
ViewStore
.
Type
;
backendSrv
:
any
;
}
export
default
ContainerProps
;
public/app/features/
manage-dashboard
s/FolderPermissions.tsx
→
public/app/features/
folder
s/FolderPermissions.tsx
View file @
a83beac5
import
React
,
{
Component
}
from
'react'
;
import
{
hot
}
from
'react-hot-loader'
;
import
{
inject
,
observer
}
from
'mobx-react'
;
import
{
toJS
}
from
'mobx'
;
import
{
connect
}
from
'react-redux'
;
import
PageHeader
from
'app/core/components/PageHeader/PageHeader'
;
import
Permissions
from
'app/core/components/Permissions/Permissions'
;
...
...
@@ -11,13 +10,16 @@ import AddPermissions from 'app/core/components/Permissions/AddPermissions';
import
SlideDown
from
'app/core/components/Animations/SlideDown'
;
import
{
getNavModel
}
from
'app/core/selectors/navModel'
;
import
{
NavModel
,
StoreState
,
FolderState
}
from
'app/types'
;
import
{
getFolderByUid
,
setFolderTitle
,
saveFolder
,
deleteFolder
}
from
'./state/actions'
;
import
{
getFolderByUid
}
from
'./state/actions'
;
import
{
PermissionsStore
}
from
'app/stores/PermissionsStore/PermissionsStore'
;
export
interface
Props
{
navModel
:
NavModel
;
getFolderByUid
:
typeof
getFolderByUid
;
folderUid
:
string
;
folder
:
FolderState
;
permissions
:
typeof
PermissionsStore
.
Type
;
backendSrv
:
any
;
}
@
inject
(
'permissions'
)
...
...
public/app/features/
manage-dashboard
s/FolderSettingsPage.test.tsx
→
public/app/features/
folder
s/FolderSettingsPage.test.tsx
View file @
a83beac5
import
React
from
'react'
;
import
{
FolderSettingsPage
,
Props
}
from
'./FolderSettingsPage'
;
import
{
NavModel
,
FolderState
}
from
'../..
/types'
;
import
{
NavModel
}
from
'app
/types'
;
import
{
shallow
}
from
'enzyme'
;
const
setup
=
(
propOverrides
?:
object
)
=>
{
...
...
@@ -12,6 +12,7 @@ const setup = (propOverrides?: object) => {
uid
:
'1234'
,
title
:
'loading'
,
canSave
:
true
,
url
:
'url'
,
hasChanged
:
false
,
version
:
1
,
},
...
...
public/app/features/
manage-dashboard
s/FolderSettingsPage.tsx
→
public/app/features/
folder
s/FolderSettingsPage.tsx
View file @
a83beac5
...
...
@@ -31,7 +31,6 @@ export class FolderSettingsPage extends PureComponent<Props> {
evt
.
stopPropagation
();
await
this
.
props
.
saveFolder
(
this
.
props
.
folder
);
appEvents
.
emit
(
'alert-success'
,
[
'Folder saved'
]);
};
onDelete
=
evt
=>
{
...
...
public/app/features/
manage-dashboard
s/__snapshots__/FolderSettingsPage.test.tsx.snap
→
public/app/features/
folder
s/__snapshots__/FolderSettingsPage.test.tsx.snap
View file @
a83beac5
File moved
public/app/features/
manage-dashboard
s/state/actions.ts
→
public/app/features/
folder
s/state/actions.ts
View file @
a83beac5
import
{
getBackendSrv
}
from
'app/core/services/backend_srv'
;
import
{
StoreState
}
from
'app/types'
;
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
FolderDTO
,
FolderState
,
NavModelItem
}
from
'app/types'
;
import
{
FolderDTO
,
FolderState
}
from
'app/types'
;
import
{
updateNavIndex
,
updateLocation
}
from
'app/core/actions'
;
import
{
buildNavModel
}
from
'./navModel'
;
import
appEvents
from
'app/core/app_events'
;
export
enum
ActionTypes
{
LoadFolder
=
'LOAD_FOLDER'
,
...
...
@@ -15,16 +17,16 @@ export interface LoadFolderAction {
payload
:
FolderDTO
;
}
export
const
loadFolder
=
(
folder
:
FolderDTO
):
LoadFolderAction
=>
({
type
:
ActionTypes
.
LoadFolder
,
payload
:
folder
,
});
export
interface
SetFolderTitleAction
{
type
:
ActionTypes
.
SetFolderTitle
;
payload
:
string
;
}
export
const
loadFolder
=
(
folder
:
FolderDTO
):
LoadFolderAction
=>
({
type
:
ActionTypes
.
LoadFolder
,
payload
:
folder
,
});
export
const
setFolderTitle
=
(
newTitle
:
string
):
SetFolderTitleAction
=>
({
type
:
ActionTypes
.
SetFolderTitle
,
payload
:
newTitle
,
...
...
@@ -34,39 +36,6 @@ export type Action = LoadFolderAction | SetFolderTitleAction;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
any
>
;
function
buildNavModel
(
folder
:
FolderDTO
):
NavModelItem
{
return
{
icon
:
'fa fa-folder-open'
,
id
:
'manage-folder'
,
subTitle
:
'Manage folder dashboards & permissions'
,
url
:
''
,
text
:
folder
.
title
,
breadcrumbs
:
[{
title
:
'Dashboards'
,
url
:
'dashboards'
}],
children
:
[
{
active
:
false
,
icon
:
'fa fa-fw fa-th-large'
,
id
:
`folder-dashboards-
${
folder
.
uid
}
`
,
text
:
'Dashboards'
,
url
:
folder
.
url
,
},
{
active
:
false
,
icon
:
'fa fa-fw fa-lock'
,
id
:
`folder-permissions-
${
folder
.
uid
}
`
,
text
:
'Permissions'
,
url
:
`
${
folder
.
url
}
/permissions`
,
},
{
active
:
false
,
icon
:
'fa fa-fw fa-cog'
,
id
:
`folder-settings-
${
folder
.
uid
}
`
,
text
:
'Settings'
,
url
:
`
${
folder
.
url
}
/settings`
,
},
],
};
}
export
function
getFolderByUid
(
uid
:
string
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
...
...
@@ -82,6 +51,10 @@ export function saveFolder(folder: FolderState): ThunkResult<void> {
title
:
folder
.
title
,
version
:
folder
.
version
,
});
// this should be redux action at some point
appEvents
.
emit
(
'alert-success'
,
[
'Folder saved'
]);
dispatch
(
updateLocation
({
path
:
`
${
res
.
url
}
/settings`
}));
};
}
...
...
public/app/features/folders/state/navModel.ts
0 → 100644
View file @
a83beac5
import
{
FolderDTO
,
NavModelItem
}
from
'app/types'
;
export
function
buildNavModel
(
folder
:
FolderDTO
):
NavModelItem
{
return
{
icon
:
'fa fa-folder-open'
,
id
:
'manage-folder'
,
subTitle
:
'Manage folder dashboards & permissions'
,
url
:
''
,
text
:
folder
.
title
,
breadcrumbs
:
[{
title
:
'Dashboards'
,
url
:
'dashboards'
}],
children
:
[
{
active
:
false
,
icon
:
'fa fa-fw fa-th-large'
,
id
:
`folder-dashboards-
${
folder
.
uid
}
`
,
text
:
'Dashboards'
,
url
:
folder
.
url
,
},
{
active
:
false
,
icon
:
'fa fa-fw fa-lock'
,
id
:
`folder-permissions-
${
folder
.
uid
}
`
,
text
:
'Permissions'
,
url
:
`
${
folder
.
url
}
/permissions`
,
},
{
active
:
false
,
icon
:
'fa fa-fw fa-cog'
,
id
:
`folder-settings-
${
folder
.
uid
}
`
,
text
:
'Settings'
,
url
:
`
${
folder
.
url
}
/settings`
,
},
],
};
}
public/app/features/
manage-dashboard
s/state/reducers.ts
→
public/app/features/
folder
s/state/reducers.ts
View file @
a83beac5
File moved
public/app/features/teams/state/actions.ts
View file @
a83beac5
...
...
@@ -131,107 +131,71 @@ function buildNavModel(team: Team): NavModelItem {
export
function
loadTeam
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
await
getBackendSrv
()
.
get
(
`/api/teams/
${
id
}
`
)
.
then
(
response
=>
{
dispatch
(
teamLoaded
(
response
));
dispatch
(
updateNavIndex
(
buildNavModel
(
response
)));
});
const
response
=
await
getBackendSrv
().
get
(
`/api/teams/
${
id
}
`
);
dispatch
(
teamLoaded
(
response
));
dispatch
(
updateNavIndex
(
buildNavModel
(
response
)));
};
}
export
function
loadTeamMembers
():
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
get
(
`/api/teams/
${
team
.
id
}
/members`
)
.
then
(
response
=>
{
dispatch
(
teamMembersLoaded
(
response
));
});
const
response
=
await
getBackendSrv
().
get
(
`/api/teams/
${
team
.
id
}
/members`
);
dispatch
(
teamMembersLoaded
(
response
));
};
}
export
function
addTeamMember
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
post
(
`/api/teams/
${
team
.
id
}
/members`
,
{
userId
:
id
})
.
then
(()
=>
{
dispatch
(
loadTeamMembers
());
});
await
getBackendSrv
().
post
(
`/api/teams/
${
team
.
id
}
/members`
,
{
userId
:
id
});
dispatch
(
loadTeamMembers
());
};
}
export
function
removeTeamMember
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
delete
(
`/api/teams/
${
team
.
id
}
/members/
${
id
}
`
)
.
then
(()
=>
{
dispatch
(
loadTeamMembers
());
});
await
getBackendSrv
().
delete
(
`/api/teams/
${
team
.
id
}
/members/
${
id
}
`
);
dispatch
(
loadTeamMembers
());
};
}
export
function
updateTeam
(
name
:
string
,
email
:
string
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
put
(
`/api/teams/
${
team
.
id
}
`
,
{
name
,
email
,
})
.
then
(()
=>
{
dispatch
(
loadTeam
(
team
.
id
));
});
await
getBackendSrv
().
put
(
`/api/teams/
${
team
.
id
}
`
,
{
name
,
email
});
dispatch
(
loadTeam
(
team
.
id
));
};
}
export
function
loadTeamGroups
():
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
get
(
`/api/teams/
${
team
.
id
}
/groups`
)
.
then
(
response
=>
{
dispatch
(
teamGroupsLoaded
(
response
));
});
const
response
=
await
getBackendSrv
().
get
(
`/api/teams/
${
team
.
id
}
/groups`
);
dispatch
(
teamGroupsLoaded
(
response
));
};
}
export
function
addTeamGroup
(
groupId
:
string
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
post
(
`/api/teams/
${
team
.
id
}
/groups`
,
{
groupId
:
groupId
})
.
then
(()
=>
{
dispatch
(
loadTeamGroups
());
});
await
getBackendSrv
().
post
(
`/api/teams/
${
team
.
id
}
/groups`
,
{
groupId
:
groupId
});
dispatch
(
loadTeamGroups
());
};
}
export
function
removeTeamGroup
(
groupId
:
string
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
team
=
getStore
().
team
.
team
;
await
getBackendSrv
()
.
delete
(
`/api/teams/
${
team
.
id
}
/groups/
${
groupId
}
`
)
.
then
(()
=>
{
dispatch
(
loadTeamGroups
());
});
await
getBackendSrv
().
delete
(
`/api/teams/
${
team
.
id
}
/groups/
${
groupId
}
`
);
dispatch
(
loadTeamGroups
());
};
}
export
function
deleteTeam
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
await
getBackendSrv
()
.
delete
(
`/api/teams/
${
id
}
`
)
.
then
(()
=>
{
dispatch
(
loadTeams
());
});
await
getBackendSrv
().
delete
(
`/api/teams/
${
id
}
`
);
dispatch
(
loadTeams
());
};
}
public/app/routes/routes.ts
View file @
a83beac5
...
...
@@ -5,8 +5,8 @@ import ServerStats from 'app/features/admin/ServerStats';
import
AlertRuleList
from
'app/features/alerting/AlertRuleList'
;
import
TeamPages
from
'app/features/teams/TeamPages'
;
import
TeamList
from
'app/features/teams/TeamList'
;
import
FolderSettingsPage
from
'app/features/
manage-dashboard
s/FolderSettingsPage'
;
import
FolderPermissions
from
'app/features/
manage-dashboard
s/FolderPermissions'
;
import
FolderSettingsPage
from
'app/features/
folder
s/FolderSettingsPage'
;
import
FolderPermissions
from
'app/features/
folder
s/FolderPermissions'
;
/** @ngInject */
export
function
setupAngularRoutes
(
$routeProvider
,
$locationProvider
)
{
...
...
public/app/stores/configureStore.ts
View file @
a83beac5
...
...
@@ -4,13 +4,13 @@ import { createLogger } from 'redux-logger';
import
sharedReducers
from
'app/core/reducers'
;
import
alertingReducers
from
'app/features/alerting/state/reducers'
;
import
teamsReducers
from
'app/features/teams/state/reducers'
;
import
manageDashboardsReducers
from
'app/features/manage-dashboard
s/state/reducers'
;
import
foldersReducers
from
'app/features/folder
s/state/reducers'
;
const
rootReducer
=
combineReducers
({
...
sharedReducers
,
...
alertingReducers
,
...
teamsReducers
,
...
manageDashboard
sReducers
,
...
folder
sReducers
,
});
export
let
store
;
...
...
yarn.lock
View file @
a83beac5
...
...
@@ -3182,7 +3182,7 @@ debug@^3.1.0:
dependencies:
ms "^2.1.1"
debuglog@
*, debuglog@
^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
...
...
@@ -5553,7 +5553,7 @@ import-local@^2.0.0:
pkg-dir "^3.0.0"
resolve-cwd "^2.0.0"
imurmurhash@
*, imurmurhash@
^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
...
...
@@ -6990,10 +6990,6 @@ lodash-es@^4.17.5:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.10.tgz#62cd7104cdf5dd87f235a837f0ede0e8e5117e05"
lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
...
...
@@ -7001,25 +6997,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"
lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
dependencies:
lodash._getnative "^3.0.0"
lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
lodash._getnative@
*, lodash._getnative@
^3.0.0:
lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
...
...
@@ -7103,10 +7085,6 @@ lodash.mergewith@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
...
...
@@ -9902,7 +9880,7 @@ readable-stream@~1.1.10:
isarray "0.0.1"
string_decoder "~0.10.x"
readdir-scoped-modules@
*, readdir-scoped-modules@
^1.0.0:
readdir-scoped-modules@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
dependencies:
...
...
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