Google Drive UI changes.

This commit is contained in:
Harry Hedger 2016-09-20 18:55:05 -04:00
parent 53601c5076
commit b71048e8af
2 changed files with 15 additions and 19 deletions

View file

@ -1,5 +1,4 @@
import html from '../../core/html'
import Breadcrumbs from './Breadcrumbs'
import Sidebar from './Sidebar'
import Table from './Table'
@ -14,17 +13,9 @@ export default (props, bus) => {
return html`
<div>
<div class="UppyGoogleDrive-header">
<ul class="UppyGoogleDrive-breadcrumbs">
${Breadcrumbs({
getNextFolder: props.getNextFolder,
directories: props.directories
})}
</ul>
</div>
<div class="container-fluid">
<div class="row">
<div class="hidden-md-down col-lg-3 col-xl-3">
<div class="hidden-md-down col-lg-12 col-xl-12">
${Sidebar({
getRootDirectory: () => props.getNextFolder('root', 'Google Drive'),
logout: props.logout,
@ -32,7 +23,7 @@ export default (props, bus) => {
filterInput: props.filterInput
})}
</div>
<div class="col-md-12 col-lg-9 col-xl-6">
<div class="col-md-12 col-lg-12 col-xl-12">
<div class="UppyGoogleDrive-browserContainer">
${Table({
folders: filteredFolders,

View file

@ -38,6 +38,8 @@ export default class Google extends Plugin {
this.handleRowClick = this.handleRowClick.bind(this)
this.logout = this.logout.bind(this)
this.handleDemoAuth = this.handleDemoAuth.bind(this)
this.sortByTitle = this.sortByTitle.bind(this)
this.sortByDate = this.sortByDate.bind(this)
// Visual
this.render = this.render.bind(this)
@ -73,6 +75,9 @@ export default class Google extends Plugin {
.then((authenticated) => {
this.updateState({authenticated})
console.log('are we authenticated?')
console.log(authenticated)
if (authenticated) {
return this.getFolder('root')
}
@ -110,15 +115,11 @@ export default class Google extends Plugin {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: {
demo: this.opts.demo
}
})
.then((res) => {
if (res.status >= 200 && res.status <= 300) {
return res.json()
} else {
console.log(res.status)
if (res.status < 200 || res.status > 300) {
this.updateState({
authenticated: false,
error: true
@ -127,6 +128,8 @@ export default class Google extends Plugin {
error.response = res
throw error
}
return res.json()
})
.then((data) => data.isAuthenticated)
.catch((err) => err)
@ -275,7 +278,7 @@ export default class Google extends Plugin {
}
sortByTitle () {
const state = this.core.getState().googleDrive
const state = Object.assign({}, this.core.getState().googleDrive)
const {files, folders, sorting} = state
let sortedFiles = files.sort((fileA, fileB) => {
@ -300,7 +303,7 @@ export default class Google extends Plugin {
}
sortByDate () {
const state = this.core.getState().googleDrive
const state = Object.assign({}, this.core.getState().googleDrive)
const {files, folders, sorting} = state
let sortedFiles = files.sort((fileA, fileB) => {
@ -366,6 +369,8 @@ export default class Google extends Plugin {
filterItems: this.filterItems,
filterQuery: this.filterQuery,
handleRowClick: this.handleRowClick,
sortByTitle: this.sortByTitle,
sortByDate: this.sortByDate,
logout: this.logout,
demo: this.opts.demo
})