mirror of https://github.com/Lissy93/dashy.git
✨ UI implementation of custom response code (#456)
This commit is contained in:
parent
7f67ea6a5f
commit
e6ba3243c3
|
@ -95,6 +95,7 @@ export default {
|
||||||
statusCheckUrl: String, // Custom URL for status check endpoint
|
statusCheckUrl: String, // Custom URL for status check endpoint
|
||||||
statusCheckInterval: Number, // Num seconds beteween repeating checks
|
statusCheckInterval: Number, // Num seconds beteween repeating checks
|
||||||
statusCheckAllowInsecure: Boolean, // Status check ignore SSL certs
|
statusCheckAllowInsecure: Boolean, // Status check ignore SSL certs
|
||||||
|
statusCheckAcceptCodes: String, // Allow status checks to pass with a code other than 200
|
||||||
parentSectionTitle: String, // Title of parent section (for add new)
|
parentSectionTitle: String, // Title of parent section (for add new)
|
||||||
isAddNew: Boolean, // Only set if 'fake' item used as Add New button
|
isAddNew: Boolean, // Only set if 'fake' item used as Add New button
|
||||||
},
|
},
|
||||||
|
@ -236,7 +237,7 @@ export default {
|
||||||
/* Pulls together all user options, returns URL + Get params for ping endpoint */
|
/* Pulls together all user options, returns URL + Get params for ping endpoint */
|
||||||
makeApiUrl() {
|
makeApiUrl() {
|
||||||
const {
|
const {
|
||||||
url, statusCheckUrl, statusCheckHeaders, statusCheckAllowInsecure,
|
url, statusCheckUrl, statusCheckHeaders, statusCheckAllowInsecure, statusCheckAcceptCodes,
|
||||||
} = this;
|
} = this;
|
||||||
const encode = (str) => encodeURIComponent(str);
|
const encode = (str) => encodeURIComponent(str);
|
||||||
this.statusResponse = undefined;
|
this.statusResponse = undefined;
|
||||||
|
@ -249,8 +250,10 @@ export default {
|
||||||
? `&headers=${encode(JSON.stringify(statusCheckHeaders))}` : '';
|
? `&headers=${encode(JSON.stringify(statusCheckHeaders))}` : '';
|
||||||
// Deterimine if user disabled security
|
// Deterimine if user disabled security
|
||||||
const enableInsecure = statusCheckAllowInsecure ? '&enableInsecure=true' : '';
|
const enableInsecure = statusCheckAllowInsecure ? '&enableInsecure=true' : '';
|
||||||
|
const acceptCodes = statusCheckAcceptCodes ? `&acceptCodes=${statusCheckAcceptCodes}` : '';
|
||||||
// Construct the full API endpoint's URL with GET params
|
// Construct the full API endpoint's URL with GET params
|
||||||
return `${baseUrl}${serviceEndpoints.statusCheck}/${urlToCheck}${headers}${enableInsecure}`;
|
return `${baseUrl}${serviceEndpoints.statusCheck}/${urlToCheck}`
|
||||||
|
+ `${headers}${enableInsecure}${acceptCodes}`;
|
||||||
},
|
},
|
||||||
/* Checks if a given service is currently online */
|
/* Checks if a given service is currently online */
|
||||||
checkWebsiteStatus() {
|
checkWebsiteStatus() {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
:enableStatusCheck="item.statusCheck !== undefined ? item.statusCheck : enableStatusCheck"
|
:enableStatusCheck="item.statusCheck !== undefined ? item.statusCheck : enableStatusCheck"
|
||||||
:statusCheckInterval="statusCheckInterval"
|
:statusCheckInterval="statusCheckInterval"
|
||||||
:statusCheckAllowInsecure="item.statusCheckAllowInsecure"
|
:statusCheckAllowInsecure="item.statusCheckAllowInsecure"
|
||||||
|
:statusCheckAcceptCodes="item.statusCheckAcceptCodes"
|
||||||
@itemClicked="$emit('itemClicked')"
|
@itemClicked="$emit('itemClicked')"
|
||||||
@triggerModal="triggerModal"
|
@triggerModal="triggerModal"
|
||||||
:isAddNew="false"
|
:isAddNew="false"
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
:itemSize="itemSize"
|
:itemSize="itemSize"
|
||||||
:hotkey="item.hotkey"
|
:hotkey="item.hotkey"
|
||||||
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
|
:enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)"
|
||||||
|
:statusCheckAllowInsecure="item.statusCheckAllowInsecure"
|
||||||
|
:statusCheckAcceptCodes="item.statusCheckAcceptCodes"
|
||||||
:statusCheckInterval="getStatusCheckInterval()"
|
:statusCheckInterval="getStatusCheckInterval()"
|
||||||
@itemClicked="$emit('itemClicked')"
|
@itemClicked="$emit('itemClicked')"
|
||||||
@triggerModal="triggerModal"
|
@triggerModal="triggerModal"
|
||||||
|
|
Loading…
Reference in New Issue