improved git file changes

This commit is contained in:
Usman Nasir
2020-03-13 20:41:50 +05:00
parent 0e31305dae
commit 59683599f4
9 changed files with 33 additions and 66 deletions

View File

@@ -2,10 +2,8 @@
* Created by usman on 7/24/17.
*/
/* Utilities */
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
@@ -34,18 +32,15 @@ function randomPassword(length) {
/* Utilities ends here */
/* Java script code to monitor system status */
var app = angular.module('CyberCP', []);
app.config(['$interpolateProvider', function($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
}]);
app.filter('getwebsitename', function() {
return function(domain, uppercase) {
@@ -93,13 +88,8 @@ app.controller('systemStatusInfo', function($scope,$http,$timeout) {
}
});
/* Admin status */
app.controller('adminController', function($scope,$http,$timeout) {
url = "/base/getAdminStatus";
@@ -315,11 +305,8 @@ app.controller('adminController', function($scope,$http,$timeout) {
function cantLoadInitialData(response) {}
});
/* Load average */
app.controller('loadAvg', function($scope,$http,$timeout) {
//getStuff();
@@ -350,13 +337,8 @@ app.controller('loadAvg', function($scope,$http,$timeout) {
}
});
/// home page system status
app.controller('homePageStatus', function($scope,$http,$timeout) {
getStuff();
@@ -472,9 +454,6 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
}
});
////////////
function increment(){
@@ -488,11 +467,8 @@ function increment(){
increment();
////////////
app.controller('versionManagment', function($scope,$http,$timeout) {
$scope.upgradeLoading = true;

View File

@@ -130,7 +130,7 @@ def versionManagment(request):
currentBuild = data[1]
except:
currentVersion = latestVersion
currentBuild = str(latestBuild) + 'E'
currentBuild = str(5) + 'E'
return render(request, 'baseTemplate/versionManagment.html', {'build': currentBuild,
'currentVersion': currentVersion,

View File

@@ -193,7 +193,7 @@ def loadLoginPage(request):
firstName="Cyber",lastName="Panel", acl=acl, token=token)
admin.save()
vers = version(currentVersion="1.9", build=4)
vers = version(currentVersion="1.9", build=5)
vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000,

View File

@@ -34,7 +34,7 @@ def main():
firstName="Cyber", lastName="Panel", acl=acl, token=token)
admin.save()
vers = version(currentVersion="1.9", build=4)
vers = version(currentVersion="1.9", build=5)
vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000,

View File

@@ -2,10 +2,8 @@
* Created by usman on 7/24/17.
*/
/* Utilities */
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
@@ -34,18 +32,15 @@ function randomPassword(length) {
/* Utilities ends here */
/* Java script code to monitor system status */
var app = angular.module('CyberCP', []);
app.config(['$interpolateProvider', function($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
}]);
app.filter('getwebsitename', function() {
return function(domain, uppercase) {
@@ -93,13 +88,8 @@ app.controller('systemStatusInfo', function($scope,$http,$timeout) {
}
});
/* Admin status */
app.controller('adminController', function($scope,$http,$timeout) {
url = "/base/getAdminStatus";
@@ -315,11 +305,8 @@ app.controller('adminController', function($scope,$http,$timeout) {
function cantLoadInitialData(response) {}
});
/* Load average */
app.controller('loadAvg', function($scope,$http,$timeout) {
//getStuff();
@@ -350,13 +337,8 @@ app.controller('loadAvg', function($scope,$http,$timeout) {
}
});
/// home page system status
app.controller('homePageStatus', function($scope,$http,$timeout) {
getStuff();
@@ -472,9 +454,6 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
}
});
////////////
function increment(){
@@ -488,11 +467,8 @@ function increment(){
increment();
////////////
app.controller('versionManagment', function($scope,$http,$timeout) {
$scope.upgradeLoading = true;

View File

@@ -6620,7 +6620,7 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
type: 'success'
});
$scope.fileStatus = false;
$scope.fileChangedContent = response.data.fileChangedContent;
document.getElementById("fileChangedContent").innerHTML = response.data.fileChangedContent;
} else {
new PNotify({
title: 'Operation Failed!',

View File

@@ -6620,7 +6620,7 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
type: 'success'
});
$scope.fileStatus = false;
$scope.fileChangedContent = response.data.fileChangedContent;
document.getElementById("fileChangedContent").innerHTML = response.data.fileChangedContent;
} else {
new PNotify({
title: 'Operation Failed!',

View File

@@ -626,7 +626,7 @@
<table ng-hide="gitCommitsTable" style="margin-top: 2%" class="table">
<thead>
<tr>
<th>ID/th>
<th>ID</th>
<th>Commit Hash</th>
<th>Description</th>
<th>Commiter</th>
@@ -665,30 +665,33 @@
<div class="form-group">
<label class="col-sm-2 control-label">{% trans "Select File" %}</label>
<div class="col-sm-10">
<select ng-change="fetchChangesInFile()" ng-model="$parent.changeFile" class="form-control">
<select ng-change="fetchChangesInFile()"
ng-model="$parent.changeFile" class="form-control">
<option ng-repeat="file in files track by $index">
{$ file $}
</option>
</select>
</div>
<hr>
<hr ng-hide="fileStatus">
<div ng-hide="fileStatus"
style="margin-left: 0px; margin-right: 0px"
class="form-group">
<label class="col-sm-2 control-label">{% trans "Git Diff" %}</label>
<div class="col-sm-10">
<textarea ng-model="fileChangedContent" rows="12"
class="form-control"></textarea>
<div ng-hide="fileStatus" class="example-box-wrapper">
<div class="row">
<div class="col-md-12">
<div class="content-box">
<div id="fileChangedContent" class="content-box-wrapper">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@@ -3653,9 +3653,21 @@ StrictHostKeyChecking no
return ACLManager.loadErrorJson()
command = 'git -C %s show %s -- %s/%s' % (self.folder, self.commit, self.folder, self.file.strip('\n').strip(' '))
fileChangedContent = ProcessUtilities.outputExecutioner(command)
fileChangedContent = ProcessUtilities.outputExecutioner(command).split('\n')
data_ret = {'status': 1, 'fileChangedContent': fileChangedContent}
fileLen = len(fileChangedContent)
finalContent = ''
for i in range(12, fileLen-1):
if fileChangedContent[i][0] == '+':
finalContent = finalContent + '<p style="color:green">%s</p><br>' % (fileChangedContent[i])
elif fileChangedContent[i][0] == '-':
finalContent = finalContent + '<p style="color:red">%s</p><br>' % (fileChangedContent[i])
else:
finalContent = finalContent + '<p>%s</p><br>' % (fileChangedContent[i])
data_ret = {'status': 1, 'fileChangedContent': finalContent}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)