-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedit-diff.html
105 lines (89 loc) · 3.53 KB
/
edit-diff.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ftployin</title>
<link rel="stylesheet" href="assets/css/app.min.css">
</head>
<body>
<div id="modal">
<div class="ui window-title drag-region">change diff</div>
<div class="ui window-body modal edit-diff-page">
<div class="ui form full-height">
<div class="body full-height">
<div class="ui form padding-h-16">
<div class="ui note">
<i class="icon icon-warning"></i>
changing suggested configs you can break your application. be careful!
</div>
<div class="input-group select">
<label for="from">from: </label>
<select id="from" v-model="from">
<option v-for="commit in commits" :value="commit.hash">
{{ commit.shortHash }} - {{ commit.title }}
</option>
<option value="">ZERO POINT (this will deploy the entire project)</option>
</select>
</div>
</div>
</div>
<div class="footer">
<div class="cols">
<div class="col-2">
<button class="ui btn pink" v-on:click="close()">cancel</button>
</div>
<div class="col-2 offset-8">
<button class="ui btn green" v-on:click="save()">change</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/vue.min.js"></script>
<script src="src/js/ui/tabs.js"></script>
<script src="src/js/ui/code-editor.js"></script>
<script>
const modal = require('electron-modal');
const path = require('path');
const GitUtils = require(path.join(__dirname, 'src/js/data/git-utils.js'));
const methods = {};
const filters = {};
const computed = {};
methods.save = function () {
modal.emit('save', { from: this.from || null, to: this.to });
modal.close();
};
methods.close = function () {
modal.close();
};
computed.validTargetCommits = {
get: function () {
const len = this.commits.length;
let lastValidCommitIndex = len;
for (let x = 0; x < len; x += 1) {
const cur = this.commits[x];
if (cur.hash === this.from) {
lastValidCommitIndex = x + 1;
break;
}
}
return this.commits.filter((c, i) => i < lastValidCommitIndex);
}
}
modal.getData().then((data) => {
GitUtils.getAllCommitsList(data.cwd)
.then(list => { data.commits = list; })
.then(() => new Vue({ el: '#modal', data, methods, computed, filters }))
.catch((err) => {
console.log(err);
});
});
// document.addEventListener("keydown", function (e) {
// if (e.which === 27) {
// require('electron').remote.getCurrentWindow().toggleDevTools();
// }
// });
</script>
</body>
</html>