Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
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
1
Merge Requests
1
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
atichat
safetcut-app
Commits
cd1feaf6
Commit
cd1feaf6
authored
Sep 24, 2019
by
HaOuiha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update setting
parent
9c8958a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
screens/Private/SettingScreen/Setting.js
+14
-1
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
+4
-5
screens/Private/TimerScreen/TimerScreen.js
+13
-5
No files found.
screens/Private/SettingScreen/Setting.js
View file @
cd1feaf6
...
...
@@ -52,8 +52,21 @@ class updateDetailScreen extends Component {
toggleModal
=
visible
=>
this
.
setState
({
isVisible
:
visible
});
setDefualtValue
=
data
=>
{
switch
(
this
.
state
.
field
)
{
case
'Name'
:
return
data
===
''
?
'Untitled'
:
data
;
case
'Description'
:
return
data
;
case
'RCBO'
:
return
data
;
default
:
return
data
;
}
};
handleConfirm
=
()
=>
{
this
.
props
.
updateDetail
(
this
.
state
.
field
,
this
.
s
tate
.
data
);
this
.
props
.
updateDetail
(
this
.
state
.
field
,
this
.
s
etDefualtValue
(
this
.
state
.
data
)
);
this
.
toggleModal
(
false
);
this
.
props
.
navigation
.
navigate
(
'Setting'
);
};
...
...
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
View file @
cd1feaf6
...
...
@@ -312,7 +312,6 @@ class SmartMeterDetailScreen extends Component {
},
3000
);
};
// let isSubOn = this.props.shadow[`ML${indexMcbLinks + 1}`][`L${indexMcbLinks + 1}B${indexSubBreakers + 1}`];
return
(
<
View
style
=
{{
...
...
@@ -334,7 +333,7 @@ class SmartMeterDetailScreen extends Component {
<
Left
style
=
{{
flex
:
4
}}
>
<
View
>
<
Text
style
=
{[
theme
.
normalText
,
theme
.
textDark
]}
>
{
subBreaker
.
name
{
subBreaker
.
name
!==
`Sub Breaker
${
indexSubBreakers
+
1
}
`
||
'Untitled'
?
`Sub Breaker
${
indexSubBreakers
+
1
}
[
${
subBreaker
.
name
.
length
<
20
?
subBreaker
.
name
...
...
@@ -349,7 +348,7 @@ class SmartMeterDetailScreen extends Component {
<
/Left
>
<
Right
>
<
Switch
disabled
=
{
this
.
props
.
shadow
.
SM1
.
BK_S
===
0
?
true
:
false
}
disabled
=
{
this
.
props
.
breakerStatus
.
SM1
.
BK_S
===
0
?
true
:
false
}
value
=
{
subBreaker
.
isPowerOn
}
onValueChange
=
{
value
=>
{
this
.
state
.
isWaiting
?
null
:
handleOnPressSubBreakerSwitch
(
value
);
...
...
@@ -374,7 +373,7 @@ class SmartMeterDetailScreen extends Component {
>
<
Left
style
=
{{
flex
:
4
}}
>
<
Text
style
=
{[
theme
.
normalText
,
theme
.
textDark
]}
>
{
mcbLink
.
name
{
mcbLink
.
name
!==
`MCB Link
${
indexMcbLinks
+
1
}
`
||
'Untitled'
?
`MCB Link
${
indexMcbLinks
+
1
}
[
${
mcbLink
.
name
.
length
<
20
?
mcbLink
.
name
:
`
${
mcbLink
.
name
.
substr
(
0
,
17
)}
...`
}
]`
...
...
@@ -471,7 +470,7 @@ const mapStateToProps = state => ({
error
:
state
.
timersReducer
.
error
,
existedMcbLinksData
:
state
.
timersReducer
.
existedMcbLinksData
,
existedSubBreakersData
:
state
.
timersReducer
.
existedSubBreakersData
,
shadow
:
state
.
currentSelectedDeviceReducer
.
shadow
,
//
shadow: state.currentSelectedDeviceReducer.shadow,
breakerStatus
:
state
.
currentSelectedDeviceReducer
.
breakerStatus
,
desiredBreakerStatus
:
state
.
currentSelectedDeviceReducer
.
desiredBreakerStatus
,
...
...
screens/Private/TimerScreen/TimerScreen.js
View file @
cd1feaf6
...
...
@@ -124,7 +124,9 @@ class TimerScreen extends PureComponent {
const
{
currentSelectedData
}
=
this
.
props
;
let
pickerSelectData
=
[
{
label
:
`Main Device
${
currentSelectedData
.
name
?
`[
${
currentSelectedData
.
name
}
]`
:
''
}
`
,
label
:
`Main Device
${
currentSelectedData
.
name
!==
'Main Device'
||
'Untitled'
?
`[
${
currentSelectedData
.
name
}
]`
:
''
}
`
,
value
:
'main'
,
color
:
color
.
darkGrey
,
},
...
...
@@ -133,7 +135,9 @@ class TimerScreen extends PureComponent {
if
(
this
.
props
.
existedMcbLinksData
)
{
this
.
props
.
existedMcbLinksData
.
map
((
mcbLink
,
index
)
=>
{
pickerSelectData
.
push
({
label
:
`MCB Link
${
index
+
1
}
${
mcbLink
.
name
?
`[
${
mcbLink
.
name
}
]`
:
''
}
`
,
label
:
`MCB Link
${
index
+
1
}
${
mcbLink
.
name
!==
`MCB Link
${
index
+
1
}
`
||
'Untitled'
?
`[
${
mcbLink
.
name
}
]`
:
''
}
`
,
value
:
index
+
1
,
color
:
color
.
darkGrey
,
});
...
...
@@ -273,7 +277,7 @@ class TimerScreen extends PureComponent {
});
}
console
.
log
(
this
.
state
);
//
console.log(this.state);
};
componentDidMount
=
()
=>
{
...
...
@@ -369,7 +373,9 @@ class TimerScreen extends PureComponent {
containerStyle
=
{
styles
.
checkboxContainer
}
fontFamily
=
{
'Avenir-Roman'
}
textStyle
=
{{
fontWeight
:
'normal'
,
color
:
color
.
darkGrey
}}
title
=
{
`Sub Breaker
${
item
.
id
}
${
item
.
name
?
`[
${
item
.
name
}
]`
:
''
}
`
}
title
=
{
`Sub Breaker
${
item
.
id
}
${
item
.
name
!==
`Sub Breaker
${
item
.
id
}
`
||
'Untitled'
?
`[
${
item
.
name
}
]`
:
''
}
`
}
checked
=
{
this
.
state
.
subBreakerList
[
index
].
selected
}
checkedIcon
=
{
<
Icon
...
...
@@ -559,7 +565,9 @@ class TimerScreen extends PureComponent {
containerStyle
=
{
styles
.
checkboxContainer
}
fontFamily
=
{
'Avenir-Roman'
}
textStyle
=
{{
fontWeight
:
'normal'
,
color
:
color
.
darkGrey
}}
title
=
{
`Sub Breaker
${
item
.
id
}
${
item
.
name
?
`[
${
item
.
name
}
]`
:
''
}
`
}
title
=
{
`Sub Breaker
${
item
.
id
}
${
item
.
name
!==
`Sub Breaker
${
item
.
id
}
`
||
'Untitled'
?
`[
${
item
.
name
}
]`
:
''
}
`
}
checked
=
{
this
.
state
.
subBreakerList
[
index
].
selected
}
checkedIcon
=
{
<
Icon
name
=
"md-checkbox"
style
=
{{
color
:
color
.
primary
,
fontSize
:
26
}}
/>
}
uncheckedIcon
=
{
...
...
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