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

show current repo

This commit is contained in:
s2
2018-05-19 22:31:13 +02:00
parent b039540e9f
commit bc5a494918
4 changed files with 17 additions and 7 deletions

View File

@@ -22,9 +22,6 @@
</head> </head>
<body> <body>
<div class="js-container"> <div class="js-container">
<div class="alert alert-primary" role="alert">
Getting file list...
</div>
</div> </div>
<script src="js/index.js"></script> <script src="js/index.js"></script>
</body> </body>

View File

@@ -9,15 +9,19 @@
//events //events
ipcRenderer.on('fileList', (event, files) => { ipcRenderer.on('fileList', (event, files) => {
if (files && files.length > 0) { if (files && files.length > 0) {
$('.js-container').html(gitlit.templates.main({files: files})); $('.files-table-container').html(gitlit.templates.files({files: files}));
sorttable.makeSortable($('.js-filestable')[0]); sorttable.makeSortable($('.js-filestable')[0]);
var myTH = document.getElementsByTagName("th")[0]; var myTH = document.getElementsByTagName("th")[0];
sorttable.innerSortFunction.apply(myTH, []); sorttable.innerSortFunction.apply(myTH, []);
} else { } else {
$('.js-container').html(gitlit.templates.noGitLfsFiles()); $('.files-table-container').html(gitlit.templates.noGitLfsFiles());
} }
}); });
ipcRenderer.on('repoDir', (event, repoDir) => {
$('.js-repo-dir').text('current repo dir: ' + repoDir).show();
});
ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => { ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => {
$('.js-container').html(gitlit.templates.isNoGitLfsRepo({repoDir: repoDir})); $('.js-container').html(gitlit.templates.isNoGitLfsRepo({repoDir: repoDir}));
}); });
@@ -84,5 +88,6 @@
//startup //startup
PNotify.defaults.styling = 'bootstrap4'; // Bootstrap version 4 PNotify.defaults.styling = 'bootstrap4'; // Bootstrap version 4
$('.js-container').html(gitlit.templates.main());
})(jQuery); })(jQuery);

View File

@@ -1,6 +1,14 @@
window.gitlit = window.gitlit || {}; window.gitlit = window.gitlit || {};
gitlit.templates = { gitlit.templates = {
main: ejs.compile(` main: ejs.compile(`
<div class="alert alert-success js-repo-dir" style="display:none;"></div>
<div class="files-table-container">
<div class="alert alert-primary" role="alert">
Getting file list...
</div>
</div>
`),
files: ejs.compile(`
<table class="table table-striped sortable js-filestable"> <table class="table table-striped sortable js-filestable">
<tr> <tr>
<th>file</th> <th>file</th>

View File

@@ -9,7 +9,7 @@ const args = require('minimist')(process.defaultApp ? process.argv.slice(2) : pr
} }
}); });
const repoDir = args._.join(' '); const repoDir = path.normalize(args._.join(' '));
function getLfsFileList(dir, cb) { function getLfsFileList(dir, cb) {
exec('git lfs ls-files', { exec('git lfs ls-files', {
@@ -98,7 +98,7 @@ function createWindow() {
}); });
win.webContents.on('did-finish-load', () => { win.webContents.on('did-finish-load', () => {
console.log('getting file list and lock status in ' + repoDir + '...'); win.webContents.send('repoDir', repoDir);
getLfsFileList(repoDir, (err, files) => { getLfsFileList(repoDir, (err, files) => {
if (err) { if (err) {