re #168, get asset deletion route to work, update options dropdown on asset list

This commit is contained in:
Cassie Tarakajian 2019-09-25 17:54:46 -04:00
parent 7c1aa2e589
commit 0cde29e56d
5 changed files with 15 additions and 4 deletions

View file

@ -28,7 +28,7 @@ class AssetListRowBase extends React.Component {
this.setState({ isFocused: false });
setTimeout(() => {
if (!this.state.isFocused) {
this.closeAll();
this.closeOptions();
}
}, 200);
}
@ -109,6 +109,7 @@ class AssetListRowBase extends React.Component {
target="_blank"
onBlur={this.onBlurComponent}
onFocus={this.onFocusComponent}
className="asset-table__action-option"
>
Open in New Tab
</Link>

View file

@ -93,3 +93,7 @@
top: 63%;
right: calc(100% - 26px);
}
.asset-table__action-option {
font-size: #{12 / $base-font-size}rem;
}

View file

@ -60,7 +60,13 @@ export function deleteObjectsFromS3(keyList, callback) {
}
export function deleteObjectFromS3(req, res) {
const objectKey = req.params.object_key;
const { object_key, user_id } = req.params;
let objectKey;
if (user_id) {
objectKey = `${user_id}/${object_key}`
} else {
objectKey = object_key;
}
deleteObjectsFromS3([objectKey], () => {
res.json({ success: true });
});

View file

@ -18,7 +18,7 @@ export function userResponse(user) {
apiKeys: user.apiKeys,
verified: user.verified,
id: user._id,
totalSize: req.user.totalSize
totalSize: user.totalSize
};
}

View file

@ -6,7 +6,7 @@ const router = new Router();
router.post('/S3/sign', isAuthenticated, AWSController.signS3);
router.post('/S3/copy', isAuthenticated, AWSController.copyObjectInS3);
router.delete('/S3/:object_key', isAuthenticated, AWSController.deleteObjectFromS3);
router.delete('/S3/:user_id?/:object_key', isAuthenticated, AWSController.deleteObjectFromS3);
router.get('/S3/objects', AWSController.listObjectsInS3ForUserRequestHandler);
export default router;