Add kiosk browser properties policy config UI

revert-dabc3590
Saad Sahibjan 6 years ago
parent 7cbaed3947
commit 0adce7a331

@ -200,8 +200,12 @@ var androidOperationModule = function () {
case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]: case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]:
payload = { payload = {
"cosuProfileRestrictionStartTime": operationPayload["cosuProfileOperationRestrictionEndTime"], "cosuProfileRestrictionStartTime": operationPayload["cosuProfileOperationRestrictionEndTime"],
"cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"] "cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"],
} "primaryURL": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["primaryURL"],
"isAddressBarEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]
["isAddressBarEnabled"]
};
break;
case androidOperationConstants["KIOSK_APPS_CODE"]: case androidOperationConstants["KIOSK_APPS_CODE"]:
payload = { payload = {
"cosuWhitelistedApplications": operationPayload["whitelistedApplications"] "cosuWhitelistedApplications": operationPayload["whitelistedApplications"]
@ -401,7 +405,13 @@ var androidOperationModule = function () {
payload = { payload = {
"operation": { "operation": {
"cosuProfileRestrictionStartTime": operationData["cosuProfileOperationRestrictionStartTime"], "cosuProfileRestrictionStartTime": operationData["cosuProfileOperationRestrictionStartTime"],
"cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"] "cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"],
"deviceGlobalConfigurations" : {
"browserProperties": {
"primaryURL": operationData["primaryURL"],
"isAddressBarEnabled": operationData["isAddressBarEnabled"]
}
}
} }
}; };
break; break;

@ -919,89 +919,92 @@ $(document).ready(function () {
var operationDataWrapper = $(this).data("target"); var operationDataWrapper = $(this).data("target");
// prevents event bubbling by figuring out what element it's being called from. // prevents event bubbling by figuring out what element it's being called from.
if (event.target.tagName == "INPUT") { if (event.target.tagName == "INPUT") {
var featureConfiguredIcon; var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation");
if ($("input[type='checkbox']", this).is(":checked")) { if (!isNonAdvanceOperation) {
configuredOperations.push(operationCode); var featureConfiguredIcon;
// when a feature is enabled, if "zero-configured-features" msg is available, hide that. if ($("input[type='checkbox']", this).is(":checked")) {
var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; configuredOperations.push(operationCode);
if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { // when a feature is enabled, if "zero-configured-features" msg is available, hide that.
$(zeroConfiguredOperationsErrorMsg).addClass("hidden"); var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg";
} if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) {
// add configured-state-icon to the feature $(zeroConfiguredOperationsErrorMsg).addClass("hidden");
featureConfiguredIcon = "#" + operation + "-configured"; }
if ($(featureConfiguredIcon).hasClass("hidden")) { // add configured-state-icon to the feature
$(featureConfiguredIcon).removeClass("hidden"); featureConfiguredIcon = "#" + operation + "-configured";
} if ($(featureConfiguredIcon).hasClass("hidden")) {
} else { $(featureConfiguredIcon).removeClass("hidden");
//splicing the array if operation is present. }
var index = $.inArray(operationCode, configuredOperations); } else {
if (index != -1) { //splicing the array if operation is present.
configuredOperations.splice(index, 1); var index = $.inArray(operationCode, configuredOperations);
} if (index != -1) {
// when a feature is disabled, clearing all its current configured, error or success states configuredOperations.splice(index, 1);
var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; }
var subErrorIcon = "#" + operation + "-error"; // when a feature is disabled, clearing all its current configured, error or success states
var subOkIcon = "#" + operation + "-ok"; var subErrorMsgWrapper = "#" + operation + "-feature-error-msg";
featureConfiguredIcon = "#" + operation + "-configured"; var subErrorIcon = "#" + operation + "-error";
var subOkIcon = "#" + operation + "-ok";
featureConfiguredIcon = "#" + operation + "-configured";
if (!$(subErrorMsgWrapper).hasClass("hidden")) { if (!$(subErrorMsgWrapper).hasClass("hidden")) {
$(subErrorMsgWrapper).addClass("hidden"); $(subErrorMsgWrapper).addClass("hidden");
}
if (!$(subErrorIcon).hasClass("hidden")) {
$(subErrorIcon).addClass("hidden");
}
if (!$(subOkIcon).hasClass("hidden")) {
$(subOkIcon).addClass("hidden");
}
if (!$(featureConfiguredIcon).hasClass("hidden")) {
$(featureConfiguredIcon).addClass("hidden");
}
// reinitializing input fields into the defaults
$(operationDataWrapper + " input").each(
function () {
if ($(this).is("input:text")) {
$(this).val($(this).data("default"));
} else if ($(this).is("input:password")) {
$(this).val("");
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", $(this).data("default"));
// if this checkbox is the parent input of a grouped-input
if ($(this).hasClass("parent-input")) {
var groupedInput = $(this).parent().parent().parent();
updateGroupedInputVisibility(groupedInput);
}
}
} }
); if (!$(subErrorIcon).hasClass("hidden")) {
// reinitializing select fields into the defaults $(subErrorIcon).addClass("hidden");
$(operationDataWrapper + " select").each(
function () {
var defaultOption = $(this).data("default");
$("option:eq(" + defaultOption + ")", this).prop("selected", "selected");
} }
); if (!$(subOkIcon).hasClass("hidden")) {
// collapsing expanded-panes (upon the selection of html-select-options) if any $(subOkIcon).addClass("hidden");
$(operationDataWrapper + " .expanded").each(
function () {
if ($(this).hasClass("expanded")) {
$(this).removeClass("expanded");
}
$(this).slideUp();
} }
); if (!$(featureConfiguredIcon).hasClass("hidden")) {
// removing all entries of grid-input elements if exist $(featureConfiguredIcon).addClass("hidden");
$(operationDataWrapper + " .grouped-array-input").each( }
function () { // reinitializing input fields into the defaults
var gridInputs = $(this).find("[data-add-form-clone]"); $(operationDataWrapper + " input").each(
if (gridInputs.length > 0) { function () {
gridInputs.remove(); if ($(this).is("input:text")) {
$(this).val($(this).data("default"));
} else if ($(this).is("input:password")) {
$(this).val("");
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", $(this).data("default"));
// if this checkbox is the parent input of a grouped-input
if ($(this).hasClass("parent-input")) {
var groupedInput = $(this).parent().parent().parent();
updateGroupedInputVisibility(groupedInput);
}
}
} }
var helpTexts = $(this).find("[data-help-text=add-form]"); );
if (helpTexts.length > 0) { // reinitializing select fields into the defaults
helpTexts.show(); $(operationDataWrapper + " select").each(
function () {
var defaultOption = $(this).data("default");
$("option:eq(" + defaultOption + ")", this).prop("selected", "selected");
} }
} );
); // collapsing expanded-panes (upon the selection of html-select-options) if any
$(operationDataWrapper + " .expanded").each(
function () {
if ($(this).hasClass("expanded")) {
$(this).removeClass("expanded");
}
$(this).slideUp();
}
);
// removing all entries of grid-input elements if exist
$(operationDataWrapper + " .grouped-array-input").each(
function () {
var gridInputs = $(this).find("[data-add-form-clone]");
if (gridInputs.length > 0) {
gridInputs.remove();
}
var helpTexts = $(this).find("[data-help-text=add-form]");
if (helpTexts.length > 0) {
helpTexts.show();
}
}
);
}
} }
} }
}); });

