-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Walking skeleton with About box, language choice, copy to clipboard
- Loading branch information
Showing
15 changed files
with
183 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup> | ||
import imgUrl from '../assets/logo.png' | ||
const close = defineEmits(['close']) | ||
const closeModal = () => { | ||
console.log('close modal') | ||
close('close') | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-sky-500/50"> | ||
<div class="modal-content bg-white p-6 rounded shadow-lg w-96"> | ||
<img :src="imgUrl" alt="Manikure logo" class="w-2/3 mx-auto" /> | ||
<h2 class="text-2xl font-semibold my-2 text-center">Manikure</h2> | ||
<p class="text-center">The manifest builder for Kubernetes resources.</p> | ||
<button id="close-modal" @click="closeModal" class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded mt-4"> | ||
Close | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
@media (min-width: 1024px) { | ||
.about { | ||
min-height: 100vh; | ||
display: flex; | ||
align-items: center; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
<script setup> | ||
import { usePreferencesStore } from '../stores/preferences'; | ||
const emit = defineEmits(['showAbout']) | ||
const showAbout = () => { | ||
console.log('about clicked') | ||
emit('showAbout') | ||
} | ||
const prefs = usePreferencesStore() | ||
</script> | ||
|
||
<template> | ||
<div class="p-4 border-b-2"> | ||
Manikure 💅 — <strong>Mani</strong>fest Builder for <strong>Ku</strong>bernetes <strong>Re</strong>sources | ||
<div class="border-b-2"> | ||
<div class="flex justify-between"> | ||
<p class="p-4">Manikure Studio 💅 — <strong>Mani</strong>fest Builder for <strong>Ku</strong>bernetes <strong>Re</strong>sources</p> | ||
<nav class="flex flex-wrap justify-center"> | ||
<div> | ||
<label class="inline-block p-4"> | ||
<input type="radio" name="code-view-language" value="json" v-model="prefs.codeViewLanguage" class="peer" /> | ||
JSON | ||
</label> | ||
<label class="inline-block p-4"> | ||
<input type="radio" name="code-view-language" value="yaml" v-model="prefs.codeViewLanguage" class="peer" /> | ||
YAML | ||
</label> | ||
</div> | ||
<a @click="showAbout" class="p-4 cursor-pointer">About</a> | ||
<a href="https://github.com/monodot/k8s-manifest-builder" target="_blank" class="p-4">GitHub</a> | ||
</nav> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
<script setup> | ||
import { ref } from 'vue' | ||
import { ref, computed } from 'vue' | ||
import { useProjectStore } from '../stores/project' | ||
import { usePreferencesStore } from '../stores/preferences' | ||
import jsyaml from 'js-yaml' | ||
const project = useProjectStore() | ||
const prefs = usePreferencesStore() | ||
const tehCode = ref(project.documents[project.selectedDocument]) | ||
project.$subscribe((mutation, state) => { | ||
tehCode.value = state.documents[state.selectedDocument] | ||
}) | ||
function renderCode(document) { | ||
if (prefs.codeViewLanguage === 'yaml') { | ||
return jsyaml.dump(document) | ||
} else { | ||
return JSON.stringify(document, null, 2) | ||
} | ||
} | ||
const copyToClipboard = () => { | ||
navigator.clipboard.writeText(JSON.stringify(project.documents[project.selectedDocument], null, 2)) | ||
} | ||
project.$subscribe((mutation, state) => { | ||
tehCode.value = state.documents[state.selectedDocument] | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div class="flex flex-col flex-1 min-w-0"> | ||
<!-- Copy to clipboard --> | ||
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" @click="copyToClipboard">Copy to clipboard</button> | ||
|
||
<pre v-text="tehCode" class="font-mono py-2 px-3"></pre> | ||
<textarea v-text="renderCode(tehCode)" class="flex-auto font-mono p-2" readonly=""></textarea> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script setup> | ||
import { ref } from 'vue' | ||
import { useProjectStore } from '../stores/project' | ||
const project = useProjectStore() | ||
const ingress = ref(project.documents[project.selectedDocument]) | ||
</script> | ||
|
||
<template> | ||
<div class="p-4" aria-label="Ingress Properties"> | ||
<h2 class="text-4xl font-bold text-gray-800 py-4">Ingress</h2> | ||
<p>Ingress is a collection of rules that allow inbound connections to reach the | ||
endpoints defined by a backend.</p> | ||
<div class=""> | ||
<div class=""> | ||
<div> | ||
<label>Ingress name:</label> | ||
<input v-model="ingress.metadata.name" | ||
class="appearance-none bg-gray-200 w-full py-2 px-4 block rounded text-gray-800 focus:outline-none focus:shadow-outline"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineStore } from 'pinia' | ||
|
||
export const usePreferencesStore = defineStore({ | ||
id: 'preferences', | ||
state: () => ({ | ||
theme: 'dark', | ||
showSidebar: true, | ||
codeViewLanguage: 'yaml', | ||
}), | ||
}) |
Oops, something went wrong.