Skip to content

Commit

Permalink
Merge pull request #358 from nono/show-device-name
Browse files Browse the repository at this point in the history
Show the device name in GUI
  • Loading branch information
kosssi committed May 30, 2016
2 parents 7997e0c + d043f0f commit 77eedac
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions gui/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const addFile = (info) => {
filename: path.basename(info.path),
path: info.path,
icon: selectIcon(info),
size: info.size,
size: info.size || 0,
updated: +new Date()
}
updateState('syncing', file.filename)
Expand Down Expand Up @@ -242,7 +242,7 @@ const sendDiskSpace = () => {
}

const startSync = (force) => {
sendToMainWindow('synchronization', device.url)
sendToMainWindow('synchronization', device.url, device.deviceName)
for (let file of lastFiles) {
sendToMainWindow('transfer', file)
}
Expand Down
4 changes: 2 additions & 2 deletions gui/app/ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ elmectron.ports.chooseFolder.subscribe(() => {
ipcRenderer.send('choose-folder')
})

ipcRenderer.on('synchronization', (event, url) => {
elmectron.ports.synchonization.send(url)
ipcRenderer.on('synchronization', (event, url, deviceName) => {
elmectron.ports.synchonization.send([url, deviceName])
})
elmectron.ports.startSync.subscribe((folder) => {
ipcRenderer.send('start-sync', folder)
Expand Down
13 changes: 8 additions & 5 deletions gui/lib/Account.elm
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import Helpers exposing (Helpers)

type alias Model =
{ address : String
, deviceName : String
, busy : Bool
}


init : Model
init =
{ address = ""
, deviceName = ""
, busy = False
}

Expand All @@ -27,7 +29,7 @@ init =


type Msg
= FillAddress String
= FillAddressAndDevice ( String, String )
| UnlinkCozy


Expand All @@ -39,8 +41,8 @@ update msg model =
case
msg
of
FillAddress address' ->
( { model | address = address' }, Cmd.none )
FillAddressAndDevice ( address', deviceName' ) ->
( { model | address = address', deviceName = deviceName' }, Cmd.none )

UnlinkCozy ->
( { model | busy = True }, unlinkCozy () )
Expand All @@ -54,8 +56,9 @@ view : Helpers -> Model -> Html Msg
view helpers model =
section [ class "two-panes__content two-panes__content--account" ]
[ h1 [] [ text (helpers.t "Account Account") ]
, h3 []
[ a [ href model.address ] [ text model.address ] ]
, h3 [] [ a [ href model.address ] [ text model.address ] ]
, h2 [] [ text (helpers.t "Account Device name") ]
, p [] [ text model.deviceName ]
, h2 [] [ text (helpers.t "Account Unlink Cozy") ]
, p []
[ text (helpers.t "Account It will unlink your account to this computer.")
Expand Down
8 changes: 4 additions & 4 deletions gui/lib/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ init flags =
type Msg
= NoOp
| WizardMsg Wizard.Msg
| SyncStart String
| SyncStart ( String, String )
| TwoPanesMsg TwoPanes.Msg
| Unlink
| Restart
Expand All @@ -110,10 +110,10 @@ update msg model =
in
( { model | wizard = wizard' }, Cmd.map WizardMsg cmd )

SyncStart address ->
SyncStart info ->
let
( twopanes', _ ) =
TwoPanes.update (TwoPanes.FillAddress address) model.twopanes
TwoPanes.update (TwoPanes.FillAddressAndDevice info) model.twopanes
in
( { model | page = TwoPanesPage, twopanes = twopanes' }, Cmd.none )

Expand Down Expand Up @@ -147,7 +147,7 @@ port registration : (Maybe String -> msg) -> Sub msg
port folder : (String -> msg) -> Sub msg


port synchonization : (String -> msg) -> Sub msg
port synchonization : (( String, String ) -> msg) -> Sub msg


port gototab : (String -> msg) -> Sub msg
Expand Down
6 changes: 3 additions & 3 deletions gui/lib/TwoPanes.elm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Msg
= NoOp
| GoToTab Tab
| GoToStrTab String
| FillAddress String
| FillAddressAndDevice ( String, String )
| DashboardMsg Dashboard.Msg
| SettingsMsg Settings.Msg
| AccountMsg Account.Msg
Expand Down Expand Up @@ -88,10 +88,10 @@ update msg model =
_ ->
update (GoToTab DashboardTab) model

FillAddress address ->
FillAddressAndDevice info ->
let
( account', _ ) =
Account.update (Account.FillAddress address) model.account
Account.update (Account.FillAddressAndDevice info) model.account
in
( { model | account = account' }, Cmd.none )

Expand Down
1 change: 1 addition & 0 deletions gui/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Account Account": "Account",
"Account Device name": "Device name",
"Account Unlink Cozy": "Unlink Cozy",
"Account It will unlink your account to this computer.": "It will unlink your account to this computer.",
"Account Your files won't be deleted.": "Your files won't be deleted.",
Expand Down
1 change: 1 addition & 0 deletions gui/locales/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"Account Account": "Compte",
"Account Device name": "Nom de l'appareil",
"Account Unlink Cozy": "Déconnecter de son Cozy",
"Account It will unlink your account to this computer.": "Ce compte sera retiré de cet ordinateur.",
"Account Your files won't be deleted.": "Vos fichiers ne seront pas supprimés.",
Expand Down

0 comments on commit 77eedac

Please sign in to comment.