[Notice] Announcing the End of Demo Server [Read me]

Merge branch 'issue-1662' of dlab/hive
from pull request 1213
@58c0e597645d2cce20aef32c578b28f58e3c4ce0
--- app/controllers/ProjectApp.java
+++ app/controllers/ProjectApp.java
... | ... | @@ -68,6 +68,7 @@ |
68 | 68 |
import views.html.project.home; |
69 | 69 |
import views.html.project.setting; |
70 | 70 |
import views.html.project.transfer; |
71 |
+import views.html.project.change_vcs; |
|
71 | 72 |
|
72 | 73 |
import javax.servlet.ServletException; |
73 | 74 |
|
... | ... | @@ -629,6 +630,27 @@ |
629 | 630 |
return redirect(routes.ProjectApp.project(project.owner, project.name)); |
630 | 631 |
} |
631 | 632 |
|
633 |
+ @IsAllowed(Operation.UPDATE) |
|
634 |
+ public static Result changeVCSForm(String ownerId, String projectName) { |
|
635 |
+ Project project = Project.findByOwnerAndProjectName(ownerId, projectName); |
|
636 |
+ Form<Project> projectForm = form(Project.class).fill(project); |
|
637 |
+ return ok(change_vcs.render("title.projectChangeVCS", projectForm, project)); |
|
638 |
+ } |
|
639 |
+ |
|
640 |
+ @IsAllowed(Operation.UPDATE) |
|
641 |
+ public static Result changeVCS(String ownerId, String projectName) throws Exception { |
|
642 |
+ Project project = Project.findByOwnerAndProjectName(ownerId, projectName); |
|
643 |
+ try { |
|
644 |
+ project.changeVCS(); |
|
645 |
+ String url = routes.ProjectApp.project(ownerId, projectName).url(); |
|
646 |
+ response().setHeader("Location", url); |
|
647 |
+ return noContent(); |
|
648 |
+ } catch (Exception e) { |
|
649 |
+ Logger.error(e.getMessage()); |
|
650 |
+ } |
|
651 |
+ return internalServerError(); |
|
652 |
+ } |
|
653 |
+ |
|
632 | 654 |
private static void sendTransferRequestMail(ProjectTransfer pt) { |
633 | 655 |
HtmlEmail email = new HtmlEmail(); |
634 | 656 |
try { |
--- app/models/Project.java
+++ app/models/Project.java
... | ... | @@ -558,6 +558,20 @@ |
558 | 558 |
} |
559 | 559 |
} |
560 | 560 |
|
561 |
+ public void changeVCS() throws Exception { |
|
562 |
+ if(this.forkingProjects != null) { |
|
563 |
+ for(Project fork : forkingProjects) { |
|
564 |
+ fork.originalProject = null; |
|
565 |
+ fork.update(); |
|
566 |
+ } |
|
567 |
+ } |
|
568 |
+ |
|
569 |
+ RepositoryService.deleteRepository(this); |
|
570 |
+ this.vcs = nextVCS(); |
|
571 |
+ RepositoryService.getRepository(this).create(); |
|
572 |
+ this.update(); |
|
573 |
+ } |
|
574 |
+ |
|
561 | 575 |
public enum State { |
562 | 576 |
PUBLIC, PRIVATE, ALL |
563 | 577 |
} |
... | ... | @@ -750,4 +764,12 @@ |
750 | 764 |
public boolean isPrivate() { |
751 | 765 |
return projectScope == ProjectScope.PRIVATE; |
752 | 766 |
} |
767 |
+ |
|
768 |
+ public String nextVCS() { |
|
769 |
+ if(this.vcs.equals(RepositoryService.VCS_GIT)) { |
|
770 |
+ return RepositoryService.VCS_SUBVERSION; |
|
771 |
+ } else { |
|
772 |
+ return RepositoryService.VCS_GIT; |
|
773 |
+ } |
|
774 |
+ } |
|
753 | 775 |
} |
+++ app/views/project/change_vcs.scala.html
... | ... | @@ -0,0 +1,85 @@ |
1 | +@** | |
2 | +* Yobi, Project Hosting SW | |
3 | +* | |
4 | +* Copyright 2014 NAVER Corp. | |
5 | +* http://yobi.io | |
6 | +* | |
7 | +* @Author Keesun | |
8 | +* | |
9 | +* Licensed under the Apache License, Version 2.0 (the "License"); | |
10 | +* you may not use this file except in compliance with the License. | |
11 | +* You may obtain a copy of the License at | |
12 | +* | |
13 | +* http://www.apache.org/licenses/LICENSE-2.0 | |
14 | +* | |
15 | +* Unless required by applicable law or agreed to in writing, software | |
16 | +* distributed under the License is distributed on an "AS IS" BASIS, | |
17 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
18 | +* See the License for the specific language governing permissions and | |
19 | +* limitations under the License. | |
20 | +**@ | |
21 | +@(message: String)(projectForm: Form[Project], project:Project) | |
22 | + | |
23 | +@import helper._ | |
24 | +@import utils.TemplateHelper._ | |
25 | + | |
26 | +@projectLayout(message, project, utils.MenuType.PROJECT_SETTING) { | |
27 | +@projectMenu(project, utils.MenuType.PROJECT_SETTING, "") | |
28 | +<div class="page-wrap-outer"> | |
29 | + <div class="project-page-wrap"> | |
30 | + @partial_settingmenu(project) | |
31 | + <div class="bubble-wrap gray wp"> | |
32 | + <div class="row-fluid"> | |
33 | + <div class="cu-label">@Messages("project.changeVCS.current.vcs")</div> | |
34 | + <div class="cu-desc"> | |
35 | + <p> | |
36 | + @project.vcs | |
37 | + </p> | |
38 | + </div> | |
39 | + </div> | |
40 | + <div class="row-fluid"> | |
41 | + <div class="cu-label">@Messages("project.changeVCS")</div> | |
42 | + <div class="cu-desc"> | |
43 | + <ul> | |
44 | + <li class="notice"><strong>@Messages("project.changeVCS.description1", project.nextVCS)</strong></li> | |
45 | + <li class="notice"><strong>@Messages("project.changeVCS.description2")</strong></li> | |
46 | + </ul> | |
47 | + <p> | |
48 | + <input id="acceptChangeVCS" type="checkbox" class="checkbox" autocomplete="off"> | |
49 | + <label for="acceptChangeVCS" class="bg-checkbox label-agreement">@Messages("project.changeVCS.accept")</label> | |
50 | + </p> | |
51 | + </div> | |
52 | + </div> | |
53 | + </div> | |
54 | + <div class="box-wrap bottom"> | |
55 | + <a id="btnChangeVCS" href="#alertChangeVCS" class="ybtn ybtn-danger" data-toggle="modal"> | |
56 | + <i class="yobicon-database"></i> @Messages("project.changeVCS.this") | |
57 | + </a> | |
58 | + </div> | |
59 | + | |
60 | + @** Confirm to transfer project **@ | |
61 | + <div id="alertChangeVCS" class="modal hide"> | |
62 | + <div class="modal-header"> | |
63 | + <button type="button" class="close" data-dismiss="modal">×</button> | |
64 | + <h3>@Messages("project.changeVCS.requestion", project.nextVCS)</h3> | |
65 | + </div> | |
66 | + <div class="modal-body"> | |
67 | + <p>@Messages("project.changeVCS.description2")</p> | |
68 | + <p>@Messages("project.changeVCS.reaccept")</p> | |
69 | + </div> | |
70 | + <div class="modal-footer"> | |
71 | + <button id="btnChangeVCSExec" type="button" class="ybtn ybtn-danger">@Messages("button.yes")</button> | |
72 | + <button type="button" class="ybtn" data-dismiss="modal">@Messages("button.no")</button> | |
73 | + </div> | |
74 | + </div> | |
75 | + @** // -- // **@ | |
76 | + </div> | |
77 | +</div> | |
78 | +<script type="text/javascript"> | |
79 | + $(document).ready(function(){ | |
80 | + $yobi.loadModule("project.ChangeVCS", { | |
81 | + "sTransferURL": "@routes.ProjectApp.changeVCS(project.owner, project.name)" | |
82 | + }); | |
83 | + }); | |
84 | +</script> | |
85 | +} |
--- conf/messages
+++ conf/messages
... | ... | @@ -445,6 +445,16 @@ |
445 | 445 |
post.write = Write |
446 | 446 |
project.all = ALL |
447 | 447 |
project.belongsToMe = Project members. |
448 |
+project.changeVCS = Repository Type Change |
|
449 |
+project.changeVCS.accept = I agree with changing the repository type. |
|
450 |
+project.changeVCS.alert = You should agree with changing the repository type. |
|
451 |
+project.changeVCS.current.vcs = Current Repository Type |
|
452 |
+project.changeVCS.description1 = Changing the repository to {0}. |
|
453 |
+project.changeVCS.description2 = If change the repository, All code and history will be deleted. |
|
454 |
+project.changeVCS.error = Cann''t Repository Type |
|
455 |
+project.changeVCS.requestion = Do you want to change the repository to {0}? |
|
456 |
+project.changeVCS.reaccept = Are you sure? |
|
457 |
+project.changeVCS.this = Change Repository Type. |
|
448 | 458 |
project.codeUpdate = Latest code update |
449 | 459 |
project.create = Create a project |
450 | 460 |
project.created = Created date |
... | ... | @@ -454,7 +464,7 @@ |
454 | 464 |
project.dashboard.openIssuesByAssignee = Open issues: by assignee |
455 | 465 |
project.dashboard.openIssuesByLabel = Open issues: by label |
456 | 466 |
project.dashboard.openIssuesByMilestone = Open issues: by milestone |
457 |
-project.dashboard.pullRequests = Open pull requests |
|
467 |
+project.dashboard.pullRequests = pen pull requests |
|
458 | 468 |
project.default.group.member = Participating projects as member |
459 | 469 |
project.default.group.watching = Watching projects |
460 | 470 |
project.defaultBranch.placeholder = Enter default branch |
... | ... | @@ -780,6 +790,7 @@ |
780 | 790 |
title.post.notExistingPage = Page not found |
781 | 791 |
title.privateProject = Private repositories |
782 | 792 |
title.project = Project |
793 |
+title.projectChangeVCS= Repository Change |
|
783 | 794 |
title.projectDashboard = Project dashboard |
784 | 795 |
title.projectDelete = Delete project |
785 | 796 |
title.projectHome = Project home |
--- conf/messages.ko
+++ conf/messages.ko
... | ... | @@ -446,6 +446,16 @@ |
446 | 446 |
post.write = 글쓰기 |
447 | 447 |
project.all = 모든 |
448 | 448 |
project.belongsToMe = 프로젝트 멤버 |
449 |
+project.changeVCS = 코드 저장소 타입 변경 |
|
450 |
+project.changeVCS.accept = 코드 저장소 타입을 변경하는데 동의합니다. |
|
451 |
+project.changeVCS.alert = 코드 저장소 타입 변경에 동의해야 합니다. |
|
452 |
+project.changeVCS.current.vcs = 현재 사용중인 코드 저장소 타입 |
|
453 |
+project.changeVCS.description1 = 코드 저장소 타입을 {0}으로 변경합니다. |
|
454 |
+project.changeVCS.description2 = 코드 저장소 타입을 변경하면 현재 코드와 변경내역을 삭제합니다. |
|
455 |
+project.changeVCS.error = 코드 저장소를 변경할 수 없습니다. |
|
456 |
+project.changeVCS.requestion = 코드 저장소 타입을 {0}으로 변경하시겠습니까? |
|
457 |
+project.changeVCS.reaccept = 정말로 변경하시겠습니까? |
|
458 |
+project.changeVCS.this = 코드 저장소 타입을 변경합니다. |
|
449 | 459 |
project.codeUpdate = 마지막 코드 업데이트 |
450 | 460 |
project.create = 프로젝트 생성 |
451 | 461 |
project.created = 생성일 |
... | ... | @@ -570,7 +580,7 @@ |
570 | 580 |
project.transfer.this = 프로젝트를 이관합니다. |
571 | 581 |
project.unwatch = 그만 지켜보기 |
572 | 582 |
project.unwatch.start = 프로젝트를 더 이상 지켜보지 않습니다 |
573 |
-project.vcs = 코드 관리 시스템 |
|
583 |
+project.vcs = 코드 저장소 타입 |
|
574 | 584 |
project.watch = 지켜보기 |
575 | 585 |
project.watching = 지켜보기 중 |
576 | 586 |
project.you.are.not.watching = {0} 프로젝트를 지켜보고 있지 않습니다. |
... | ... | @@ -781,6 +791,7 @@ |
781 | 791 |
title.post.notExistingPage = 페이지를 찾지 못했습니다. |
782 | 792 |
title.privateProject = 비공개 프로젝트 |
783 | 793 |
title.project = 프로젝트 |
794 |
+title.projectChangeVCS= 코드 저장소 타입 변경 |
|
784 | 795 |
title.projectDashboard = 프로젝트 대시보드 |
785 | 796 |
title.projectDelete = 프로젝트 삭제 |
786 | 797 |
title.projectHome = 홈 |
--- conf/routes
+++ conf/routes
... | ... | @@ -140,6 +140,8 @@ |
140 | 140 |
PUT /:user/:project/transfer controllers.ProjectApp.transferProject(user, project) |
141 | 141 |
GET /project/transfer/:id/:key controllers.ProjectApp.acceptTransfer(id: Long, key) |
142 | 142 |
GET /:user/:project/search controllers.SearchApp.searchInAProject(user, project) |
143 |
+GET /:user/:project/changeVCS controllers.ProjectApp.changeVCSForm(user, project) |
|
144 |
+POST /:user/:project/changeVCS controllers.ProjectApp.changeVCS(user, project) |
|
143 | 145 |
|
144 | 146 |
# Project Review Menu |
145 | 147 |
GET /:user/:project/reviews controllers.ReviewThreadApp.reviewThreads(user, project) |
+++ public/javascripts/service/yobi.project.ChangeVCS.js
... | ... | @@ -0,0 +1,85 @@ |
1 | +/** | |
2 | + * Yobi, Project Hosting SW | |
3 | + * | |
4 | + * Copyright 2014 NAVER Corp. | |
5 | + * http://yobi.io | |
6 | + * | |
7 | + * @Author Keesun Baik | |
8 | + * | |
9 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
10 | + * you may not use this file except in compliance with the License. | |
11 | + * You may obtain a copy of the License at | |
12 | + * | |
13 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
14 | + * | |
15 | + * Unless required by applicable law or agreed to in writing, software | |
16 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
17 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
18 | + * See the License for the specific language governing permissions and | |
19 | + * limitations under the License. | |
20 | + */ | |
21 | +(function(ns){ | |
22 | + | |
23 | + var NO_CONTENT = 204; | |
24 | + var oNS = $yobi.createNamespace(ns); | |
25 | + oNS.container[oNS.name] = function(options){ | |
26 | + | |
27 | + var elements = {}; | |
28 | + | |
29 | + /** | |
30 | + * initialize | |
31 | + */ | |
32 | + function _init(options){ | |
33 | + _initElement(options); | |
34 | + _attachEvent(options); | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * initialize element variables | |
39 | + */ | |
40 | + function _initElement(optinos){ | |
41 | + elements.acceptChangeVCS = $("#acceptChangeVCS"); | |
42 | + elements.btnChangeVCS = $("#btnChangeVCS"); | |
43 | + elements.btnChangeVCSExec = $("#btnChangeVCSExec"); | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * attach event handlers | |
48 | + */ | |
49 | + function _attachEvent(options){ | |
50 | + elements.btnChangeVCS.on('click', showConfirmPopup); | |
51 | + elements.btnChangeVCSExec.on("click", changeVCS); | |
52 | + } | |
53 | + | |
54 | + function showConfirmPopup() { | |
55 | + if(elements.acceptChangeVCS.is(":checked") === false){ | |
56 | + $yobi.alert(Messages("project.changeVCS.alert")); | |
57 | + return false; | |
58 | + } | |
59 | + return true; | |
60 | + } | |
61 | + | |
62 | + function changeVCS() { | |
63 | + $.ajax(options.sTransferURL, { | |
64 | + "method" : "post", | |
65 | + "success": function(res, status, xhr){ | |
66 | + // default action below: | |
67 | + var location = xhr.getResponseHeader("Location"); | |
68 | + | |
69 | + if(xhr.status === NO_CONTENT && location){ | |
70 | + document.location.href = location; | |
71 | + } else { | |
72 | + document.location.reload(); | |
73 | + } | |
74 | + }, | |
75 | + "error": function(){ | |
76 | + $("#alertChangeVCS").modal("hide"); | |
77 | + $yobi.alert(Messages("project.changeVCS.error")); | |
78 | + } | |
79 | + }); | |
80 | + } | |
81 | + | |
82 | + _init(options || {}); | |
83 | + }; | |
84 | + | |
85 | +})("yobi.project.ChangeVCS"); |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?