Merge 9f17fc7b9b
into d1732af529
This commit is contained in:
commit
6acf5f44a0
3 changed files with 35 additions and 18 deletions
|
@ -2,16 +2,6 @@ import { SocketHandler } from "../socket-handler.js";
|
|||
import { DockgeServer } from "../dockge-server";
|
||||
import { callbackError, checkLogin, DockgeSocket, ValidationError } from "../util-server";
|
||||
import { log } from "../log";
|
||||
import yaml from "yaml";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import {
|
||||
allowedCommandList,
|
||||
allowedRawKeys,
|
||||
getComposeTerminalName, getContainerExecTerminalName,
|
||||
isDev,
|
||||
PROGRESS_TERMINAL_ROWS
|
||||
} from "../util-common";
|
||||
import { InteractiveTerminal, MainTerminal, Terminal } from "../terminal";
|
||||
import { Stack } from "../stack";
|
||||
|
||||
|
@ -37,7 +27,7 @@ export class TerminalSocketHandler extends SocketHandler {
|
|||
} else {
|
||||
throw new Error("Terminal not found or it is not a Interactive Terminal.");
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
errorCallback({
|
||||
ok: false,
|
||||
msg: e.message,
|
||||
|
|
|
@ -96,6 +96,7 @@ export const allowedCommandList : string[] = [
|
|||
"ls",
|
||||
"cd",
|
||||
"dir",
|
||||
"clear",
|
||||
];
|
||||
|
||||
export const allowedRawKeys = [
|
||||
|
|
|
@ -24,22 +24,28 @@
|
|||
|
||||
<h2 class="mb-3">Docker Run</h2>
|
||||
<div class="mb-3">
|
||||
<textarea id="name" v-model="dockerRunCommand" type="text" class="form-control docker-run" required placeholder="docker run ..."></textarea>
|
||||
<textarea id="name" v-model="dockerRunCommand" type="text" class="form-control docker-run" required
|
||||
placeholder="docker run ..."></textarea>
|
||||
</div>
|
||||
|
||||
<button class="btn-normal btn" @click="convertDockerRun">Convert to Compose</button>
|
||||
<button class="btn-normal btn mb-4" @click="convertDockerRun">Convert to Compose</button>
|
||||
|
||||
<h2 class="mb-3">Import from URL</h2>
|
||||
<div class="mb-3">
|
||||
<input id="url" v-model="importUrl" class="form-control import-url" required placeholder="URL"/>
|
||||
</div>
|
||||
|
||||
<button class="btn-normal btn" @click="importFromUrl">Import</button>
|
||||
</div>
|
||||
</transition>
|
||||
<router-view ref="child" />
|
||||
<router-view ref="child"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { statusNameShort } from "../../../backend/util-common";
|
||||
import {statusNameShort} from "../../../backend/util-common";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
calculatedHeight: {
|
||||
type: Number,
|
||||
|
@ -58,6 +64,7 @@ export default {
|
|||
importantHeartBeatListLength: 0,
|
||||
displayedRecords: [],
|
||||
dockerRunCommand: "",
|
||||
importUrl: "",
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -127,6 +134,18 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
importFromUrl() {
|
||||
fetch(this.importUrl)
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
this.$root.composeTemplate = text;
|
||||
this.$router.push("/compose");
|
||||
})
|
||||
.catch(err => {
|
||||
this.$root.toastError(err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the displayed records when a new important heartbeat arrives.
|
||||
* @param {object} heartbeat - The heartbeat object received.
|
||||
|
@ -230,4 +249,11 @@ table {
|
|||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.import-url {
|
||||
background-color: $dark-bg !important;
|
||||
border: none;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Reference in a new issue