Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
eb60744b
Commit
eb60744b
authored
6 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Change monitor "type" to "mode" to be consistent with vm
parent
896f732c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/monitor/monitor.jsx
+12
-12
12 additions, 12 deletions
src/components/monitor/monitor.jsx
src/containers/monitor.jsx
+18
-18
18 additions, 18 deletions
src/containers/monitor.jsx
with
30 additions
and
30 deletions
src/components/monitor/monitor.jsx
+
12
−
12
View file @
eb60744b
...
...
@@ -19,7 +19,7 @@ const categories = {
list
:
'
#FC662C
'
};
const
typ
es
=
{
const
mod
es
=
{
default
:
DefaultMonitor
,
large
:
LargeMonitor
};
...
...
@@ -34,9 +34,9 @@ const MonitorComponent = props => (
<
Box
className
=
{
styles
.
monitorContainer
}
componentRef
=
{
props
.
componentRef
}
onDoubleClick
=
{
props
.
onNext
Typ
e
}
onDoubleClick
=
{
props
.
onNext
Mod
e
}
>
{
typ
es
[
props
.
type
]({
{
(
mod
es
[
props
.
mode
]
||
modes
.
default
)({
// Use default until other modes arrive
categoryColor
:
categories
[
props
.
category
],
label
:
props
.
label
,
value
:
props
.
value
...
...
@@ -44,14 +44,14 @@ const MonitorComponent = props => (
</
Box
>
</
Draggable
>
<
ContextMenu
id
=
{
`monitor-
${
props
.
label
}
`
}
>
<
MenuItem
onClick
=
{
props
.
onSet
Typ
eToDefault
}
>
<
MenuItem
onClick
=
{
props
.
onSet
Mod
eToDefault
}
>
<
FormattedMessage
defaultMessage
=
"normal readout"
description
=
"Menu item to switch to the default monitor"
id
=
"gui.monitor.contextMenu.default"
/>
</
MenuItem
>
<
MenuItem
onClick
=
{
props
.
onSet
Typ
eToLarge
}
>
<
MenuItem
onClick
=
{
props
.
onSet
Mod
eToLarge
}
>
<
FormattedMessage
defaultMessage
=
"large readout"
description
=
"Menu item to switch to the large monitor"
...
...
@@ -65,17 +65,17 @@ const MonitorComponent = props => (
MonitorComponent
.
categories
=
categories
;
const
monitor
Typ
es
=
Object
.
keys
(
typ
es
);
const
monitor
Mod
es
=
Object
.
keys
(
mod
es
);
MonitorComponent
.
propTypes
=
{
category
:
PropTypes
.
oneOf
(
Object
.
keys
(
categories
)),
componentRef
:
PropTypes
.
func
.
isRequired
,
label
:
PropTypes
.
string
.
isRequired
,
mode
:
PropTypes
.
oneOf
(
monitorModes
),
onDragEnd
:
PropTypes
.
func
.
isRequired
,
onNextType
:
PropTypes
.
func
.
isRequired
,
onSetTypeToDefault
:
PropTypes
.
func
.
isRequired
,
onSetTypeToLarge
:
PropTypes
.
func
.
isRequired
,
type
:
PropTypes
.
oneOf
(
monitorTypes
),
onNextMode
:
PropTypes
.
func
.
isRequired
,
onSetModeToDefault
:
PropTypes
.
func
.
isRequired
,
onSetModeToLarge
:
PropTypes
.
func
.
isRequired
,
value
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
number
])
...
...
@@ -83,10 +83,10 @@ MonitorComponent.propTypes = {
MonitorComponent
.
defaultProps
=
{
category
:
'
data
'
,
typ
e
:
'
default
'
mod
e
:
'
default
'
};
export
{
MonitorComponent
as
default
,
monitor
Typ
es
monitor
Mod
es
};
This diff is collapsed.
Click to expand it.
src/containers/monitor.jsx
+
18
−
18
View file @
eb60744b
...
...
@@ -3,7 +3,7 @@ import React from 'react';
import
PropTypes
from
'
prop-types
'
;
import
monitorAdapter
from
'
../lib/monitor-adapter.js
'
;
import
MonitorComponent
,
{
monitor
Typ
es
}
from
'
../components/monitor/monitor.jsx
'
;
import
MonitorComponent
,
{
monitor
Mod
es
}
from
'
../components/monitor/monitor.jsx
'
;
import
{
addMonitorRect
,
getInitialPosition
,
resizeMonitorRect
,
removeMonitorRect
}
from
'
../reducers/monitor-layout
'
;
import
{
connect
}
from
'
react-redux
'
;
...
...
@@ -13,15 +13,15 @@ class Monitor extends React.Component {
super
(
props
);
bindAll
(
this
,
[
'
handleDragEnd
'
,
'
handleNext
Typ
e
'
,
'
handleSet
Typ
eToDefault
'
,
'
handleSet
Typ
eToLarge
'
,
'
handleNext
Mod
e
'
,
'
handleSet
Mod
eToDefault
'
,
'
handleSet
Mod
eToLarge
'
,
'
setElement
'
]);
// @todo consume from VM, but need to store until there are APIs to update vm
this
.
state
=
{
typ
e
:
props
.
mode
mod
e
:
props
.
mode
};
}
componentDidMount
()
{
...
...
@@ -67,17 +67,17 @@ class Monitor extends React.Component {
parseInt
(
this
.
element
.
style
.
top
,
10
)
+
y
);
}
handleNext
Typ
e
()
{
// @todo the
typ
e list needs to be filtered for current available
typ
es
// i.e. no sliders for read-only monitors, only list
type
for list vars.
const
typ
eIndex
=
monitor
Typ
es
.
indexOf
(
this
.
state
.
typ
e
);
this
.
setState
({
typ
e
:
monitor
Typ
es
[(
typ
eIndex
+
1
)
%
monitor
Typ
es
.
length
]});
handleNext
Mod
e
()
{
// @todo the
mod
e list needs to be filtered for current available
mod
es
// i.e. no sliders for read-only monitors, only list for list vars.
const
mod
eIndex
=
monitor
Mod
es
.
indexOf
(
this
.
state
.
mod
e
);
this
.
setState
({
mod
e
:
monitor
Mod
es
[(
mod
eIndex
+
1
)
%
monitor
Mod
es
.
length
]});
}
handleSet
Typ
eToDefault
()
{
this
.
setState
({
typ
e
:
'
default
'
});
handleSet
Mod
eToDefault
()
{
this
.
setState
({
mod
e
:
'
default
'
});
}
handleSet
Typ
eToLarge
()
{
this
.
setState
({
typ
e
:
'
large
'
});
handleSet
Mod
eToLarge
()
{
this
.
setState
({
mod
e
:
'
large
'
});
}
setElement
(
monitorElt
)
{
this
.
element
=
monitorElt
;
...
...
@@ -88,11 +88,11 @@ class Monitor extends React.Component {
<
MonitorComponent
componentRef
=
{
this
.
setElement
}
{
...
monitorProps
}
typ
e
=
{
this
.
state
.
typ
e
}
mod
e
=
{
this
.
state
.
mod
e
}
onDragEnd
=
{
this
.
handleDragEnd
}
onNext
Typ
e
=
{
this
.
handleNext
Typ
e
}
onSet
Typ
eToDefault
=
{
this
.
handleSet
Typ
eToDefault
}
onSet
Typ
eToLarge
=
{
this
.
handleSet
Typ
eToLarge
}
onNext
Mod
e
=
{
this
.
handleNext
Mod
e
}
onSet
Mod
eToDefault
=
{
this
.
handleSet
Mod
eToDefault
}
onSet
Mod
eToLarge
=
{
this
.
handleSet
Mod
eToLarge
}
/>
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment