|
@@ -1,6 +1,8 @@
|
|
|
import React from 'react';
|
|
|
|
|
|
import ApiMixin from '../mixins/apiMixin';
|
|
|
+import OrganizationState from '../mixins/organizationState';
|
|
|
+import TooltipMixin from '../mixins/tooltip';
|
|
|
import FileSize from '../components/fileSize';
|
|
|
import LoadingError from '../components/loadingError';
|
|
|
import LoadingIndicator from '../components/loadingIndicator';
|
|
@@ -15,7 +17,14 @@ const ReleaseArtifacts = React.createClass({
|
|
|
release: React.PropTypes.object
|
|
|
},
|
|
|
|
|
|
- mixins: [ApiMixin],
|
|
|
+ mixins: [
|
|
|
+ ApiMixin,
|
|
|
+ OrganizationState,
|
|
|
+ TooltipMixin({
|
|
|
+ selector: '.tip',
|
|
|
+ trigger: 'hover'
|
|
|
+ })
|
|
|
+ ],
|
|
|
|
|
|
getInitialState() {
|
|
|
return {
|
|
@@ -57,6 +66,7 @@ const ReleaseArtifacts = React.createClass({
|
|
|
fileList: data,
|
|
|
pageLinks: jqXHR.getResponseHeader('Link')
|
|
|
});
|
|
|
+ this.attachTooltips();
|
|
|
},
|
|
|
error: () => {
|
|
|
this.setState({
|
|
@@ -109,23 +119,37 @@ const ReleaseArtifacts = React.createClass({
|
|
|
</div>
|
|
|
);
|
|
|
|
|
|
+ let access = this.getAccess();
|
|
|
+
|
|
|
// TODO(dcramer): files should allow you to download them
|
|
|
return (
|
|
|
<div>
|
|
|
<div className="release-group-header">
|
|
|
<div className="row">
|
|
|
- <div className="col-sm-9 col-xs-8">{'Name'}</div>
|
|
|
+ <div className="col-sm-8 col-xs-7">{'Name'}</div>
|
|
|
<div className="col-sm-2 col-xs-2 align-right">{'Size'}</div>
|
|
|
- <div className="col-sm-1 col-xs-2 align-right"></div>
|
|
|
+ <div className="col-sm-2 col-xs-3 align-right"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className="release-list">
|
|
|
{this.state.fileList.map((file) => {
|
|
|
return (
|
|
|
<div className="release release-artifact row" key={file.id}>
|
|
|
- <div className="col-sm-9 col-xs-8" style={{wordWrap: 'break-word'}}><strong>{file.name || '(empty)'}</strong></div>
|
|
|
+ <div className="col-sm-8 col-xs-7" style={{wordWrap: 'break-word'}}><strong>{file.name || '(empty)'}</strong></div>
|
|
|
<div className="col-sm-2 col-xs-2 align-right"><FileSize bytes={file.size} /></div>
|
|
|
- <div className="col-sm-1 col-xs-2 align-right">
|
|
|
+ <div className="col-sm-2 col-xs-3 align-right actions">
|
|
|
+ {access.has('project:write') ?
|
|
|
+ <a
|
|
|
+ href={this.api.baseUrl + this.getFilesEndpoint() + `${file.id}/?download=1`}
|
|
|
+ className="btn btn-sm btn-default">
|
|
|
+ <span className="icon icon-open" />
|
|
|
+ </a>
|
|
|
+ :
|
|
|
+ <div
|
|
|
+ className="btn btn-sm btn-default disabled tip" title={t('You do not have the required permission to download this artifact.')}>
|
|
|
+ <span className="icon icon-open" />
|
|
|
+ </div>
|
|
|
+ }
|
|
|
<LinkWithConfirmation
|
|
|
className="btn btn-sm btn-default"
|
|
|
title={t('Delete artifact')}
|