Repository: louislam/uptime-kuma
File: src/pages/EditMonitor.vue (Vue)

Code before:
            "scram-sha-256",
            "scram-sha-512",
            "aws",
        ];

        for (let i = 100; i <= 999; i++) {
            acceptedStatusCodeOptions.push(i.toString());
        }

        this.acceptedStatusCodeOptions = acceptedStatusCodeOptions;
        this.dnsresolvetypeOptions = dnsresolvetypeOptions;
        this.kafkaSaslMechanismOptions = kafkaSaslMechanismOptions;
    },
    methods: {
        /** Initialize the edit monitor form */
        init() {
            if (this.isAdd) {

                this.monitor = {
                    type: "http",
                    name: "",
                    parent: null,
                    url: "https://",
                    method: "GET",
                    interval: 60,
                    timeout: this.interval * 0.8, // previous default value
                    retryInterval: this.interval,
                    resendInterval: 0,
                    maxretries: 1,
                    notificationIDList: {},
                    ignoreTls: false,
                    upsideDown: false,
                    packetSize: 56,
                    expiryNotification: false,
                    maxredirects: 10,
                    accepted_statuscodes: [ "200-299" ],
                    dns_resolve_type: "A",
                    dns_resolve_server: "1.1.1.1",
                    docker_container: "",
                    docker_host: null,
                    proxyId: null,
                    mqttUsername: "",
                    mqttPassword: "",
                    mqttTopic: "",
                    mqttSuccessMessage: "",
                    authMethod: null,
                    httpBodyEncoding: "json",
                    kafkaProducerBrokers: [],
                    kafkaProducerSaslOptions: {
                        mechanism: "None",
                    },

Review comment (suggestion):
Previous compared to what?
I think this comment will not age well ^^

```suggestion
                    timeout: this.interval * 0.8,
```

Code after:
        "$route.fullPath"() {
            this.init();
        },

        "monitor.interval"(value, oldValue) {
            // Link interval and retryInterval if they are the same value.
            if (this.monitor.retryInterval === oldValue) {
                this.monitor.retryInterval = value;
            }
        },

        "monitor.timeout"(value, oldValue) {
            // keep timeout within 80% range
            if (value && value !== oldValue) {
                this.monitor.timeout = this.clampTimeout(value);
            }
        },

        "monitor.type"() {
            if (this.monitor.type === "push") {
                if (! this.monitor.pushToken) {
                    this.monitor.pushToken = genSecret(10);
                }
            }

            // Set default port for DNS if not already defined
            if (! this.monitor.port || this.monitor.port === "53" || this.monitor.port === "1812") {
                if (this.monitor.type === "dns") {
                    this.monitor.port = "53";
                } else if (this.monitor.type === "radius") {
                    this.monitor.port = "1812";
                } else {
                    this.monitor.port = undefined;
                }
            }

            // Get the game list from server
            if (this.monitor.type === "gamedig") {
                this.$root.getSocket().emit("getGameList", (res) => {
                    if (res.ok) {
                        this.gameList = res.gameList;
                    } else {
                        toast.error(res.msg);
                    }
                });
            }

            // Set default database connection string if empty or it is a template from another database monitor type
            for (let monitorType in this.connectionStringTemplates) {
                if (this.monitor.type === monitorType) {
                    let isTemplate = false;