1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-02 20:30:05 +02:00

no notification if everything is allright

This commit is contained in:
s2
2018-05-18 17:07:13 +02:00
parent 0a2e639e1c
commit 7a6c320ddf
5 changed files with 13 additions and 4 deletions

3
app/css/app.css Normal file
View File

@@ -0,0 +1,3 @@
.js-container {
margin: 5px;
}

View File

@@ -4,7 +4,9 @@
<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">
<title>gitlit</title> <title>gitlit</title>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="node_modules/jquery/dist/jquery.js"></script> <script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.js"></script> <script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
@@ -16,6 +18,7 @@
<script src="js/index.js"></script> <script src="js/index.js"></script>
<link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet"> <link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<link href="css/app.css" rel="stylesheet">
</head> </head>
<body> <body>
<div class="js-container"> <div class="js-container">

View File

@@ -27,10 +27,14 @@
if (notification.event && notification.event === 'unlock') { if (notification.event && notification.event === 'unlock') {
$('[data-file="' + notification.file + '"].js-unlock').hide(); $('[data-file="' + notification.file + '"].js-unlock').hide();
$('[data-file="' + notification.file + '"].js-lock').show(); $('[data-file="' + notification.file + '"].js-lock').show();
let text = 'not locked';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
} }
if (notification.event && notification.event === 'lock') { if (notification.event && notification.event === 'lock') {
$('[data-file="' + notification.file + '"].js-lock').hide(); $('[data-file="' + notification.file + '"].js-lock').hide();
$('[data-file="' + notification.file + '"].js-unlock').show(); $('[data-file="' + notification.file + '"].js-unlock').show();
let text = notification.data.owner.name + ' (id: ' + notification.data.id + ')';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
} }
}); });

View File

@@ -33,7 +33,7 @@ gitlit.templates = {
</table> </table>
<div> <div class="float-right">
<a class="btn btn-secondary js-refresh" href="javascript:///"> <a class="btn btn-secondary js-refresh" href="javascript:///">
Refresh Refresh
</a> </a>

View File

@@ -142,7 +142,6 @@ ipcMain.on('unlock', (event, file) => {
notification = { notification = {
file: file, file: file,
event: 'unlock', event: 'unlock',
message: stdout,
type: 'info' type: 'info'
}; };
} }
@@ -152,7 +151,7 @@ ipcMain.on('unlock', (event, file) => {
}); });
ipcMain.on('lock', (event, file) => { ipcMain.on('lock', (event, file) => {
exec('git lfs lock "' + file + '"', { exec('git lfs lock --json "' + file + '"', {
cwd: repoDir cwd: repoDir
}, },
(error, stdout, stderr) => { (error, stdout, stderr) => {
@@ -165,7 +164,7 @@ ipcMain.on('lock', (event, file) => {
notification = { notification = {
file: file, file: file,
event: 'lock', event: 'lock',
message: stdout, data: JSON.parse(stdout),
type: 'info' type: 'info'
}; };
} }