Skip to content
This repository was archived by the owner on Mar 5, 2020. It is now read-only.

Commit 3c78c34

Browse files
committed
Fixs
1 parent 6230f3e commit 3c78c34

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

src/main/java/pl/simplemethod/codebin/githubOauth/GithubClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ protected org.json.JSONObject getCloneReposMinimalInfo(String token, String user
4949
body.put("html_url", jsonObject.get("html_url"));
5050
body.put("description", jsonObject.get("description"));
5151
body.put("language", jsonObject.get("language"));
52+
body.put("id", jsonObject.get("id"));
5253
try {
5354
if (!url.isEmpty()) {
5455
String error = (String) jsonObject.get("error");

src/main/java/pl/simplemethod/codebin/model/Containers.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Containers implements Serializable {
1111
@Id
1212
@GeneratedValue(strategy = GenerationType.IDENTITY)
1313
@Column(name = "id")
14-
private Integer id;
14+
private Long id;
1515

1616
@Column(unique = true, nullable = false)
1717
private String name;
@@ -68,11 +68,11 @@ public void setShareUrl(String shareUrl) {
6868
}
6969

7070

71-
public Integer getId() {
71+
public Long getId() {
7272
return id;
7373
}
7474

75-
public void setId(Integer id) {
75+
public void setId(Long id) {
7676
this.id = id;
7777
}
7878

src/main/java/pl/simplemethod/codebin/repository/ContainersRepository.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313
@Transactional
1414
public interface ContainersRepository extends JpaRepository<Containers, Long> {
1515

16-
Containers getFirstById(Integer id);
16+
Containers removeById(Long id);
17+
18+
Containers deleteByName(String name);
19+
20+
Containers removeByName(String name);
21+
22+
Containers deleteContainersByName(String name);
23+
24+
Containers getFirstById(Long id);
1725

1826
Containers getFirstByIdDocker(String dockerId);
1927

src/main/java/pl/simplemethod/codebin/srv/SrvRestController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ ResponseEntity deleteContainer(@PathVariable(value = "ID") String containerId) {
255255
HttpHeaders headers = new HttpHeaders();
256256
headers.setContentType(MediaType.APPLICATION_JSON);
257257
org.json.JSONObject response = srvClient.deleteContainer(containerId);
258+
259+
// TODO: 02.06.2019 Poprawić usuwanie
260+
261+
258262
return new ResponseEntity<>(response.toString(), headers, HttpStatus.valueOf(response.getInt("status")));
259263
}
260264

src/main/resources/public/app.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,36 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
6262
$scope.containersId = response.data.idDocker;
6363
$scope.hostPorts = response.data.hostPorts;
6464

65+
$scope.dockerRestart = function(msg)
66+
{
67+
console.log("Takbyło:"+$scope.containersId);
68+
$http({
69+
url: 'http://127.0.0.1/srv/container/'+$scope.containersId+'/restart',
70+
method: 'POST'
71+
}).then(
72+
function (response) {
73+
console.log(response)
74+
},
75+
function (response) {
76+
console.error(response)
77+
}
78+
);
79+
};
80+
81+
$scope.dockerRemove = function()
82+
{
83+
$http({
84+
url: 'http://127.0.0.1/srv/container/'+$scope.containersId+'/delete',
85+
method: 'DELETE'
86+
}).then(
87+
function (response) {
88+
},
89+
function (response) {
90+
$scope.passCheck = false;
91+
}
92+
);
93+
};
94+
6595
$http({
6696
url: 'http://127.0.0.1/srv/container/' + $scope.containersId + '/logs',
6797
method: 'GET'
@@ -94,6 +124,7 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
94124
);
95125

96126

127+
97128
}]);
98129

99130

src/main/resources/public/dashboard/container.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ <h6 class="m-0">General view</h6>
5353
<a class="ml-auto" href="http://127.0.0.1/share/{{shareStatus}}">Share link</a></span>
5454
<span ng-if="shareStatus === null" class="d-flex mb-2"><i
5555
class="material-icons mr-1">visibility</i><strong
56-
class="mr-1">Visibility:</strong> <strong class="text-danger"><a href=""
57-
data-toggle="modal"
58-
data-target="#local">Local access</a> </strong></span>
56+
class="mr-1">Visibility:</strong> <strong class="text-danger"><a href="" data-toggle="modal" data-target="#local">Local access</a> </strong></span>
5957
<span class="d-flex mb-2"><i class="material-icons mr-1">calendar_today</i><strong class="mr-1">Creation time:</strong> <mydate>{{creationTime * 1000 | date:'dd-MM-yyyy HH:mm:ss'}}</mydate> </span>
6058

6159
<span class="d-flex mb-2">
62-
<button type="button" class="mb-2 btn btn-danger mr-2">Remove container</button><button
63-
type="button" class=" ml-auto mb-2 btn btn-warning mr-2">Restart container</button>
60+
<button type="button" class="mb-2 btn btn-danger mr-2" ng-click="dockerRemove()">Remove container</button>
61+
<button type="button" class=" ml-auto mb-2 btn btn-warning mr-2" ng-click="dockerRestart()">Restart container</button>
6462
</span>
6563
</ul>
6664
</div>

0 commit comments

Comments
 (0)