@ -1683,6 +1683,71 @@
</div> </div>
</div> </div>
</form> </form>
<form class="form-horizontal">
<div class="form-group">
<h2 class="sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:15px; margin-left:15px;">
Device Global Configuration
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-profile-device-global-operation">
<input type="checkbox" class="non-advance-operation" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-profile-device-global-operation" class="panel-collapse panel-body collapse"
role="tabpanel">
<form class="form-horizontal">
<div class="form-group">
<h2 class="col-sm-12 form-inline sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:13px; margin-left:10px;">
Browser Properties
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-browser-property">
<input type="checkbox" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-browser-property" class="panel-collapse panel-body collapse"
role="tabpanel">
<div class="wr-input-control">
<label class="wr-input-label">
Primary URL
<span class="helper" title="Primary URL">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="cosu-browser-property-primary-url" type="text"
class="form-control operationDataKeys" data-key="primaryURL"
maxlength="100" placeholder="[ Should be a valid URL ]"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input id="cosu-browser-property-address-bar-enabled" type="checkbox"
class="form-control operationDataKeys"
data-key="isAddressBarEnabled"/>
<span class="helper" title="Enables address bar of the browser.">
Enable browser address bar
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
</div>
</div>
</form>
<br/>
<div>
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="cosu-profile-configuration-select-msg">
Global configurations related to device.
</a>
</ul>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>

