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
ee216ba6
Commit
ee216ba6
authored
Dec 20, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
poc: mobx test
parent
af1f3dd7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
14 deletions
+51
-14
public/app/containers/ServerStats.tsx
+20
-5
public/app/store/store.ts
+12
-8
tsconfig.json
+1
-1
yarn.lock
+18
-0
No files found.
public/app/containers/ServerStats.tsx
View file @
ee216ba6
import
React
from
"react"
;
import
{
observer
}
from
"mobx-react"
;
import
PageHeader
from
"app/core/components/PageHeader/PageHeader"
;
import
{
NavModel
,
NavModelSrv
}
from
"app/core/nav_model_srv"
;
import
{
store
}
from
"app/store/store"
;
export
interface
IState
{
navModel
:
NavModel
;
search
:
any
;
}
export
default
class
ServerStats
extends
React
.
Component
<
any
,
IState
>
{
@
observer
export
default
class
ServerStats
extends
React
.
Component
<
any
,
any
>
{
constructor
(
props
)
{
super
(
props
);
const
navModelSrv
=
new
NavModelSrv
();
this
.
state
=
{
navModel
:
navModelSrv
.
getNav
(
"cfg"
,
"admin"
,
"server-stats"
,
1
)
navModel
:
navModelSrv
.
getNav
(
"cfg"
,
"admin"
,
"server-stats"
,
1
),
search
:
store
.
search
};
}
onClick
=
()
=>
{
this
.
state
.
search
.
search
();
};
render
()
{
console
.
log
(
"render"
);
return
(
<
PageHeader
model=
{
this
.
state
.
navModel
}
>
<
h2
>
ServerStats
</
h2
>
</
PageHeader
>
<
div
>
<
PageHeader
model=
{
this
.
state
.
navModel
}
/>
<
div
className=
"page-container"
>
name:
<
h2
onClick=
{
this
.
onClick
}
>
{
this
.
state
.
search
.
name
}
</
h2
>
</
div
>
</
div
>
);
}
}
public/app/store/store.ts
View file @
ee216ba6
import
{
types
}
from
"mobx-state-tree"
;
const
Search
=
types
.
model
({
name
:
""
,
done
:
false
});
const
Search
=
types
.
model
({
name
:
"asdas"
,
done
:
false
})
.
actions
(
self
=>
({
search
()
{
self
.
name
=
"changed"
;
}
}));
const
RootStore
=
types
.
model
({
search
:
types
.
map
(
Search
)
search
:
types
.
optional
(
Search
,
{}
)
});
const
store
=
RootStore
.
create
({
search
:
{}
});
const
store
=
RootStore
.
create
({});
export
{
store
};
tsconfig.json
View file @
ee216ba6
...
...
@@ -13,7 +13,7 @@
"sourceMap"
:
true
,
"noEmitOnError"
:
false
,
"emitDecoratorMetadata"
:
false
,
"experimentalDecorators"
:
fals
e
,
"experimentalDecorators"
:
tru
e
,
"noImplicitReturns"
:
true
,
"noImplicitThis"
:
false
,
"noImplicitUseStrict"
:
false
,
...
...
yarn.lock
View file @
ee216ba6
...
...
@@ -4399,6 +4399,10 @@ hoek@4.x.x:
version "4.2.0"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d"
hoist-non-react-statics@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"
home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
...
...
@@ -6303,6 +6307,20 @@ mkdirp@0.5.1, mkdirp@0.x.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi
dependencies:
minimist "0.0.8"
mobx-react@^4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/mobx-react/-/mobx-react-4.3.5.tgz#76853f2f2ef4a6f960c374bcd9f01e875929c04c"
dependencies:
hoist-non-react-statics "^2.3.1"
mobx-state-tree@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/mobx-state-tree/-/mobx-state-tree-1.3.1.tgz#9e1ba9b8b6ea183f1a4a2ae1f67bfa8f2bcae4fe"
mobx@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/mobx/-/mobx-3.4.1.tgz#37abe5ee882d401828d9f26c6c1a2f47614bbbef"
mocha@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.0.1.tgz#0aee5a95cf69a4618820f5e51fa31717117daf1b"
...
...
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