Skip to content

Commit

Permalink
Merge pull request #2823 from subutai-io/issue-2821
Browse files Browse the repository at this point in the history
Issue 2821
  • Loading branch information
Dilshat authored Mar 12, 2019
2 parents e3e721a + ed056bd commit ae920b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function ContainerViewCtrl($scope, $rootScope, environmentService, SweetAlert, D
vm.rollbackSnapshot = rollbackSnapshot;
vm.removeSnapshot = removeSnapshot;
vm.addSnapshot = addSnapshot;
vm.trimPrefix = trimPrefix;
vm.isAdmin = isAdmin;

environmentService.getContainersType().success(function (data) {
Expand Down Expand Up @@ -454,6 +455,14 @@ function ContainerViewCtrl($scope, $rootScope, environmentService, SweetAlert, D
}

function addSnapshot(snapshot){

snapshot.label = snapshot.label.trim()
if ( /^env-/i.test(snapshot.label)){
SweetAlert.swal("Invalid snapshot name", "The snapshot name must not start with \"env-\"", "error");

return;
}

var previousWindowKeyDown = window.onkeydown;
SweetAlert.swal({
title: "Stop container?",
Expand Down Expand Up @@ -484,6 +493,10 @@ function ContainerViewCtrl($scope, $rootScope, environmentService, SweetAlert, D
});
}

function trimPrefix(label){
return label.replace(/^(env-)/i,"");
}


var timeout;
vm.uploadPercent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<td>Remove</td>
</tr>
<tr ng-repeat="(idx, snapshot) in containerViewCtrl.snapshots">
<td>{{ snapshot.label }}</td>
<td>{{ containerViewCtrl.trimPrefix(snapshot.label); }}</td>
<td>{{ snapshot.createdTime }}</td>
<td>
<a href
Expand Down

0 comments on commit ae920b9

Please sign in to comment.