Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f946b0b
Add style to allow word to be break and wrap
JamieHo3312 Apr 18, 2016
6230d9c
Update the style to place in the middle of the table
JamieHo3312 Apr 18, 2016
3b1c6e8
Remove angular-breadcrumb & implement breadcrumb component
Apr 21, 2016
2f1e1dc
Add base style for display property
JamieHo3312 Apr 21, 2016
d0227f2
Fix flexbox type layout issues in IE10
JamieHo3312 Apr 21, 2016
ce606a8
Add list item style for file list
JamieHo3312 Apr 21, 2016
ef3ccc9
Design file list
JamieHo3312 Apr 21, 2016
e7ad670
Change the accent theme grey to indigo
JamieHo3312 Apr 21, 2016
b17959d
Add File component
Apr 21, 2016
0a18a11
Remove angular-breadcrumb from source code
Apr 21, 2016
9ea4a82
Add click event to bucket component
Apr 22, 2016
dfb26b3
Add sample view & service to file component
Apr 22, 2016
337c7ac
Redesign bucket list
JamieHo3312 Apr 25, 2016
3146d6e
Rename utils to services
Apr 25, 2016
e782e35
Move natural sotr function to utils for reusable
Apr 25, 2016
55f211c
Replace upload and create folder icon
JamieHo3312 Apr 26, 2016
dd78031
Add dialog-footer and list-dialog style
JamieHo3312 Apr 27, 2016
57bc03a
Add the ui of upload file
JamieHo3312 Apr 27, 2016
7f836dd
Real api call
May 6, 2016
745928e
Merge remote-tracking branch 'jamie/feature/design-file-list' into fe…
May 6, 2016
ad02be3
Bind controller properties to view
May 6, 2016
6fc82ff
Update $file service
May 6, 2016
635cf94
Merge branch 'dev' into feature/implement-breadcrumb
May 16, 2016
ce3cdb1
fix bug in action-navbar.html
May 16, 2016
46cf39a
Merge branch 'dev' into feature/files-list-component
May 16, 2016
b521b34
Merge branch 'feature/implement-breadcrumb' into feature/files-list-c…
May 16, 2016
6679b83
Update file module
May 16, 2016
0a58ba8
Add ng-file-upload to dependencies
May 16, 2016
a356e99
Merge remote-tracking branch 'jamie/feature/design-upload-form' into …
May 16, 2016
d11309a
Add fileUpload to vendor and remove angular-breadcrumb
May 17, 2016
6b3d4af
Add filesize filter for size format
May 17, 2016
f71b02c
Add align style for set the vertical alignment
JamieHo3312 May 17, 2016
4fc9ec7
Add style for highlight the messages
JamieHo3312 May 17, 2016
37cc662
Design transfer view
JamieHo3312 May 17, 2016
5bbc8af
Update file.html
May 18, 2016
3d1c5c6
Remove unnecessary state and dependence in file.service.js
May 18, 2016
d90dfd1
Add file upload component
May 18, 2016
0054bd7
Add sign out handler
May 18, 2016
30283b7
Add method to Upload button in action navbar
May 18, 2016
f024de0
Fix breadcrumb bar
May 18, 2016
36bc561
Merge remote-tracking branch 'jamie/feature/design-transfer' into fea…
May 18, 2016
b8f6cff
Add transfer UI & update layout component
May 18, 2016
f46b0b1
Add transfer service
May 18, 2016
cf833f4
Remove transfer import in components/index.js
May 18, 2016
c931e89
Use boolean to control upadting status
May 18, 2016
48fadf8
Move toal size method to utils
May 18, 2016
d26b84b
Update method name
May 18, 2016
89fac79
Refactor upload component
May 18, 2016
35d0104
Merge branch 'feature/files-upload-component' into feature/transfer-c…
May 18, 2016
c0a0904
Update TokenInterceptor for other error handler
May 19, 2016
c98ab5b
Complete transfer component
May 19, 2016
f5df9e0
Fix bugs of toast message
May 19, 2016
e6b383d
Add $file dependence to $transfer
May 19, 2016
891ea2d
Update transfers & properties button of action navbar
May 19, 2016
3b7d1e4
Update properties event in actions button of action navbar
May 19, 2016
f9114a3
Fix bug when file size small than 1024 bytes
May 20, 2016
e0c66b0
Fix file icon in upload.html
May 20, 2016
9d9f9bb
Fix bug when action navbar switch
May 20, 2016
14d0269
Fix menu items of actions button
May 23, 2016
d8a9931
Fix bug when action navbar switch
May 20, 2016
854f751
Revert "Fix bug when action navbar switch"
May 23, 2016
de6b57f
Merge branch 'feature/files-upload-component' into feature/transfer-c…
May 23, 2016
c9c7b00
Fix menu items of actions button
May 23, 2016
aa3b916
Revert "Fix menu items of actions button"
May 23, 2016
d407d44
Merge branch 'feature/files-upload-component' into feature/transfer-c…
May 23, 2016
15f5cd3
Design the ui of delete bucket form
JamieHo3312 May 24, 2016
58a7748
Fix issue display upload completed icon
May 24, 2016
c298fe5
Merge remote-tracking branch 'jamie/feature/redesign-bucket-list' int…
May 24, 2016
559e5c1
Add select bucket to bucket component
May 24, 2016
1fcdd1d
Merge remote-tracking branch 'jamie/feature/design-delete-bucket-form…
May 25, 2016
469f6b6
Add delete bucket component
May 25, 2016
3d88735
Add unit test for delete bucket component
May 26, 2016
dcbc653
Add bucket controller and delete controller unit test.
chaoen Jun 7, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"angular": "^1.5.0",
"angular-animate": "^1.5.0",
"angular-aria": "^1.5.0",
"angular-breadcrumb": "^0.4.1",
"angular-material": "^1.0.5",
"angular-messages": "^1.5.0",
"angular-translate": "^2.9.2",
Expand All @@ -49,6 +48,7 @@
"javascript-natural-sort": "^0.7.1",
"lodash": "^4.5.1",
"material-design-icons": "^2.2.0",
"ng-file-upload": "^12.0.4",
"satellizer": "^0.14.0"
},
"devDependencies": {
Expand Down
13 changes: 11 additions & 2 deletions src/components/bucket/bucket.controller.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
export default class BucketController {
/** @ngInject */
constructor($scope, $bucket) {
constructor($scope, $bucket, $state, $breadcrumb) {
Object.assign(this, {
$scope, $bucket,
$scope, $bucket, $state,
});

this.$scope.$watch(
() => $bucket.state.lists,
newVal => Object.assign(this, newVal)
, true);

$breadcrumb.initPaths();
this.$bucket.getBuckets();
}

createBucket($event) {
this.$bucket.createDialog($event);
}

clickBucket(path) {
this.$state.go('file', { path });
}

selectBucket(name) {
this.$bucket.selectBucket(name);
}
}
36 changes: 21 additions & 15 deletions src/components/bucket/bucket.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@
<table class="table table-cursor table-hover">
<thead>
<tr>
<th style="width:24px;"></th>
<th style="width:48px;"></th>
<th>Name</th>
</tr>
</thead>

<tbody>
<tr ng-repeat="bucket in bucket.data" ng-class="{active:@A.3}">
<td>
<a ng-click="@A.4">
<md-icon>info_outline</md-icon>
</a>
</td>
<td ng-bind="bucket.Name">
<a ng-click="@A.11"></a>
</td>
</tr>
</tbody>
</table>

<md-list>
<md-list-item
aria-label="Bucket list item"
ng-class="{ checked: b.checked }"
ng-repeat="b in bucket.data"
ng-click="bucket.clickBucket(b.Name)"
>
<md-checkbox
aria-label="checkbox of bucket list item"
class="md-secondary"
ng-checked="b.checked"
ng-click="bucket.selectBucket(b.Name)"
></md-checkbox>
<p class="break-word flex-grow">
<span ng-bind="b.Name"></span>
</p>
</md-list-item>
</md-list>
</div>

<div
Expand Down Expand Up @@ -67,4 +73,4 @@
<md-icon class="icon-default">refresh</md-icon>
</md-button>
</div>
</md-content>
</md-content>
3 changes: 0 additions & 3 deletions src/components/bucket/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const route = $stateProvider => {
controllerAs: 'bucket',
template: BucketTemplate,
onEnter: $nav => $nav.setTypeToBucket(),
ncyBreadcrumb: {
label: 'All Buckets ( {{ bucket.data.length }} )',
},
});
};

