- project - Show graphs - Added !
This commit is contained in:
parent
7d6e78fa5a
commit
e38cecb7e4
5 changed files with 152 additions and 87 deletions
|
@ -1,7 +1,6 @@
|
|||
angular.module('SeHub')
|
||||
.controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||
{
|
||||
$scope.isEditPressed = false;
|
||||
$scope.loadingData = true;
|
||||
$scope.myProjectsEmpty = true;
|
||||
$scope.user = $scope.$parent.user;
|
||||
|
@ -52,18 +51,5 @@ angular.module('SeHub')
|
|||
};
|
||||
$scope.arrayHolder.push(tempArr);
|
||||
}
|
||||
|
||||
$scope.editPressed = function()
|
||||
{
|
||||
$scope.isEditPressed = true;
|
||||
console.log("EditPressed " + $scope.isEditPressed);
|
||||
}
|
||||
$scope.removeProject = function()
|
||||
{
|
||||
console.log("Project has been removed!");
|
||||
}
|
||||
|
||||
|
||||
$scope.displayMyProjects(); // Will display all my projects
|
||||
|
||||
}]);
|
|
@ -2,6 +2,46 @@ angular.module('SeHub')
|
|||
.controller('projectController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope',
|
||||
function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||
{
|
||||
var token = $cookies['com.sehub.www'];
|
||||
var projectId = $routeParams.projectId;
|
||||
$scope.isEditPressed = false;
|
||||
$scope.user = $scope.$parent.user;
|
||||
$scope.loadingData = true;
|
||||
|
||||
// $scope.thisProject = {};
|
||||
// $scope.thisProject.courseName = $routeParams.className;
|
||||
|
||||
$scope.editProject = function()
|
||||
{
|
||||
$scope.isEditPressed = true;
|
||||
console.log("EditPressed " + $scope.isEditPressed);
|
||||
}
|
||||
$scope.removeProject = function()
|
||||
{
|
||||
console.log("Project has been removed!");
|
||||
}
|
||||
|
||||
$scope.getProjectInfo = function()
|
||||
{
|
||||
apiService.getProjectsById(token, projectId).success(function(data)
|
||||
{
|
||||
$scope.project = data;
|
||||
console.log($scope.project);
|
||||
$scope.init_line_lables();
|
||||
$scope.loadingData = false;
|
||||
console.log($scope.project);
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log("Error: " + err.message);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.init_line_lables = function(){
|
||||
$scope.project.weekly_labels = [];
|
||||
for(var i = 0 ; i < $scope.project.info.stats.weekly_commits[0].length; i++)
|
||||
$scope.project.weekly_labels.push('w '+i.toString());
|
||||
|
||||
}
|
||||
|
||||
$scope.getProjectInfo(); // Get all this project data
|
||||
}]);
|
|
@ -125,6 +125,14 @@ service.factory('apiService', ['$http', function($http) {
|
|||
};
|
||||
return $http(req);
|
||||
},
|
||||
getProjectsById: function(token, projectId){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsById/" + token + "/" + projectId;
|
||||
req = {
|
||||
method : "GET",
|
||||
url : url
|
||||
};
|
||||
return $http(req);
|
||||
},
|
||||
getProjectsByUser: function(token){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsByUser/" + token;
|
||||
req = {
|
||||
|
|
|
@ -1,13 +1,44 @@
|
|||
<div class = "myClasses">
|
||||
<div class = "project">
|
||||
<md-content layout-padding layout-margin>
|
||||
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> Project</h1>
|
||||
Yipi Kayea Mother Fraker
|
||||
<div>
|
||||
|
||||
<!-- Yipi Kayea Mother Fraker -->
|
||||
<div flex = "99" layout = "row" layout-padding>
|
||||
<div flex = "25">
|
||||
Project Logo
|
||||
<!-- <img ng-src="{{project.logo_url}} class = "md-avatar"> -->
|
||||
</div>
|
||||
<div flex = "20">
|
||||
{{project.projectName}}
|
||||
</div>
|
||||
<div layout = "row" flex = "45">
|
||||
<div flex>
|
||||
<md-button ng-click="editProject()" style = "size:180%; width:50%;" ng class="md-raised md-primary">
|
||||
<i class="fa fa-pencil-square-o"></i>
|
||||
</md-button>
|
||||
</div>
|
||||
<div flex>
|
||||
<md-button ng-click="removeProject()" style = "size:180%; width:40%;" ng class="md-raised md-primary">
|
||||
<i class="fa fa-times"></i>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div flex = "99" layout = "row">
|
||||
<div flex = "45">
|
||||
<!-- Graph -->
|
||||
<div ng-if="loadingData" layout-paddig layout-margin class="loader">
|
||||
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||
</div>
|
||||
<md-card>
|
||||
<canvas layout-padding layout-margin ng-if = "!loadingData" id="line" class="chart chart-line" data="project.info.stats.weekly_commits" labels="project.weekly_labels" legend="true" ></canvas>
|
||||
</md-card>
|
||||
</div>
|
||||
<div flex = "45">
|
||||
<md-card>
|
||||
<canvas layout-padding layout-margin ng-if = "!loadingData" id="project.projectName" class="chart chart-bar" data="project.info.stats.micro.data" labels="project.info.stats.micro.labels" series="project.info.stats.micro.series"></canvas>
|
||||
</md-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
<div class="register">
|
||||
<md-content layout-padding>
|
||||
<md-card layout-padding>
|
||||
<h1 style="margin-left:15px"><i class="fa fa-pencil"></i> Registration</h1>
|
||||
<center>
|
||||
First Login Of {{user.name}}
|
||||
<div class="avatar">
|
||||
<img ng-src="{{user.avatar_url}}" alt="{{item.who}}">
|
||||
</div>
|
||||
</center>
|
||||
<div layout="col">
|
||||
<div>
|
||||
<md-input-container ng-if="userHasNoName">
|
||||
<label>Full Name: </label>
|
||||
<input ng-model="user.name" ng-minlength="1" required>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<br></br>
|
||||
<div layout="row" layout-align="center center">
|
||||
<p>Are You A Lecturer?</p>
|
||||
<md-switch ng-model="user.isLecturer" aria-label="Switch 1">
|
||||
</md-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div ng-if="user.isLecturer">
|
||||
<md-card layout-padding>
|
||||
<h1 style="margin-left:15px"><i class="fa fa-pencil"></i> Registration</h1>
|
||||
<center>
|
||||
First Login Of {{user.name}}
|
||||
<div class="avatar">
|
||||
<img ng-src="{{user.avatar_url}}" alt="{{item.who}}">
|
||||
</div>
|
||||
</center>
|
||||
<div layout="col">
|
||||
<div>
|
||||
<md-button ng-click = "createCampus($event)" ng-model="jsonCreateCampus" class="md-raised">Create Campus</md-button>
|
||||
<div class = "createCampus" ng-if="createCampusClicked">
|
||||
<md-input-container>
|
||||
<label>Academic Suffix Email</label>
|
||||
<input type="text" ng-model="user.campusMail" ng-minlength="1" required/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Name</label>
|
||||
<input type="text" ng-if="createCampusClicked" ng-model="user.campusName" ng-minlength="1" required !important/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Avatar Url (optional)</label>
|
||||
<input type="text" ng-if="createCampusClicked" ng-model="user.newCampusAvatar"/>
|
||||
</md-input-container>
|
||||
<md-input-container ng-if="userHasNoName">
|
||||
<label>Full Name: </label>
|
||||
<input ng-model="user.name" ng-minlength="1" required>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<br></br>
|
||||
<div layout="row" layout-align="center center">
|
||||
<p>Are You A Lecturer?</p>
|
||||
<md-switch ng-model="user.isLecturer" aria-label="Switch 1">
|
||||
</md-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div ng-if="user.isLecturer">
|
||||
<div>
|
||||
<md-button ng-click = "createCampus($event)" ng-model="jsonCreateCampus" class="md-raised">Create Campus</md-button>
|
||||
<div class = "createCampus" ng-if="createCampusClicked">
|
||||
<md-input-container>
|
||||
<label>Academic Suffix Email</label>
|
||||
<input type="text" ng-model="user.campusMail" ng-minlength="1" required/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Name</label>
|
||||
<input type="text" ng-if="createCampusClicked" ng-model="user.campusName" ng-minlength="1" required !important/>
|
||||
</md-input-container>
|
||||
<md-input-container>
|
||||
<label>Campus Avatar Url (optional)</label>
|
||||
<input type="text" ng-if="createCampusClicked" ng-model="user.newCampusAvatar"/>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "dropDown">
|
||||
<md-select placeholder="Pick your Campus" ng-model="campus" style="z-index: 300" ng-change="dropdownClicked()">
|
||||
<md-option ng-switch="user.isLecturer" ng-repeat="c in campuses" value="{{c.title}}">{{c.title}}</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div layout="col" layout-align="center center">
|
||||
<div>
|
||||
<div class="campusAvatar" ng-if="campusChecked">
|
||||
<img ng-src="{{campusObj.avatar_url}}" alt="campusAvatar">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "dropDown">
|
||||
<md-select placeholder="Pick your Campus" ng-model="campus" style="z-index: 300" ng-change="dropdownClicked()">
|
||||
<md-option ng-switch="user.isLecturer" ng-repeat="c in campuses" value="{{c.title}}">{{c.title}}</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
<div layout="col" layout-align="center center">
|
||||
<div>
|
||||
<div class="campusAvatar" ng-if="campusChecked">
|
||||
<img ng-src="{{campusObj.avatar_url}}" alt="campusAvatar">
|
||||
<div class = "disabledSubmitButton">
|
||||
<md-button ng-click="submitClicked($event)" ng-disabled="!campusChecked" class="md-raised md-primary">Submit</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class = "disabledSubmitButton">
|
||||
<md-button ng-click="submitClicked($event)" ng-disabled="!campusChecked" class="md-raised md-primary">Submit</md-button>
|
||||
</div>
|
||||
</div>
|
||||
<div layout="row" layout-align="center center">
|
||||
<div ng-if="campusChecked">
|
||||
<div layout="row" layout-align="center center">
|
||||
<div ng-if="campusChecked">
|
||||
<div>
|
||||
<md-input-container>
|
||||
<label>Academic Email</label>
|
||||
<input type="text" ng-model="user.AcMail" ng-length="1" required/>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<md-input-container>
|
||||
<label>Academic Email</label>
|
||||
<input type="text" ng-model="user.AcMail" ng-length="1" required/>
|
||||
</md-input-container>
|
||||
<div class="mail_suffix">
|
||||
{{campusObj.email_ending}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mail_suffix">
|
||||
{{campusObj.email_ending}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
Loading…
Reference in a new issue