-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathconfig.html
146 lines (117 loc) · 4.18 KB
/
config.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
/* https://css-tricks.com/box-sizing/ */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: Helvetica, Arial, sans-serif;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin: 1em 0;
}
label {
font-weight: bold;
}
input[type=text], input[type=password] {
display: block;
border: 1px solid #ccc;
font-size: 1em;
padding: 0.5em;
margin: 0.25em 0;
width: 100%;
outline: none;
}
input[type=text]:invalid, input[type=password]:invalid {
border-color: red;
}
input[type=text]:focus, input[type=password]:focus {
border-color: #3079ed;
}
button {
font-size: 1.25em;
border: 0;
padding: 0.5em 1em;
cursor: pointer;
color: white;
border-radius: 4px;
}
button.primary {
background-color: #3079ed;
}
button.loading {
opacity: 0.5;
cursor: default;
}
.desc {
color: gray;
font-size: 0.9em;
}
.sheet-id {
color: gray;
font-size: 0.8em;
}
.action-buttons {
display: flex;
justify-content: flex-end;
}
</style>
</head>
<body>
<form onsubmit="handleSubmit(); return false">
<p><strong>Note:</strong> You must already have an S3 bucket configured before filling out the fields below to enable publishing. See the <a href="https://github.com/liddiard/google-sheet-s3/blob/master/README.md#aws-setup" target="_blank">AWS setup instructions</a> for instructions on how to do that.</p>
<p>See the <a href="https://github.com/liddiard/google-sheet-s3/blob/master/README.md#google-sheet-setup" target="_blank">Google Sheet setup instructions</a> for information on how to format your spreadsheet for publishing.</p>
<ul>
<li>
<label for="bucket-name">S3 bucket name</label>
<input id="bucket-name" name="bucketName" type="text" autofocus value="<?!= bucketName ?>" placeholder="my-bucket-name" required />
</li>
<li>
<label for="path">Path</label>
<input id="path" name="path" type="text" value="<?!= path ?>" placeholder="path/to/folder" />
<span class="desc">Folder path within the bucket where the spreadsheet JSON file will be saved, <strong>without leading or trailing slashes</strong>. Leave blank for the top level.</span>
</li>
<li>
<label for="aws-region">AWS region</label>
<input id="aws-access-region" name="awsRegion" type="text" value="<?!= awsRegion ?>" placeholder="us-west-2" required />
<span class="desc">This value is listed on your S3 bucket's "Properties" page.</span>
</li>
<li>
<label for="aws-access-key-id">AWS access key ID</label>
<input id="aws-access-key-id" name="awsAccessKeyId" type="text" value="<?!= awsAccessKeyId ?>" required />
<span class="desc">Get this value from the <a href="https://console.aws.amazon.com/iam/" target="_blank">IAM Console</a>.</span>
</li>
<li>
<label for="aws-secret-key">AWS secret key</label>
<input id="aws-secret-key" name="awsSecretKey" type="password" value="<?!= awsSecretKey ?>" required />
<span class="desc">Get this value from the <a href="https://console.aws.amazon.com/iam/" target="_blank">IAM Console</a>.</span>
</li>
<li class="sheet-id">
Sheet ID: <?!= sheetId ?>
</li>
</ul>
<div class="action-buttons">
<button type="submit" class="primary">Save</button>
</div>
</form>
<script>
function handleSubmit() {
const form = document.querySelector('form');
const submitButton = document.querySelector('form button[type=submit]');
submitButton.classList.add('loading');
submitButton.innerHTML = 'Saving...';
google.script.run.updateConfig(form);
}
</script>
</body>
</html>