repo-auth-tokens: UX, set and disable to VCS scope if selected an repo from select2
This commit is contained in:
parent
79c8fadc26
commit
a9fc01d079
4 changed files with 20 additions and 0 deletions
|
|
@ -699,6 +699,7 @@ class UsersView(UserAppView):
|
|||
c.role_options = [(c.role_values, _("Role"))]
|
||||
c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
|
||||
c.user.user_id, show_expired=True)
|
||||
c.role_vcs = AuthTokenModel.cls.ROLE_VCS
|
||||
return self._get_template_context(c)
|
||||
|
||||
def maybe_attach_token_scope(self, token):
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ class MyAccountView(BaseAppView, DataGridAppView):
|
|||
c.role_options = [(c.role_values, _("Role"))]
|
||||
c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
|
||||
c.user.user_id, show_expired=True)
|
||||
c.role_vcs = AuthTokenModel.cls.ROLE_VCS
|
||||
return self._get_template_context(c)
|
||||
|
||||
def maybe_attach_token_scope(self, token):
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ var repoFilter = function(data) {
|
|||
|
||||
$("#scope_repo_id_disabled").select2(select2Options);
|
||||
|
||||
var selectVcsScope = function() {
|
||||
// select vcs scope and disable input
|
||||
$("#role").select2("val", "${c.role_vcs}").trigger('change');
|
||||
$("#role").select2("readonly", true)
|
||||
};
|
||||
|
||||
$("#scope_repo_id").select2({
|
||||
cachedDataSource: {},
|
||||
minimumInputLength: 2,
|
||||
|
|
@ -174,6 +180,9 @@ $("#scope_repo_id").select2({
|
|||
}
|
||||
})
|
||||
});
|
||||
$("#scope_repo_id").on('select2-selecting', function(e){
|
||||
selectVcsScope()
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -139,6 +139,12 @@ var repoFilter = function(data) {
|
|||
|
||||
$("#scope_repo_id_disabled").select2(select2Options);
|
||||
|
||||
var selectVcsScope = function() {
|
||||
// select vcs scope and disable input
|
||||
$("#role").select2("val", "${c.role_vcs}").trigger('change');
|
||||
$("#role").select2("readonly", true)
|
||||
};
|
||||
|
||||
$("#scope_repo_id").select2({
|
||||
cachedDataSource: {},
|
||||
minimumInputLength: 2,
|
||||
|
|
@ -172,6 +178,9 @@ $("#scope_repo_id").select2({
|
|||
}
|
||||
})
|
||||
});
|
||||
$("#scope_repo_id").on('select2-selecting', function(e){
|
||||
selectVcsScope()
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue