Ajout du force push
This commit is contained in:
parent
a621cd1521
commit
beb829da46
17
ajax.php
17
ajax.php
@ -41,11 +41,18 @@ if (!empty($_POST['action'])) {
|
||||
if ($_POST['action'] == 'status') {
|
||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $gitstatus . "'"));
|
||||
exit;
|
||||
} else if ($_POST['action'] == 'push') {
|
||||
$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 && git push && ' . $gitstatus . "'"));
|
||||
if (!empty($config['after_push'])) {
|
||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push'] . "'"));
|
||||
} else if (strpos($_POST['action'], 'push') !== false) {
|
||||
if (strpos($_POST['action'], 'force') !== false) {
|
||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git push && ' . $gitstatus . "'"));
|
||||
if (!empty($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;
|
||||
} else if ($_POST['action'] == 'pull') {
|
||||
|
@ -9,35 +9,43 @@
|
||||
}
|
||||
|
||||
.toolbar-top.btn-group .btn {
|
||||
border-bottom: 0;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
border-bottom: 0;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
pre {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toolbar-bottom {
|
||||
margin-top: -1px;
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toolbar-bottom {
|
||||
margin-top: -1px;
|
||||
display: block;
|
||||
padding-right: 79px;
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
||||
.toolbar-bottom .input-block-level {
|
||||
border-top-left-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.toolbar-bottom .btn {
|
||||
width: 80px;
|
||||
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 {
|
||||
|
112
index.php
112
index.php
@ -5,61 +5,65 @@ require_once 'utils.php';
|
||||
global $servers;
|
||||
?><!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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-responsive.min.css">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
<title>Git Control Center</title>
|
||||
</head>
|
||||
<body data-spy="scroll">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<ul class="nav nav-list well affix">
|
||||
<?php foreach ($servers as $pays => $ssh): ?>
|
||||
<li class="nav-header"><?php echo $pays; ?></li>
|
||||
<?php foreach ($ssh as $id => $param): ?>
|
||||
<li><a href="#<?php echo $id; ?>"><?php echo $param['title']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span9">
|
||||
<?php foreach ($servers as $pays => $ssh): ?>
|
||||
<h1><?php echo $pays; ?></h1>
|
||||
<?php foreach ($ssh as $id => $param): ?>
|
||||
<section id="<?php echo $id; ?>">
|
||||
<h3><?php echo $param['title']; ?></h3>
|
||||
<div class="pull-right"><span class="label"></span></div>
|
||||
<div class="btn-group toolbar-top">
|
||||
<button class="btn" onclick="callRequest('status', '<?php echo $id; ?>');">
|
||||
<i class="icon-refresh"></i> Status
|
||||
</button>
|
||||
<button class="btn" onclick="callRequest('pull', '<?php echo $id; ?>');">
|
||||
<i class="icon-arrow-down"></i> Pull
|
||||
</button>
|
||||
</div>
|
||||
<pre></pre>
|
||||
<div class="toolbar-bottom input-append">
|
||||
<input class="input-block-level" type="text" name="message" placeholder="Commit message">
|
||||
<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
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
<hr>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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-responsive.min.css">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
<title>Git Control Center</title>
|
||||
</head>
|
||||
<body data-spy="scroll">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<ul class="nav nav-list well affix">
|
||||
<?php foreach ($servers as $pays => $ssh): ?>
|
||||
<li class="nav-header"><?php echo $pays; ?></li>
|
||||
<?php foreach ($ssh as $id => $param): ?>
|
||||
<li><a href="#<?php echo $id; ?>"><?php echo $param['title']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span9">
|
||||
<?php foreach ($servers as $pays => $ssh): ?>
|
||||
<h1><?php echo $pays; ?></h1>
|
||||
<?php foreach ($ssh as $id => $param): ?>
|
||||
<section id="<?php echo $id; ?>">
|
||||
<h3><?php echo $param['title']; ?></h3>
|
||||
|
||||
<footer>
|
||||
<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/app.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
<div class="pull-right"><span class="label"></span></div>
|
||||
<div class="btn-group toolbar-top">
|
||||
<button class="btn" onclick="callRequest('status', '<?php echo $id; ?>');">
|
||||
<i class="icon-refresh"></i> Status
|
||||
</button>
|
||||
<button class="btn" onclick="callRequest('pull', '<?php echo $id; ?>');">
|
||||
<i class="icon-arrow-down"></i> Pull
|
||||
</button>
|
||||
</div>
|
||||
<pre></pre>
|
||||
<div class="toolbar-bottom input-append">
|
||||
<input class="input-block-level" type="text" name="message" placeholder="Commit message">
|
||||
<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
|
||||
</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>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
<hr>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<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/app.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
window.addEventListener('load', function () {
|
||||
var sections = document.querySelectorAll('section');
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
callRequest('status', sections[i].id);
|
||||
@ -26,7 +26,7 @@ function callRequest(action, section, message) {
|
||||
xhr.open('POST', 'ajax.php');
|
||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xhr.send('action=' + action + '§ion=' + section + '&message=' + message);
|
||||
xhr.onreadystatechange = function() {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
|
||||
pre.innerHTML = xhr.responseText;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user