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

Commit ea5df71

Browse files
committed
Correcting the code, adding a button when creating a container
1 parent 40bd0a7 commit ea5df71

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

src/main/resources/public/app.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ angular.module("CombineModule", ["mainApp", "dashboard"]);
4444

4545
app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope', '$http', function ($filter, $routeParams, $scope, $http) {
4646
$scope.supportedPlatforms = ["Java", "C", "C++", "Python", "HTML", "JavaScript", "CSS"];
47+
$scope.referId=$routeParams.id;
4748
$scope.progressBar=0;
4849
$http({
4950
url: 'http://127.0.0.1/github/user/repos/' + $routeParams.id,
@@ -114,8 +115,9 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
114115
console.log("Nazwa dokeru:" + $scope.id);
115116
console.log("Ilość pamięci ram: " + $scope.rammemory + " i dysku: " + $scope.diskquota);
116117
$scope.progressBar=90;
118+
117119
$http({
118-
url: 'http://127.0.0.1/srv/container/create3',
120+
url: 'http://127.0.0.1/srv/container/create',
119121
method: 'POST',
120122
params: {
121123
dockerimage: $scope.dockerImages,
@@ -131,7 +133,7 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
131133
function (create) {
132134
console.log(create.data);
133135
$scope.progressBar=100;
134-
136+
$scope.finish=1;
135137
},
136138
function (create) {
137139
$scope.errors= "Problem with creating a container";
@@ -204,7 +206,7 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
204206
method: 'DELETE'
205207
}).then(
206208
function (response) {
207-
$window.location.href="/";
209+
window.location = "/";
208210
},
209211
function (response) {
210212
$scope.errors= "Problem with deleteing a container";
@@ -236,6 +238,7 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
236238
},
237239
function (response) {
238240
$scope.errors= "Fatal error";
241+
window.location = "/";
239242
}
240243
);
241244
}]);

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ <h6 class="m-0">General view</h6>
7575
class="mr-1">Creation time:</strong> <mydate>{{creationTime * 1000 | date:'dd-MM-yyyy HH:mm:ss'}}</mydate> </span>
7676

7777
<span class="d-flex mb-2">
78-
<button type="button" class="mb-2 btn btn-danger mr-2" data-toggle="modal" data-target="#remove">Remove container</button>
78+
<button type="button" class="mb-2 btn btn-danger mr-2" data-toggle="modal"
79+
data-target="#remove">Remove container</button>
7980
<button type="button" class=" ml-auto mb-2 btn btn-warning mr-2" ng-click="dockerRestart()">Restart container</button>
8081
</span>
8182
</ul>
@@ -87,7 +88,7 @@ <h6 class="m-0">General view</h6>
8788
<h6 class="m-0">Advertising</h6>
8889
</div>
8990
<div class="card-body p-0">
90-
<div style="text-align: center"><img src="https://i.imgur.com/8jVsNBp.png"> </div>
91+
<div style="text-align: center"><img src="https://i.imgur.com/8jVsNBp.png"></div>
9192
</div>
9293
</div>
9394
</div>
@@ -141,8 +142,10 @@ <h5 class="modal-title">Warning!</h5>
141142
</button>
142143
</div>
143144
<div class="modal-body">
144-
<div style="text-align: center"> <h5>Are you sure about delete the container?</h5>
145-
<button type="button" class="mb-2 btn btn-danger mr-2" ng-click="dockerRemove()">Remove container</button></div>
145+
<div style="text-align: center"><h5>Are you sure about delete the container?</h5>
146+
<button type="button" class="mb-2 btn btn-danger mr-2" ng-click="dockerRemove()">Remove container
147+
</button>
148+
</div>
146149
</div>
147150
<div class="modal-footer">
148151
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h5 class="card-title">{{name}}</h5>
2424
<div class="col-lg-12">
2525
<div class="card card-small card-post mb-4">
2626
<div class="card-body">
27-
<h3>Basic information</h3>
27+
<h3>Basic information</h3>
2828
<div class="row">
2929
<hr>
3030
<div class="col">
@@ -43,16 +43,22 @@ <h3>Basic information</h3>
4343
<hr>
4444
<h5><b>Installation process:</b></h5>
4545

46+
<div style="text-align:center;" ng-if="finish">
47+
<a href="/dashboard.html#!/containers/{{referId}}"><button type="button" class="mb-2 btn btn-primary mr-2">Go to the container </button> </a>
48+
</div>
49+
4650
<div ng-if="errors">
4751
<h5 style="text-align:center; color: #ff2600"><b>{{errors}}</b></h5>
4852
</div>
49-
<span id="percentage">({{progressBar}}%)</span>
50-
<div class="progress progress-sm mb-3">
51-
<div id="" class="progress-bar" role="progressbar" ng-style="{width : ( progressBar + '%' ) }" aria-valuenow="{{progressBar}}" aria-valuemin="0" aria-valuemax="100"></div>
52-
</div>
53-
<div style="text-align:center;" ng-if="progressBar==100">
54-
<button type="button" onclick="location.href='/dashboard.html#!/containers/{{id}}'" class="mb-2 btn btn-primary mr-2">Go to the container</button>
53+
<div ng-if="!finish">
54+
<span id="percentage">({{progressBar}}%)</span>
55+
<div class="progress progress-sm mb-3">
56+
<div id="" class="progress-bar" role="progressbar" ng-style="{width : ( progressBar + '%' ) }"
57+
aria-valuenow="{{progressBar}}" aria-valuemin="0" aria-valuemax="100"></div>
58+
</div>
5559
</div>
60+
61+
5662
</div>
5763
</div>
5864
</div>

0 commit comments

Comments
 (0)