@ -241,12 +241,15 @@ $(document).ready(function () {
var operation = $(this).parents(".operation-data").data("operation"); var operation = $(this).parents(".operation-data").data("operation");
// prevents event bubbling by figuring out what element it's being called from. // prevents event bubbling by figuring out what element it's being called from.
if (event.target.tagName == "INPUT") { if (event.target.tagName == "INPUT") {
var featureConfiguredIcon; var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation");
if ($("input[type='checkbox']", this).is(":checked")) { if (!isNonAdvanceOperation) {
// add configured-state-icon to the feature var featureConfiguredIcon;
featureConfiguredIcon = "#" + operation + "-configured"; if ($("input[type='checkbox']", this).is(":checked")) {
if ($(featureConfiguredIcon).hasClass("hidden")) { // add configured-state-icon to the feature
$(featureConfiguredIcon).removeClass("hidden"); featureConfiguredIcon = "#" + operation + "-configured";
if ($(featureConfiguredIcon).hasClass("hidden")) {
$(featureConfiguredIcon).removeClass("hidden");
}
} }
} }
} }

@ -1265,6 +1265,71 @@
</div> </div>
</div> </div>
</form> </form>
<form class="form-horizontal">
<div class="form-group">
<h2 class="sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:15px; margin-left:15px;">
Device Global Configuration
<label class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cosu-profile-device-global-operation">
<input type="checkbox" class="non-advance-operation" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-profile-device-global-operation" class="panel-collapse panel-body collapse"
role="tabpanel">
<form class="form-horizontal">
<div class="form-group">
<h2 class="col-sm-12 form-inline sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:13px; margin-left:10px;">
Browser Properties
<label class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cosu-browser-property">
<input type="checkbox" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-browser-property" class="panel-collapse panel-body collapse"
role="tabpanel">
<div class="wr-input-control">
<label class="wr-input-label">
Primary URL
<span class="helper" title="Primary URL">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="cosu-browser-property-primary-url" type="text"
class="form-control operationDataKeys" data-key="primaryURL"
maxlength="100" placeholder="[ Should be a valid URL ]" disabled/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input id="cosu-browser-property-address-bar-enabled" type="checkbox"
class="form-control operationDataKeys"
data-key="isAddressBarEnabled" disabled/>
<span class="helper" title="Enables address bar of the browser.">
Enable browser address bar
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
</div>
</div>
</form>
<br/>
<div>
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="cosu-profile-configuration-select-msg">
Global configurations related to device.
</a>
</ul>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>

@ -884,89 +884,92 @@ $(document).ready(function () {
var operationDataWrapper = $(this).data("target"); var operationDataWrapper = $(this).data("target");
// prevents event bubbling by figuring out what element it's being called from. // prevents event bubbling by figuring out what element it's being called from.
if (event.target.tagName == "INPUT") { if (event.target.tagName == "INPUT") {
var featureConfiguredIcon; var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation");
if ($("input[type='checkbox']", this).is(":checked")) { if (!isNonAdvanceOperation) {
configuredOperations.push(operationCode); var featureConfiguredIcon;
// when a feature is enabled, if "zero-configured-features" msg is available, hide that. if ($("input[type='checkbox']", this).is(":checked")) {
var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; configuredOperations.push(operationCode);
if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { // when a feature is enabled, if "zero-configured-features" msg is available, hide that.
$(zeroConfiguredOperationsErrorMsg).addClass("hidden"); var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg";
} if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) {
// add configured-state-icon to the feature $(zeroConfiguredOperationsErrorMsg).addClass("hidden");
featureConfiguredIcon = "#" + operation + "-configured"; }
if ($(featureConfiguredIcon).hasClass("hidden")) { // add configured-state-icon to the feature
$(featureConfiguredIcon).removeClass("hidden"); featureConfiguredIcon = "#" + operation + "-configured";
} if ($(featureConfiguredIcon).hasClass("hidden")) {
} else { $(featureConfiguredIcon).removeClass("hidden");
//splicing the array if operation is present. }
var index = $.inArray(operationCode, configuredOperations); } else {
if (index != -1) { //splicing the array if operation is present.
configuredOperations.splice(index, 1); var index = $.inArray(operationCode, configuredOperations);
} if (index != -1) {
// when a feature is disabled, clearing all its current configured, error or success states configuredOperations.splice(index, 1);
var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; }
var subErrorIcon = "#" + operation + "-error"; // when a feature is disabled, clearing all its current configured, error or success states
var subOkIcon = "#" + operation + "-ok"; var subErrorMsgWrapper = "#" + operation + "-feature-error-msg";
featureConfiguredIcon = "#" + operation + "-configured"; var subErrorIcon = "#" + operation + "-error";
var subOkIcon = "#" + operation + "-ok";
featureConfiguredIcon = "#" + operation + "-configured";
if (!$(subErrorMsgWrapper).hasClass("hidden")) { if (!$(subErrorMsgWrapper).hasClass("hidden")) {
$(subErrorMsgWrapper).addClass("hidden"); $(subErrorMsgWrapper).addClass("hidden");
}
if (!$(subErrorIcon).hasClass("hidden")) {
$(subErrorIcon).addClass("hidden");
}
if (!$(subOkIcon).hasClass("hidden")) {
$(subOkIcon).addClass("hidden");
}
if (!$(featureConfiguredIcon).hasClass("hidden")) {
$(featureConfiguredIcon).addClass("hidden");
}
// reinitializing input fields into the defaults
$(operationDataWrapper + " input").each(
function () {
if ($(this).is("input:text")) {
$(this).val($(this).data("default"));
} else if ($(this).is("input:password")) {
$(this).val("");
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", $(this).data("default"));
// if this checkbox is the parent input of a grouped-input
if ($(this).hasClass("parent-input")) {
var groupedInput = $(this).parent().parent().parent();
updateGroupedInputVisibility(groupedInput);
}
}
} }
); if (!$(subErrorIcon).hasClass("hidden")) {
// reinitializing select fields into the defaults $(subErrorIcon).addClass("hidden");
$(operationDataWrapper + " select").each(
function () {
var defaultOption = $(this).data("default");
$("option:eq(" + defaultOption + ")", this).prop("selected", "selected");
} }
); if (!$(subOkIcon).hasClass("hidden")) {
// collapsing expanded-panes (upon the selection of html-select-options) if any $(subOkIcon).addClass("hidden");
$(operationDataWrapper + " .expanded").each(
function () {
if ($(this).hasClass("expanded")) {
$(this).removeClass("expanded");
}
$(this).slideUp();
} }
); if (!$(featureConfiguredIcon).hasClass("hidden")) {
// removing all entries of grid-input elements if exist $(featureConfiguredIcon).addClass("hidden");
$(operationDataWrapper + " .grouped-array-input").each( }
function () { // reinitializing input fields into the defaults
var gridInputs = $(this).find("[data-add-form-clone]"); $(operationDataWrapper + " input").each(
if (gridInputs.length > 0) { function () {
gridInputs.remove(); if ($(this).is("input:text")) {
$(this).val($(this).data("default"));
} else if ($(this).is("input:password")) {
$(this).val("");
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", $(this).data("default"));
// if this checkbox is the parent input of a grouped-input
if ($(this).hasClass("parent-input")) {
var groupedInput = $(this).parent().parent().parent();
updateGroupedInputVisibility(groupedInput);
}
}
} }
var helpTexts = $(this).find("[data-help-text=add-form]"); );
if (helpTexts.length > 0) { // reinitializing select fields into the defaults
helpTexts.show(); $(operationDataWrapper + " select").each(
function () {
var defaultOption = $(this).data("default");
$("option:eq(" + defaultOption + ")", this).prop("selected", "selected");
} }
} );
); // collapsing expanded-panes (upon the selection of html-select-options) if any
$(operationDataWrapper + " .expanded").each(
function () {
if ($(this).hasClass("expanded")) {
$(this).removeClass("expanded");
}
$(this).slideUp();
}
);
// removing all entries of grid-input elements if exist
$(operationDataWrapper + " .grouped-array-input").each(
function () {
var gridInputs = $(this).find("[data-add-form-clone]");
if (gridInputs.length > 0) {
gridInputs.remove();
}
var helpTexts = $(this).find("[data-help-text=add-form]");
if (helpTexts.length > 0) {
helpTexts.show();
}
}
);
}
} }
} }
}); });

