Ajout du force push
This commit is contained in:
parent
a621cd1521
commit
beb829da46
13
ajax.php
13
ajax.php
@ -41,12 +41,19 @@ if (!empty($_POST['action'])) {
|
|||||||
if ($_POST['action'] == 'status') {
|
if ($_POST['action'] == 'status') {
|
||||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $gitstatus . "'"));
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $gitstatus . "'"));
|
||||||
exit;
|
exit;
|
||||||
} else if ($_POST['action'] == 'push') {
|
} else if (strpos($_POST['action'], 'push') !== false) {
|
||||||
$message = empty($_POST['message']) ? 'FTP' : str_replace(array('"', "'"), ' ', stripslashes($_POST['message']));
|
if (strpos($_POST['action'], 'force') !== false) {
|
||||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push && git push && ' . $gitstatus . "'"));
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git push && ' . $gitstatus . "'"));
|
||||||
if (!empty($config['after_push'])) {
|
if (!empty($config['after_push'])) {
|
||||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push'] . "'"));
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push'] . "'"));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$message = empty($_POST['message']) ? 'FTP' : str_replace(array('"', "'"), ' ', stripslashes($_POST['message']));
|
||||||
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push && ' . $gitstatus . "'"));
|
||||||
|
if (!empty($config['after_push'])) {
|
||||||
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push'] . "'"));
|
||||||
|
}
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
} else if ($_POST['action'] == 'pull') {
|
} else if ($_POST['action'] == 'pull') {
|
||||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git pull && ' . $gitstatus . "'"));
|
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git pull && ' . $gitstatus . "'"));
|
||||||
|
@ -23,11 +23,9 @@ pre {
|
|||||||
|
|
||||||
.toolbar-bottom {
|
.toolbar-bottom {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
}
|
|
||||||
|
|
||||||
.toolbar-bottom {
|
|
||||||
display: block;
|
display: block;
|
||||||
padding-right: 79px;
|
padding-right: 79px;
|
||||||
|
margin-right: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-bottom .input-block-level {
|
.toolbar-bottom .input-block-level {
|
||||||
@ -40,6 +38,16 @@ pre {
|
|||||||
border-top-right-radius: 0 !important;
|
border-top-right-radius: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toolbar-bottom .btn:last-child i:last-child {
|
||||||
|
position: relative;
|
||||||
|
right: 9px;
|
||||||
|
margin-right: -9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-bottom .btn:last-child {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.span9 {
|
.span9 {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
20
index.php
20
index.php
@ -5,16 +5,16 @@ require_once 'utils.php';
|
|||||||
global $servers;
|
global $servers;
|
||||||
?><!doctype html>
|
?><!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
|
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
|
||||||
<link rel="stylesheet" href="css/styles.css">
|
<link rel="stylesheet" href="css/styles.css">
|
||||||
<title>Git Control Center</title>
|
<title>Git Control Center</title>
|
||||||
</head>
|
</head>
|
||||||
<body data-spy="scroll">
|
<body data-spy="scroll">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span2">
|
<div class="span2">
|
||||||
<ul class="nav nav-list well affix">
|
<ul class="nav nav-list well affix">
|
||||||
@ -32,6 +32,7 @@ global $servers;
|
|||||||
<?php foreach ($ssh as $id => $param): ?>
|
<?php foreach ($ssh as $id => $param): ?>
|
||||||
<section id="<?php echo $id; ?>">
|
<section id="<?php echo $id; ?>">
|
||||||
<h3><?php echo $param['title']; ?></h3>
|
<h3><?php echo $param['title']; ?></h3>
|
||||||
|
|
||||||
<div class="pull-right"><span class="label"></span></div>
|
<div class="pull-right"><span class="label"></span></div>
|
||||||
<div class="btn-group toolbar-top">
|
<div class="btn-group toolbar-top">
|
||||||
<button class="btn" onclick="callRequest('status', '<?php echo $id; ?>');">
|
<button class="btn" onclick="callRequest('status', '<?php echo $id; ?>');">
|
||||||
@ -47,6 +48,9 @@ global $servers;
|
|||||||
<button class="btn" onclick="callRequest('push', '<?php echo $id; ?>', document.querySelector('#<?php echo $id; ?> input[name=message]').value);">
|
<button class="btn" onclick="callRequest('push', '<?php echo $id; ?>', document.querySelector('#<?php echo $id; ?> input[name=message]').value);">
|
||||||
<i class="icon-arrow-up"></i> Push
|
<i class="icon-arrow-up"></i> Push
|
||||||
</button>
|
</button>
|
||||||
|
<button class="btn" title="Force Push" onclick="callRequest('push force', '<?php echo $id; ?>', document.querySelector('#<?php echo $id; ?> input[name=message]').value);">
|
||||||
|
<i class="icon-arrow-up"></i><i class="icon-arrow-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -54,12 +58,12 @@ global $servers;
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
|
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
|
||||||
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" src="js/app.js"></script>
|
<script type="text/javascript" src="js/app.js"></script>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener('load', function () {
|
||||||
var sections = document.querySelectorAll('section');
|
var sections = document.querySelectorAll('section');
|
||||||
for (var i = 0; i < sections.length; i++) {
|
for (var i = 0; i < sections.length; i++) {
|
||||||
callRequest('status', sections[i].id);
|
callRequest('status', sections[i].id);
|
||||||
@ -26,7 +26,7 @@ function callRequest(action, section, message) {
|
|||||||
xhr.open('POST', 'ajax.php');
|
xhr.open('POST', 'ajax.php');
|
||||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
xhr.send('action=' + action + '§ion=' + section + '&message=' + message);
|
xhr.send('action=' + action + '§ion=' + section + '&message=' + message);
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
|
if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
|
||||||
pre.innerHTML = xhr.responseText;
|
pre.innerHTML = xhr.responseText;
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@ if (defined('ONGITLAB') && ONGITLAB) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ansi2html($string) {
|
function ansi2html($string)
|
||||||
|
{
|
||||||
$dictionary = array(
|
$dictionary = array(
|
||||||
'[30m' => '<span style="color:black">',
|
'[30m' => '<span style="color:black">',
|
||||||
'[31m' => '<span style="color:red">',
|
'[31m' => '<span style="color:red">',
|
||||||
|
Loading…
Reference in New Issue
Block a user