aboutsummaryrefslogtreecommitdiff
path: root/src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue
blob: c5591eebc97ad3e47ce9bcf7d70473af1f1fd66c (plain) (blame)
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
<script setup lang="ts">
import { MessageType, composerize } from 'composerize-ts';
import { withDefaultOnError } from '@/utils/defaults';
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
import { textToBase64 } from '@/utils/base64';
import TextareaCopyable from '@/components/TextareaCopyable.vue';

const dockerRun = ref(
  'docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx',
);

const conversionResult = computed(() =>
  withDefaultOnError(() => composerize(dockerRun.value.trim()), { yaml: '', messages: [] }),
);
const dockerCompose = computed(() => conversionResult.value.yaml);
const notImplemented = computed(() =>
  conversionResult.value.messages.filter(msg => msg.type === MessageType.notImplemented).map(msg => msg.value),
);
const notComposable = computed(() =>
  conversionResult.value.messages.filter(msg => msg.type === MessageType.notTranslatable).map(msg => msg.value),
);
const errors = computed(() =>
  conversionResult.value.messages
    .filter(msg => msg.type === MessageType.errorDuringConversion)
    .map(msg => msg.value),
);
const dockerComposeBase64 = computed(() => `data:application/yaml;base64,${textToBase64(dockerCompose.value)}`);
const { download } = useDownloadFileFromBase64({ source: dockerComposeBase64, filename: 'docker-compose.yml' });
</script>

<template>
  <div>
    <c-input-text
      v-model:value="dockerRun"
      label="Your docker run command:"
      style="font-family: monospace"
      multiline
      raw-text
      monospace
      placeholder="Your docker run command to convert..."
      rows="3"
    />

    <n-divider />

    <TextareaCopyable :value="dockerCompose" language="yaml" />

    <div mt-5 flex justify-center>
      <c-button :disabled="dockerCompose === ''" secondary @click="download">
        Download docker-compose.yml
      </c-button>
    </div>

    <div v-if="notComposable.length > 0">
      <n-alert title="This options are not translatable to docker-compose" type="info" mt-5>
        <ul>
          <li v-for="(message, index) of notComposable" :key="index">
            {{ message }}
          </li>
        </ul>
      </n-alert>
    </div>

    <div v-if="notImplemented.length > 0">
      <n-alert
        title="This options are not yet implemented and therefore haven't been translated to docker-compose"
        type="warning"
        mt-5
      >
        <ul>
          <li v-for="(message, index) of notImplemented" :key="index">
            {{ message }}
          </li>
        </ul>
      </n-alert>
    </div>

    <div v-if="errors.length > 0">
      <n-alert title="The following errors occured" type="error" mt-5>
        <ul>
          <li v-for="(message, index) of errors" :key="index">
            {{ message }}
          </li>
        </ul>
      </n-alert>
    </div>
  </div>
</template>
uni/db-pluggable-backend Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/examples/framework-svelte/astro.config.mjs (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-02-06[ci] update lockfile (#2527)Gravatar Fred K. Schott 1-208/+238
2022-02-06[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-05[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-04[ci] yarn formatGravatar natemoo-re 1-2/+3
2022-02-04fix: HTML/SVG boolean attributes (#2538)Gravatar Nate Moore 2-3/+21
2022-02-04[ci] yarn formatGravatar matthewp 1-4/+2
2022-02-04fix: import local plugins into markdown (#2534)Gravatar Juan Martín Seery 9-22/+41
2022-02-04[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-03Append to list of HMR modules, don't override (#2532)Gravatar Matthew Phillips 2-1/+6
2022-02-03add back dev server host support (#2531)Gravatar Fred K. Schott 2-1/+14
2022-02-03simplify status code regexGravatar Fred K. Schott 2-87/+4
2022-02-03Adding StackUp Digital to the list of sponsors (#2521)Gravatar Astroalex 3-0/+10
2022-02-03[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-03[ci] yarn formatGravatar FredKSchott 2-3/+85
2022-02-02Handles all http error code file names the same as 404 files. (#2525)Gravatar Zade Viggers 2-4/+7
2022-02-02fix(sitemap): remove debug if sitemap disabled (#2514)Gravatar Mark Pinero 1-2/+2
2022-02-02[ci] update lockfile (#2515)Gravatar Fred K. Schott 1-276/+279
2022-02-02[ci] yarn formatGravatar matthewp 1-8/+8
2022-02-02[ci] release (next) (#2523)astro@0.23.0-next.1Gravatar github-actions[bot] 28-34/+41
2022-02-02[ci] yarn formatGravatar matthewp 2-17/+29
2022-02-02Fix support for scss in static build (#2522)Gravatar Matthew Phillips 6-20/+114
2022-02-02[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-01[ci] yarn formatGravatar matthewp 2-12/+12
2022-02-01[ci] release (next) (#2492)astro@0.23.0-next.0@astrojs/test-static-build-pkg@0.0.2@astrojs/markdown-remark@0.6.1-next.0Gravatar github-actions[bot] 31-43/+93
2022-02-01[ci] collect statsGravatar FredKSchott 1-0/+1
2022-01-31update congratsbot format againGravatar Fred K. Schott 1-1/+1
2022-01-31update congratsbot againGravatar Fred K. Schott 1-1/+1
2022-01-31Remove SVG animation on GitHub/NPM (#2512)Gravatar Nate Moore 1-21/+0
2022-01-31[ci] yarn formatGravatar natemoo-re 2-4/+6
2022-01-31Add Shiki as an alternative to Prism (#2497)Gravatar Juan Martín Seery 26-9/+356
2022-01-31Deprecate unescaped HTML inside of expressions (#2489)Gravatar Nate Moore 9-31/+74