diff --git a/src/components/ContainerHome.react.js b/src/components/ContainerHome.react.js index a0af212ed5..f47cd9620b 100644 --- a/src/components/ContainerHome.react.js +++ b/src/components/ContainerHome.react.js @@ -41,7 +41,7 @@ var ContainerHome = React.createClass({ }, showFolders: function () { - return this.props.container.Volumes && _.keys(this.props.container.Volumes).length > 0 && this.props.container.State.Running; + return this.props.container.Mounts && this.props.container.Mounts.length > 0 && this.props.container.State.Running; }, render: function () { diff --git a/src/components/ContainerHomeFolders.react.js b/src/components/ContainerHomeFolders.react.js index 2755663d79..0aecb10622 100644 --- a/src/components/ContainerHomeFolders.react.js +++ b/src/components/ContainerHomeFolders.react.js @@ -14,30 +14,36 @@ var ContainerHomeFolder = React.createClass({ contextTypes: { router: React.PropTypes.func }, - handleClickFolder: function (hostVolume, containerVolume) { + handleClickFolder: function (source, destination) { metrics.track('Opened Volume Directory', { from: 'home' }); - if (hostVolume.indexOf(util.windowsToLinuxPath(util.home())) === -1) { + if (source.indexOf(util.windowsToLinuxPath(util.home())) === -1) { dialog.showMessageBox({ message: `Enable all volumes to edit files? This may not work with all database containers.`, buttons: ['Enable Volumes', 'Cancel'] }, (index) => { if (index === 0) { - var volumes = _.clone(this.props.container.Volumes); - var newHostVolume = util.escapePath(path.join(util.home(), util.documents(), 'Kitematic', this.props.container.Name, containerVolume)); - volumes[containerVolume] = newHostVolume; - var binds = _.pairs(volumes).map(function (pair) { - if(util.isWindows()) { - return util.windowsToLinuxPath(pair[1]) + ':' + pair[0]; + var mounts = _.clone(this.props.container.Mounts); + var newSource = util.escapePath(path.join(util.home(), util.documents(), 'Kitematic', this.props.container.Name, destination)); + var binds = mounts.map(function (m) { + let source = m.Source; + if (m.Destination === destination) { + source = newSource; } - return pair[1] + ':' + pair[0]; + + if(util.isWindows()) { + return util.windowsToLinuxPath(source) + ':' + m.Destination; + } + + return source + ':' + m.Destination; }); - mkdirp(newHostVolume, function (err) { + + mkdirp(newSource, function (err) { console.log(err); if (!err) { - shell.showItemInFolder(newHostVolume); + shell.showItemInFolder(newSource); } }); @@ -45,7 +51,7 @@ var ContainerHomeFolder = React.createClass({ } }); } else { - let path = util.isWindows() ? util.linuxToWindowsPath(hostVolume) : hostVolume; + let path = util.isWindows() ? util.linuxToWindowsPath(source) : source; shell.showItemInFolder(path); } }, @@ -60,12 +66,13 @@ var ContainerHomeFolder = React.createClass({ return false; } - var folders = _.map(_.omit(this.props.container.Volumes, (v, k) => k.indexOf('/Users/') !== -1), (val, key) => { - var firstFolder = key; + var folders = _.map(this.props.container.Mounts, (m, i) => { + let destination = m.Destination; + let source = m.Source; return ( -