Merge remote-tracking branch 'upstream/api-attribute-rename' into api-attributes

This commit is contained in:
Tan Jiang 2016-06-03 18:51:26 +08:00
commit 884f496854
28 changed files with 1175 additions and 1180 deletions

View File

@ -48,7 +48,7 @@ func hasProjectAdminRole(userID int, projectID int64) bool {
//sysadmin has all privileges to all projects //sysadmin has all privileges to all projects
func listRoles(userID int, projectID int64) ([]models.Role, error) { func listRoles(userID int, projectID int64) ([]models.Role, error) {
roles := make([]models.Role, 1) roles := make([]models.Role, 0, 1)
isSysAdmin, err := dao.IsAdminRole(userID) isSysAdmin, err := dao.IsAdminRole(userID)
if err != nil { if err != nil {
return roles, err return roles, err

View File

@ -13,7 +13,6 @@
limitations under the License. limitations under the License.
*/ */
.footer { .footer {
margin-top: 60px;
width: 100%; width: 100%;
/* Set the fixed height of the footer here */ /* Set the fixed height of the footer here */
height: 60px; height: 60px;

View File

@ -12,6 +12,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var AjaxUtil = function(params){ var AjaxUtil = function(params){
this.url = params.url; this.url = params.url;
@ -153,8 +154,13 @@ jQuery(function(){
} }
if(settings.callback != null){ if(settings.callback != null){
$("#dlgConfirm").on("click", function(){ var hasEntered = false;
$("#dlgConfirm").on("click", function(e){
if(!hasEntered) {
hasEntered = true;
settings.callback(); settings.callback();
}
}); });
} }
$(self).modal('show'); $(self).modal('show');

View File

@ -131,7 +131,6 @@ jQuery(function(){
} }
} }
data.Created = moment(new Date(data.Created)).format("YYYY-MM-DD HH:mm:ss"); data.Created = moment(new Date(data.Created)).format("YYYY-MM-DD HH:mm:ss");
$("#dlgModal").dialogModal({"title": i18n.getMessage("image_details"), "content": data}); $("#dlgModal").dialogModal({"title": i18n.getMessage("image_details"), "content": data});
} }
} }
@ -204,7 +203,7 @@ jQuery(function(){
if(operationType == "add"){ if(operationType == "add"){
ajaxOpts.url = "/api/projects/" + projectId + "/members/"; ajaxOpts.url = "/api/projects/" + projectId + "/members/";
ajaxOpts.type = "post"; ajaxOpts.type = "post";
ajaxOpts.data = {"roles" : checkedRoleItemList, "user_name": username}; ajaxOpts.data = {"roles" : checkedRoleItemList, "username": username};
}else if(operationType == "edit"){ }else if(operationType == "edit"){
ajaxOpts.url = "/api/projects/" + projectId + "/members/" + userId; ajaxOpts.url = "/api/projects/" + projectId + "/members/" + userId;
ajaxOpts.type = "put"; ajaxOpts.type = "put";
@ -241,24 +240,15 @@ jQuery(function(){
var ownerId = $("#ownerId").val(); var ownerId = $("#ownerId").val();
$("#tblUser tbody tr").remove(); $("#tblUser tbody tr").remove();
for(var i = 0; i < userList.length; ){ for(var i = 0; i < userList.length; i++){
var userId = userList[i].UserId; var userId = userList[i].user_id;
var roleId = userList[i].RoleId; var roleId = userList[i].role_id;
var username = userList[i].username; var username = userList[i].username;
var roleNameList = [];
for(var j = i; j < userList.length; i++, j++){
if(userList[j].UserId == userId){
roleNameList.push(name_mapping[userList[j].Rolename]);
}else{
break;
}
}
var row = '<tr>' + var row = '<tr>' +
'<td>' + username + '</td>' + '<td>' + username + '</td>' +
'<td>' + roleNameList.join(",") + '</td>' + '<td>' + name_mapping[userList[i].role_name] + '</td>' +
'<td>'; '<td>';
var isShowOperations = true; var isShowOperations = true;
if(loginedUserRoleId >= 3 /*role: developer guest*/){ if(loginedUserRoleId >= 3 /*role: developer guest*/){
@ -284,11 +274,11 @@ jQuery(function(){
$.each(LogList || [], function(i, e){ $.each(LogList || [], function(i, e){
$("#tabOperationLog tbody").append( $("#tabOperationLog tbody").append(
'<tr>' + '<tr>' +
'<td>' + e.Username + '</td>' + '<td>' + e.username + '</td>' +
'<td>' + e.RepoName + '</td>' + '<td>' + e.repo_name + '</td>' +
'<td>' + e.RepoTag + '</td>' + '<td>' + e.repo_tag + '</td>' +
'<td>' + e.Operation + '</td>' + '<td>' + e.operation + '</td>' +
'<td>' + moment(new Date(e.OpTime)).format("YYYY-MM-DD HH:mm:ss") + '</td>' + '<td>' + moment(new Date(e.op_time)).format("YYYY-MM-DD HH:mm:ss") + '</td>' +
'</tr>'); '</tr>');
}); });
} }
@ -302,7 +292,7 @@ jQuery(function(){
$("#operationType").val("edit"); $("#operationType").val("edit");
$("#editUserId").val(user.user_id); $("#editUserId").val(user.user_id);
$("#spnSearch").hide(); $("#spnSearch").hide();
$("#txtUserName").val(user.user_name); $("#txtUserName").val(user.username);
$("#txtUserName").prop("disabled", true); $("#txtUserName").prop("disabled", true);
$("#btnSave").removeClass("disabled"); $("#btnSave").removeClass("disabled");
$("#dlgUserTitle").text(i18n.getMessage("edit_members")); $("#dlgUserTitle").text(i18n.getMessage("edit_members"));
@ -404,7 +394,7 @@ jQuery(function(){
new AjaxUtil({ new AjaxUtil({
url: "/api/projects/" + projectId + "/logs/filter", url: "/api/projects/" + projectId + "/logs/filter",
data:{"username":username, "project_id" : projectId, "keywords" : getKeyWords() , "beginTimestamp" : beginTimestamp, "endTimestamp" : endTimestamp}, data:{"username":username, "project_id" : Number(projectId), "keywords" : getKeyWords() , "begin_timestamp" : beginTimestamp, "end_timestamp" : endTimestamp},
type: "post", type: "post",
success: function(data, status, xhr){ success: function(data, status, xhr){
if(xhr && xhr.status == 200){ if(xhr && xhr.status == 200){
@ -464,9 +454,9 @@ jQuery(function(){
showClear: true showClear: true
}); });
}); });
} }
$(document).on("keydown", function(e){ $(document).on("keydown", function(e){
if(e.keyCode == 13){ if(e.keyCode == 13){
e.preventDefault(); e.preventDefault();
if($("#tabItemDetail li:eq(0)").is(":focus") || $("#txtRepoName").is(":focus")){ if($("#tabItemDetail li:eq(0)").is(":focus") || $("#txtRepoName").is(":focus")){
@ -479,5 +469,5 @@ jQuery(function(){
$("#btnSave").trigger("click"); $("#btnSave").trigger("click");
} }
} }
}); });
}) })

View File

@ -19,7 +19,7 @@ jQuery(function(){
type: "get", type: "get",
success: function(data, status, xhr){ success: function(data, status, xhr){
if(xhr && xhr.status == 200){ if(xhr && xhr.status == 200){
if(data.HasAdminRole == 1) { if(data.has_admin_role == 1) {
renderForAdminRole(); renderForAdminRole();
} }
renderForAnyRole(); renderForAnyRole();
@ -55,16 +55,16 @@ jQuery(function(){
$("#tblProject tbody tr").remove(); $("#tblProject tbody tr").remove();
$.each(data || [], function(i, e){ $.each(data || [], function(i, e){
var row = '<tr>' + var row = '<tr>' +
'<td style="vertical-align: middle;"><a href="/registry/detail?project_id=' + e.ProjectId + '">' + e.Name + '</a></td>' + '<td style="vertical-align: middle;"><a href="/registry/detail?project_id=' + e.project_id + '">' + e.name + '</a></td>' +
'<td style="vertical-align: middle;">' + moment(new Date(e.CreationTime)).format("YYYY-MM-DD HH:mm:ss") + '</td>'; '<td style="vertical-align: middle;">' + moment(new Date(e.creation_time)).format("YYYY-MM-DD HH:mm:ss") + '</td>';
if(e.Public == 1 && e.Togglable){ if(e.public == 1 && e.Togglable){
row += '<td><button type="button" class="btn btn-success" projectid="' + e.ProjectId + '">' + i18n.getMessage("button_on")+ '</button></td>' row += '<td><button type="button" class="btn btn-success" projectid="' + e.project_id + '">' + i18n.getMessage("button_on")+ '</button></td>'
} else if (e.Public == 1) { } else if (e.public == 1) {
row += '<td><button type="button" class="btn btn-success" projectid="' + e.ProjectId + '" disabled>' + i18n.getMessage("button_on")+ '</button></td>'; row += '<td><button type="button" class="btn btn-success" projectid="' + e.project_id + '" disabled>' + i18n.getMessage("button_on")+ '</button></td>';
} else if (e.Public == 0 && e.Togglable) { } else if (e.public == 0 && e.Togglable) {
row += '<td><button type="button" class="btn btn-danger" projectid="' + e.ProjectId + '">' + i18n.getMessage("button_off")+ '</button></td>'; row += '<td><button type="button" class="btn btn-danger" projectid="' + e.project_id + '">' + i18n.getMessage("button_off")+ '</button></td>';
} else if (e.Public == 0) { } else if (e.public == 0) {
row += '<td><button type="button" class="btn btn-danger" projectid="' + e.ProjectId + '" disabled>' + i18n.getMessage("button_off")+ '</button></td>'; row += '<td><button type="button" class="btn btn-danger" projectid="' + e.project_id + '" disabled>' + i18n.getMessage("button_off")+ '</button></td>';
row += '</tr>'; row += '</tr>';
} }
$("#tblProject tbody").append(row); $("#tblProject tbody").append(row);
@ -163,12 +163,12 @@ jQuery(function(){
var row = '<tr>' + var row = '<tr>' +
'<td style="vertical-align: middle;">' + e.username + '</td>' + '<td style="vertical-align: middle;">' + e.username + '</td>' +
'<td style="vertical-align: middle;">' + e.email + '</td>'; '<td style="vertical-align: middle;">' + e.email + '</td>';
if(e.HasAdminRole == 1){ if(e.has_admin_role == 1){
row += '<td style="padding-left: 30px;"><button type="button" class="btn btn-success" userid="' + e.UserId + '">' + i18n.getMessage("button_on") + '</button></td>'; row += '<td style="padding-left: 30px;"><button type="button" class="btn btn-success" userid="' + e.user_id + '">' + i18n.getMessage("button_on") + '</button></td>';
} else { } else {
row += '<td style="padding-left: 30px;"><button type="button" class="btn btn-danger" userid="' + e.UserId + '">' + i18n.getMessage("button_off") + '</button></td>'; row += '<td style="padding-left: 30px;"><button type="button" class="btn btn-danger" userid="' + e.user_id + '">' + i18n.getMessage("button_off") + '</button></td>';
} }
row += '<td style="padding-left: 30px; vertical-align: middle;"><a href="#" style="visibility: hidden;" class="tdDeleteUser" userid="' + e.UserId + '" username="' + e.Username + '"><span class="glyphicon glyphicon-trash"></span></a></td>'; row += '<td style="padding-left: 30px; vertical-align: middle;"><a href="#" style="visibility: hidden;" class="tdDeleteUser" userid="' + e.user_id + '" username="' + e.username + '"><span class="glyphicon glyphicon-trash"></span></a></td>';
row += '</tr>'; row += '</tr>';
$("#tblUser tbody").append(row); $("#tblUser tbody").append(row);
}); });
@ -194,12 +194,12 @@ jQuery(function(){
} }
}).exec(); }).exec();
}); });
$("#tblUser tbody tr").on("mouseover", function(){ $("#tblUser tbody tr").on("mouseover", function(e){
$(".tdDeleteUser", this).css({"visibility":"visible"}); $(".tdDeleteUser", this).css({"visibility":"visible"});
}).on("mouseout", function(){ }).on("mouseout", function(e){
$(".tdDeleteUser", this).css({"visibility":"hidden"}); $(".tdDeleteUser", this).css({"visibility":"hidden"});
}); });
$("#tblUser tbody tr .tdDeleteUser").on("click", function(){ $("#tblUser tbody tr .tdDeleteUser").on("click", function(e){
var userId = $(this).attr("userid"); var userId = $(this).attr("userid");
$("#dlgModal") $("#dlgModal")
.dialogModal({ .dialogModal({
@ -219,6 +219,7 @@ jQuery(function(){
}).exec(); }).exec();
} }
}); });
}); });
}); });
} }
@ -231,4 +232,4 @@ jQuery(function(){
listUserAdminRole(username); listUserAdminRole(username);
}); });
} }
}) })

