Remove agent management UI

This commit is contained in:
Ben Schumacher 2015-05-19 16:34:56 -06:00
parent 8d5910862e
commit 01649db5a5
6 changed files with 0 additions and 104 deletions

View file

@ -22,12 +22,10 @@
<!-- main javascript application --> <!-- main javascript application -->
<script src="/static/scripts/term.js"></script> <script src="/static/scripts/term.js"></script>
<script src="/static/scripts/drone.js"></script> <script src="/static/scripts/drone.js"></script>
<script src="/static/scripts/controllers/agents.js"></script>
<script src="/static/scripts/controllers/repos.js"></script> <script src="/static/scripts/controllers/repos.js"></script>
<script src="/static/scripts/controllers/builds.js"></script> <script src="/static/scripts/controllers/builds.js"></script>
<script src="/static/scripts/controllers/users.js"></script> <script src="/static/scripts/controllers/users.js"></script>
<script src="/static/scripts/services/agents.js"></script>
<script src="/static/scripts/services/repos.js"></script> <script src="/static/scripts/services/repos.js"></script>
<script src="/static/scripts/services/builds.js"></script> <script src="/static/scripts/services/builds.js"></script>
<script src="/static/scripts/services/users.js"></script> <script src="/static/scripts/services/users.js"></script>

View file

@ -1,37 +0,0 @@
(function () {
function AgentsCtrl($scope, $window, users, agents) {
// this is the address that agents should connect with.
$scope.addr = $window.location.origin;
// Gets the currently authenticated user
users.getCached().then(function(payload){
$scope.user = payload.data;
});
// Generages a remote agents.
agents.getAgents().then(function(payload){
$scope.agents = payload.data;
});
$scope.onDelete = function(agent) {
console.log("delete agent", agent)
agents.deleteAgent(agent).then(function(payload){
var index = $scope.agents.indexOf(agent);
$scope.agents.splice(index, 1);
});
}
$scope.newAgent={address: ""};
$scope.onAdd = function(agent) {
agents.postAgent(agent).then(function(payload){
$scope.agents.push(payload.data);
$scope.newAgent={address: ""};
});
}
}
angular
.module('drone')
.controller('AgentsCtrl', AgentsCtrl);
})();

View file

@ -62,11 +62,6 @@
controller: 'UserCtrl', controller: 'UserCtrl',
resolve: resolveUser resolve: resolveUser
}) })
.when('/agents', {
templateUrl: '/static/scripts/views/agents.html',
controller: 'AgentsCtrl',
resolve: resolveUser
})
.when('/users', { .when('/users', {
templateUrl: '/static/scripts/views/users.html', templateUrl: '/static/scripts/views/users.html',
controller: 'UsersCtrl', controller: 'UsersCtrl',

View file

@ -1,31 +0,0 @@
'use strict';
(function () {
/**
* The Agent provides access to build agent
* data and management using REST API calls.
*/
function AgentService($http) {
/**
* Gets an agent list.
*/
this.getAgents = function() {
return $http.get('/api/agents');
};
this.deleteAgent = function(agent) {
return $http.delete('/api/agents/'+agent.id);
};
this.postAgent = function(agent) {
return $http.post('/api/agents', agent);
};
}
angular
.module('drone')
.service('agents', AgentService);
})();

View file

@ -1,28 +0,0 @@
<h1>{{ user.login }}</h1>
<a href="/">Back</a>
<input type="text" ng-model="newAgent.address" />
<button ng-click="onAdd(newAgent)">Add</button>
<table border="1">
<thead>
<tr>
<th>Address</th>
<th>Token</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="agent in agents | orderBy:'-address'">
<td>{{ agent.address }}</td>
<td>{{ agent.token }}</td>
<td><button ng-click="onDelete(agent)">Delete</button>
</tr>
</tbody>
</table>
<pre>
docker run -d drone/drone-agent --addr={{ addr }} --token={{ token }}
</pre>

View file

@ -3,7 +3,6 @@
<a href="/new">New</a> <a href="/new">New</a>
<a href="/profile">Settings</a> <a href="/profile">Settings</a>
<a href="/users" ng-if="user.admin">User Management</a> <a href="/users" ng-if="user.admin">User Management</a>
<a href="/agents" ng-if="user.admin">Agent Management</a>
<table border="1"> <table border="1">
<thead> <thead>