Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk] reset server configuration to defaults button & location tracking #6012

Open
wants to merge 6 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions plugins/sdk/frontend/public/javascripts/countly.views.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
features: {
label: "SDK Features",
list: ["crt", "vt", "st", "cet", "ecz", "cr"]
list: ["crt", "vt", "st", "cet", "lt", "ecz", "cr"]
},
settings: {
label: "SDK Settings",
Expand Down Expand Up @@ -138,17 +138,24 @@
default: true,
value: null
},
lt: {
type: "switch",
name: "Allow Location Tracking",
description: "Enable or disable tracking of location (default: enabled)",
default: true,
value: null
},
ecz: {
type: "switch",
name: "Enable Content Zone",
description: "Enable or disable listening to Journey related contents (default: false)",
description: "Enable or disable listening to Journey related contents (default: disabled)",
default: false,
value: null
},
cr: {
type: "switch",
name: "Require Consent",
description: "Enable or disable requiring consent for tracking (default: false)",
description: "Enable or disable requiring consent for tracking (default: disabled)",
default: false,
value: null
},
Expand Down Expand Up @@ -176,7 +183,7 @@
dort: {
type: "number",
name: "Request Drop Age",
description: "Provide time in hours after which an old request should be dropped if they are not sent to server (default: 0 = not enabled)",
description: "Provide time in hours after which an old request should be dropped if they are not sent to server (default: 0 = disabled)",
default: 0,
value: null
},
Expand Down Expand Up @@ -271,6 +278,27 @@
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
resetSDKConfiguration: function() {
var helper_msg = "You are about to reset your SDK configuration to default state. Do you want to continue?";
var helper_title = "Reset configuration?";
var self = this;

CountlyHelpers.confirm(helper_msg, "red", function(result) {
if (!result) {
return true;
}

var params = self.$store.getters["countlySDK/sdk/all"];
var data = params || {};
for (var key in self.configs) {
self.configs[key].value = self.configs[key].default;
data[key] = self.configs[key].value;
}
self.$store.dispatch("countlySDK/sdk/update", data).then(function() {
self.$store.dispatch("countlySDK/initialize");
});
}, ["No, don't reset", "Yes, reset"], {title: helper_title});
},
save: function() {
var params = this.$store.getters["countlySDK/sdk/all"];
var data = params || {};
Expand Down
5 changes: 5 additions & 0 deletions plugins/sdk/frontend/public/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
title="SDK Configuration (Experimental)"
:tooltip="{description}">
<template v-slot:header-right>
<div class="bu-level-item">
<el-button @click="resetSDKConfiguration" type="default" size="small" icon="cly-icon-btn fas fa-sync">
Reset configuration
</el-button>
</div>
<div class="bu-level-item">
<el-button @click="downloadConfig" type="default" size="small" icon="cly-icon-btn cly-icon-download">
Download Config
Expand Down
Loading