2021-06-25 13:55:49 +00:00
< template >
2021-08-19 18:37:59 +00:00
< transition name = "slide-fade" appear >
< div >
< h1 class = "mb-3" > { { pageName } } < / h1 >
< form @submit.prevent ="submit" >
2023-03-31 12:58:45 +00:00
< div class = "shadow-box shadow-box-with-fixed-bottom-bar" >
2021-08-19 18:37:59 +00:00
< div class = "row" >
< div class = "col-md-6" >
2021-08-24 10:26:44 +00:00
< h2 class = "mb-2" > { { $t ( "General" ) } } < / h2 >
2021-08-19 18:37:59 +00:00
< div class = "my-3" >
2021-08-24 10:26:44 +00:00
< label for = "type" class = "form-label" > { { $t ( "Monitor Type" ) } } < / label >
2021-09-09 13:24:29 +00:00
< select id = "type" v-model = "monitor.type" class="form-select" >
2022-12-13 14:00:54 +00:00
< optgroup : label = "$t('General Monitor Type')" >
2023-01-28 01:58:03 +00:00
< option value = "group" >
{ { $t ( "Group" ) } }
< / option >
2022-06-13 10:14:47 +00:00
< option value = "http" >
HTTP ( s )
< / option >
< option value = "port" >
TCP Port
< / option >
< option value = "ping" >
Ping
< / option >
2024-04-27 01:05:56 +00:00
< option value = "snmp" >
SNMP
< / option >
2022-06-13 10:14:47 +00:00
< option value = "keyword" >
HTTP ( s ) - { { $t ( "Keyword" ) } }
< / option >
2023-07-13 15:37:26 +00:00
< option value = "json-query" >
HTTP ( s ) - { { $t ( "Json Query" ) } }
< / option >
2022-08-03 05:00:39 +00:00
< option value = "grpc-keyword" >
gRPC ( s ) - { { $t ( "Keyword" ) } }
< / option >
2022-06-13 10:14:47 +00:00
< option value = "dns" >
DNS
< / option >
2022-06-15 09:33:00 +00:00
< option value = "docker" >
{ { $t ( "Docker Container" ) } }
< / option >
2023-06-27 07:54:33 +00:00
< option value = "real-browser" >
HTTP ( s ) - Browser Engine ( Chrome / Chromium ) ( Beta )
< / option >
2022-06-13 10:14:47 +00:00
< / optgroup >
2022-12-13 14:00:54 +00:00
< optgroup : label = "$t('Passive Monitor Type')" >
2022-06-13 10:14:47 +00:00
< option value = "push" >
Push
< / option >
< / optgroup >
2022-12-13 14:00:54 +00:00
< optgroup : label = "$t('Specific Monitor Type')" >
2022-06-13 10:14:47 +00:00
< option value = "steam" >
{ { $t ( "Steam Game Server" ) } }
< / option >
2023-01-08 08:22:36 +00:00
< option value = "gamedig" >
GameDig
< / option >
2022-06-13 10:14:47 +00:00
< option value = "mqtt" >
MQTT
< / option >
2023-07-17 08:15:44 +00:00
< option value = "kafka-producer" >
Kafka Producer
< / option >
2022-06-13 10:14:47 +00:00
< option value = "sqlserver" >
2022-10-01 20:35:33 +00:00
Microsoft SQL Server
2022-06-13 10:14:47 +00:00
< / option >
2022-06-15 17:12:47 +00:00
< option value = "postgres" >
PostgreSQL
< / option >
2022-10-02 00:52:53 +00:00
< option value = "mysql" >
MySQL / MariaDB
< / option >
2022-11-17 01:50:34 +00:00
< option value = "mongodb" >
MongoDB
< / option >
2022-08-11 13:08:06 +00:00
< option value = "radius" >
Radius
< / option >
2023-01-05 14:58:24 +00:00
< option value = "redis" >
Redis
< / option >
2023-09-07 08:15:21 +00:00
< option v-if = "!$root.info.isContainer" value="tailscale-ping" >
2023-07-19 12:58:21 +00:00
Tailscale Ping
< / option >
2022-06-13 10:14:47 +00:00
< / optgroup >
2023-01-29 16:00:41 +00:00
< / select >
2021-08-19 18:37:59 +00:00
< / div >
2023-07-19 12:58:21 +00:00
< div v-if = "monitor.type === 'tailscale-ping'" class="alert alert-warning" role="alert" >
{ { $t ( "tailscalePingWarning" ) } }
< / div >
2021-09-30 16:09:43 +00:00
<!-- Friendly Name -- >
2021-08-19 18:37:59 +00:00
< div class = "my-3" >
2021-08-24 10:26:44 +00:00
< label for = "name" class = "form-label" > { { $t ( "Friendly Name" ) } } < / label >
2021-08-19 18:37:59 +00:00
< input id = "name" v-model = "monitor.name" type="text" class="form-control" required >
< / div >
2021-09-30 16:09:43 +00:00
<!-- URL -- >
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'real-browser'" class="my-3" >
2021-08-24 10:26:44 +00:00
< label for = "url" class = "form-label" > { { $t ( "URL" ) } } < / label >
2021-08-19 18:37:59 +00:00
< input id = "url" v-model = "monitor.url" type="url" class="form-control" pattern="https?://.+" required >
< / div >
2022-08-03 05:00:39 +00:00
<!-- gRPC URL -- >
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'grpc-keyword'" class="my-3" >
2022-08-03 05:00:39 +00:00
< label for = "grpc-url" class = "form-label" > { { $t ( "URL" ) } } < / label >
2023-04-11 10:55:27 +00:00
< input id = "grpc-url" v-model = "monitor.grpcUrl" type="text" class="form-control" required >
2022-08-03 05:00:39 +00:00
< / div >
2021-09-30 16:09:43 +00:00
<!-- Push URL -- >
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'push'" class="my-3" >
2021-10-05 07:20:24 +00:00
< label for = "push-url" class = "form-label" > { { $t ( "PushUrl" ) } } < / label >
2021-09-30 16:09:43 +00:00
< CopyableInput id = "push-url" v-model = "pushURL" type="url" disabled="disabled" / >
2021-10-01 08:43:11 +00:00
< div class = "form-text" >
2021-10-12 08:29:18 +00:00
{ { $t ( "needPushEvery" , [ monitor . interval ] ) } } < br / >
2021-12-25 19:25:21 +00:00
{ { $t ( "pushOptionalParams" , [ "status, msg, ping" ] ) } }
2021-10-01 08:43:11 +00:00
< / div >
2023-10-11 11:28:06 +00:00
< button class = "btn btn-primary" type = "button" @click ="resetToken" >
{ { $t ( "Reset Token" ) } }
< / button >
2021-09-30 16:09:43 +00:00
< / div >
<!-- Keyword -- >
2023-01-27 10:25:57 +00:00
< div v-if = "monitor.type === 'keyword' || monitor.type === 'grpc-keyword'" class="my-3" >
2021-08-24 10:26:44 +00:00
< label for = "keyword" class = "form-label" > { { $t ( "Keyword" ) } } < / label >
2021-08-19 18:37:59 +00:00
< input id = "keyword" v-model = "monitor.keyword" type="text" class="form-control" required >
< div class = "form-text" >
2021-08-27 16:41:58 +00:00
{ { $t ( "keywordDescription" ) } }
2021-08-19 18:37:59 +00:00
< / div >
< / div >
2023-04-06 00:10:21 +00:00
<!-- Invert keyword -- >
< div v-if = "monitor.type === 'keyword' || monitor.type === 'grpc-keyword'" class="my-3 form-check" >
< input id = "invert-keyword" v-model = "monitor.invertKeyword" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "invert-keyword" >
{ { $t ( "Invert Keyword" ) } }
< / label >
< div class = "form-text" >
{ { $t ( "invertKeywordDescription" ) } }
< / div >
< / div >
2023-12-01 07:29:10 +00:00
<!-- Remote Browser -- >
< div v-if = "monitor.type === 'real-browser'" class="my-3" >
<!-- Toggle -- >
< div class = "my-3 form-check" >
< input id = "toggle" v-model = "remoteBrowsersToggle" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "toggle" >
{ { $t ( "useRemoteBrowser" ) } }
< / label >
< div class = "form-text" >
{ { $t ( "remoteBrowserToggle" ) } }
< / div >
< / div >
< div v-if = "remoteBrowsersToggle" >
< label for = "remote-browser" class = "form-label" > { { $t ( "Remote Browser" ) } } < / label >
2024-04-27 01:05:56 +00:00
< ActionSelect v-model = "monitor.remote_browser" :options="remoteBrowsersOptions" icon="plus" :action="() => $refs.remoteBrowserDialog.show()" / >
2023-12-01 07:29:10 +00:00
< / div >
< / div >
2023-07-13 15:37:26 +00:00
<!-- Json Query -- >
< div v-if = "monitor.type === 'json-query'" class="my-3" >
< label for = "jsonPath" class = "form-label" > { { $t ( "Json Query" ) } } < / label >
< input id = "jsonPath" v-model = "monitor.jsonPath" type="text" class="form-control" required >
2023-12-15 10:38:57 +00:00
< i18n-t tag = "div" class = "form-text" keypath = "jsonQueryDescription" >
< a href = "https://jsonata.org/" > jsonata . org < / a >
< a href = "https://try.jsonata.org/" > { { $t ( 'here' ) } } < / a >
< / i18n-t >
2023-07-13 15:37:26 +00:00
< br >
< label for = "expectedValue" class = "form-label" > { { $t ( "Expected Value" ) } } < / label >
< input id = "expectedValue" v-model = "monitor.expectedValue" type="text" class="form-control" required >
< / div >
2023-01-08 08:22:36 +00:00
<!-- Game -- >
<!-- GameDig only -- >
< div v-if = "monitor.type === 'gamedig'" class="my-3" >
< label for = "game" class = "form-label" > { { $t ( "Game" ) } } < / label >
2023-01-24 15:03:01 +00:00
< select id = "game" v-model = "monitor.game" class="form-select" required >
< option v-for = "game in gameList" :key="game.keys[0]" :value="game.keys[0]" >
{ { game . pretty } }
< / option >
< / select >
2023-01-08 08:22:36 +00:00
< / div >
2023-07-17 08:15:44 +00:00
< template v-if = "monitor.type === 'kafka-producer'" >
<!-- Kafka Brokers List -- >
< div class = "my-3" >
< label for = "kafkaProducerBrokers" class = "form-label" > { { $t ( "Kafka Brokers" ) } } < / label >
2024-04-27 01:05:56 +00:00
< VueMultiselect id = "kafkaProducerBrokers" v-model = "monitor.kafkaProducerBrokers" :multiple="true" :options="[]" :placeholder="$t('Enter the list of brokers')" :tag-placeholder="$t('Press Enter to add broker')" :max-height="500" :taggable="true" :show-no-options="false" :close-on-select="false" :clear-on-select="false" :preserve-search="false" :preselect-first="false" @tag="addKafkaProducerBroker" > < / VueMultiselect >
2023-07-17 08:15:44 +00:00
< / div >
<!-- Kafka Topic Name -- >
< div class = "my-3" >
< label for = "kafkaProducerTopic" class = "form-label" > { { $t ( "Kafka Topic Name" ) } } < / label >
< input id = "kafkaProducerTopic" v-model = "monitor.kafkaProducerTopic" type="text" class="form-control" required >
< / div >
<!-- Kafka Producer Message -- >
< div class = "my-3" >
< label for = "kafkaProducerMessage" class = "form-label" > { { $t ( "Kafka Producer Message" ) } } < / label >
< input id = "kafkaProducerMessage" v-model = "monitor.kafkaProducerMessage" type="text" class="form-control" required >
< / div >
<!-- Kafka SSL -- >
< div class = "my-3 form-check" >
< input id = "kafkaProducerSsl" v-model = "monitor.kafkaProducerSsl" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "kafkaProducerSsl" >
{ { $t ( "Enable Kafka SSL" ) } }
< / label >
< / div >
<!-- Kafka SSL -- >
< div class = "my-3 form-check" >
< input id = "kafkaProducerAllowAutoTopicCreation" v-model = "monitor.kafkaProducerAllowAutoTopicCreation" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "kafkaProducerAllowAutoTopicCreation" >
{ { $t ( "Enable Kafka Producer Auto Topic Creation" ) } }
< / label >
< / div >
< / template >
2021-10-14 08:07:25 +00:00
<!-- Hostname -- >
2024-04-27 01:05:56 +00:00
<!-- TCP Port / Ping / DNS / Steam / MQTT / Radius / Tailscale Ping / SNMP only -- >
< div v-if = "monitor.type === 'port' || monitor.type === 'ping' || monitor.type === 'dns' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius' || monitor.type === 'tailscale-ping' || monitor.type === 'snmp'" class="my-3" >
2021-08-24 10:26:44 +00:00
< label for = "hostname" class = "form-label" > { { $t ( "Hostname" ) } } < / label >
2023-01-05 13:06:13 +00:00
< input id = "hostname" v-model = "monitor.hostname" type="text" class="form-control" :pattern="`${monitor.type === 'mqtt' ? mqttIpOrHostnameRegexPattern : ipOrHostnameRegexPattern}`" required >
2021-08-19 18:37:59 +00:00
< / div >
2021-10-18 09:02:05 +00:00
<!-- Port -- >
2024-04-27 01:05:56 +00:00
<!-- For TCP Port / Steam / MQTT / Radius Type / SNMP -- >
< div v-if = "monitor.type === 'port' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius' || monitor.type === 'snmp'" class="my-3" >
2021-08-24 10:26:44 +00:00
< label for = "port" class = "form-label" > { { $t ( "Port" ) } } < / label >
2021-08-19 18:37:59 +00:00
< input id = "port" v-model = "monitor.port" type="number" class="form-control" required min="0" max="65535" step="1" >
< / div >
2024-04-27 01:05:56 +00:00
<!-- SNMP Monitor Type -- >
< div v-if = "monitor.type === 'snmp'" class="my-3" >
< label for = "snmp_community_string" class = "form-label" > { { $t ( "Community String" ) } } < / label >
< input id = "snmp_community_string" v-model = "monitor.snmpCommunityString" type="text" class="form-control" required >
< / div >
2021-08-22 22:05:48 +00:00
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'snmp'" class="my-3" >
< label for = "snmp_oid" class = "form-label" > { { $t ( "OID (Object Identifier)" ) } } < / label >
< input id = "snmp_oid" v-model = "monitor.snmpOid" type="text" class="form-control" required >
< / div >
< div v-if = "monitor.type === 'snmp'" class="my-3" >
< div class = "d-flex align-items-start" >
< div >
< label for = "snmp_condition" class = "form-label" > { { $t ( "Condition" ) } } < / label >
< select id = "snmp_condition" v-model = "monitor.snmpCondition" class="form-select me-3" >
< option value = ">" > > < / option >
< option value = ">=" > >= < / option >
< option value = "<" > << / o p t i o n >
< option value = "<=" > <= < / option >
< option value = "==" > == < / option >
< option value = "contains" > contains < / option >
< / select >
2022-04-13 20:02:19 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div >
< label for = "snmp_control_value" class = "form-label" > { { $t ( "Control Value" ) } } < / label >
< input id = "snmp_control_value" v-model = "monitor.snmpControlValue" type="number" class="form-control" required step=".01" >
< / div >
< / div >
< / div >
2022-04-13 20:02:19 +00:00
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'snmp'" class="my-3" >
< label for = "snmp_version" class = "form-label" > { { $t ( "SNMP Version" ) } } < / label >
< select id = "snmp_version" v-model = "monitor.snmpVersion" class="form-select" >
< option value = "1" >
SNMPv1
< / option >
< option value = "2c" >
SNMPv2c
< / option >
< option value = "3" >
SNMPv3
< / option >
< / select >
< / div >
2021-08-28 03:46:26 +00:00
2024-04-27 01:05:56 +00:00
<!-- DNS Resolver Server -- >
<!-- For DNS Type -- >
< template v-if = "monitor.type === 'dns'" >
< div class = "my-3" >
< label for = "dns_resolve_server" class = "form-label" > { { $t ( "Resolver Server" ) } } < / label >
< input id = "dns_resolve_server" v-model = "monitor.dns_resolve_server" type="text" class="form-control" :pattern="ipRegex" required >
< div class = "form-text" >
{ { $t ( "resolverserverDescription" ) } }
2021-08-22 22:05:48 +00:00
< / div >
2022-01-13 16:17:07 +00:00
< / div >
2024-04-27 01:05:56 +00:00
<!-- Port -- >
< div class = "my-3" >
< label for = "port" class = "form-label" > { { $t ( "Port" ) } } < / label >
< input id = "port" v-model = "monitor.port" type="number" class="form-control" required min="0" max="65535" step="1" >
< div class = "form-text" >
{ { $t ( "dnsPortDescription" ) } }
2022-07-22 15:47:04 +00:00
< / div >
2022-01-13 16:17:07 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "dns_resolve_type" class = "form-label" > { { $t ( "Resource Record Type" ) } } < / label >
2021-11-17 01:44:10 +00:00
2024-04-27 01:05:56 +00:00
<!-- : allow - empty = "false" is not working , set a default value instead https : //github.com/shentao/vue-multiselect/issues/336 -->
< VueMultiselect id = "dns_resolve_type" v-model ="monitor.dns_resolve_type" :options="dnsresolvetypeOptions" :multiple="false" :close-on-select="true" :clear-on-select="false" :preserve-search="false" :placeholder="$t('Pick a RR-Type...')" :preselect-first="false" :max-height="500" :taggable ="false" > < / VueMultiselect >
2021-11-17 01:44:10 +00:00
2024-04-27 01:05:56 +00:00
< div class = "form-text" >
{ { $t ( "rrtypeDescription" ) } }
2021-11-04 01:46:43 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
< / template >
2021-11-04 01:46:43 +00:00
2024-04-27 01:05:56 +00:00
<!-- Docker Container Name / ID -- >
<!-- For Docker Type -- >
< div v-if = "monitor.type === 'docker'" class="my-3" >
< label for = "docker_container" class = "form-label" > { { $t ( "Container Name / ID" ) } } < / label >
< input id = "docker_container" v-model = "monitor.docker_container" type="text" class="form-control" required >
< / div >
2023-12-02 17:36:19 +00:00
2024-04-27 01:05:56 +00:00
<!-- Docker Host -- >
<!-- For Docker Type -- >
< div v-if = "monitor.type === 'docker'" class="my-3" >
< div class = "mb-3" >
< label for = "docker-host" class = "form-label" > { { $t ( "Docker Host" ) } } < / label >
< ActionSelect id = "docker-host" v-model = "monitor.docker_host" :action-aria-label="$t('openModalTo', $t('Setup Docker Host'))" :options="dockerHostOptionsList" :disabled="$root.dockerHostList == null || $root.dockerHostList.length === 0" :icon="'plus'" :action="() => $refs.dockerHostDialog.show()" :required="true" / >
< / div >
< / div >
2023-12-02 17:36:19 +00:00
2024-04-27 01:05:56 +00:00
<!-- MQTT -- >
<!-- For MQTT Type -- >
< template v-if = "monitor.type === 'mqtt'" >
< div class = "my-3" >
< label for = "mqttUsername" class = "form-label" > MQTT { { $t ( "Username" ) } } < / label >
< input id = "mqttUsername" v-model = "monitor.mqttUsername" type="text" class="form-control" >
< / div >
2023-12-02 17:36:19 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "mqttPassword" class = "form-label" > MQTT { { $t ( "Password" ) } } < / label >
< input id = "mqttPassword" v-model = "monitor.mqttPassword" type="password" class="form-control" >
< / div >
2023-12-02 17:36:19 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "mqttTopic" class = "form-label" > MQTT { { $t ( "Topic" ) } } < / label >
< input id = "mqttTopic" v-model = "monitor.mqttTopic" type="text" class="form-control" required >
< div class = "form-text" >
{ { $t ( "topicExplanation" ) } }
2021-11-04 01:46:43 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2021-11-04 01:46:43 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "mqttCheckType" class = "form-label" > MQTT { { $t ( "Check Type" ) } } < / label >
< select id = "mqttCheckType" v-model = "monitor.mqttCheckType" class="form-select" required >
< option value = "keyword" > { { $t ( "Keyword" ) } } < / option >
< option value = "json-query" > { { $t ( "Json Query" ) } } < / option >
< / select >
< / div >
2022-05-12 09:48:38 +00:00
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.mqttCheckType === 'keyword'" class="my-3" >
< label for = "mqttSuccessKeyword" class = "form-label" > MQTT { { $t ( "successKeyword" ) } } < / label >
< input id = "mqttSuccessKeyword" v-model = "monitor.mqttSuccessMessage" type="text" class="form-control" >
< div class = "form-text" >
{ { $t ( "successKeywordExplanation" ) } }
2022-05-12 17:48:03 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2022-05-12 09:48:38 +00:00
2024-04-27 01:05:56 +00:00
<!-- Json Query -- >
< div v-if = "monitor.mqttCheckType === 'json-query'" class="my-3" >
< label for = "jsonPath" class = "form-label" > { { $t ( "Json Query" ) } } < / label >
< input id = "jsonPath" v-model = "monitor.jsonPath" type="text" class="form-control" required >
2022-05-12 09:48:38 +00:00
2024-04-27 01:05:56 +00:00
<!-- eslint - disable - next - line vue / no - v - html -- >
< div class = "form-text" v-html = "$t('jsonQueryDescription')" >
2022-05-12 09:48:38 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< br >
2022-05-12 09:48:38 +00:00
2024-04-27 01:05:56 +00:00
< label for = "expectedValue" class = "form-label" > { { $t ( "Expected Value" ) } } < / label >
< input id = "expectedValue" v-model = "monitor.expectedValue" type="text" class="form-control" required >
< / div >
< / template >
2022-05-12 09:48:38 +00:00
2024-04-27 01:05:56 +00:00
< template v-if = "monitor.type === 'radius'" >
< div class = "my-3" >
< label for = "radius_username" class = "form-label" > Radius { { $t ( "Username" ) } } < / label >
< input id = "radius_username" v-model = "monitor.radiusUsername" type="text" class="form-control" required / >
< / div >
2023-10-15 16:38:56 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "radius_password" class = "form-label" > Radius { { $t ( "Password" ) } } < / label >
< input id = "radius_password" v-model = "monitor.radiusPassword" type="password" class="form-control" required / >
< / div >
2023-10-15 16:43:07 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "radius_secret" class = "form-label" > { { $t ( "RadiusSecret" ) } } < / label >
< input id = "radius_secret" v-model = "monitor.radiusSecret" type="password" class="form-control" required / >
< div class = "form-text" > { { $t ( "RadiusSecretDescription" ) } } < / div >
< / div >
2022-05-12 17:48:03 +00:00
2021-08-19 18:37:59 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "radius_called_station_id" class = "form-label" > { { $t ( "RadiusCalledStationId" ) } } < / label >
< input id = "radius_called_station_id" v-model = "monitor.radiusCalledStationId" type="text" class="form-control" required / >
< div class = "form-text" > { { $t ( "RadiusCalledStationIdDescription" ) } } < / div >
2021-08-19 18:37:59 +00:00
< / div >
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "radius_calling_station_id" class = "form-label" > { { $t ( "RadiusCallingStationId" ) } } < / label >
< input id = "radius_calling_station_id" v-model = "monitor.radiusCallingStationId" type="text" class="form-control" required / >
< div class = "form-text" > { { $t ( "RadiusCallingStationIdDescription" ) } } < / div >
2021-08-19 18:37:59 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / template >
2021-08-19 18:37:59 +00:00
2024-04-27 01:05:56 +00:00
<!-- SQL Server / PostgreSQL / MySQL / Redis / MongoDB -- >
< template v-if = "monitor.type === 'sqlserver' || monitor.type === 'postgres' || monitor.type === 'mysql' || monitor.type === 'redis' || monitor.type === 'mongodb'" >
2021-09-11 16:54:55 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "connectionString" class = "form-label" > { { $t ( "Connection String" ) } } < / label >
< input id = "connectionString" v-model = "monitor.databaseConnectionString" type="text" class="form-control" required >
2021-09-11 16:54:55 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / template >
2021-09-11 16:54:55 +00:00
2024-04-27 01:05:56 +00:00
< template v-if = "monitor.type === 'mysql'" >
< div class = "my-3" >
< label for = "mysql-password" class = "form-label" > { { $t ( "Password" ) } } < / label >
<!-- TODO : Rename monitor . radiusPassword to monitor . password for general use -- >
< HiddenInput id = "mysql-password" v-model = "monitor.radiusPassword" autocomplete="false" > < / HiddenInput >
2023-08-06 16:14:56 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / template >
2023-08-06 16:14:56 +00:00
2024-04-27 01:05:56 +00:00
<!-- SQL Server / PostgreSQL / MySQL -- >
< template v-if = "monitor.type === 'sqlserver' || monitor.type === 'postgres' || monitor.type === 'mysql'" >
2022-01-23 14:22:57 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "sqlQuery" class = "form-label" > { { $t ( "Query" ) } } < / label >
< textarea id = "sqlQuery" v-model = "monitor.databaseQuery" class="form-control" :placeholder="$t('Example:', ['SELECT 1'])" > < / textarea >
2022-01-23 14:22:57 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / template >
2022-01-23 14:22:57 +00:00
2024-04-27 01:05:56 +00:00
<!-- Interval -- >
< div class = "my-3" >
< label for = "interval" class = "form-label" > { { $t ( "Heartbeat Interval" ) } } ( { { $t ( "checkEverySecond" , [ monitor . interval ] ) } } ) < / label >
< input id = "interval" v-model = "monitor.interval" type="number" class="form-control" required :min="minInterval" step="1" :max="maxInterval" @blur="finishUpdateInterval" >
< / div >
2021-08-19 18:37:59 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "maxRetries" class = "form-label" > { { $t ( "Retries" ) } } < / label >
< input id = "maxRetries" v-model = "monitor.maxretries" type="number" class="form-control" required min="0" step="1" >
< div class = "form-text" >
{ { $t ( "retriesDescription" ) } }
2022-04-05 13:27:50 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2022-04-05 13:27:50 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "retry-interval" class = "form-label" >
{ { $t ( "Heartbeat Retry Interval" ) } }
< span > ( { { $t ( "retryCheckEverySecond" , [ monitor . retryInterval ] ) } } ) < / span >
< / label >
< input id = "retry-interval" v-model = "monitor.retryInterval" type="number" class="form-control" required :min="minInterval" step="1" >
< / div >
<!-- Timeout : HTTP / Keyword only -- >
< div v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" class="my-3" >
< label for = "timeout" class = "form-label" > { { $t ( "Request Timeout" ) } } ( { { $t ( "timeoutAfter" , [ monitor . timeout || clampTimeout ( monitor . interval ) ] ) } } ) < / label >
< input id = "timeout" v-model = "monitor.timeout" type="number" class="form-control" required min="0" step="0.1" >
< / div >
< div class = "my-3" >
< label for = "resend-interval" class = "form-label" >
{ { $t ( "Resend Notification if Down X times consecutively" ) } }
< span v-if = "monitor.resendInterval > 0" > ( {{ $ t ( " resendEveryXTimes " , [ monitor.resendInterval ] ) }} ) < / span >
< span v-else > ( {{ $ t ( " resendDisabled " ) }} ) < / span >
< / label >
< input id = "resend-interval" v-model = "monitor.resendInterval" type="number" class="form-control" required min="0" step="1" >
< / div >
< h2 v-if = "monitor.type !== 'push'" class="mt-5 mb-2" > {{ $ t ( " Advanced " ) }} < / h2 >
< div v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" class="my-3 form-check" >
< input id = "expiry-notification" v-model = "monitor.expiryNotification" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "expiry-notification" >
{ { $t ( "Certificate Expiry Notification" ) } }
< / label >
< div class = "form-text" >
2021-08-19 18:37:59 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2021-08-19 18:37:59 +00:00
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" class="my-3 form-check" >
< input id = "ignore-tls" v-model = "monitor.ignoreTls" class="form-check-input" type="checkbox" value="" >
< label class = "form-check-label" for = "ignore-tls" >
{ { $t ( "ignoreTLSError" ) } }
< / label >
< / div >
< div class = "my-3 form-check" >
< input id = "upside-down" v-model = "monitor.upsideDown" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "upside-down" >
{ { $t ( "Upside Down Mode" ) } }
< / label >
< div class = "form-text" >
{ { $t ( "upsideDownModeDescription" ) } }
< / div >
< / div >
< div v-if = "monitor.type === 'gamedig'" class="my-3 form-check" >
< input id = "gamedig-guess-port" v-model = "monitor.gamedigGivenPortOnly" :true-value="false" :false-value="true" class="form-check-input" type="checkbox" >
< label class = "form-check-label" for = "gamedig-guess-port" >
{ { $t ( "gamedigGuessPort" ) } }
< / label >
< div class = "form-text" >
{ { $t ( "gamedigGuessPortDescription" ) } }
< / div >
< / div >
<!-- Ping packet size -- >
< div v-if = "monitor.type === 'ping'" class="my-3" >
< label for = "packet-size" class = "form-label" > { { $t ( "Packet Size" ) } } < / label >
< input id = "packet-size" v-model = "monitor.packetSize" type="number" class="form-control" required min="1" max="65500" step="1" >
< / div >
<!-- HTTP / Keyword only -- >
< template v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'grpc-keyword'" >
< div class = "my-3" >
< label for = "maxRedirects" class = "form-label" > { { $t ( "Max. Redirects" ) } } < / label >
< input id = "maxRedirects" v-model = "monitor.maxredirects" type="number" class="form-control" required min="0" step="1" >
2021-08-19 18:37:59 +00:00
< div class = "form-text" >
2024-04-27 01:05:56 +00:00
{ { $t ( "maxRedirectDescription" ) } }
2021-08-19 18:37:59 +00:00
< / div >
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "acceptedStatusCodes" class = "form-label" > { { $t ( "Accepted Status Codes" ) } } < / label >
< VueMultiselect id = "acceptedStatusCodes" v-model ="monitor.accepted_statuscodes" :options="acceptedStatusCodeOptions" :multiple="true" :close-on-select="false" :clear-on-select="false" :preserve-search="true" :placeholder="$t('Pick Accepted Status Codes...')" :preselect-first="false" :max-height="600" :taggable ="true" > < / VueMultiselect >
2023-08-07 19:14:21 +00:00
< div class = "form-text" >
2024-04-27 01:05:56 +00:00
{ { $t ( "acceptedStatusCodesDescription" ) } }
2023-08-07 19:14:21 +00:00
< / div >
< / div >
2024-04-27 01:05:56 +00:00
< / template >
2023-08-07 19:14:21 +00:00
2024-04-27 01:05:56 +00:00
<!-- Parent Monitor -- >
< div class = "my-3" >
< label for = "monitorGroupSelector" class = "form-label" > { { $t ( "Monitor Group" ) } } < / label >
< ActionSelect id = "monitorGroupSelector" v-model = "monitor.parent" :action-aria-label="$t('openModalTo', 'setup a new monitor group')" :options="parentMonitorOptionsList" :disabled="sortedGroupMonitorList.length === 0 && draftGroupName == null" :icon="'plus'" :action="() => $refs.createGroupDialog.show()" / >
< / div >
2022-07-14 07:32:51 +00:00
2024-04-27 01:05:56 +00:00
<!-- Description -- >
< div class = "my-3" >
< label for = "description" class = "form-label" > { { $t ( "Description" ) } } < / label >
< input id = "description" v-model = "monitor.description" type="text" class="form-control" >
< / div >
2021-08-19 18:37:59 +00:00
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< tags-manager ref = "tagsManager" :pre-selected-tags = "monitor.tags" > < / tags-manager >
< / div >
< / div >
2021-08-28 03:46:26 +00:00
2024-04-27 01:05:56 +00:00
< div class = "col-md-6" >
< div v-if = "$root.isMobile" class="mt-3" / >
2021-08-19 18:37:59 +00:00
2024-04-27 01:05:56 +00:00
<!-- Notifications -- >
< h2 class = "mb-2" > { { $t ( "Notifications" ) } } < / h2 >
< p v-if = "$root.notificationList.length === 0" >
{ { $t ( "Not available, please setup." ) } }
< / p >
2023-08-27 20:59:47 +00:00
2024-04-27 01:05:56 +00:00
< div v-for = "notification in $root.notificationList" :key="notification.id" class="form-check form-switch my-3" >
< input : id = "'notification' + notification.id" v-model = "monitor.notificationIDList[notification.id]" class="form-check-input" type="checkbox" >
2023-02-25 12:13:46 +00:00
2024-04-27 01:05:56 +00:00
< label class = "form-check-label" : for = "'notification' + notification.id" >
{ { notification . name } }
< a href = "#" @click ="$refs.notificationDialog.show(notification.id)" > {{ $ t ( " Edit " ) }} < / a >
< / label >
< span v-if = "notification.isDefault == true" class="badge bg-primary ms-2" > {{ $ t ( " Default " ) }} < / span >
2021-07-27 17:47:13 +00:00
< / div >
2021-07-19 16:23:06 +00:00
2024-04-27 01:05:56 +00:00
< button class = "btn btn-primary me-2" type = "button" @click ="$refs.notificationDialog.show()" >
{ { $t ( "Setup Notification" ) } }
< / button >
2021-07-29 17:09:14 +00:00
2024-04-27 01:05:56 +00:00
<!-- Proxies -- >
< div v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" >
< h2 class = "mt-5 mb-2" > { { $t ( "Proxy" ) } } < / h2 >
< p v-if = "$root.proxyList.length === 0" >
2021-08-24 10:26:44 +00:00
{ { $t ( "Not available, please setup." ) } }
2021-08-19 18:37:59 +00:00
< / p >
2021-07-29 17:09:14 +00:00
2024-04-27 01:05:56 +00:00
< div v-if = "$root.proxyList.length > 0" class="form-check my-3" >
< input id = "proxy-disable" v-model = "monitor.proxyId" :value="null" name="proxy" class="form-check-input" type="radio" >
< label class = "form-check-label" for = "proxy-disable" > { { $t ( "No Proxy" ) } } < / label >
< / div >
< div v-for = "proxy in $root.proxyList" :key="proxy.id" class="form-check my-3" >
< input :id = "`proxy-${proxy.id}`" v-model = "monitor.proxyId" :value="proxy.id" name="proxy" class="form-check-input" type="radio" >
2021-07-29 17:09:14 +00:00
2024-04-27 01:05:56 +00:00
< label class = "form-check-label" :for = "`proxy-${proxy.id}`" >
{ { proxy . host } } : { { proxy . port } } ( { { proxy . protocol } } )
< a href = "#" @click ="$refs.proxyDialog.show(proxy.id)" > {{ $ t ( " Edit " ) }} < / a >
2021-08-19 18:37:59 +00:00
< / label >
2021-09-05 21:23:06 +00:00
2024-04-27 01:05:56 +00:00
< span v-if = "proxy.default === true" class="badge bg-primary ms-2" > {{ $ t ( " default " ) }} < / span >
2021-08-19 18:37:59 +00:00
< / div >
2021-08-05 11:04:38 +00:00
2024-04-27 01:05:56 +00:00
< button class = "btn btn-primary me-2" type = "button" @click ="$refs.proxyDialog.show()" >
{ { $t ( "Setup Proxy" ) } }
2021-08-19 18:37:59 +00:00
< / button >
2024-04-27 01:05:56 +00:00
< / div >
2021-10-15 10:36:40 +00:00
2024-04-27 01:05:56 +00:00
<!-- Kafka SASL Options -- >
<!-- Kafka Producer only -- >
< template v-if = "monitor.type === 'kafka-producer'" >
< h2 class = "mt-5 mb-2" > { { $t ( "Kafka SASL Options" ) } } < / h2 >
< div class = "my-3" >
< label class = "form-label" for = "kafkaProducerSaslMechanism" >
{ { $t ( "Mechanism" ) } }
< / label >
< VueMultiselect id = "kafkaProducerSaslMechanism" v-model ="monitor.kafkaProducerSaslOptions.mechanism" :options="kafkaSaslMechanismOptions" :multiple="false" :clear-on-select="false" :preserve-search="false" :placeholder="$t('Pick a SASL Mechanism...')" :preselect-first="false" :max-height="500" :allow-empty="false" :taggable ="false" > < / VueMultiselect >
< / div >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism !== 'None'" >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism !== 'aws'" class="my-3" >
< label for = "kafkaProducerSaslUsername" class = "form-label" > { { $t ( "Username" ) } } < / label >
< input id = "kafkaProducerSaslUsername" v-model = "monitor.kafkaProducerSaslOptions.username" type="text" autocomplete="kafkaProducerSaslUsername" class="form-control" >
< / div >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism !== 'aws'" class="my-3" >
< label for = "kafkaProducerSaslPassword" class = "form-label" > { { $t ( "Password" ) } } < / label >
< input id = "kafkaProducerSaslPassword" v-model = "monitor.kafkaProducerSaslOptions.password" type="password" autocomplete="kafkaProducerSaslPassword" class="form-control" >
< / div >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism === 'aws'" class="my-3" >
< label for = "kafkaProducerSaslAuthorizationIdentity" class = "form-label" > { { $t ( "Authorization Identity" ) } } < / label >
< input id = "kafkaProducerSaslAuthorizationIdentity" v-model = "monitor.kafkaProducerSaslOptions.authorizationIdentity" type="text" autocomplete="kafkaProducerSaslAuthorizationIdentity" class="form-control" required >
< / div >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism === 'aws'" class="my-3" >
< label for = "kafkaProducerSaslAccessKeyId" class = "form-label" > { { $t ( "AccessKey Id" ) } } < / label >
< input id = "kafkaProducerSaslAccessKeyId" v-model = "monitor.kafkaProducerSaslOptions.accessKeyId" type="text" autocomplete="kafkaProducerSaslAccessKeyId" class="form-control" required >
< / div >
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism === 'aws'" class="my-3" >
< label for = "kafkaProducerSaslSecretAccessKey" class = "form-label" > { { $t ( "Secret AccessKey" ) } } < / label >
< input id = "kafkaProducerSaslSecretAccessKey" v-model = "monitor.kafkaProducerSaslOptions.secretAccessKey" type="password" autocomplete="kafkaProducerSaslSecretAccessKey" class="form-control" required >
2022-04-07 06:37:33 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div v-if = "monitor.kafkaProducerSaslOptions.mechanism === 'aws'" class="my-3" >
< label for = "kafkaProducerSaslSessionToken" class = "form-label" > { { $t ( "Session Token" ) } } < / label >
< input id = "kafkaProducerSaslSessionToken" v-model = "monitor.kafkaProducerSaslOptions.sessionToken" type="password" autocomplete="kafkaProducerSaslSessionToken" class="form-control" >
< / div >
< / div >
< / template >
2021-10-30 17:37:15 +00:00
2024-04-27 01:05:56 +00:00
<!-- HTTP Options -- >
< template v-if = "monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" >
< h2 class = "mt-5 mb-2" > { { $t ( "HTTP Options" ) } } < / h2 >
2021-10-30 17:37:15 +00:00
2024-04-27 01:05:56 +00:00
<!-- Method -- >
< div class = "my-3" >
< label for = "method" class = "form-label" > { { $t ( "Method" ) } } < / label >
< select id = "method" v-model = "monitor.method" class="form-select" >
< option value = "GET" >
GET
< / option >
< option value = "POST" >
POST
< / option >
< option value = "PUT" >
PUT
< / option >
< option value = "PATCH" >
PATCH
< / option >
< option value = "DELETE" >
DELETE
< / option >
< option value = "HEAD" >
HEAD
< / option >
< option value = "OPTIONS" >
OPTIONS
< / option >
< / select >
< / div >
2021-10-30 17:37:15 +00:00
2024-04-27 01:05:56 +00:00
<!-- Encoding -- >
< div class = "my-3" >
< label for = "httpBodyEncoding" class = "form-label" > { { $t ( "Body Encoding" ) } } < / label >
< select id = "httpBodyEncoding" v-model = "monitor.httpBodyEncoding" class="form-select" >
< option value = "json" > JSON < / option >
< option value = "form" > x - www - form - urlencoded < / option >
< option value = "xml" > XML < / option >
< / select >
< / div >
2021-10-30 17:37:15 +00:00
2024-04-27 01:05:56 +00:00
<!-- Body -- >
< div class = "my-3" >
< label for = "body" class = "form-label" > { { $t ( "Body" ) } } < / label >
< textarea id = "body" v-model ="monitor.body" class="form-control" :placeholder ="bodyPlaceholder" > < / textarea >
2021-10-30 17:37:15 +00:00
< / div >
2024-04-27 01:05:56 +00:00
<!-- Headers -- >
< div class = "my-3" >
< label for = "headers" class = "form-label" > { { $t ( "Headers" ) } } < / label >
< textarea id = "headers" v-model ="monitor.headers" class="form-control" :placeholder ="headersPlaceholder" > < / textarea >
< / div >
<!-- HTTP Auth -- >
< h4 class = "mt-5 mb-2" > { { $t ( "Authentication" ) } } < / h4 >
<!-- Method -- >
< div class = "my-3" >
< label for = "method" class = "form-label" > { { $t ( "Method" ) } } < / label >
< select id = "method" v-model = "monitor.authMethod" class="form-select" >
< option :value = "null" >
{ { $t ( "None" ) } }
< / option >
< option value = "basic" >
{ { $t ( "HTTP Basic Auth" ) } }
< / option >
< option value = "oauth2-cc" >
{ { $t ( "OAuth2: Client Credentials" ) } }
< / option >
< option value = "ntlm" >
NTLM
< / option >
< option value = "mtls" >
mTLS
< / option >
< / select >
< / div >
< template v-if = "monitor.authMethod && monitor.authMethod !== null" >
< template v-if = "monitor.authMethod === 'mtls'" >
< div class = "my-3" >
< label for = "tls-cert" class = "form-label" > { { $t ( "Cert" ) } } < / label >
< textarea id = "tls-cert" v-model = "monitor.tlsCert" class="form-control" :placeholder="$t('Cert body')" required > < / textarea >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "tls-key" class = "form-label" > { { $t ( "Key" ) } } < / label >
< textarea id = "tls-key" v-model = "monitor.tlsKey" class="form-control" :placeholder="$t('Key body')" required > < / textarea >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "tls-ca" class = "form-label" > { { $t ( "CA" ) } } < / label >
< textarea id = "tls-ca" v-model = "monitor.tlsCa" class="form-control" :placeholder="$t('Server CA')" > < / textarea >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / template >
< template v -else -if = " monitor.authMethod = = = ' oauth2 -cc ' " >
< div class = "my-3" >
< label for = "oauth_auth_method" class = "form-label" > { { $t ( "Authentication Method" ) } } < / label >
< select id = "oauth_auth_method" v-model = "monitor.oauth_auth_method" class="form-select" >
< option value = "client_secret_basic" >
{ { $t ( "Authorization Header" ) } }
< / option >
< option value = "client_secret_post" >
{ { $t ( "Form Data Body" ) } }
< / option >
< / select >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "oauth_token_url" class = "form-label" > { { $t ( "OAuth Token URL" ) } } < / label >
< input id = "oauth_token_url" v-model = "monitor.oauth_token_url" type="text" class="form-control" :placeholder="$t('OAuth Token URL')" required >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< div class = "my-3" >
< label for = "oauth_client_id" class = "form-label" > { { $t ( "Client ID" ) } } < / label >
< input id = "oauth_client_id" v-model = "monitor.oauth_client_id" type="text" class="form-control" :placeholder="$t('Client ID')" required >
2023-07-17 08:15:44 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< template v-if = "monitor.oauth_auth_method === 'client_secret_post' || monitor.oauth_auth_method === 'client_secret_basic'" >
2023-01-04 07:37:30 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "oauth_client_secret" class = "form-label" > { { $t ( "Client Secret" ) } } < / label >
< input id = "oauth_client_secret" v-model = "monitor.oauth_client_secret" type="password" class="form-control" :placeholder="$t('Client Secret')" required >
2023-01-04 07:37:30 +00:00
< / div >
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "oauth_scopes" class = "form-label" > { { $t ( "OAuth Scope" ) } } < / label >
< input id = "oauth_scopes" v-model = "monitor.oauth_scopes" type="text" class="form-control" :placeholder="$t('Optional: Space separated list of scopes')" >
2023-01-04 07:37:30 +00:00
< / div >
< / template >
2024-04-27 01:05:56 +00:00
< / template >
< template v-else >
< div class = "my-3" >
< label for = "basicauth-user" class = "form-label" > { { $t ( "Username" ) } } < / label >
< input id = "basicauth-user" v-model = "monitor.basic_auth_user" type="text" class="form-control" :placeholder="$t('Username')" >
< / div >
< div class = "my-3" >
< label for = "basicauth-pass" class = "form-label" > { { $t ( "Password" ) } } < / label >
< input id = "basicauth-pass" v-model = "monitor.basic_auth_pass" type="password" autocomplete="new-password" class="form-control" :placeholder="$t('Password')" >
< / div >
< template v-if = "monitor.authMethod === 'ntlm'" >
2022-05-13 17:58:23 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "ntlm-domain" class = "form-label" > { { $t ( "Domain" ) } } < / label >
< input id = "ntlm-domain" v-model = "monitor.authDomain" type="text" class="form-control" :placeholder="$t('Domain')" >
2022-05-13 17:58:23 +00:00
< / div >
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "ntlm-workstation" class = "form-label" > { { $t ( "Workstation" ) } } < / label >
< input id = "ntlm-workstation" v-model = "monitor.authWorkstation" type="text" class="form-control" :placeholder="$t('Workstation')" >
2022-05-13 17:58:23 +00:00
< / div >
< / template >
< / template >
2021-10-15 10:36:40 +00:00
< / template >
2024-04-27 01:05:56 +00:00
< / template >
2022-08-03 05:00:39 +00:00
2024-04-27 01:05:56 +00:00
<!-- gRPC Options -- >
< template v-if = "monitor.type === 'grpc-keyword'" >
<!-- Proto service enable TLS -- >
< h2 class = "mt-5 mb-2" > { { $t ( "GRPC Options" ) } } < / h2 >
< div class = "my-3 form-check" >
< input id = "grpc-enable-tls" v-model = "monitor.grpcEnableTls" class="form-check-input" type="checkbox" value="" >
< label class = "form-check-label" for = "grpc-enable-tls" >
{ { $t ( "Enable TLS" ) } }
< / label >
< div class = "form-text" >
{ { $t ( "enableGRPCTls" ) } }
2022-08-03 05:00:39 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
<!-- Proto service name data -- >
< div class = "my-3" >
< label for = "protobuf" class = "form-label" > { { $t ( "Proto Service Name" ) } } < / label >
< input id = "name" v-model = "monitor.grpcServiceName" type="text" class="form-control" :placeholder="protoServicePlaceholder" required >
< / div >
2022-08-03 05:00:39 +00:00
2024-04-27 01:05:56 +00:00
<!-- Proto method data -- >
< div class = "my-3" >
< label for = "protobuf" class = "form-label" > { { $t ( "Proto Method" ) } } < / label >
< input id = "name" v-model = "monitor.grpcMethod" type="text" class="form-control" :placeholder="protoMethodPlaceholder" required >
< div class = "form-text" >
{ { $t ( "grpcMethodDescription" ) } }
2022-08-03 05:00:39 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2022-08-03 05:00:39 +00:00
2024-04-27 01:05:56 +00:00
<!-- Proto data -- >
< div class = "my-3" >
< label for = "protobuf" class = "form-label" > { { $t ( "Proto Content" ) } } < / label >
< textarea id = "protobuf" v-model ="monitor.grpcProtobuf" class="form-control" :placeholder ="protoBufDataPlaceholder" > < / textarea >
< / div >
2022-08-03 05:00:39 +00:00
2024-04-27 01:05:56 +00:00
<!-- Body -- >
< div class = "my-3" >
< label for = "body" class = "form-label" > { { $t ( "Body" ) } } < / label >
< textarea id = "body" v-model ="monitor.grpcBody" class="form-control" :placeholder ="bodyPlaceholder" > < / textarea >
< / div >
<!-- Metadata : temporary disable waiting for next PR allow to send gRPC with metadata -- >
< template v-if = "false" >
2022-08-03 05:00:39 +00:00
< div class = "my-3" >
2024-04-27 01:05:56 +00:00
< label for = "metadata" class = "form-label" > { { $t ( "Metadata" ) } } < / label >
< textarea id = "metadata" v-model ="monitor.grpcMetadata" class="form-control" :placeholder ="headersPlaceholder" > < / textarea >
2022-08-03 05:00:39 +00:00
< / div >
< / template >
2024-04-27 01:05:56 +00:00
< / template >
2023-02-25 07:40:09 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
2023-01-26 12:47:33 +00:00
2024-04-27 01:05:56 +00:00
< div class = "fixed-bottom-bar p-3" >
< button id = "monitor-submit-btn" class = "btn btn-primary" type = "submit" :disabled = "processing" > { { $t ( "Save" ) } } < / button >
2021-07-27 17:47:13 +00:00
< / div >
2024-04-27 01:05:56 +00:00
< / div >
< / form >
2021-06-25 13:55:49 +00:00
2024-04-27 01:05:56 +00:00
< NotificationDialog ref = "notificationDialog" @added ="addedNotification" / >
< DockerHostDialog ref = "dockerHostDialog" @added ="addedDockerHost" / >
< ProxyDialog ref = "proxyDialog" @added ="addedProxy" / >
< CreateGroupDialog ref = "createGroupDialog" @added ="addedDraftGroup" / >
< RemoteBrowserDialog ref = "remoteBrowserDialog" @added ="addedRemoteBrowser" / >
2021-06-25 13:55:49 +00:00
< / div >
2021-08-19 18:37:59 +00:00
< / transition >
2021-06-25 13:55:49 +00:00
< / template >
< script >
2022-04-25 23:26:57 +00:00
import VueMultiselect from "vue-multiselect" ;
import { useToast } from "vue-toastification" ;
2023-08-04 06:48:21 +00:00
import ActionSelect from "../components/ActionSelect.vue" ;
2022-04-25 23:26:57 +00:00
import CopyableInput from "../components/CopyableInput.vue" ;
2023-08-04 06:48:21 +00:00
import CreateGroupDialog from "../components/CreateGroupDialog.vue" ;
2021-06-29 08:06:20 +00:00
import NotificationDialog from "../components/NotificationDialog.vue" ;
2022-07-22 15:47:04 +00:00
import DockerHostDialog from "../components/DockerHostDialog.vue" ;
2023-12-01 07:29:10 +00:00
import RemoteBrowserDialog from "../components/RemoteBrowserDialog.vue" ;
2021-10-30 17:37:15 +00:00
import ProxyDialog from "../components/ProxyDialog.vue" ;
2021-08-26 10:55:19 +00:00
import TagsManager from "../components/TagsManager.vue" ;
2023-12-10 12:40:40 +00:00
import { genSecret , isDev , MAX _INTERVAL _SECOND , MIN _INTERVAL _SECOND , sleep } from "../util.ts" ;
2023-01-06 10:00:20 +00:00
import { hostNameRegexPattern } from "../util-frontend" ;
2023-10-15 16:38:56 +00:00
import HiddenInput from "../components/HiddenInput.vue" ;
2021-09-30 16:09:43 +00:00
2023-10-14 11:00:27 +00:00
const toast = useToast ;
2021-06-25 13:55:49 +00:00
2023-10-11 11:28:06 +00:00
const pushTokenLength = 32 ;
2021-06-25 13:55:49 +00:00
2023-08-04 06:48:21 +00:00
const monitorDefaults = {
type : "http" ,
name : "" ,
parent : null ,
url : "https://" ,
method : "GET" ,
interval : 60 ,
retryInterval : 60 ,
resendInterval : 0 ,
2023-12-01 06:09:13 +00:00
maxretries : 0 ,
2023-08-06 16:14:56 +00:00
timeout : 48 ,
2023-08-04 06:48:21 +00:00
notificationIDList : { } ,
ignoreTls : false ,
upsideDown : false ,
packetSize : 56 ,
expiryNotification : false ,
maxredirects : 10 ,
2024-04-27 01:05:56 +00:00
accepted _statuscodes : [ "200-299" ] ,
2023-08-04 06:48:21 +00:00
dns _resolve _type : "A" ,
dns _resolve _server : "1.1.1.1" ,
docker _container : "" ,
docker _host : null ,
proxyId : null ,
mqttUsername : "" ,
mqttPassword : "" ,
mqttTopic : "" ,
mqttSuccessMessage : "" ,
2023-12-02 17:36:19 +00:00
mqttCheckType : "keyword" ,
2023-08-04 06:48:21 +00:00
authMethod : null ,
oauth _auth _method : "client_secret_basic" ,
httpBodyEncoding : "json" ,
kafkaProducerBrokers : [ ] ,
kafkaProducerSaslOptions : {
mechanism : "None" ,
} ,
2023-09-23 19:30:15 +00:00
kafkaProducerSsl : false ,
2023-10-28 06:42:55 +00:00
kafkaProducerAllowAutoTopicCreation : false ,
2023-08-07 19:14:21 +00:00
gamedigGivenPortOnly : true ,
2024-04-27 01:05:56 +00:00
remote _browser : null ,
2023-08-04 06:48:21 +00:00
} ;
2021-06-25 13:55:49 +00:00
export default {
components : {
2023-10-15 16:38:56 +00:00
HiddenInput ,
2023-08-04 06:48:21 +00:00
ActionSelect ,
2021-10-30 17:37:15 +00:00
ProxyDialog ,
2021-09-30 16:09:43 +00:00
CopyableInput ,
2023-08-04 06:48:21 +00:00
CreateGroupDialog ,
2021-07-27 17:47:13 +00:00
NotificationDialog ,
2022-07-22 15:47:04 +00:00
DockerHostDialog ,
2023-12-01 07:29:10 +00:00
RemoteBrowserDialog ,
2021-08-26 10:55:19 +00:00
TagsManager ,
2021-08-05 13:06:47 +00:00
VueMultiselect ,
2021-06-25 13:55:49 +00:00
} ,
2021-08-08 13:14:29 +00:00
2021-06-25 13:55:49 +00:00
data ( ) {
return {
2022-12-08 15:21:55 +00:00
minInterval : MIN _INTERVAL _SECOND ,
maxInterval : MAX _INTERVAL _SECOND ,
2021-06-25 13:55:49 +00:00
processing : false ,
2021-07-09 09:55:48 +00:00
monitor : {
notificationIDList : { } ,
2021-08-28 03:46:26 +00:00
// Do not add default value here, please check init() method
2021-07-09 09:55:48 +00:00
} ,
2021-08-08 13:14:29 +00:00
acceptedStatusCodeOptions : [ ] ,
2021-08-22 22:05:48 +00:00
dnsresolvetypeOptions : [ ] ,
2023-07-17 08:15:44 +00:00
kafkaSaslMechanismOptions : [ ] ,
2023-01-05 13:48:12 +00:00
ipOrHostnameRegexPattern : hostNameRegexPattern ( ) ,
2023-01-24 15:03:01 +00:00
mqttIpOrHostnameRegexPattern : hostNameRegexPattern ( true ) ,
gameList : null ,
2023-04-02 18:57:14 +00:00
connectionStringTemplates : {
"sqlserver" : "Server=<hostname>,<port>;Database=<your database>;User Id=<your user id>;Password=<your password>;Encrypt=<true/false>;TrustServerCertificate=<Yes/No>;Connection Timeout=<int>" ,
"postgres" : "postgres://username:password@host:port/database" ,
"mysql" : "mysql://username:password@host:port/database" ,
"redis" : "redis://user:password@host:port" ,
"mongodb" : "mongodb://username:password@host:port/database" ,
2023-08-04 06:48:21 +00:00
} ,
draftGroupName : null ,
2023-12-01 07:29:10 +00:00
remoteBrowsersEnabled : false ,
2021-09-30 16:09:43 +00:00
} ;
2021-06-25 13:55:49 +00:00
} ,
2021-08-08 13:14:29 +00:00
2021-06-25 13:55:49 +00:00
computed : {
2021-08-25 17:50:27 +00:00
ipRegex ( ) {
// Allow to test with simple dns server with port (127.0.0.1:5300)
2024-04-27 01:05:56 +00:00
if ( ! isDev ) {
2021-08-25 17:50:27 +00:00
return this . ipRegexPattern ;
}
return null ;
} ,
2021-06-25 13:55:49 +00:00
pageName ( ) {
2022-12-27 22:26:05 +00:00
let name = "Add New Monitor" ;
if ( this . isClone ) {
name = "Clone Monitor" ;
} else if ( this . isEdit ) {
name = "Edit" ;
}
return this . $t ( name ) ;
2021-06-25 13:55:49 +00:00
} ,
2023-12-01 07:29:10 +00:00
remoteBrowsersOptions ( ) {
return this . $root . remoteBrowserList . map ( browser => {
return {
label : browser . name ,
value : browser . id ,
} ;
} ) ;
} ,
remoteBrowsersToggle : {
get ( ) {
return this . remoteBrowsersEnabled || this . monitor . remote _browser != null ;
} ,
set ( value ) {
if ( value ) {
this . remoteBrowsersEnabled = true ;
if ( this . monitor . remote _browser == null && this . $root . remoteBrowserList . length > 0 ) {
// set a default remote browser if there is one. Otherwise, the user will have to select one manually.
this . monitor . remote _browser = this . $root . remoteBrowserList [ 0 ] . id ;
}
} else {
this . remoteBrowsersEnabled = false ;
this . monitor . remote _browser = null ;
}
}
} ,
2021-06-25 13:55:49 +00:00
isAdd ( ) {
return this . $route . path === "/add" ;
2021-06-27 08:10:55 +00:00
} ,
2021-09-30 16:09:43 +00:00
2022-12-27 22:26:05 +00:00
isClone ( ) {
return this . $route . path . startsWith ( "/clone" ) ;
} ,
2021-06-27 08:10:55 +00:00
isEdit ( ) {
return this . $route . path . startsWith ( "/edit" ) ;
2021-07-27 17:47:13 +00:00
} ,
2021-09-30 16:09:43 +00:00
pushURL ( ) {
2022-04-30 13:44:03 +00:00
return this . $root . baseURL + "/api/push/" + this . monitor . pushToken + "?status=up&msg=OK&ping=" ;
2021-10-02 14:48:27 +00:00
} ,
2022-08-03 05:00:39 +00:00
protoServicePlaceholder ( ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ "Health" ] ) ;
2022-08-03 05:00:39 +00:00
} ,
protoMethodPlaceholder ( ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ "check" ] ) ;
2022-08-03 05:00:39 +00:00
} ,
protoBufDataPlaceholder ( ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ `
2022-08-03 05:00:39 +00:00
syntax = "proto3" ;
package grpc . health . v1 ;
service Health {
rpc Check ( HealthCheckRequest ) returns ( HealthCheckResponse ) ;
rpc Watch ( HealthCheckRequest ) returns ( stream HealthCheckResponse ) ;
}
message HealthCheckRequest {
string service = 1 ;
}
message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0 ;
SERVING = 1 ;
NOT _SERVING = 2 ;
SERVICE _UNKNOWN = 3 ; // Used only by the Watch method.
}
ServingStatus status = 1 ;
}
` ]);
} ,
2021-11-29 11:40:53 +00:00
bodyPlaceholder ( ) {
2023-02-18 14:02:56 +00:00
if ( this . monitor && this . monitor . httpBodyEncoding && this . monitor . httpBodyEncoding === "xml" ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ `
2023-02-18 14:02:56 +00:00
< ? xml version = "1.0" encoding = "utf-8" ? >
< soap : Envelope xmlns :xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns :xsd = "http://www.w3.org/2001/XMLSchema" xmlns :soap = "http://schemas.xmlsoap.org/soap/envelope/" >
< soap : Body >
< Uptime > Kuma < / Uptime >
< / s o a p : B o d y >
< / s o a p : E n v e l o p e > ` ] ) ;
}
2023-09-09 10:05:25 +00:00
if ( this . monitor && this . monitor . httpBodyEncoding === "form" ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ "key1=value1&key2=value2" ] ) ;
2023-09-09 10:05:25 +00:00
}
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ `
2021-11-29 11:40:53 +00:00
{
"key" : "value"
2022-04-17 07:27:35 +00:00
} ` ]);
2021-11-29 11:40:53 +00:00
} ,
headersPlaceholder ( ) {
2024-04-27 01:05:56 +00:00
return this . $t ( "Example:" , [ `
2021-11-29 11:40:53 +00:00
{
"HeaderName" : "HeaderValue"
2022-04-17 07:27:35 +00:00
} ` ]);
2023-01-24 15:03:01 +00:00
} ,
currentGameObject ( ) {
if ( this . gameList ) {
for ( let game of this . gameList ) {
if ( game . keys [ 0 ] === this . monitor . game ) {
return game ;
}
}
}
return null ;
} ,
2021-11-29 11:40:53 +00:00
2023-01-28 13:22:15 +00:00
// Filter result by active state, weight and alphabetical
// Only return groups which arent't itself and one of its decendants
2023-08-04 06:48:21 +00:00
sortedGroupMonitorList ( ) {
2023-01-28 01:58:03 +00:00
let result = Object . values ( this . $root . monitorList ) ;
2023-01-28 13:28:34 +00:00
// Only groups, not itself, not a decendant
result = result . filter (
monitor => monitor . type === "group" &&
2024-04-27 01:05:56 +00:00
monitor . id !== this . monitor . id &&
! this . monitor . childrenIDs ? . includes ( monitor . id )
2023-01-28 13:28:34 +00:00
) ;
2023-01-28 01:58:03 +00:00
2023-01-28 13:28:53 +00:00
// Filter result by active state, weight and alphabetical
2023-01-28 01:58:03 +00:00
result . sort ( ( m1 , m2 ) => {
if ( m1 . active !== m2 . active ) {
if ( m1 . active === 0 ) {
return 1 ;
}
if ( m2 . active === 0 ) {
return - 1 ;
}
}
if ( m1 . weight !== m2 . weight ) {
if ( m1 . weight > m2 . weight ) {
return - 1 ;
}
if ( m1 . weight < m2 . weight ) {
return 1 ;
}
}
return m1 . pathName . localeCompare ( m2 . pathName ) ;
} ) ;
return result ;
} ,
2023-08-04 06:48:21 +00:00
/ * *
* Generates the parent monitor options list based on the sorted group monitor list and draft group name .
2023-08-11 07:46:41 +00:00
* @ returns { Array } The parent monitor options list .
2023-08-04 06:48:21 +00:00
* /
parentMonitorOptionsList ( ) {
let list = [ ] ;
if ( this . sortedGroupMonitorList . length === 0 && this . draftGroupName == null ) {
list = [
{
label : this . $t ( "noGroupMonitorMsg" ) ,
value : null
}
] ;
} else {
list = [
{
label : this . $t ( "None" ) ,
value : null
} ,
... this . sortedGroupMonitorList . map ( monitor => {
return {
label : monitor . pathName ,
value : monitor . id ,
} ;
} ) ,
] ;
}
if ( this . draftGroupName != null ) {
list = [ {
label : this . draftGroupName ,
value : - 1 ,
} ] . concat ( list ) ;
}
return list ;
} ,
2023-11-12 12:32:40 +00:00
dockerHostOptionsList ( ) {
if ( this . $root . dockerHostList && this . $root . dockerHostList . length > 0 ) {
return this . $root . dockerHostList . map ( ( host ) => {
return {
label : host . name ,
value : host . id
} ;
} ) ;
} else {
return [ {
label : this . $t ( "noDockerHostMsg" ) ,
value : null ,
} ] ;
}
}
2021-07-27 17:47:13 +00:00
} ,
watch : {
2021-10-30 17:37:15 +00:00
"$root.proxyList" ( ) {
if ( this . isAdd ) {
if ( this . $root . proxyList && ! this . monitor . proxyId ) {
const proxy = this . $root . proxyList . find ( proxy => proxy . default ) ;
if ( proxy ) {
this . monitor . proxyId = proxy . id ;
}
}
}
} ,
2021-09-30 16:09:43 +00:00
2021-08-19 18:37:59 +00:00
"$route.fullPath" ( ) {
2021-07-27 17:47:13 +00:00
this . init ( ) ;
} ,
2021-09-30 16:09:43 +00:00
2021-09-14 07:48:25 +00:00
"monitor.interval" ( value , oldValue ) {
2021-10-02 14:48:27 +00:00
// Link interval and retryInterval if they are the same value.
2021-09-14 07:48:25 +00:00
if ( this . monitor . retryInterval === oldValue ) {
this . monitor . retryInterval = value ;
}
2021-09-30 16:09:43 +00:00
} ,
2023-08-06 16:14:56 +00:00
"monitor.timeout" ( value , oldValue ) {
// keep timeout within 80% range
if ( value && value !== oldValue ) {
this . monitor . timeout = this . clampTimeout ( value ) ;
}
} ,
2021-09-30 16:09:43 +00:00
"monitor.type" ( ) {
if ( this . monitor . type === "push" ) {
2024-04-27 01:05:56 +00:00
if ( ! this . monitor . pushToken ) {
2023-10-11 11:28:06 +00:00
// ideally this would require checking if the generated token is already used
// it's very unlikely to get a collision though (62^32 ~ 2.27265788 * 10^57 unique tokens)
this . monitor . pushToken = genSecret ( pushTokenLength ) ;
2021-09-30 16:09:43 +00:00
}
}
2022-04-13 20:02:19 +00:00
// Set default port for DNS if not already defined
2024-04-27 01:05:56 +00:00
if ( ! this . monitor . port || this . monitor . port === "53" || this . monitor . port === "1812" ) {
2022-04-13 20:02:19 +00:00
if ( this . monitor . type === "dns" ) {
this . monitor . port = "53" ;
2022-10-12 16:32:05 +00:00
} else if ( this . monitor . type === "radius" ) {
this . monitor . port = "1812" ;
2024-04-29 21:59:59 +00:00
} else if ( this . monitor . type === "snmp" ) {
this . monitor . port = "161" ;
2022-04-13 20:02:19 +00:00
} else {
2022-06-21 14:33:09 +00:00
this . monitor . port = undefined ;
2022-04-13 20:02:19 +00:00
}
}
2023-01-24 15:03:01 +00:00
2024-04-29 21:59:59 +00:00
// Set default SNMP version
if ( ! this . monitor . snmpVersion ) {
this . monitor . snmpVersion = "2c" ;
}
2023-01-24 15:03:01 +00:00
// 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 {
2023-10-14 11:00:27 +00:00
this . $root . toastError ( res . msg ) ;
2023-01-24 15:03:01 +00:00
}
} ) ;
}
2023-04-02 18:57:14 +00:00
// 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 ;
for ( let key in this . connectionStringTemplates ) {
if ( this . monitor . databaseConnectionString === this . connectionStringTemplates [ key ] ) {
isTemplate = true ;
break ;
}
}
if ( ! this . monitor . databaseConnectionString || isTemplate ) {
this . monitor . databaseConnectionString = this . connectionStringTemplates [ monitorType ] ;
}
break ;
}
}
2023-01-24 15:03:01 +00:00
} ,
currentGameObject ( newGameObject , previousGameObject ) {
if ( ! this . monitor . port || ( previousGameObject && previousGameObject . options . port === this . monitor . port ) ) {
this . monitor . port = newGameObject . options . port ;
}
this . monitor . game = newGameObject . keys [ 0 ] ;
2023-04-02 18:57:14 +00:00
} ,
2021-07-27 17:47:13 +00:00
} ,
mounted ( ) {
this . init ( ) ;
2021-08-08 13:14:29 +00:00
let acceptedStatusCodeOptions = [
"100-199" ,
"200-299" ,
"300-399" ,
"400-499" ,
"500-599" ,
] ;
2021-08-22 22:05:48 +00:00
let dnsresolvetypeOptions = [
"A" ,
"AAAA" ,
"CAA" ,
"CNAME" ,
"MX" ,
"NS" ,
"PTR" ,
"SOA" ,
"SRV" ,
"TXT" ,
] ;
2023-07-17 08:15:44 +00:00
let kafkaSaslMechanismOptions = [
"None" ,
"plain" ,
"scram-sha-256" ,
"scram-sha-512" ,
"aws" ,
] ;
2021-08-08 13:14:29 +00:00
for ( let i = 100 ; i <= 999 ; i ++ ) {
acceptedStatusCodeOptions . push ( i . toString ( ) ) ;
}
this . acceptedStatusCodeOptions = acceptedStatusCodeOptions ;
2021-08-22 22:05:48 +00:00
this . dnsresolvetypeOptions = dnsresolvetypeOptions ;
2023-07-17 08:15:44 +00:00
this . kafkaSaslMechanismOptions = kafkaSaslMechanismOptions ;
2021-06-25 13:55:49 +00:00
} ,
methods : {
2023-08-11 07:46:41 +00:00
/ * *
* Initialize the edit monitor form
* @ returns { void }
* /
2021-06-27 08:10:55 +00:00
init ( ) {
if ( this . isAdd ) {
2021-09-09 13:24:29 +00:00
2021-06-27 08:10:55 +00:00
this . monitor = {
2023-08-04 06:48:21 +00:00
... monitorDefaults
2021-09-30 16:09:43 +00:00
} ;
2021-09-05 21:23:06 +00:00
2021-10-30 17:37:15 +00:00
if ( this . $root . proxyList && ! this . monitor . proxyId ) {
const proxy = this . $root . proxyList . find ( proxy => proxy . default ) ;
if ( proxy ) {
this . monitor . proxyId = proxy . id ;
}
}
2021-09-05 21:23:06 +00:00
for ( let i = 0 ; i < this . $root . notificationList . length ; i ++ ) {
2022-04-25 23:26:57 +00:00
if ( this . $root . notificationList [ i ] . isDefault === true ) {
2021-09-05 21:23:06 +00:00
this . monitor . notificationIDList [ this . $root . notificationList [ i ] . id ] = true ;
}
}
2022-12-27 22:26:05 +00:00
} else if ( this . isEdit || this . isClone ) {
2021-06-27 08:10:55 +00:00
this . $root . getSocket ( ) . emit ( "getMonitor" , this . $route . params . id , ( res ) => {
if ( res . ok ) {
2023-03-24 10:39:52 +00:00
if ( this . isClone ) {
// Reset push token for cloned monitors
if ( res . monitor . type === "push" ) {
res . monitor . pushToken = undefined ;
}
}
2021-06-27 08:10:55 +00:00
this . monitor = res . monitor ;
2021-09-20 10:23:53 +00:00
2022-12-27 22:26:05 +00:00
if ( this . isClone ) {
2023-02-25 09:05:03 +00:00
/ *
2023-06-14 16:58:45 +00:00
* Cloning a monitor will include properties that can not be posted to backend
* as they are not valid columns in the SQLite table .
* /
2022-12-27 22:26:05 +00:00
this . monitor . id = undefined ; // Remove id when cloning as we want a new id
this . monitor . includeSensitiveData = undefined ;
this . monitor . maintenance = undefined ;
2023-06-14 16:58:45 +00:00
// group monitor fields
this . monitor . childrenIDs = undefined ;
this . monitor . forceInactive = undefined ;
2024-03-03 09:59:38 +00:00
this . monitor . path = undefined ;
2023-06-14 16:58:45 +00:00
this . monitor . pathName = undefined ;
2023-07-17 08:15:44 +00:00
this . monitor . screenshot = undefined ;
2023-06-14 16:58:45 +00:00
2024-04-27 01:05:56 +00:00
this . monitor . name = this . $t ( "cloneOf" , [ this . monitor . name ] ) ;
2023-03-01 22:44:16 +00:00
this . $refs . tagsManager . newTags = this . monitor . tags . map ( ( monitorTag ) => {
return {
id : monitorTag . tag _id ,
name : monitorTag . name ,
color : monitorTag . color ,
value : monitorTag . value ,
new : true ,
} ;
} ) ;
this . monitor . tags = undefined ;
2022-12-27 22:26:05 +00:00
}
2021-09-20 10:23:53 +00:00
// Handling for monitors that are created before 1.7.0
if ( this . monitor . retryInterval === 0 ) {
this . monitor . retryInterval = this . monitor . interval ;
}
2023-08-06 16:14:56 +00:00
// Handling for monitors that are missing/zeroed timeout
if ( ! this . monitor . timeout ) {
this . monitor . timeout = ~ ~ ( this . monitor . interval * 8 ) / 10 ;
}
2021-06-27 08:10:55 +00:00
} else {
2023-10-14 11:00:27 +00:00
this . $root . toastError ( res . msg ) ;
2021-06-27 08:10:55 +00:00
}
2021-09-30 16:09:43 +00:00
} ) ;
2021-06-27 08:10:55 +00:00
}
2023-08-04 06:48:21 +00:00
this . draftGroupName = null ;
2021-06-27 08:10:55 +00:00
} ,
2023-07-17 08:15:44 +00:00
addKafkaProducerBroker ( newBroker ) {
this . monitor . kafkaProducerBrokers . push ( newBroker ) ;
} ,
2022-06-02 12:46:44 +00:00
/ * *
* Validate form input
* @ returns { boolean } Is the form input valid ?
* /
2021-10-02 14:48:27 +00:00
isInputValid ( ) {
2022-08-12 00:57:03 +00:00
if ( this . monitor . body && ( ! this . monitor . httpBodyEncoding || this . monitor . httpBodyEncoding === "json" ) ) {
2021-10-02 14:48:27 +00:00
try {
JSON . parse ( this . monitor . body ) ;
} catch ( err ) {
2021-10-05 07:20:24 +00:00
toast . error ( this . $t ( "BodyInvalidFormat" ) + err . message ) ;
2021-10-02 14:48:27 +00:00
return false ;
}
}
if ( this . monitor . headers ) {
2021-10-09 10:42:32 +00:00
try {
JSON . parse ( this . monitor . headers ) ;
} catch ( err ) {
toast . error ( this . $t ( "HeadersInvalidFormat" ) + err . message ) ;
2021-10-02 14:48:27 +00:00
return false ;
}
}
2023-11-12 12:32:40 +00:00
if ( this . monitor . type === "docker" ) {
if ( this . monitor . docker _host == null ) {
toast . error ( this . $t ( "DockerHostRequired" ) ) ;
return false ;
}
}
2021-10-02 14:48:27 +00:00
return true ;
} ,
2023-10-11 11:28:06 +00:00
resetToken ( ) {
this . monitor . pushToken = genSecret ( pushTokenLength ) ;
} ,
2022-06-02 12:46:44 +00:00
/ * *
* Submit the form data for processing
2024-03-15 14:02:55 +00:00
* @ returns { Promise < void > }
2022-06-02 12:46:44 +00:00
* /
2021-08-26 10:55:19 +00:00
async submit ( ) {
2023-02-18 19:18:48 +00:00
2021-06-25 13:55:49 +00:00
this . processing = true ;
2021-10-02 14:48:27 +00:00
if ( ! this . isInputValid ( ) ) {
this . processing = false ;
return ;
}
2022-08-12 00:57:03 +00:00
// Beautify the JSON format (only if httpBodyEncoding is not set or === json)
if ( this . monitor . body && ( ! this . monitor . httpBodyEncoding || this . monitor . httpBodyEncoding === "json" ) ) {
2021-10-15 10:57:27 +00:00
this . monitor . body = JSON . stringify ( JSON . parse ( this . monitor . body ) , null , 4 ) ;
}
2024-04-27 01:05:56 +00:00
const monitorTypesWithEncodingAllowed = [ "http" , "keyword" , "json-query" ] ;
2023-08-07 07:13:51 +00:00
if ( this . monitor . type && ! monitorTypesWithEncodingAllowed . includes ( this . monitor . type ) ) {
2023-02-18 19:18:48 +00:00
this . monitor . httpBodyEncoding = null ;
}
2021-10-15 10:57:27 +00:00
if ( this . monitor . headers ) {
this . monitor . headers = JSON . stringify ( JSON . parse ( this . monitor . headers ) , null , 4 ) ;
}
2023-01-19 22:33:45 +00:00
if ( this . monitor . hostname ) {
this . monitor . hostname = this . monitor . hostname . trim ( ) ;
}
if ( this . monitor . url ) {
this . monitor . url = this . monitor . url . trim ( ) ;
}
2023-08-04 06:48:21 +00:00
let createdNewParent = false ;
if ( this . draftGroupName && this . monitor . parent === - 1 ) {
// Create Monitor with name of draft group
const res = await new Promise ( ( resolve ) => {
this . $root . add ( {
... monitorDefaults ,
type : "group" ,
name : this . draftGroupName ,
interval : this . monitor . interval ,
active : false ,
} , resolve ) ;
} ) ;
if ( res . ok ) {
createdNewParent = true ;
this . monitor . parent = res . monitorID ;
} else {
2023-10-14 11:00:27 +00:00
this . $root . toastError ( res . msg ) ;
2023-08-04 06:48:21 +00:00
this . processing = false ;
return ;
}
}
2022-12-27 22:26:05 +00:00
if ( this . isAdd || this . isClone ) {
2021-08-26 10:55:19 +00:00
this . $root . add ( this . monitor , async ( res ) => {
2021-06-25 13:55:49 +00:00
if ( res . ok ) {
2021-08-26 10:55:19 +00:00
await this . $refs . tagsManager . submit ( res . monitorID ) ;
2023-08-04 06:48:21 +00:00
// Start the new parent monitor after edit is done
if ( createdNewParent ) {
2024-03-15 14:02:55 +00:00
await this . startParentGroupMonitor ( ) ;
2023-08-04 06:48:21 +00:00
}
2021-08-26 10:55:19 +00:00
this . processing = false ;
this . $root . getMonitorList ( ) ;
2021-09-30 16:09:43 +00:00
this . $router . push ( "/dashboard/" + res . monitorID ) ;
2021-06-25 13:55:49 +00:00
} else {
2021-08-26 10:55:19 +00:00
this . processing = false ;
2021-06-25 13:55:49 +00:00
}
2023-10-14 11:00:27 +00:00
this . $root . toastRes ( res ) ;
2021-09-30 16:09:43 +00:00
} ) ;
2021-06-25 13:55:49 +00:00
} else {
2021-08-26 10:55:19 +00:00
await this . $refs . tagsManager . submit ( this . monitor . id ) ;
2021-06-27 08:10:55 +00:00
this . $root . getSocket ( ) . emit ( "editMonitor" , this . monitor , ( res ) => {
this . processing = false ;
2021-09-10 03:53:11 +00:00
this . $root . toastRes ( res ) ;
this . init ( ) ;
2023-08-04 06:48:21 +00:00
// Start the new parent monitor after edit is done
if ( createdNewParent ) {
this . startParentGroupMonitor ( ) ;
}
2021-09-30 16:09:43 +00:00
} ) ;
2021-06-25 13:55:49 +00:00
}
2021-07-27 17:47:13 +00:00
} ,
2021-09-09 13:24:29 +00:00
2023-08-04 06:48:21 +00:00
async startParentGroupMonitor ( ) {
await sleep ( 2000 ) ;
2024-04-27 01:05:56 +00:00
await this . $root . getSocket ( ) . emit ( "resumeMonitor" , this . monitor . parent , ( ) => { } ) ;
2023-08-04 06:48:21 +00:00
} ,
2022-06-02 12:46:44 +00:00
/ * *
* Added a Notification Event
* Enable it if the notification is added in EditMonitor . vue
* @ param { number } id ID of notification to add
2023-08-11 07:46:41 +00:00
* @ returns { void }
2022-06-02 12:46:44 +00:00
* /
2021-09-09 13:24:29 +00:00
addedNotification ( id ) {
this . monitor . notificationIDList [ id ] = true ;
} ,
2021-10-30 17:37:15 +00:00
2022-06-02 12:46:44 +00:00
/ * *
* Added a Proxy Event
* Enable it if the proxy is added in EditMonitor . vue
* @ param { number } id ID of proxy to add
2023-08-11 07:46:41 +00:00
* @ returns { void }
2022-06-02 12:46:44 +00:00
* /
2021-10-30 17:37:15 +00:00
addedProxy ( id ) {
this . monitor . proxyId = id ;
} ,
2022-07-22 15:47:04 +00:00
2023-08-11 07:46:41 +00:00
/ * *
* Added a Docker Host Event
* Enable it if the Docker Host is added in EditMonitor . vue
* @ param { number } id ID of docker host
* @ returns { void }
* /
2022-07-22 15:47:04 +00:00
addedDockerHost ( id ) {
this . monitor . docker _host = id ;
2023-01-24 15:03:01 +00:00
} ,
2023-08-04 06:48:21 +00:00
/ * *
* Adds a draft group .
2023-08-11 07:46:41 +00:00
* @ param { string } draftGroupName The name of the draft group .
* @ returns { void }
2023-08-04 06:48:21 +00:00
* /
addedDraftGroup ( draftGroupName ) {
this . draftGroupName = draftGroupName ;
this . monitor . parent = - 1 ;
2023-08-06 16:14:56 +00:00
} ,
// Clamp timeout
clampTimeout ( timeout ) {
// limit to 80% of interval, narrowly avoiding epsilon bug
2024-04-27 01:05:56 +00:00
const maxTimeout = ~ ~ ( this . monitor . interval * 8 ) / 10 ;
2023-08-06 16:14:56 +00:00
const clamped = Math . max ( 0 , Math . min ( timeout , maxTimeout ) ) ;
// 0 will be treated as 80% of interval
return Number . isFinite ( clamped ) ? clamped : maxTimeout ;
} ,
finishUpdateInterval ( ) {
// Update timeout if it is greater than the clamp timeout
let clampedValue = this . clampTimeout ( this . monitor . interval ) ;
if ( this . monitor . timeout > clampedValue ) {
this . monitor . timeout = clampedValue ;
}
} ,
2021-06-27 08:10:55 +00:00
} ,
2021-09-30 16:09:43 +00:00
} ;
2021-06-25 13:55:49 +00:00
< / script >
2021-10-02 14:48:27 +00:00
< style lang = "scss" scoped >
2024-04-27 01:05:56 +00:00
@ import "../assets/vars.scss" ;
2023-02-25 07:40:09 +00:00
2024-04-27 01:05:56 +00:00
textarea {
min - height : 200 px ;
}
< / style >