This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from Callek/issue259
- Loading branch information
Showing
4 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<div ng-app="slaveloan" ng-controller="slaveloanController"> | ||
<h2>New Loan</h2> | ||
|
||
<form name="newLoanForm"> | ||
<fieldset><legend>Who You Are</legend> | ||
<div class="form-group"> | ||
<label for="ldap_email" class="control-label col-sm-2">Full LDAP Username: </label> | ||
<div class="col-sm-4"> | ||
<input type="text" ng-model="newLoan.ldap_email" name="ldap_email" class="form-control" disabled /> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="bugzilla_email" class="control-label col-sm-2">Your Bugzilla E-mail: </label> | ||
<div class="col-sm-4"> | ||
<input type="text" name="bugzilla_email" ng-model="newLoan.bugzilla_email" class="form-control" placeholder="{{user}}" /> | ||
</div> | ||
</div> | ||
</fieldset> | ||
|
||
<fieldset><legend>Slave Info</legend> | ||
<div class="form-group"> | ||
<label for="slave2loan" class="control-label col-sm-2">Slave to loan: </label> | ||
<div class="col-sm-3"> | ||
<select name="slave2loan" class="form-control" ng-model="newLoan.slavetype" ng-required="true"> | ||
<option></option> | ||
<option ng-repeat="(key, value) in machineTypes">{{key}}</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="alert alert-info col-xs-12" role="alert"> | ||
If you don't know what machine you need either ping us for help in | ||
<a href="irc://irc.mozilla.org/#releng">#releng | ||
<span class="glyphicon glyphicon-new-window"></span></a> | ||
or file a <a href="http://bugzil.la/foo">bug | ||
<span class="glyphicon glyphicon-new-window"></span></a> instead, | ||
</div> | ||
<fieldset> | ||
|
||
<legend>Complete</legend> | ||
<button class="btn btn-primary btn-block" ng-disabled="addSlaveForm.$invalid" ng-click="submitLoanRequest()">Submit Loan Request</button> | ||
</fieldset> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
angular.module('slaveloan', ['relengapi', 'initial_data']); | ||
|
||
angular.module('slaveloan').controller('slaveloanController', | ||
function($scope, restapi, initial_data) { | ||
$scope.machineTypes = initial_data.machine_types; | ||
$scope.user = initial_data.user.authenticated_email; | ||
$scope.loanRequestUrl = initial_data.loan_request_url; | ||
|
||
$scope.newLoan = { | ||
ldap_email: $scope.user, | ||
bugzilla_email: '', | ||
slavetype: '', | ||
}; | ||
|
||
$scope.origNewLoan = angular.copy($scope.newLoan); | ||
|
||
$scope.submitLoanRequest = function() { | ||
var ldap = $scope.newLoan.ldap_email; | ||
var bugzilla = $scope.newLoan.bugzilla_email; | ||
var slavetype = $scope.newLoan.slavetype; | ||
|
||
restapi({ | ||
url: $scope.loanRequestUrl, | ||
method: 'POST', | ||
headers: {'Content-Type': 'application/json; charset=utf-8'}, | ||
data: JSON.stringify({ | ||
ldap_email: ldap, | ||
bugzilla_email: bugzilla, | ||
requested_slavetype: slavetype, | ||
}), | ||
while: 'Submitting Loan Request', | ||
}).then(function(response) { | ||
if (response.data.result) { | ||
var r = response.data.result; | ||
$scope.newLoan = angular.copy($scope.origNewLoan); | ||
$scope.newLoanForm.$setPristine(); | ||
alertify.success("Loan id " + r.id + " successfully filed") | ||
} else { | ||
alertify.error("Error submitting loan"); | ||
} | ||
}); | ||
}; | ||
|
||
}); |
23 changes: 0 additions & 23 deletions
23
relengapi/blueprints/slaveloan/templates/slaveloan_root.html
This file was deleted.
Oops, something went wrong.