View File

@ -30,7 +30,6 @@ jQuery(function(){
} }
bindEnterKey(); bindEnterKey();
var spinner = new Spinner({scale:1}).spin(); var spinner = new Spinner({scale:1}).spin();
$("#btnSubmit").on("click", function(){ $("#btnSubmit").on("click", function(){

View File

@ -13,14 +13,14 @@
limitations under the License. limitations under the License.
--> -->
<!-- Main jumbotron for a primary marketing message or call to action --> <!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron"> <div class="jumbotron">
<div class="container"> <div class="container">
<img class="pull-left" src="static/resources/image/Harbor_Logo_rec.png" alt="Harbor's Logo" height="180" width="360"/> <img class="pull-left" src="static/resources/image/Harbor_Logo_rec.png" alt="Harbor's Logo" height="180" width="360"/>
<p class="pull-left" style="margin-top: 85px; color: #245580; font-size: 30pt; text-align: center; width: 60%;">{{i18n .Lang "index_title"}}</p> <p class="pull-left" style="margin-top: 85px; color: #245580; font-size: 30pt; text-align: center; width: 60%;">{{i18n .Lang "index_title"}}</p>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<!-- Example row of columns --> <!-- Example row of columns -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -33,5 +33,5 @@
<p>{{i18n .Lang "index_desc_5"}}</p> <p>{{i18n .Lang "index_desc_5"}}</p>
</div> </div>
</div> </div>
</div> <!-- /container --> </div> <!-- /container -->
<script src="static/resources/js/login.js"></script> <script src="static/resources/js/login.js"></script>

View File

@ -18,7 +18,7 @@
<li>{{.ProjectName}}</li> <li>{{.ProjectName}}</li>
</ol> </ol>
<div class="page-header" style="margin-top: -10px;"> <div class="page-header" style="margin-top: -10px;">
<h2>{{.ProjectName}} </h2></h4>{{i18n .Lang "owner"}}: {{.OwnerName}}</h4> <h2>{{.ProjectName}} </h2><h4>{{i18n .Lang "owner"}}: {{.OwnerName}}</h4>
</div> </div>
<div row="tabpanel"> <div row="tabpanel">
<div class="row"> <div class="row">
@ -53,7 +53,7 @@
</div> </div>
</div> </div>
</form> </form>
<p> <p/>
<div class="table-responsive div-height"> <div class="table-responsive div-height">
<div class="alert alert-danger" role="alert" id="divErrMsg"><center></center></div> <div class="alert alert-danger" role="alert" id="divErrMsg"><center></center></div>
<div class="panel-group" id="accordionRepo" role="tablist" aria-multiselectable="true"> <div class="panel-group" id="accordionRepo" role="tablist" aria-multiselectable="true">
@ -76,7 +76,7 @@
</div> </div>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#dlgUser" id="btnAddUser">{{i18n .Lang "add_members"}}</button> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#dlgUser" id="btnAddUser">{{i18n .Lang "add_members"}}</button>
</form> </form>
<p> <p/>
<div class="table-responsive div-height"> <div class="table-responsive div-height">
<table id="tblUser" class="table table-hover"> <table id="tblUser" class="table table-hover">
<thead> <thead>
@ -108,8 +108,7 @@
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseAdvance" aria-expanded="false" aria-controls="collapseAdvance">{{i18n .Lang "advance"}}</button> <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseAdvance" aria-expanded="false" aria-controls="collapseAdvance">{{i18n .Lang "advance"}}</button>
</div> </div>
</div> </div>
<form> <p/>
<p></p>
<div class="collapse" id="collapseAdvance"> <div class="collapse" id="collapseAdvance">
<form class="form"> <form class="form">
<div class="form-group"> <div class="form-group">
@ -139,7 +138,6 @@
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -151,7 +149,6 @@
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
@ -170,11 +167,12 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="modal fade" id="dlgUser" tabindex="-1" role="dialog" aria-labelledby="User" aria-hidden="true"> <div class="modal fade" id="dlgUser" tabindex="-1" role="dialog" aria-labelledby="User" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">

View File

@ -78,8 +78,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="dlgAddProject" tabindex="-1" role="dialog" aria-labelledby="Add Project" aria-hidden="true"> <div class="modal fade" id="dlgAddProject" tabindex="-1" role="dialog" aria-labelledby="Add Project" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -109,7 +109,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script src="static/resources/js/validate-options.js"></script> <script src="static/resources/js/validate-options.js"></script>
<script src="static/resources/js/project.js"></script> <script src="static/resources/js/project.js"></script>

View File

@ -14,8 +14,8 @@
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<p>{{.Hint}}:</p> <p>{{.Hint}}:</p>
<a href="{{.URL}}/resetPassword?reset_uuid={{.UUID}}">{{.URL}}/resetPassword?reset_uuid={{.UUID}}</a> <a href="{{.URL}}/resetPassword?reset_uuid={{.UUID}}">{{.URL}}/resetPassword?reset_uuid={{.UUID}}</a>
</body> </body>
</html> </html>

View File

@ -14,15 +14,15 @@
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
{{.HeaderInc}} {{.HeaderInc}}
<title>{{.PageTitle}}</title> <title>{{.PageTitle}}</title>
</head> </head>
<body> <body>
{{.HeaderContent}} {{.HeaderContent}}
{{.BodyContent}} {{.BodyContent}}
{{.FooterInc}} {{.FooterInc}}
{{.ModalDialog}} {{.ModalDialog}}
{{.FootContent}} {{.FootContent}}
</body> </body>
</html> </html>

View File

@ -11,7 +11,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<input type="hidden" id="currentLanguage" value="{{.Lang}}"> <input type="hidden" id="currentLanguage" value="{{.Lang}}">
<input type="hidden" id="isAdmin" value="{{.IsAdmin}}"> <input type="hidden" id="isAdmin" value="{{.IsAdmin}}">
<nav class="navbar navbar-default" role="navigation" style="margin-bottom: 0;"> <nav class="navbar navbar-default" role="navigation" style="margin-bottom: 0;">
@ -86,4 +87,5 @@
{{ end }} {{ end }}
</form> </form>
</div> </div>
</nav> </nav>

View File

@ -13,11 +13,11 @@
limitations under the License. limitations under the License.
--> -->
<style> <style>
.center { .center {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
top: 10%; top: 10%;
} }
</style> </style>
<!-- Modal --> <!-- Modal -->
<div class="center modal fade" id="dlgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="center modal fade" id="dlgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">