Expand Down
66 changes: 50 additions & 16 deletions src/components/bucket/bucket.service.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { element } from 'angular';
import natural from 'javascript-natural-sort';
import { sortByName } from '../../utils/sort';
import BucketCreateController from './create/create.controller';
import BucketCreateTemplate from './create/create.html';
import BucketDeleteController from './delete/delete.controller';
import BucketDeleteTemplate from './delete/delete.html';

export default class BucketService {
/** @ngInject */
constructor($fetch, $toast, $mdDialog) {
constructor($fetch, $toast, $mdDialog, $breadcrumb) {
Object.assign(this, {
$fetch, $toast, $mdDialog,
$fetch, $toast, $mdDialog, $breadcrumb,
});

this.initState();
Expand All @@ -30,6 +32,9 @@ export default class BucketService {
checked: false,
duplicated: false,
},
delete: {
name: null,
}
};
}

Expand Down Expand Up @@ -63,6 +68,17 @@ export default class BucketService {
});
}

deleteDialog($event) {
this.$mdDialog.show({
controller: BucketDeleteController,
controllerAs: 'delete',
template: BucketDeleteTemplate,
parent: element(document.body),
targetEvent: $event,
clickOutsideToClose: true,
});
}

/**
* Close the dialog.
*
Expand All @@ -73,18 +89,31 @@ export default class BucketService {
this.resetCheckBucketState();
}

/**
* Natural sort for the specified object key.
*
* @param {Object} a
* @param {Object} b
* @return {Integer}
*/
sortByName(a, b) {
const x = a.Name;
const y = b.Name;
selectBucket(name) {
const { data } = this.state.lists;
const index = data.findIndex(bucket => bucket.Name === name);
this.state.lists.data = data.map((bucket, id) => ({
...bucket,
checked: (id === index) ? ! bucket.checked : false,
}));

this.state.delete.name = this.state.lists.data[index].checked ? data[index].Name : null;
}

return natural(x, y);
deleteBucket() {
const { name } = this.state.delete;
this.$fetch.delete(`/v1/bucket/delete/${name}`)
.then(() => {
this.state.delete.name = null;
this.$toast.show(`Bucket ${name} has been deleted!`);
this.getBuckets();
})
.catch(err => {
this.$toast.show(`Bucket ${name} delete failed, please try again!`);
})
.finally(() => {
this.closeDialog();
});
}

/**
Expand All @@ -99,13 +128,18 @@ export default class BucketService {
this.$fetch.post('/v1/bucket/list')
.then(({ data }) => {
this.state.lists.error = false;
this.state.lists.data = data.Buckets.sort(this.sortByName);
const buckets = data.Buckets.map(bucket => ({
...bucket,
checked: false,
}));
this.state.lists.data = buckets.sort(sortByName);
})
.catch(() => {
this.state.lists.error = true;
})
.finally(() => {
this.state.lists.requesting = false;
this.$breadcrumb.updateBucketPath(this.state.lists.data.length);
});
}

Expand Down Expand Up @@ -140,7 +174,7 @@ export default class BucketService {
createBucket(bucket) {
this.$fetch.post('/v1/bucket/create', { bucket })
.then(({ data }) => {
this.state.lists.data = data.Buckets.sort(this.sortByName);
this.state.lists.data = data.Buckets.sort(sortByName);
this.$toast.show(`Bucket ${bucket} has created!`);
})
.catch(() => {
Expand Down
Loading