-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.html
125 lines (118 loc) · 4.1 KB
/
sidebar.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html>
<head>
<base target="_top" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
/>
<!-- The CSS package above applies Google styling to buttons and other elements. -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div class="box">
<div class="field">
<label class="label">Source document</label>
<div class="control">
<input
class="input"
type="text"
placeholder="URL"
id="sUrl"
/>
</div>
</div>
<div class="field">
<div class="control">
<input
class="input"
type="text"
placeholder="Key column"
id="sK"
/>
</div>
</div>
<div class="field">
<div class="control">
<input
class="input"
type="text"
placeholder="Value column"
id="sV"
/>
</div>
</div>
<div class="field">
<label class="label">Target document (current)</label>
<div class="control">
<input
class="input"
type="text"
placeholder="Key column"
id="tK"
/>
</div>
</div>
<div class="field">
<div class="control">
<input
class="input"
type="text"
placeholder="Value column"
id="tV"
/>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-link" onclick="runSync()">
Sync
</button>
</div>
<div class="control">
<button class="button is-link is-light">Cancel</button>
</div>
</div>
<div class="notification is-primary is-hidden" id="success-msg">
Success: Synchronization finished!
</div>
<div class="notification is-danger is-hidden" id="failure-msg">
Fail: Synchronization failed, check stackdriver logs!
</div>
</div>
<script
defer
src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"
></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
function onSuccess() {
$("#success-msg").removeClass("is-hidden")
setTimeout(function() {
$("#success-msg")
.addClass("is-hidden")
}, 5000);
}
function onFailure() {
$("#failure-msg").removeClass("is-hidden")
setTimeout(function() {
$("#failure-msg")
.addClass("is-hidden")
}, 5000);
}
function runSync() {
var sUrl = $("#sUrl").val();
var sK = $("#sK").val();
var sV = $("#sV").val();
var tK = $("#tK").val();
var tV = $("#tV").val();
var successMsg = $("#success-msg");
var failureMsg = $("#failure-msg");
google.script.run
.withSuccessHandler(onSuccess)
.withFailureHandler(onFailure)
.syncSheets(sUrl, sK, sV, tK, tV);
}
</script>
</body>
</html>