Finished v0.1.0
parent
f83ce96bcc
commit
195cfdccfc
@ -0,0 +1,40 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>CPGC</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,800" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="css/normalize.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="left">
|
||||
<header>
|
||||
<h1>CPGC</h1>
|
||||
<h3>0.1.0</h3>
|
||||
</header>
|
||||
|
||||
<div class="container u-full-width">
|
||||
<a href="" onclick="gotoOverview()">Overview</a>
|
||||
<a href="" class="active">Commit History</a>
|
||||
<a href="" onclick="handleChangeProject()">Change Project</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="user_name">
|
||||
Welcome, <span id="user_name"></span>
|
||||
</div>
|
||||
|
||||
<section>Commit History - <span class="remote"></span></section>
|
||||
<p id="desc"></p>
|
||||
<span class="login" onclick="login()">Connect with GitHub</span>
|
||||
<span class="logged_in" style="display: none;">Logged in to GitHub as </span>
|
||||
|
||||
<div class="window commit">
|
||||
<div class="heading">Branch <span id="branch"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="js/commit.js"></script>
|
||||
</html>
|
@ -0,0 +1,72 @@
|
||||
const electron = require('electron');
|
||||
const ipc = electron.ipcRenderer;
|
||||
|
||||
if(localStorage.getItem('token') != null) {
|
||||
document.querySelector('.login').style.display = 'none';
|
||||
document.querySelector('.logged_in').style.display = 'block';
|
||||
|
||||
ipc.send('getCollaborators', localStorage.getItem('token'));
|
||||
}
|
||||
|
||||
ipc.on('send_username', function(event, args) {
|
||||
document.getElementById("user_name").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.on('send_useremail', function(event, args) {
|
||||
document.getElementById("user_email").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.on('send_remote', function(event, args) {
|
||||
document.querySelector(".remote").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.on('send_branch', function(event, args) {
|
||||
document.querySelector("#branch").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.once('send_status', function(event, args) {
|
||||
let res = args.split('\n');
|
||||
|
||||
for(let i = 0; i < res.length; i++) {
|
||||
document.querySelector(".status").innerHTML += res[i] + '<br>';
|
||||
}
|
||||
});
|
||||
|
||||
ipc.once('send_log', function(event, args) {
|
||||
for(let i = 0; i < args.length; i++) {
|
||||
let w = document.querySelector('.window');
|
||||
w.innerHTML +=
|
||||
`<div class="log">
|
||||
<div class="log--message">${args[i][4]}</div>
|
||||
<div class="log--email">${args[i][1]}</div><div class="log--time">${args[i][2]}</div>
|
||||
<span class="log--number">${args[i][0]}</span>
|
||||
</div><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on('token', function(event, data) {
|
||||
localStorage.setItem('token', data);
|
||||
});
|
||||
|
||||
ipc.once('gh_user', (event, data) => {
|
||||
document.querySelector('.logged_in').innerHTML += data;
|
||||
});
|
||||
|
||||
ipc.once('desc', (event, data) => {
|
||||
document.querySelector('#desc').innerHTML += data;
|
||||
});
|
||||
|
||||
function login() {
|
||||
event.preventDefault();
|
||||
ipc.send('login');
|
||||
}
|
||||
|
||||
function handleChangeProject() {
|
||||
event.preventDefault();
|
||||
ipc.send('changeProject');
|
||||
}
|
||||
|
||||
function gotoOverview() {
|
||||
event.preventDefault();
|
||||
ipc.send('gotoOverview');
|
||||
}
|
@ -1,25 +1,67 @@
|
||||
const electron = require('electron');
|
||||
const ipc = electron.ipcRenderer;
|
||||
|
||||
if(localStorage.getItem('token') != null) {
|
||||
document.querySelector('.login').style.display = 'none';
|
||||
document.querySelector('.logged_in').style.display = 'block';
|
||||
|
||||
ipc.send('getCollaborators', localStorage.getItem('token'));
|
||||
}
|
||||
|
||||
ipc.on('send_username', function(event, args) {
|
||||
document.getElementById("user_name").innerHTML = args;
|
||||
console.log(args);
|
||||
});
|
||||
ipc.on('send_useremail', function(event, args) {
|
||||
document.getElementById("user_email").innerHTML = args;
|
||||
console.log(args);
|
||||
});
|
||||
|
||||
// ipc.on('send_useremail', function(event, args) {
|
||||
// document.getElementById("user_email").innerHTML = args;
|
||||
// });
|
||||
|
||||
ipc.on('send_remote', function(event, args) {
|
||||
document.getElementById("remote").innerHTML = args;
|
||||
console.log(args);
|
||||
document.querySelector(".remote").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.on('send_branch', function(event, args) {
|
||||
document.querySelector("#branch").innerHTML = args;
|
||||
});
|
||||
|
||||
ipc.once('send_status', function(event, args) {
|
||||
let res = args.split('\n');
|
||||
|
||||
for(let i = 0; i < res.length; i++) {
|
||||
document.querySelector(".status").innerHTML += res[i] + '<br>';
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on('send_status', function(event, args) {
|
||||
document.getElementById("status").innerHTML = args;
|
||||
console.log(args);
|
||||
ipc.once('send_log', function(event, args) {
|
||||
document.querySelector(".log--message").innerHTML = args[0][4];
|
||||
document.querySelector(".log--email").innerHTML = args[0][1];
|
||||
document.querySelector(".log--time").innerHTML = args[0][2];
|
||||
});
|
||||
|
||||
ipc.on('send_log', function(event, args) {
|
||||
document.getElementById("log").innerHTML = args;
|
||||
console.log(args);
|
||||
});
|
||||
ipc.on('token', function(event, data) {
|
||||
localStorage.setItem('token', data);
|
||||
});
|
||||
|
||||
|
||||
ipc.once('gh_user', (event, data) => {
|
||||
document.querySelector('.logged_in').innerHTML += data;
|
||||
});
|
||||
|
||||
ipc.once('desc', (event, data) => {
|
||||
document.querySelector('#desc').innerHTML += data;
|
||||
});
|
||||
|
||||
function login() {
|
||||
event.preventDefault();
|
||||
ipc.send('login');
|
||||
}
|
||||
|
||||
function handleChangeProject() {
|
||||
event.preventDefault();
|
||||
ipc.send('changeProject');
|
||||
}
|
||||
|
||||
function gotoCommit() {
|
||||
event.preventDefault();
|
||||
ipc.send('gotoCommit');
|
||||
}
|
Loading…
Reference in New Issue