mirror of
https://github.com/louislam/dockge.git
synced 2025-02-25 13:05:55 +00:00
wip
This commit is contained in:
parent
06307956ca
commit
2530cac989
8 changed files with 122 additions and 13 deletions
|
@ -331,7 +331,7 @@ export class DockgeServer {
|
||||||
version: versionProperty,
|
version: versionProperty,
|
||||||
latestVersion: latestVersionProperty,
|
latestVersion: latestVersionProperty,
|
||||||
isContainer,
|
isContainer,
|
||||||
//primaryBaseURL: await Settings.get("primaryBaseURL"),
|
primaryHostname: await Settings.get("primaryHostname"),
|
||||||
//serverTimezone: await this.getTimezone(),
|
//serverTimezone: await this.getTimezone(),
|
||||||
//serverTimezoneOffset: this.getTimezoneOffset(),
|
//serverTimezoneOffset: this.getTimezoneOffset(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -343,8 +343,6 @@ export class Stack {
|
||||||
|
|
||||||
let lines = res.toString().split("\n");
|
let lines = res.toString().split("\n");
|
||||||
|
|
||||||
console.log(lines);
|
|
||||||
|
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
try {
|
try {
|
||||||
let obj = JSON.parse(line);
|
let obj = JSON.parse(line);
|
||||||
|
|
|
@ -254,3 +254,84 @@ function copyYAMLCommentsItems(items : any, srcItems : any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible Inputs:
|
||||||
|
* ports:
|
||||||
|
* - "3000"
|
||||||
|
* - "3000-3005"
|
||||||
|
* - "8000:8000"
|
||||||
|
* - "9090-9091:8080-8081"
|
||||||
|
* - "49100:22"
|
||||||
|
* - "8000-9000:80"
|
||||||
|
* - "127.0.0.1:8001:8001"
|
||||||
|
* - "127.0.0.1:5000-5010:5000-5010"
|
||||||
|
* - "6060:6060/udp"
|
||||||
|
* @param input
|
||||||
|
* @param defaultHostname
|
||||||
|
*/
|
||||||
|
export function parseDockerPort(input : string, defaultHostname : string = "localhost") {
|
||||||
|
let hostname = defaultHostname;
|
||||||
|
let port;
|
||||||
|
let display;
|
||||||
|
|
||||||
|
const parts = input.split("/");
|
||||||
|
const part1 = parts[0];
|
||||||
|
let protocol = parts[1] || "tcp";
|
||||||
|
|
||||||
|
// Split the last ":"
|
||||||
|
const lastColon = part1.lastIndexOf(":");
|
||||||
|
|
||||||
|
if (lastColon === -1) {
|
||||||
|
// No colon, so it's just a port or port range
|
||||||
|
// Check if it's a port range
|
||||||
|
const dash = part1.indexOf("-");
|
||||||
|
if (dash === -1) {
|
||||||
|
// No dash, so it's just a port
|
||||||
|
port = part1;
|
||||||
|
} else {
|
||||||
|
// Has dash, so it's a port range, use the first port
|
||||||
|
port = part1.substring(0, dash);
|
||||||
|
}
|
||||||
|
|
||||||
|
display = part1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Has colon, so it's a port mapping
|
||||||
|
let hostPart = part1.substring(0, lastColon);
|
||||||
|
display = hostPart;
|
||||||
|
|
||||||
|
// Check if it's a port range
|
||||||
|
const dash = part1.indexOf("-");
|
||||||
|
|
||||||
|
if (dash !== -1) {
|
||||||
|
// Has dash, so it's a port range, use the first port
|
||||||
|
hostPart = part1.substring(0, dash);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if it has a ip (ip:port)
|
||||||
|
const colon = hostPart.indexOf(":");
|
||||||
|
|
||||||
|
if (colon !== -1) {
|
||||||
|
// Has colon, so it's a ip:port
|
||||||
|
hostname = hostPart.substring(0, colon);
|
||||||
|
port = hostPart.substring(colon + 1);
|
||||||
|
} else {
|
||||||
|
// No colon, so it's just a port
|
||||||
|
port = hostPart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let portInt = parseInt(port);
|
||||||
|
|
||||||
|
if (portInt == 443) {
|
||||||
|
protocol = "https";
|
||||||
|
} else if (protocol === "tcp") {
|
||||||
|
protocol = "http";
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: protocol + "://" + hostname + ":" + portInt,
|
||||||
|
display: display,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<div v-if="valid">
|
||||||
<ul v-if="isArrayInited" class="list-group">
|
<ul v-if="isArrayInited" class="list-group">
|
||||||
<li v-for="(value, index) in array" :key="index" class="list-group-item">
|
<li v-for="(value, index) in array" :key="index" class="list-group-item">
|
||||||
<input v-model="array[index]" type="text" class="no-bg domain-input" :placeholder="placeholder" />
|
<input v-model="array[index]" type="text" class="no-bg domain-input" :placeholder="placeholder" />
|
||||||
|
@ -9,6 +10,10 @@
|
||||||
|
|
||||||
<button class="btn btn-normal btn-sm mt-3" @click="addField">{{ $t("addListItem", [ displayName ]) }}</button>
|
<button class="btn btn-normal btn-sm mt-3" @click="addField">{{ $t("addListItem", [ displayName ]) }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
Long syntax is not supported here. Please use the YAML editor.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -55,6 +60,21 @@ export default {
|
||||||
return this.$parent.$parent.service;
|
return this.$parent.$parent.service;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
valid() {
|
||||||
|
// Check if the array is actually an array
|
||||||
|
if (!Array.isArray(this.array)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the array contains non-object only.
|
||||||
|
for (let item of this.array) {
|
||||||
|
if (typeof item === "object") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!isEditMode">
|
<div v-if="!isEditMode">
|
||||||
<span class="badge me-1" :class="bgStyle">{{ status }}</span>
|
<span class="badge me-1" :class="bgStyle">{{ status }}</span>
|
||||||
|
|
||||||
|
<a v-for="port in service.ports" :href="parsePort(port).url" target="_blank">
|
||||||
|
<span class="badge me-1 bg-secondary">{{ parsePort(port).display }}</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
|
@ -128,6 +132,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
|
import { parseDockerPort } from "../../../backend/util-common";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -220,6 +225,10 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
parsePort(port) {
|
||||||
|
let hostname = this.$root.info.primaryHostname || location.hostname;
|
||||||
|
return parseDockerPort(port, hostname);
|
||||||
|
},
|
||||||
remove() {
|
remove() {
|
||||||
delete this.jsonObject.services[this.name];
|
delete this.jsonObject.services[this.name];
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.badge {
|
.badge {
|
||||||
min-width: 62px;
|
min-width: 62px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,5 +44,6 @@
|
||||||
"addNetwork": "Add Network",
|
"addNetwork": "Add Network",
|
||||||
"disableauth.message1": "Are you sure want to <strong>disable authentication</strong>?",
|
"disableauth.message1": "Are you sure want to <strong>disable authentication</strong>?",
|
||||||
"disableauth.message2": "It is designed for scenarios <strong>where you intend to implement third-party authentication</strong> in front of Uptime Kuma such as Cloudflare Access, Authelia or other authentication mechanisms.",
|
"disableauth.message2": "It is designed for scenarios <strong>where you intend to implement third-party authentication</strong> in front of Uptime Kuma such as Cloudflare Access, Authelia or other authentication mechanisms.",
|
||||||
"passwordNotMatchMsg": "The repeat password does not match."
|
"passwordNotMatchMsg": "The repeat password does not match.",
|
||||||
|
"autoGet": "Auto Get"
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<router-link to="/settings/appearance" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
<router-link to="/settings/general" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
||||||
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue