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
41dcd764
Commit
41dcd764
authored
Sep 04, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed unused mobx state
parent
22510be4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
202 deletions
+0
-202
public/app/containers/ContainerProps.ts
+0
-4
public/app/stores/AlertListStore/AlertListStore.test.ts
+0
-66
public/app/stores/AlertListStore/AlertListStore.ts
+0
-47
public/app/stores/AlertListStore/AlertRule.ts
+0
-34
public/app/stores/AlertListStore/helpers.ts
+0
-13
public/app/stores/RootStore/RootStore.ts
+0
-8
public/app/stores/ServerStatsStore/ServerStat.ts
+0
-6
public/app/stores/ServerStatsStore/ServerStatsStore.ts
+0
-24
No files found.
public/app/containers/ContainerProps.ts
View file @
41dcd764
import
{
SearchStore
}
from
'./../stores/SearchStore/SearchStore'
;
import
{
SearchStore
}
from
'./../stores/SearchStore/SearchStore'
;
import
{
ServerStatsStore
}
from
'./../stores/ServerStatsStore/ServerStatsStore'
;
import
{
NavStore
}
from
'./../stores/NavStore/NavStore'
;
import
{
NavStore
}
from
'./../stores/NavStore/NavStore'
;
import
{
PermissionsStore
}
from
'./../stores/PermissionsStore/PermissionsStore'
;
import
{
PermissionsStore
}
from
'./../stores/PermissionsStore/PermissionsStore'
;
import
{
AlertListStore
}
from
'./../stores/AlertListStore/AlertListStore'
;
import
{
ViewStore
}
from
'./../stores/ViewStore/ViewStore'
;
import
{
ViewStore
}
from
'./../stores/ViewStore/ViewStore'
;
import
{
FolderStore
}
from
'./../stores/FolderStore/FolderStore'
;
import
{
FolderStore
}
from
'./../stores/FolderStore/FolderStore'
;
interface
ContainerProps
{
interface
ContainerProps
{
search
:
typeof
SearchStore
.
Type
;
search
:
typeof
SearchStore
.
Type
;
serverStats
:
typeof
ServerStatsStore
.
Type
;
nav
:
typeof
NavStore
.
Type
;
nav
:
typeof
NavStore
.
Type
;
alertList
:
typeof
AlertListStore
.
Type
;
permissions
:
typeof
PermissionsStore
.
Type
;
permissions
:
typeof
PermissionsStore
.
Type
;
view
:
typeof
ViewStore
.
Type
;
view
:
typeof
ViewStore
.
Type
;
folder
:
typeof
FolderStore
.
Type
;
folder
:
typeof
FolderStore
.
Type
;
...
...
public/app/stores/AlertListStore/AlertListStore.test.ts
deleted
100644 → 0
View file @
22510be4
import
{
AlertListStore
}
from
'./AlertListStore'
;
import
{
backendSrv
}
from
'test/mocks/common'
;
import
moment
from
'moment'
;
function
getRule
(
name
,
state
,
info
)
{
return
{
id
:
11
,
dashboardId
:
58
,
panelId
:
3
,
name
:
name
,
state
:
state
,
newStateDate
:
moment
()
.
subtract
(
5
,
'minutes'
)
.
format
(),
evalData
:
{},
executionError
:
''
,
url
:
'db/mygool'
,
stateText
:
state
,
stateIcon
:
'fa'
,
stateClass
:
'asd'
,
stateAge
:
'10m'
,
info
:
info
,
canEdit
:
true
,
};
}
describe
(
'AlertListStore'
,
()
=>
{
let
store
;
beforeAll
(()
=>
{
store
=
AlertListStore
.
create
(
{
rules
:
[
getRule
(
'Europe'
,
'OK'
,
'backend-01'
),
getRule
(
'Google'
,
'ALERTING'
,
'backend-02'
),
getRule
(
'Amazon'
,
'PAUSED'
,
'backend-03'
),
getRule
(
'West-Europe'
,
'PAUSED'
,
'backend-03'
),
],
search
:
''
,
},
{
backendSrv
:
backendSrv
,
}
);
});
it
(
'search should filter list on name'
,
()
=>
{
store
.
setSearchQuery
(
'urope'
);
expect
(
store
.
filteredRules
).
toHaveLength
(
2
);
});
it
(
'search should filter list on state'
,
()
=>
{
store
.
setSearchQuery
(
'ale'
);
expect
(
store
.
filteredRules
).
toHaveLength
(
1
);
});
it
(
'search should filter list on info'
,
()
=>
{
store
.
setSearchQuery
(
'-0'
);
expect
(
store
.
filteredRules
).
toHaveLength
(
4
);
});
it
(
'search should be equal'
,
()
=>
{
store
.
setSearchQuery
(
'alert'
);
expect
(
store
.
search
).
toBe
(
'alert'
);
});
});
public/app/stores/AlertListStore/AlertListStore.ts
deleted
100644 → 0
View file @
22510be4
import
{
types
,
getEnv
,
flow
}
from
'mobx-state-tree'
;
import
{
AlertRule
as
AlertRuleModel
}
from
'./AlertRule'
;
import
{
setStateFields
}
from
'./helpers'
;
type
AlertRuleType
=
typeof
AlertRuleModel
.
Type
;
export
interface
AlertRule
extends
AlertRuleType
{}
export
const
AlertListStore
=
types
.
model
(
'AlertListStore'
,
{
rules
:
types
.
array
(
AlertRuleModel
),
stateFilter
:
types
.
optional
(
types
.
string
,
'all'
),
search
:
types
.
optional
(
types
.
string
,
''
),
})
.
views
(
self
=>
({
get
filteredRules
()
{
const
regex
=
new
RegExp
(
self
.
search
,
'i'
);
return
self
.
rules
.
filter
(
alert
=>
{
return
regex
.
test
(
alert
.
name
)
||
regex
.
test
(
alert
.
stateText
)
||
regex
.
test
(
alert
.
info
);
});
},
}))
.
actions
(
self
=>
({
loadRules
:
flow
(
function
*
load
(
filters
)
{
const
backendSrv
=
getEnv
(
self
).
backendSrv
;
self
.
stateFilter
=
filters
.
state
;
// store state filter used in api query
const
apiRules
=
yield
backendSrv
.
get
(
'/api/alerts'
,
filters
);
self
.
rules
.
clear
();
for
(
const
rule
of
apiRules
)
{
setStateFields
(
rule
,
rule
.
state
);
if
(
rule
.
state
!==
'paused'
)
{
if
(
rule
.
executionError
)
{
rule
.
info
=
'Execution Error: '
+
rule
.
executionError
;
}
if
(
rule
.
evalData
&&
rule
.
evalData
.
noData
)
{
rule
.
info
=
'Query returned no data'
;
}
}
self
.
rules
.
push
(
AlertRuleModel
.
create
(
rule
));
}
}),
setSearchQuery
(
query
:
string
)
{
self
.
search
=
query
;
},
}));
public/app/stores/AlertListStore/AlertRule.ts
deleted
100644 → 0
View file @
22510be4
import
{
types
,
getEnv
,
flow
}
from
'mobx-state-tree'
;
import
{
setStateFields
}
from
'./helpers'
;
export
const
AlertRule
=
types
.
model
(
'AlertRule'
,
{
id
:
types
.
identifier
(
types
.
number
),
dashboardId
:
types
.
number
,
panelId
:
types
.
number
,
name
:
types
.
string
,
state
:
types
.
string
,
stateText
:
types
.
string
,
stateIcon
:
types
.
string
,
stateClass
:
types
.
string
,
stateAge
:
types
.
string
,
info
:
types
.
optional
(
types
.
string
,
''
),
url
:
types
.
string
,
})
.
views
(
self
=>
({
get
isPaused
()
{
return
self
.
state
===
'paused'
;
},
}))
.
actions
(
self
=>
({
/**
* will toggle alert rule paused state
*/
togglePaused
:
flow
(
function
*
togglePaused
()
{
const
backendSrv
=
getEnv
(
self
).
backendSrv
;
const
payload
=
{
paused
:
!
self
.
isPaused
};
const
res
=
yield
backendSrv
.
post
(
`/api/alerts/
${
self
.
id
}
/pause`
,
payload
);
setStateFields
(
self
,
res
.
state
);
self
.
info
=
''
;
}),
}));
public/app/stores/AlertListStore/helpers.ts
deleted
100644 → 0
View file @
22510be4
import
moment
from
'moment'
;
import
alertDef
from
'app/features/alerting/state/alertDef'
;
export
function
setStateFields
(
rule
,
state
)
{
const
stateModel
=
alertDef
.
getStateDisplayModel
(
state
);
rule
.
state
=
state
;
rule
.
stateText
=
stateModel
.
text
;
rule
.
stateIcon
=
stateModel
.
iconClass
;
rule
.
stateClass
=
stateModel
.
stateClass
;
rule
.
stateAge
=
moment
(
rule
.
newStateDate
)
.
fromNow
()
.
replace
(
' ago'
,
''
);
}
public/app/stores/RootStore/RootStore.ts
View file @
41dcd764
import
{
types
}
from
'mobx-state-tree'
;
import
{
types
}
from
'mobx-state-tree'
;
import
{
SearchStore
}
from
'./../SearchStore/SearchStore'
;
import
{
SearchStore
}
from
'./../SearchStore/SearchStore'
;
import
{
ServerStatsStore
}
from
'./../ServerStatsStore/ServerStatsStore'
;
import
{
NavStore
}
from
'./../NavStore/NavStore'
;
import
{
NavStore
}
from
'./../NavStore/NavStore'
;
import
{
AlertListStore
}
from
'./../AlertListStore/AlertListStore'
;
import
{
ViewStore
}
from
'./../ViewStore/ViewStore'
;
import
{
ViewStore
}
from
'./../ViewStore/ViewStore'
;
import
{
FolderStore
}
from
'./../FolderStore/FolderStore'
;
import
{
FolderStore
}
from
'./../FolderStore/FolderStore'
;
import
{
PermissionsStore
}
from
'./../PermissionsStore/PermissionsStore'
;
import
{
PermissionsStore
}
from
'./../PermissionsStore/PermissionsStore'
;
...
@@ -12,13 +10,7 @@ export const RootStore = types.model({
...
@@ -12,13 +10,7 @@ export const RootStore = types.model({
search
:
types
.
optional
(
SearchStore
,
{
search
:
types
.
optional
(
SearchStore
,
{
sections
:
[],
sections
:
[],
}),
}),
serverStats
:
types
.
optional
(
ServerStatsStore
,
{
stats
:
[],
}),
nav
:
types
.
optional
(
NavStore
,
{}),
nav
:
types
.
optional
(
NavStore
,
{}),
alertList
:
types
.
optional
(
AlertListStore
,
{
rules
:
[],
}),
permissions
:
types
.
optional
(
PermissionsStore
,
{
permissions
:
types
.
optional
(
PermissionsStore
,
{
fetching
:
false
,
fetching
:
false
,
items
:
[],
items
:
[],
...
...
public/app/stores/ServerStatsStore/ServerStat.ts
deleted
100644 → 0
View file @
22510be4
import
{
types
}
from
'mobx-state-tree'
;
export
const
ServerStat
=
types
.
model
(
'ServerStat'
,
{
name
:
types
.
string
,
value
:
types
.
optional
(
types
.
number
,
0
),
});
public/app/stores/ServerStatsStore/ServerStatsStore.ts
deleted
100644 → 0
View file @
22510be4
import
{
types
,
getEnv
,
flow
}
from
'mobx-state-tree'
;
import
{
ServerStat
}
from
'./ServerStat'
;
export
const
ServerStatsStore
=
types
.
model
(
'ServerStatsStore'
,
{
stats
:
types
.
array
(
ServerStat
),
error
:
types
.
optional
(
types
.
string
,
''
),
})
.
actions
(
self
=>
({
load
:
flow
(
function
*
load
()
{
const
backendSrv
=
getEnv
(
self
).
backendSrv
;
const
res
=
yield
backendSrv
.
get
(
'/api/admin/stats'
);
self
.
stats
.
clear
();
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total dashboards'
,
value
:
res
.
dashboards
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total users'
,
value
:
res
.
users
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Active users (seen last 30 days)'
,
value
:
res
.
activeUsers
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total orgs'
,
value
:
res
.
orgs
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total playlists'
,
value
:
res
.
playlists
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total snapshots'
,
value
:
res
.
snapshots
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total dashboard tags'
,
value
:
res
.
tags
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total starred dashboards'
,
value
:
res
.
stars
}));
self
.
stats
.
push
(
ServerStat
.
create
({
name
:
'Total alerts'
,
value
:
res
.
alerts
}));
}),
}));
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