@ -1392,6 +1392,71 @@
</div> </div>
</div> </div>
</form> </form>
<form class="form-horizontal">
<div class="form-group">
<h2 class="sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:15px; margin-left:15px;">
Device Global Configuration
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-profile-device-global-operation">
<input type="checkbox" class="non-advance-operation" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-profile-device-global-operation" class="panel-collapse panel-body collapse"
role="tabpanel">
<form class="form-horizontal">
<div class="form-group">
<h2 class="col-sm-12 form-inline sub-title panel-title"
style="padding: 0px; padding-right:15px; font-size:13px; margin-left:10px;">
Browser Properties
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-browser-property">
<input type="checkbox" />
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
</div>
<div id="cosu-browser-property" class="panel-collapse panel-body collapse"
role="tabpanel">
<div class="wr-input-control">
<label class="wr-input-label">
Primary URL
<span class="helper" title="Primary URL">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="cosu-browser-property-primary-url" type="text"
class="form-control operationDataKeys" data-key="primaryURL"
maxlength="100" placeholder="[ Should be a valid URL ]"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input id="cosu-browser-property-address-bar-enabled" type="checkbox"
class="form-control operationDataKeys"
data-key="isAddressBarEnabled"/>
<span class="helper" title="Enables address bar of the browser.">
Enable browser address bar
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
</div>
</div>
</form>
<br/>
<div>
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="cosu-profile-configuration-select-msg">
Global configurations related to device.
</a>
</ul>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save