1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

MOD: copy follow token in repo-api-token frontend (#4219)

This commit is contained in:
Alex Happy
2019-11-04 17:37:27 +08:00
committed by Daniel Pan
parent b15b1bdffc
commit c9c43c5791
2 changed files with 11 additions and 11 deletions

View File

@@ -62,12 +62,13 @@ class APITokenItem extends React.Component {
onPermissionChanged={this.onUpdateAPIToken} onPermissionChanged={this.onUpdateAPIToken}
/> />
</td> </td>
<td>{item.api_token}</td>
<td> <td>
<span <Fragment>
className="far fa-copy action-icon" <span>{item.api_token}</span>
onClick={this.onCopyAPIToken} {this.state.isOperationShow &&
/> <span className="far fa-copy action-icon" onClick={this.onCopyAPIToken} />
}
</Fragment>
</td> </td>
<td> <td>
<span <span
@@ -95,7 +96,7 @@ class RepoAPITokenDialog extends React.Component {
super(props); super(props);
this.state = { this.state = {
apiTokenList: [], apiTokenList: [],
permission: '', permission: 'rw',
appName: '', appName: '',
errorMsg: '', errorMsg: '',
loading: true, loading: true,
@@ -267,8 +268,7 @@ class RepoAPITokenDialog extends React.Component {
<th width="22%">{gettext('App Name')}</th> <th width="22%">{gettext('App Name')}</th>
<th width="15%">{gettext('Permission')}</th> <th width="15%">{gettext('Permission')}</th>
<th width="53%">{gettext('Access Token')}</th> <th width="53%">{gettext('Access Token')}</th>
<th width="5%"></th> <th width="10%"></th>
<th width="5%"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@@ -14,7 +14,7 @@ from seahub.api2.utils import api_error
from seaserv import seafile_api from seaserv import seafile_api
from seahub.constants import PERMISSION_READ from seahub.constants import PERMISSION_READ_WRITE
from seahub.repo_api_tokens.models import RepoAPITokens from seahub.repo_api_tokens.models import RepoAPITokens
from seahub.repo_api_tokens.utils import permission_check_admin_owner from seahub.repo_api_tokens.utils import permission_check_admin_owner
@@ -40,7 +40,7 @@ class RepoAPITokensView(APIView):
# resource check # resource check
repo = seafile_api.get_repo(repo_id) repo = seafile_api.get_repo(repo_id)
if not repo: if not repo:
error_msg = _('app_name invalid.') error_msg = _('Library %(repo_id)s not found.' % {'repo_id': repo_id})
return api_error(status.HTTP_404_NOT_FOUND, error_msg) return api_error(status.HTTP_404_NOT_FOUND, error_msg)
# permission check # permission check
@@ -63,7 +63,7 @@ class RepoAPITokensView(APIView):
if repo_permission and repo_permission not in [perm[0] for perm in RepoAPITokens.PERMISSION_CHOICES]: if repo_permission and repo_permission not in [perm[0] for perm in RepoAPITokens.PERMISSION_CHOICES]:
error_msg = _('permission invalid.') error_msg = _('permission invalid.')
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
repo_permission = repo_permission if repo_permission else PERMISSION_READ repo_permission = repo_permission if repo_permission else PERMISSION_READ_WRITE
# resource check # resource check
repo = seafile_api.get_repo(repo_id) repo = seafile_api.get_repo(repo_id)