Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Edit docker-compose file for existing services #107
Browse files Browse the repository at this point in the history
  • Loading branch information
francescou committed May 17, 2018
1 parent a0941d3 commit 186bdf1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions static/scripts/app.js
Expand Up @@ -35,6 +35,10 @@ angular
templateUrl: 'views/create.html',
controller: 'CreateCtrl'
})
.when('/edit/:from', {
templateUrl: 'views/create.html',
controller: 'CreateCtrl'
})
.otherwise({
redirectTo: '/'
});
Expand Down
20 changes: 16 additions & 4 deletions static/scripts/controllers/create.js
Expand Up @@ -10,11 +10,23 @@
angular.module('composeUiApp')
.controller('CreateCtrl', function ($scope, $routeParams, $resource, $location) {

var isEdit = $location.path().indexOf('/edit/') === 0;

if (isEdit) {
$scope.name = $routeParams.from;
$scope.isEdit = true;
}

var Projects = $resource('api/v1/projects', null, {
'createProject': {
url: 'api/v1/create-project',
method: 'POST'

'createProject' : {
url: 'api/v1/create-project',
method: 'POST'
},
'updateProject': {
url: 'api/v1/update-project',
method: 'PUT'
},
'loadProject': {
url: 'api/v1/projects/yml/:id',
method: 'GET'
Expand All @@ -37,7 +49,7 @@ angular.module('composeUiApp')
$scope.createProject = function (name, yml, env) {

//TODO: check if name is alphanumeric
Projects.createProject({
Projects[isEdit ? 'updateProject' : 'createProject']({
name: name,
yml: yml,
env: env
Expand Down
6 changes: 3 additions & 3 deletions static/views/create.html
@@ -1,5 +1,5 @@

<h3>Create new project</h3>
<h3>{{isEdit ? "Edit project" : "Create new project"}}</h3>

<div class="row">
<div class="col-md-8 col-md-offset-2">
Expand Down Expand Up @@ -38,7 +38,7 @@ <h3>Create new project</h3>
<div class="panel-heading">project metadata</div>
<div class="panel-body project-wizard">
<form class="form-horizontal" ng-submit="createProject(name, yml, env)">
<div class="form-group">
<div ng-hide="isEdit" class="form-group">
<label for="projectName">Name</label>
<input type="text" ng-model="name" class="form-control" id="projectName" placeholder="Project Name" required>
</div>
Expand All @@ -54,7 +54,7 @@ <h3>Create new project</h3>
<textarea class="form-control" ng-model="env" id="env" rows="20"></textarea>

</div>
<button type="submit" class="btn btn-primary">Create new project</button>
<button type="submit" class="btn btn-primary">{{isEdit ? "Update project" : "Create new project"}}</button>
</form>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion static/views/project-detail.html
@@ -1,7 +1,7 @@
<h3>{{projectId}}
<button class="btn btn-sm btn-default" ng-hide="yml" ng-click="details()">details</button>
<a class="btn btn-sm btn-default" ng-hide="yml" ng-href="#/create/{{projectId}}">clone</a>

<a class="btn btn-sm btn-default" ng-hide="yml" ng-href="#/edit/{{projectId}}">edit</a>
</h3>

<div class="row" ng-show="yml">
Expand Down

0 comments on commit 186bdf1

Please sign in to comment.