Skip to content

Commit

Permalink
fix: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Klesse committed Dec 22, 2024
1 parent 0d0ef90 commit fc0b751
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ export class CronJobs extends CoreCronJobs {
`docker system prune --force --all`,
{shell: true}
);
await execa('docker network create --driver=overlay deploy-party', {shell: true});
}
}
4 changes: 2 additions & 2 deletions projects/app/src/components/Form/FormCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ onMounted(() => {
}
});
const { handleBlur, handleChange, setTouched, setValue, value } = useField(() => props.name);
const { handleBlur, handleChange, resetField, setTouched, setValue, value } = useField(() => props.name);
if (!value.value) {
value.value = '';
setValue('', false);
}
function textarea(node) {
Expand Down
3 changes: 1 addition & 2 deletions projects/app/src/components/Form/FormInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const props = defineProps<{
const hover = ref(false);
const { handleBlur, handleChange, meta, setTouched, value } = useField(() => props.name);
const { text } = useClipboard();
async function fillByClipboard() {
value.value = await navigator.clipboard.readText();
Expand All @@ -25,7 +24,7 @@ async function fillByClipboard() {
>
<div class="relative mt-2 pb-2">
<span
v-show="text && hover"
v-show="hover"
class="absolute duration-200 right-0 -top-6 text-xs cursor-pointer font-light underline text-foreground/50 hover:text-primary"
@click="fillByClipboard"
>fill by clipboard</span
Expand Down
3 changes: 2 additions & 1 deletion projects/app/src/components/Modals/ModalDeleteConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function confirm() {
}
function copyName(name: string) {
useClipboard({ source: name }).copy();
const { $copyToClipboard } = useNuxtApp();
$copyToClipboard(name);
useNotification().notify({ text: 'Successfully copy name', title: 'Success', type: 'success' });
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion projects/app/src/pages/admin/api-keys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function showContextMenu(key: ApiKey) {
items: [
{
click: () => {
useClipboard({ source: key.key! }).copy();
const { $copyToClipboard } = useNuxtApp();
$copyToClipboard(key.key!);
useNotification().notify({ text: 'API-Key copied to clipboard', title: 'Success', type: 'success' });
},
label: 'Copy API-Key',
Expand Down
5 changes: 3 additions & 2 deletions projects/app/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ function showProjectContextMenu(project: Project) {
},
{
click: () => {
useClipboard({ source: project.id }).copy();
const { $copyToClipboard } = useNuxtApp();
$copyToClipboard(project.id);
useNotification().notify({ text: 'Copied project id', title: 'Success', type: 'success' });
},
label: 'Copy project id',
Expand All @@ -212,7 +213,7 @@ function showProjectContextMenu(project: Project) {
const config = await useAuthFetch(`/project/${project.id}/download-template`);
const text = JSON.stringify(config);
const filename = `${project.name.toLowerCase().replaceAll(' ', '_')}.json`;
const filename = `dp-${project.name.toLowerCase().replaceAll(' ', '_')}.json`;
let element = document.createElement('a');
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
Expand Down
5 changes: 3 additions & 2 deletions projects/app/src/pages/projects/[id]/[containerId]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ useSeoMeta({
});
const route = useRoute();
const { $copyToClipboard } = useNuxtApp();
const { currentUserState: user } = useAuthState();
const containerId = ref<string>(route.params.containerId ? (route.params.containerId as string) : '');
const { data } = await useAsyncGetContainerQuery({ id: containerId.value }, null);
const container = computed(() => data.value || null);
const dbUrl = computed(
() => `mongodb://${container.value.id}_${container.value.name.replace(/\s/g, '_')}:27017/YOUR_DB_NAME`,
);
const dbHost = computed(() => `${container.value.id}_${container.value.name.replace(/\s/g, '_')}`);
const { copy } = useClipboard({ source: dbUrl });
const disabled = computed<boolean>(() => !user.value.roles.includes('admin'));
const tab = ref<string>('');
Expand All @@ -37,7 +38,7 @@ watch(
);
function copyUrl() {
copy();
$copyToClipboard(dbUrl.value);
useNotification().notify({ text: 'Copied to clipboard', title: 'Success', type: 'success' });
}
</script>
Expand Down
14 changes: 14 additions & 0 deletions projects/app/src/plugins/clipboard.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default defineNuxtPlugin(() => {
return {
provide: {
copyToClipboard(text: number | string) {
const textarea = document.createElement('textarea');
textarea.value = text.toString();
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
},
},
};
});

0 comments on commit fc0b751

Please sign in to comment.