WEB: Add copy button to action tab (#299)

This commit is contained in:
Spenser Black
2021-05-14 16:33:32 -04:00
committed by GitHub
parent 429b58aeb7
commit a284c6abf2
6 changed files with 28 additions and 22 deletions

View File

@@ -63,6 +63,13 @@
components: { Prism: PrismComponent },
//Watchers
watch: {
tab: {
immediate: true,
handler(current) {
if (current === 'action') this.clipboard = new ClipboardJS('.copy-action')
else this.clipboard?.destroy()
},
},
palette: {
immediate: true,
handler(current, previous) {
@@ -78,6 +85,7 @@
mode: "metrics",
tab: "overview",
palette: "light",
clipboard: null,
requests: { limit: 0, used: 0, remaining: 0, reset: 0 },
cached: new Map(),
config: Object.fromEntries(Object.entries(metadata.core.web).map(([key, { defaulted }]) => [key, defaulted])),

View File

@@ -154,6 +154,9 @@
</div>
</div>
<div v-else-if="tab == 'action'">
<div>
<button class="copy-action" data-clipboard-target=".code">Copy Action Code</button>
</div>
Create a new workflow with the following content at <a :href="repo">{{ user }}/{{ user }}</a>
<div class="code">
<Prism language="yaml" :code="action"></Prism>
@@ -183,6 +186,7 @@
<script src="/.js/faker.min.js"></script>
<script src="/.js/vue.min.js"></script>
<script src="/.js/vue.prism.min.js"></script>
<script src="/.js/clipboard.min.js"></script>
<script src="/.js/app.placeholder.js?v=3.9"></script>
<script src="/.js/app.js?v=3.9"></script>
</body>