3535 class =" form-select"
3636 data-testid =" monitor-type-select"
3737 >
38+ <!-- Unsorted, since HTTP is commonly used -->
3839 <optgroup :label =" $t('General Monitor Type')" >
39- <option value =" group" >
40- {{ $t("Group") }}
41- </option >
4240 <option value =" http" >HTTP(s)</option >
41+ <option value =" keyword" >HTTP(s) - {{ $t("Keyword") }}</option >
4342 <option value =" port" >TCP Port</option >
4443 <option value =" ping" >Ping</option >
45- <option value =" smtp" >SMTP</option >
46- <option value =" snmp" >SNMP</option >
47- <option value =" keyword" >HTTP(s) - {{ $t("Keyword") }}</option >
48- <option value =" json-query" >HTTP(s) - {{ $t("Json Query") }}</option >
49- <option value =" grpc-keyword" >gRPC(s) - {{ $t("Keyword") }}</option >
5044 <option value =" dns" >DNS</option >
5145 <option value =" docker" >
5246 {{ $t("Docker Container") }}
6357 <option value =" real-browser" >
6458 HTTP(s) - Browser Engine (Chrome/Chromium) (Beta)
6559 </option >
66- <option value =" websocket-upgrade" >Websocket Upgrade</option >
60+ </optgroup >
61+
62+ <optgroup :label =" $t('monitorTypeSpecial')" >
63+ <option value =" group" >
64+ {{ $t("Group") }}
65+ </option >
6766 </optgroup >
6867
6968 <optgroup :label =" $t('Passive Monitor Type')" >
7372 </option >
7473 </optgroup >
7574
75+ <!-- Should sort from A to Z in this category -->
7676 <optgroup :label =" $t('Specific Monitor Type')" >
7777 <option value =" globalping" >
7878 {{ $t("Globalping - Access global monitoring probes") }}
7979 </option >
80- <option value =" steam" >
81- {{ $t("Steam Game Server") }}
82- </option >
83- <option value =" gamedig" >GameDig</option >
80+ <option value =" grpc-keyword" >gRPC(s) - {{ $t("Keyword") }}</option >
81+ <option value =" json-query" >HTTP(s) - {{ $t("Json Query") }}</option >
82+ <option value =" kafka-producer" >Kafka Producer</option >
8483 <option value =" mqtt" >MQTT</option >
8584 <option value =" rabbitmq" >RabbitMQ</option >
86- <option value =" kafka-producer" >Kafka Producer</option >
87- <option value =" sqlserver" >Microsoft SQL Server</option >
88- <option value =" postgres" >PostgreSQL</option >
89- <option value =" mysql" >MySQL/MariaDB</option >
90- <option value =" mongodb" >MongoDB</option >
91- <option value =" radius" >Radius</option >
92- <option value =" redis" >Redis</option >
9385 <option v-if =" !$root.info.isContainer" value =" sip-options" >
9486 SIP Options Ping
9587 </option >
88+ <option value =" smtp" >SMTP</option >
89+ <option value =" snmp" >SNMP</option >
9690 <option v-if =" !$root.info.isContainer" value =" tailscale-ping" >
9791 Tailscale Ping
9892 </option >
93+ <option value =" websocket-upgrade" >Websocket Upgrade</option >
94+ </optgroup >
95+
96+ <!-- Should sort from A to Z in this category -->
97+ <optgroup :label =" $t('monitorTypeDatabase')" >
98+ <option value =" sqlserver" >Microsoft SQL Server</option >
99+ <option value =" mongodb" >MongoDB</option >
100+ <option value =" mysql" >MySQL/MariaDB</option >
101+ <option value =" postgres" >PostgreSQL</option >
102+ <option value =" radius" >Radius</option >
103+ <option value =" redis" >Redis</option >
104+ </optgroup >
105+
106+ <!-- Should sort from A to Z in this category -->
107+ <optgroup :label =" $t('monitorTypeGameServer')" >
108+ <option value =" gamedig" >GameDig</option >
109+ <option value =" steam" >
110+ {{ $t("Steam Game Server") }}
111+ </option >
99112 </optgroup >
100113 </select >
101114 <i18n-t
@@ -2820,11 +2833,22 @@ const toast = useToast();
28202833
28212834const pushTokenLength = 32 ;
28222835
2836+ const defaultValueList = {
2837+ http: {
2838+ url: " https://" ,
2839+ accepted_statuscodes: [" 200-299" ],
2840+ },
2841+ " websocket-upgrade" : {
2842+ url: " wss://" ,
2843+ accepted_statuscodes: [" 1000" ],
2844+ },
2845+ };
2846+
28232847const monitorDefaults = {
28242848 type: " http" ,
28252849 name: " " ,
28262850 parent: null ,
2827- url: " https:// " ,
2851+ url: defaultValueList . http . url ,
28282852 wsSubprotocol: " " ,
28292853 method: " GET" ,
28302854 protocol: null ,
@@ -2842,7 +2866,7 @@ const monitorDefaults = {
28422866 expiryNotification: false ,
28432867 domainExpiryNotification: false ,
28442868 maxredirects: 10 ,
2845- accepted_statuscodes: [ " 200-299 " ] ,
2869+ accepted_statuscodes: defaultValueList . http . accepted_statuscodes ,
28462870 saveResponse: false ,
28472871 saveErrorResponse: true ,
28482872 responseMaxLength: 1024 ,
@@ -3298,9 +3322,36 @@ message HealthCheckResponse {
32983322 this .monitor .dns_resolve_server = " 1.1.1.1" ;
32993323 }
33003324
3301- if (oldType && this .monitor .type === " websocket-upgrade" ) {
3302- this .monitor .url = " wss://" ;
3303- this .monitor .accepted_statuscodes = [" 1000" ];
3325+ // Change to websocket-upgrade (override http defaults)
3326+ if (newType === " websocket-upgrade" ) {
3327+ if (! this .monitor .url || this .monitor .url === defaultValueList .http .url ) {
3328+ this .monitor .url = defaultValueList[" websocket-upgrade" ].url ;
3329+ }
3330+
3331+ if (
3332+ ! this .monitor .accepted_statuscodes ||
3333+ (this .monitor .accepted_statuscodes .length === 1 &&
3334+ this .monitor .accepted_statuscodes [0 ] === defaultValueList .http .accepted_statuscodes )
3335+ ) {
3336+ this .monitor .accepted_statuscodes = defaultValueList[" websocket-upgrade" ].accepted_statuscodes ;
3337+ }
3338+ }
3339+
3340+ // Change to http (override websocket-upgrade defaults)
3341+ // Because user may see wss:// and default to http code 1000, which is strange for http monitor.
3342+ if ([" http" , " keyword" , " real-browser" ].includes (newType)) {
3343+ if (! this .monitor .url || this .monitor .url === defaultValueList[" websocket-upgrade" ].url ) {
3344+ this .monitor .url = defaultValueList .http .url ;
3345+ }
3346+
3347+ if (
3348+ ! this .monitor .accepted_statuscodes ||
3349+ (this .monitor .accepted_statuscodes .length === 1 &&
3350+ this .monitor .accepted_statuscodes [0 ] ===
3351+ defaultValueList[" websocket-upgrade" ].accepted_statuscodes )
3352+ ) {
3353+ this .monitor .accepted_statuscodes = defaultValueList .http .accepted_statuscodes ;
3354+ }
33043355 }
33053356
33063357 if (this .monitor .type === " push" ) {
0 commit comments