File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
client/components/main/Main/ConnectionSelector Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ class Config extends React.Component {
55
55
this . setProp ( property , value ) ;
56
56
}
57
57
58
+ duplicate ( ) {
59
+ if ( this . props . favorite ) {
60
+ const data = Object . assign ( this . props . favorite . toJS ( ) , this . state . data . toJS ( ) ) ;
61
+ delete data . key ;
62
+ this . props . onDuplicate ( data ) ;
63
+ } else {
64
+ const data = this . state . data . toJS ( ) ;
65
+ data . name = 'Quick Connect'
66
+ this . props . onDuplicate ( data ) ;
67
+ }
68
+ }
69
+
58
70
save ( ) {
59
71
if ( this . props . favorite && this . state . changed ) {
60
72
this . props . onSave ( this . state . data . toJS ( ) ) ;
@@ -141,6 +153,11 @@ class Config extends React.Component {
141
153
</ div >
142
154
</ div >
143
155
< div className = "nt-button-group nt-button-group--pull-right" style = { { width : 500 , margin : '10px auto 0' } } >
156
+ < button className = "nt-button" style = {
157
+ { float : 'left' }
158
+ } onClick = { ( ) => {
159
+ this . duplicate ( ) ;
160
+ } } > { this . props . favorite ? 'Duplicate' : 'Add to Favorite' } </ button >
144
161
< button className = "nt-button" style = { { display : this . state . changed ? 'inline-block' : 'none' } } onClick = { ( ) => {
145
162
this . save ( ) ;
146
163
} } > Save Changes</ button >
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ class ConnectionSelector extends React.Component {
34
34
onSave = { ( data ) => {
35
35
store . dispatch ( actions ( 'updateFavorite' , { key : selectedFavorite . get ( 'key' ) , data } ) ) ;
36
36
} }
37
+ onDuplicate = { ( data ) => {
38
+ store . dispatch ( actions ( 'addFavorite' , data , ( ) => { } ) ) ;
39
+ } }
37
40
/>
38
41
</ div >
39
42
</ div > ;
You can’t perform that action at this time.
0 commit comments