🚧 Connection profile editor

This commit is contained in:
Gina Häußge committed 2021-07-09 17:48:51 +02:00
1 parent 030886e549
commit 2fd886f413
11 files changed
+824 -621

No files matched your search

+1 -1
View File
@@ -976,7 +976,7 @@ def fetch_template_data(refresh=False):
{
"template": "dialogs/settings/connection.jinja2",
"_div": "settings_connection",
"custom_bindings": False,
"custom_bindings": True,
},
),
"printerprofiles": (
+1 -1
View File
@@ -1 +1 @@
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
@@ -1,187 +1,436 @@
$(function () {
var checkRecursively = function (params, check) {
return _.any(params, function (p) {
if (p.type === "group") {
return check(p) || checkRecursively(p.params, check);
} else if (p.type === "presetchoice" && p.group) {
return (
check(p) || check(p.group) || checkRecursively(p.group.params, check)
);
} else {
return check(p);
}
});
};
var convertValue = function (value, option, override) {
/**
* @param value the value to apply
* @param option the option object, to lookup a default if needed
* @param override the current override value, or undefined
*/
if (override !== undefined) {
value = override;
}
if (value === undefined && option.default !== undefined) {
value = option.default;
}
if (value && (option.type === "list" || option.type === "smalllist")) {
value = value.join(", ");
}
return value;
};
var extendOption = function (option, value, data) {
/**
* @param option the option to extend
* @param value the value to apply to the option, or undefined
* @param data the currently active data object, or undefined
*/
if (option.type === "group") {
if (value === undefined) {
value = {};
}
_.each(option.params, function (option) {
extendOption(
option,
value[option.name],
data ? data[option.name] : undefined
);
});
option.modified = ko.pureComputed(function () {
return _.any(option.params, function (p) {
return p.modified();
});
});
option.advancedParameters =
option.advanced ||
_.any(option.params, function (p) {
return p.advanced;
});
option.expertParameters =
option.expert ||
_.any(option.params, function (p) {
return p.expert;
});
} else {
if (option.type === "presetchoice") {
value = convertValue(value, option, data ? data[option.name] : undefined);
_.each(option.group.params, function (p) {
extendOption(
p,
option.defaults[value]
? option.defaults[value][p.name]
: undefined,
data ? data[option.group.name] : undefined
);
});
} else if (option.type === "conditionalgroup") {
value = convertValue(value, option, data ? data[option.name] : undefined);
option.expertParameters = {};
_.each(option.groups, function (group, key) {
_.each(group, function (p) {
extendOption(p, undefined, data);
});
option.expertParameters[key] = _.any(group, function (p) {
return p.expert;
});
});
} else {
value = convertValue(value, option, data ? data[option.name] : undefined);
}
if (option.value) {
option.value(value);
} else {
option.value = ko.observable(value);
option.defaultValue = ko.observable(option.default);
option.reset = function () {
option.value(option.defaultValue());
};
option.modified = ko.pureComputed(function () {
// noinspection EqualityComparisonWithCoercionJS
return option.value() != option.defaultValue();
});
if (option.type === "presetchoice" && option.defaults) {
option.group.advancedParameters =
option.group.advanced ||
_.any(option.group.params, function (p) {
return p.advanced;
});
option.group.expertParameters =
option.group.expert ||
_.any(option.group.params, function (p) {
return p.expert;
});
var updateDefaults = function (keepValue) {
keepValue = !!keepValue;
var choice = _.find(option.choices, function (c) {
return c.value === option.value();
});
if (choice) {
_.each(option.group.params, function (p) {
if (option.defaults[choice.value]) {
var d = option.defaults[choice.value][p.name];
if (d !== undefined) {
p.defaultValue(
convertValue(
d,
p,
data ? data[p.name] : undefined
)
);
if (!keepValue) {
p.value(p.defaultValue());
}
}
}
});
}
};
option.value.subscribe(function () {
updateDefaults();
});
updateDefaults(true);
}
}
}
};
var toOptions = function (parameters) {
var result = {};
_.each(parameters, function (parameter) {
var value;
if (parameter.type === "group") {
value = toOptions(parameter.params);
} else if (parameter.type === "presetchoice") {
value = parameter.value();
result[parameter.group.name] = toOptions(parameter.group.params);
} else if (parameter.type === "conditionalgroup") {
value = parameter.value();
result = Object.assign(result, toOptions(parameter.groups[value]));
} else if (parameter.type === "list" || parameter.type === "smalllist") {
value = splitTextToArray(parameter.value(), ",", true);
} else if (parameter.type === "integer") {
value = parseInt(parameter.value());
} else if (parameter.type === "float") {
value = parseFloat(parameter.value());
} else {
value = parameter.value();
}
// and now set the value on the result, if it differs from the default
if (parameter.modified()) {
result[parameter.name] = value;
}
});
return result;
};
function EditedConnectionProfile(
printerProfiles,
protocols,
transports,
cleanProfile
) {
var self = this;
self.printerProfiles = printerProfiles;
self.protocols = protocols;
self.transports = transports;
self.cleanProfile = cleanProfile;
self.isNew = ko.observable(true);
self.name = ko.observable();
self.name.subscribe(function (value) {
self.identifierPlaceholder(self._sanitize(value));
});
self.identifier = ko.observable();
self.identifierPlaceholder = ko.observable();
self.printerProfile = ko.observable();
self.protocol = ko.observable();
self.protocolParameters = ko.observableArray();
self.advancedProtocolParameters = ko.observable(false);
self.expertProtocolParameters = ko.observable(false);
self.protocol.subscribe(function () {
var protocol = self.protocol();
if (protocol) {
self.protocolParameters(protocol.options);
} else {
self.protocolParameters([]);
}
self.advancedProtocolParameters(
_.any(self.protocolParameters(), function (p) {
return p.advanced;
})
);
self.expertProtocolParameters(
_.any(self.protocolParameters(), function (p) {
return p.expert;
})
);
});
self.transport = ko.observable();
self.transportParameters = ko.observableArray();
self.advancedTransportParameters = ko.observable(false);
self.expertTransportParameters = ko.observable(false);
self.transport.subscribe(function () {
var transport = self.transport();
if (transport) {
self.transportParameters(transport.options);
} else {
self.transportParameters([]);
}
self.advancedTransportParameters(
_.any(self.transportParameters(), function (p) {
return p.advanced;
})
);
self.expertTransportParameters(
_.any(self.transportParameters(), function (p) {
return p.expert;
})
);
});
self.fromProfileData = function (data) {
self.isNew(data === undefined);
if (data === undefined) {
data = self.cleanProfile();
}
self.identifier(data.id);
self.name(data.name);
self.printerProfile(
_.find(self.printerProfiles(), function (p) {
return p.id === data.printer_profile;
})
);
self.protocol(
_.find(self.protocols(), function (p) {
return p.key === data.protocol;
})
);
self.transport(
_.find(self.transports(), function (p) {
return p.key === data.transport;
})
);
var processParameters = function (parameters, profile_parameters) {
_.each(parameters, function (option) {
extendOption(
option,
profile_parameters[option.name],
profile_parameters
);
});
};
protocolParameters = self.protocolParameters();
processParameters(protocolParameters, data.protocol_parameters);
self.protocolParameters(protocolParameters);
transportParameters = self.transportParameters();
processParameters(transportParameters, data.transport_parameters);
self.transportParameters(transportParameters);
};
self.toProfileData = function () {
var identifier = self.identifier();
if (!identifier) {
identifier = self.identifierPlaceholder();
}
var profile = {
id: identifier,
name: self.name(),
printerProfile: self.printerProfile(),
protocol: self.protocol(),
protocol_parameters: toOptions(self.protocolParameters()),
transport: self.transport(),
transport_parameters: toOptions(self.transportParameters())
};
return profile;
};
self._sanitize = function (name) {
return name
? name.replace(/[^a-zA-Z0-9\-_\.\(\) ]/g, "").replace(/ /g, "_")
: undefined;
};
}
function ConnectionProfileEditorViewModel(parameters) {
var self = this;
self.availablePrinterProfiles = parameters[0];
self.availableProtocols = parameters[1];
self.availableTransports = parameters[2];
self.cleanProfile = parameters[3];
self.active = ko.observable(false);
self.deferred = undefined;
self.dialogTitle = ko.observable(gettext("Save connection profile"));
self.buttonText = ko.observable(gettext("Save"));
self.dialog = $("#connectionprofiles_editor_dialog");
self.profile = new EditedConnectionProfile(
self.availablePrinterProfiles,
self.availableProtocols,
self.availableTransports,
self.cleanProfile
);
self.overwrite = ko.observable(false);
self.makeDefault = ko.observable(false);
self.showMakeDefault = ko.observable(false);
self.showAddDialog = function (options) {
options = options || {};
return self.showDialog(undefined, options);
};
self.showEditDialog = function (profile, options) {
options = options || {};
options.title = options.title || gettext("Edit connection profile");
options.button = options.button || gettext("Update");
return self.showDialog(profile, options);
};
self.showDialog = function (profile, options) {
if (options.title) {
self.dialogTitle(options.title);
} else {
self.dialogTitle(gettext("Save connection profile"));
}
if (options.button) {
self.buttonText(options.button);
} else {
self.buttonText(gettext("Save"));
}
self.showMakeDefault(!!options.showMakeDefault);
self.profile.fromProfileData(profile);
self.deferred = $.Deferred();
self.dialog
.modal({
minHeight: function () {
return Math.max($.fn.modal.defaults.maxHeight() - 80, 250);
}
})
.css({
"margin-left": function () {
return -($(this).width() / 2);
}
});
return self.deferred.promise();
};
self.confirm = function () {
var profile = self.profile.toProfileData();
var overwrite = self.overwrite();
var makeDefault = self.showMakeDefault() && self.makeDefault();
OctoPrint.connectionprofiles
.set(profile.id, profile, overwrite, makeDefault)
.done(function (response) {
self.dialog.modal("hide");
if (self.deferred) {
self.deferred.resolve(response.profile);
}
});
};
}
function ConnectionViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.settings = parameters[1];
self.connectionProfiles = parameters[2];
self.printerProfiles = parameters[3];
self.access = parameters[4];
var checkRecursively = function (params, check) {
return _.any(params, function (p) {
if (p.type === "group") {
return check(p) || checkRecursively(p.params, check);
} else if (p.type === "presetchoice" && p.group) {
return (
check(p) ||
check(p.group) ||
checkRecursively(p.group.params, check)
);
} else {
return check(p);
}
});
};
var convertValue = function (value, option, override) {
/**
* @param value the value to apply
* @param option the option object, to lookup a default if needed
* @param override the current override value, or undefined
*/
if (override !== undefined) {
value = override;
}
if (value === undefined && option.default !== undefined) {
value = option.default;
}
if (value && (option.type === "list" || option.type === "smalllist")) {
value = value.join(", ");
}
return value;
};
var extendOption = function (option, value, data) {
/**
* @param option the option to extend
* @param value the value to apply to the option, or undefined
* @param data the currently active data object, or undefined
*/
if (option.type === "group") {
if (value === undefined) {
value = {};
}
_.each(option.params, function (option) {
extendOption(
option,
value[option.name],
data ? data[option.name] : undefined
);
});
option.modified = ko.pureComputed(function () {
return _.any(option.params, function (p) {
return p.modified();
});
});
option.advancedParameters =
option.advanced ||
_.any(option.params, function (p) {
return p.advanced;
});
option.expertParameters =
option.expert ||
_.any(option.params, function (p) {
return p.expert;
});
} else {
if (option.type === "presetchoice") {
value = convertValue(
value,
option,
data ? data[option.name] : undefined
);
_.each(option.group.params, function (p) {
extendOption(
p,
option.defaults[value]
? option.defaults[value][p.name]
: undefined,
data ? data[option.group.name] : undefined
);
});
} else if (option.type === "conditionalgroup") {
value = convertValue(
value,
option,
data ? data[option.name] : undefined
);
option.expertParameters = {};
_.each(option.groups, function (group, key) {
_.each(group, function (p) {
extendOption(p, undefined, data);
});
option.expertParameters[key] = _.any(group, function (p) {
return p.expert;
});
});
} else {
value = convertValue(
value,
option,
data ? data[option.name] : undefined
);
}
if (option.value) {
option.value(value);
} else {
option.value = ko.observable(value);
option.defaultValue = ko.observable(option.default);
option.reset = function () {
option.value(option.defaultValue());
};
option.modified = ko.pureComputed(function () {
// noinspection EqualityComparisonWithCoercionJS
return option.value() != option.defaultValue();
});
if (option.type === "presetchoice" && option.defaults) {
option.group.advancedParameters =
option.group.advanced ||
_.any(option.group.params, function (p) {
return p.advanced;
});
option.group.expertParameters =
option.group.expert ||
_.any(option.group.params, function (p) {
return p.expert;
});
var updateDefaults = function (keepValue) {
keepValue = !!keepValue;
var choice = _.find(option.choices, function (c) {
return c.value === option.value();
});
if (choice) {
_.each(option.group.params, function (p) {
if (option.defaults[choice.value]) {
var d = option.defaults[choice.value][p.name];
if (d !== undefined) {
p.defaultValue(
convertValue(
d,
p,
data ? data[p.name] : undefined
)
);
if (!keepValue) {
p.value(p.defaultValue());
}
}
}
});
}
};
option.value.subscribe(function () {
updateDefaults();
});
updateDefaults(true);
}
}
}
};
self.printerProfiles = parameters[2];
self.access = parameters[3];
// Connection profiles
self.availableConnectionProfiles = ko.observableArray();
self.preferredConnectionProfile = ko.observable();
self.selectedConnectionProfile = ko.observable(undefined);
self.selectedConnectionProfile.subscribe(function () {
var protocolParameters, transportParameters;
@@ -244,12 +493,14 @@ $(function () {
// Printer profiles
self.availablePrinterProfiles = ko.observableArray();
self.selectedPrinter = ko.observable(undefined);
self.selectedPrinter = ko.observable();
self.preferredPrinter = ko.observable();
// Protocols
self.availableProtocols = ko.observableArray();
self.selectedProtocol = ko.observable(undefined);
self.selectedProtocol = ko.observable();
self.preferredProtocol = ko.observable();
self.protocolParameters = ko.observable();
self.advancedProtocolParameters = ko.observable();
self.expertProtocolParameters = ko.observable();
@@ -280,7 +531,8 @@ $(function () {
// Transports
self.availableTransports = ko.observableArray();
self.selectedTransport = ko.observable(undefined);
self.selectedTransport = ko.observable();
self.preferredTransport = ko.observable();
self.transportParameters = ko.observableArray();
self.advancedTransportParameters = ko.observable();
self.expertTransportParameters = ko.observable();
@@ -308,6 +560,27 @@ $(function () {
);
});
// Profile editor
self.editor = new ConnectionProfileEditorViewModel([
self.availablePrinterProfiles,
self.availableProtocols,
self.availableTransports,
self.cleanProfile
]);
self.cleanProfile = function () {
return {
id: "",
name: "",
printerProfile: self.preferredPrinter(),
protocol: self.availableProtocols()[0],
protocol_parameters: {},
transport: self.availableTransports()[0],
transport_parameters: {}
};
};
// Various other bits
self.adjustConnectionParameters = ko.observable();
@@ -341,14 +614,35 @@ $(function () {
};
self.fromResponse = function (response) {
//~~ Preferences...
self.preferredConnectionProfile(response.options.connectionProfilePreference);
self.preferredPrinter(response.options.printerProfilePreference);
//~~ Available options...
// connection profiles
var connections = response.options.connectionProfiles;
_.each(connections, function (c) {
c.isDefault = ko.pureComputed(function () {
return c.id === self.preferredConnectionProfile();
});
c.isCurrent = ko.pureComputed(function () {
return c.id === self.selectedConnectionProfile();
});
});
self.availableConnectionProfiles(connections);
// printer profiles
var printers = response.options.printerProfiles;
_.each(printers, function (p) {
p.isDefault = ko.pureComputed(function () {
return p.id === preferredPrinter();
});
p.isCurrent = ko.pureComputed(function () {
return p.id === self.selectedPrinter();
});
});
self.availablePrinterProfiles(printers);
// protocols
@@ -487,44 +781,6 @@ $(function () {
self.connect = function (save) {
if (self.isErrorOrClosed()) {
var toOptions = function (parameters) {
var result = {};
_.each(parameters, function (parameter) {
var value;
if (parameter.type === "group") {
value = toOptions(parameter.params);
} else if (parameter.type === "presetchoice") {
value = parameter.value();
result[parameter.group.name] = toOptions(
parameter.group.params
);
} else if (parameter.type === "conditionalgroup") {
value = parameter.value();
result = Object.assign(
result,
toOptions(parameter.groups[value])
);
} else if (
parameter.type === "list" ||
parameter.type === "smalllist"
) {
value = splitTextToArray(parameter.value(), ",", true);
} else if (parameter.type === "integer") {
value = parseInt(parameter.value());
} else if (parameter.type === "float") {
value = parseFloat(parameter.value());
} else {
value = parameter.value();
}
// and now set the value on the result, if it differs from the default
if (parameter.modified()) {
result[parameter.name] = value;
}
});
return result;
};
var data = {
autoconnect: self.settings.serial_autoconnect()
};
@@ -559,8 +815,8 @@ $(function () {
profile.name = connectionProfile.name;
}
self.connectionProfiles.editor
.showDialog(profile, gettext("Save & Connect"))
self.editor
.showDialog(profile, {button: gettext("Save & Connect")})
.done(function (profile) {
OctoPrint.connection.connect({connection: profile.id});
});
@@ -623,12 +879,6 @@ $(function () {
self.onUserPermissionsChanged = self.onUserLoggedIn = self.onUserLoggedOut = function () {
self.requestData();
};
self._sanitize = function (name) {
return name !== undefined
? name.replace(/[^a-zA-Z0-9\-_.() ]/g, "").replace(/ /g, "_")
: undefined;
};
}
OCTOPRINT_VIEWMODELS.push({
@@ -636,14 +886,14 @@ $(function () {
dependencies: [
"loginStateViewModel",
"settingsViewModel",
"connectionProfilesViewModel",
"printerProfilesViewModel",
"accessViewModel"
],
elements: [
"#connection_wrapper",
"#connection_protocol_dialog",
"#connection_transport_dialog"
"#connection_transport_dialog",
"#connectionprofiles_editor_dialog"
]
});
});
@@ -1,81 +1,11 @@
$(function () {
function ConnectionProfileEditorViewModel() {
var self = this;
self.active = ko.observable(false);
self.deferred = undefined;
self.buttonText = ko.observable(gettext("Save"));
self.dialog = $("#connectionprofiles_save_dialog");
self.profile = undefined;
self.name = ko.observable();
self.identifier = ko.observable();
self.identifierPlaceholder = ko.observable();
self.overwrite = ko.observable(false);
self.makeDefault = ko.observable(false);
self.name.subscribe(function () {
self.identifierPlaceholder(self._sanitize(self.name()).toLowerCase());
});
self.showDialog = function (profile, button) {
if (button) {
self.buttonText(button);
} else {
self.buttonText(gettext("Save"));
}
self.profile = profile;
self.name(profile.name);
self.identifier(profile.identifier);
self.overwrite(profile.identifier !== undefined);
self.deferred = $.Deferred();
self.dialog.modal("show");
return self.deferred.promise();
};
self.confirm = function () {
self.profile.id = self.identifier();
if (self.profile.id === undefined) {
self.profile.id = self.identifierPlaceholder();
}
self.profile.name = self.name();
OctoPrint.connectionprofiles
.set(self.profile.id, self.profile, self.overwrite(), self.makeDefault())
.done(function (response) {
self.dialog.modal("hide");
if (self.deferred) {
self.deferred.resolve(response.profile);
}
});
};
self._sanitize = function (name) {
return name
? name.replace(/[^a-zA-Z0-9\-_\.\(\) ]/g, "").replace(/ /g, "_")
: undefined;
};
}
function ConnectionProfilesViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.access = parameters[1];
self.connection = parameters[0];
self.requestInProgress = ko.observable(false);
self.editor = new ConnectionProfileEditorViewModel();
self.profiles = new ItemListHelper(
"connectionProfiles",
{
@@ -97,63 +27,48 @@ $(function () {
self.defaultProfile = ko.observable();
self.currentProfile = ko.observable();
self.makeDefault = function (data) {
return OctoPrint.connectionprofiles
.update(data.id, {default: true})
.done(function () {
self.requestData();
});
self.connection.availableConnectionProfiles.subscribe(function () {
var profiles = self.connection.availableConnectionProfiles();
self.profiles.updateItems(profiles);
});
self.connection.preferredConnectionProfile.subscribe(function (profileId) {
self.defaultProfile(profileId);
});
self.connection.selectedConnectionProfile.subscribe(function (profile) {
var profileId = profile ? profile.id : undefined;
self.currentProfile(profileId);
});
self.editProfile = function (data) {
self.connection.editor.showEditDialog(data);
};
self.canMakeDefault = function (data) {
return !data.is_default();
return !data.isDefault();
};
self.makeDefault = function (data) {
self.requestInProgress(true);
return OctoPrint.connectionprofiles
.update(data.id, {default: true})
.done(function () {
self.connection.requestData().always(function () {
self.requestInProgress(false);
});
});
};
self.canRemove = function (data) {
return !data.is_current() && !data.is_default();
};
self.requestData = function () {
if (!self.loginState.hasPermission(self.access.permissions.CONNECTION)) {
return;
}
return OctoPrint.connectionprofiles.list().done(self.fromResponse);
};
self.fromResponse = function (data) {
var items = [];
var defaultProfile = undefined;
var currentProfile = undefined;
_.each(data.profiles, function (profile) {
if (profile.default) {
defaultProfile = profile.id;
}
if (profile.current) {
currentProfile = profile.id;
}
profile.is_default = ko.observable(profile.default);
profile.is_current = ko.observable(profile.current);
items.push(profile);
});
self.profiles.updateItems(items);
self.defaultProfile(defaultProfile);
if (currentProfile) {
self.currentProfile(currentProfile);
} else {
// shouldn't normally happen, but just to not have anything else crash...
log.warn(
"Current printer profile could not be detected, using default values"
);
self.currentProfile(undefined);
}
return !data.isCurrent() && !data.isDefault();
};
self.removeProfile = function (data) {
var proceed = function () {
self.requestInProgress(true);
OctoPrint.connectionprofiles.delete(data.id).done(function () {
self.requestData();
self.connection.requestData().always(function () {
self.requestInProgress(false);
});
});
};
@@ -167,17 +82,11 @@ $(function () {
onproceed: proceed
});
};
self.onSettingsShown = self.requestData;
self.onUserPermissionsChanged = self.onUserLoggedIn = self.onUserLoggedOut = function () {
self.requestData();
};
}
OCTOPRINT_VIEWMODELS.push({
construct: ConnectionProfilesViewModel,
dependencies: ["loginStateViewModel", "accessViewModel"],
elements: ["#connectionprofiles_save_dialog"]
dependencies: ["connectionViewModel"],
elements: ["#settings_connection_connectionprofiles"]
});
});
@@ -4,9 +4,8 @@ $(function () {
self.loginState = parameters[0];
self.access = parameters[1];
self.connectionProfiles = parameters[2];
self.printerProfiles = parameters[3];
self.about = parameters[4];
self.printerProfiles = parameters[2];
self.about = parameters[3];
// TODO: remove in upcoming version, this is only for backwards compatibility
self.users = parameters[5];
@@ -1526,7 +1525,6 @@ $(function () {
dependencies: [
"loginStateViewModel",
"accessViewModel",
"connectionProfilesViewModel",
"printerProfilesViewModel",
"aboutViewModel",
"usersViewModel"
+1
View File
@@ -1030,6 +1030,7 @@ ul.dropdown-menu li a {
}
}
#connectionprofiles_editor_dialog,
#connection_protocol_dialog,
#connection_transport_dialog {
.control-group {
@@ -4,24 +4,9 @@
<h3>{{ _('Protocol Parameters') }}</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" action="javascript:void(0)">
<!-- ko foreach: protocolParameters -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: expertProtocolParameters">
<div><small><a class="muted" href="javascript:void(0)" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: protocolParameters -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</form>
<!--ko let: { profile: { protocolParameters: protocolParameters, expertProtocolParameters:expertProtocolParameters } }-->
{% include 'snippets/connectionprofiles/protocolEditor.jinja2' %}
<!--/ko-->
</div>
<div class="modal-footer">
<a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</a>
@@ -34,208 +19,11 @@
<h3>{{ _('Transport Parameters') }}</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" action="javascript:void(0)">
<!-- ko foreach: transportParameters -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: expertTransportParameters">
<div><small><a class="muted" href="javascript:void(0)" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: transportParameters -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</form>
<!--ko let: { profile: { transportParameters: transportParameters, expertTransportParameters:expertProtocolParameters } }-->
{% include 'snippets/connectionprofiles/transportEditor.jinja2' %}
<!--/ko-->
</div>
<div class="modal-footer">
<a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</a>
</div>
</div>
<script type="text/html" id="connection_dialog_template_text">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: $data.value, attr: {placeholder: $data.default}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_url">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: $data.value, attr: {placeholder: $data.default}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_integer">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko if: $data.unit -->
<div class="input-append">
<input class="input-small" type="number" step="1" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="add-on" data-bind="text: $data.unit"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: $data.unit -->
<input class="input-small" type="number" step="1" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_float">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko if: $data.unit -->
<div class="input-append">
<input class="input-small" type="number" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="add-on" data-bind="text: $data.unit"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: $data.unit -->
<input class="input-small" type="number" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_choice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_presetchoice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
<!-- ko template: { name: 'connection_dialog_template_group', data: group } --><!-- /ko -->
</script>
<script type="text/html" id="connection_dialog_template_smallchoice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko foreach: choices -->
<label class="radio">
<input type="radio" data-bind="attr: { name: 'connection_dialog_' + $parent.name + '_group' }, value: $data.value, checked: $parent.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"> <span data-bind="markdownInline: $data.title"></span> <span class="label label-important" data-bind="visible: $data.warning">{{ _('Warning') }}</span> <!-- ko foreach: $data.labels --><span class="label" data-bind="text: $data"></span><!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</label>
<!-- /ko -->
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_boolean">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"> <span data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></span> <span class="label label-important" data-bind="visible: $data.warning">{{ _('Warning') }}</span> <!-- ko foreach: $data.labels --><span class="label" data-bind="text: $data"></span><!-- /ko -->
</label>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_suggestion">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.suggestions, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_list">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<textarea data-bind="value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></textarea>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_smalllist">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connection_dialog_template_group">
<fieldset>
<legend data-bind="markdownInline: $data.title"></legend>
<p data-bind="visible: $data.help, markdownInline: $data.help"></p>
<!-- ko foreach: params -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: expertParameters">
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: params -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</fieldset>
</script>
<script type="text/html" id="connection_dialog_template_conditionalgroup">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
<!-- ko foreach: $data.groups[$data.value()] -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: $data.expertParameters[$data.value]">
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: $data.groups[$data.value()] -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connection_dialog_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</script>
@@ -1,49 +1,272 @@
<div id="connectionprofiles_save_dialog" class="modal hide fade-in">
<div id="connectionprofiles_editor_dialog" class="modal hide fade-in">
<div class="modal-header">
<a href="#" class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
<h3>{{ _('Save connection profile') }}</h3>
<h3 data-bind="text: editor.dialogTitle">{{ _('Edit connection profile') }}</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" action="javascript:void(0)">
<div class="control-group">
<label class="control-label">{{ _('Name') }}</label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: editor.name, valueUpdate: 'afterkeydown'">
<div class="full-sized-box">
<form class="form-horizontal" action="javascript:void(0)">
<ul class="nav nav-pills">
<li class="active"><a href="#connectionprofiles_editor_dialog_general" data-toggle="tab">{{ _('General') }}</a></li>
<li><a href="#connectionprofiles_editor_dialog_printer" data-toggle="tab">{{ _('Printer profile') }}</a></li>
<li><a href="#connectionprofiles_editor_dialog_protocol" data-toggle="tab">{{ _('Protocol') }}</a></li>
<li><a href="#connectionprofiles_editor_dialog_transport" data-toggle="tab">{{ _('Transport') }}</a></li>
</ul>
<div class="tab-content">
<div id="connectionprofiles_editor_dialog_general" class="tab-pane active">
<div class="control-group">
<label class="control-label">{{ _('Name') }}</label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: editor.profile.name, valueUpdate: 'afterkeydown'">
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Identifier') }}</label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: editor.profile.identifier, attr: {placeholder: editor.profile.identifierPlaceholder}">
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: editor.profile.overwrite"> {{ _('Overwrite existing profile') }}
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: editor.profile.autoconnect"> {{ _('Attempt auto connect on server start') }}
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: editor.profile.makeDefault"> {{ _('Make default') }}
</label>
</div>
</div>
</div>
<div id="connectionprofiles_editor_dialog_printer" class="tab-pane">
<div class="control-group">
<label class="control-label">{{ _('Printer profile') }}</label>
<div class="controls">
<select class="input-block-level" data-bind="options: availablePrinterProfiles, optionsText: 'name', value: editor.profile.printerProfile"></select>
</div>
</div>
</div>
<div id="connectionprofiles_editor_dialog_protocol" class="tab-pane">
<div class="control-group">
<label class="control-label">{{ _('Protocol') }}</label>
<div class="controls">
<select class="input-block-level" data-bind="options: availableProtocols, optionsText: 'name', value: editor.profile.protocol"></select>
</div>
</div>
<!--ko let: { profile: editor.profile }-->
{% include "snippets/connectionprofiles/protocolEditor.jinja2" %}
<!--/ko-->
</div>
<div id="connectionprofiles_editor_dialog_transport" class="tab-pane">
<div class="control-group">
<label class="control-label">{{ _('Transport') }}</label>
<div class="controls">
<select class="input-block-level" data-bind="options: availableTransports, optionsText: 'name', value: editor.profile.transport"></select>
</div>
</div>
<!--ko let: { profile: editor.profile }-->
{% include "snippets/connectionprofiles/transportEditor.jinja2" %}
<!--/ko-->
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Identifier') }}</label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: editor.identifier, attr: {placeholder: editor.identifierPlaceholder}">
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: editor.overwrite"> {{ _('Overwrite existing profile') }}
</label>
</div>
</div>
<!--
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox"> {{ _('Make default') }}
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox"> {{ _('Attempt auto connect on server start') }}
</label>
</div>
</div>
-->
</form>
</form>
</div>
</div>
<div class="modal-footer">
<a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</a>
<a href="javascript:void(0)" class="btn" aria-hidden="true" data-bind="text: editor.buttonText, click: editor.confirm">{{ _('Save') }}</a>
<a href="javascript:void(0)" class="btn" aria-hidden="true" data-bind="text: editor.buttonText, click: confirm">{{ _('Save') }}</a>
</div>
</div>
<script type="text/html" id="connectionprofile_editor_template_text">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: $data.value, attr: {placeholder: $data.default}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_url">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input class="input-block-level" type="text" data-bind="value: $data.value, attr: {placeholder: $data.default}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_integer">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko if: $data.unit -->
<div class="input-append">
<input class="input-small" type="number" step="1" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="add-on" data-bind="text: $data.unit"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: $data.unit -->
<input class="input-small" type="number" step="1" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_float">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko if: $data.unit -->
<div class="input-append">
<input class="input-small" type="number" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="add-on" data-bind="text: $data.unit"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: $data.unit -->
<input class="input-small" type="number" data-bind="value: $data.value, attr: {placeholder: $data.default, min: $data.min, max: $data.max}, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_choice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_presetchoice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
<!-- ko template: { name: 'connectionprofile_editor_template_group', data: group } --><!-- /ko -->
</script>
<script type="text/html" id="connectionprofile_editor_template_smallchoice">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<!-- ko foreach: choices -->
<label class="radio">
<input type="radio" data-bind="attr: { name: 'connectionprofile_editor_' + $parent.name + '_group' }, value: $data.value, checked: $parent.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"> <span data-bind="markdownInline: $data.title"></span> <span class="label label-important" data-bind="visible: $data.warning">{{ _('Warning') }}</span> <!-- ko foreach: $data.labels --><span class="label" data-bind="text: $data"></span><!-- /ko -->
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</label>
<!-- /ko -->
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_boolean">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"> <span data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></span> <span class="label label-important" data-bind="visible: $data.warning">{{ _('Warning') }}</span> <!-- ko foreach: $data.labels --><span class="label" data-bind="text: $data"></span><!-- /ko -->
</label>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_suggestion">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.suggestions, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_list">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<textarea data-bind="value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></textarea>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_smalllist">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()">
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
</script>
<script type="text/html" id="connectionprofile_editor_template_group">
<fieldset>
<legend data-bind="markdownInline: $data.title"></legend>
<p data-bind="visible: $data.help, markdownInline: $data.help"></p>
<!-- ko foreach: params -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: expertParameters">
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: params -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</fieldset>
</script>
<script type="text/html" id="connectionprofile_editor_template_conditionalgroup">
<div class="control-group" data-bind="css: { 'control-changed': $data.modified }">
<a href="javascript:void(0)" class="fa fa-undo control-undo" title="Reset to default" data-bind="click: reset, visible: $data.modified() && $root.isErrorOrClosed()"></a>
<label class="control-label" data-bind="markdownInline: $data.title, css: { 'control-changed': $data.modified }"></label>
<div class="controls">
<select class="input-block-level" data-bind="options: $data.choices, optionsText: 'title', optionsValue: 'value', value: $data.value, css: {disabled: !$root.isErrorOrClosed()}, enable: $root.isErrorOrClosed()"></select>
<span class="help-block" data-bind="visible: $data.help, markdownInline: $data.help"></span>
</div>
</div>
<!-- ko foreach: $data.groups[$data.value()] -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: $data.expertParameters[$data.value]">
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: $data.groups[$data.value()] -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
</script>
@@ -25,19 +25,20 @@
</div>
</fieldset>
</div>
<!-- ko allowBindings: false -->
<div id="settings_connection_connectionprofiles" class="tab-pane">
<table class="table table-striped table-hover table-condensed table-hover" id="settings_connectionProfiles_profiles" data-bind="visible: connectionProfiles.profiles.items().length > 0" style="display: none">
<table class="table table-striped table-hover table-condensed table-hover" id="settings_connectionProfiles_profiles" data-bind="visible: profiles.items().length > 0" style="display: none">
<thead>
<tr>
<th class="settings_connectionProfiles_profiles_name">{{ _('Name') }}</th>
<th class="settings_connectionProfiles_profiles_action">{{ _('Action') }}</th>
</tr>
</thead>
<tbody data-bind="foreach: connectionProfiles.profiles.paginatedItems">
<tbody data-bind="foreach: profiles.paginatedItems">
<tr data-bind="attr: {title: name}">
<td class="settings_connectionProfiles_profiles_name"><span class="fa fa-star" data-bind="invisible: !is_default()"></span> <span data-bind="text: name"></span></td>
<td class="settings_connectionProfiles_profiles_name"><span class="fa fa-star" data-bind="invisible: !isDefault()"></span> <span data-bind="text: name"></span></td>
<td class="settings_connectionProfiles_profiles_action">
<a href="javascript:void(0)" class="fa fa-star" title="{{ _('Set as default profile') }}" data-bind="click: function() { if ($root.connectionProfiles.canMakeDefault($data) && !$root.connectionProfiles.requestInProgress()) { $root.connectionProfiles.makeDefault($data); } }, css: {disabled: !$root.connectionProfiles.canMakeDefault($data) || $root.connectionProfiles.requestInProgress()}, enabled: $root.connectionProfiles.canMakeDefault($data) && !$root.connectionProfiles.requestInProgress()"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" class="fa fa-trash-o" title="{{ _('Delete Profile') }}" data-bind="click: function() { if ($root.connectionProfiles.canRemove($data) && !$root.connectionProfiles.requestInProgress()) { $root.connectionProfiles.removeProfile($data); } }, css: {disabled: !$root.connectionProfiles.canRemove($data) || $root.connectionProfiles.requestInProgress()}, enabled: $root.connectionProfiles.canRemove($data) && !$root.connectionProfiles.requestInProgress()"></a>
&nbsp;<a href="javascript:void(0)" class="fa fa-star" title="{{ _('Set as default profile') }}" data-bind="click: function() { if ($root.canMakeDefault($data) && !$root.requestInProgress()) { $root.makeDefault($data); } }, css: {disabled: !$root.canMakeDefault($data) || $root.requestInProgress()}, enabled: $root.canMakeDefault($data) && !$root.requestInProgress()"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" class="fa fa-pencil" title="{{ _('Edit profile') }}" data-bind="click: function() { if (!$root.requestInProgress()) { $root.editProfile($data); } }, css: {disabled: $root.requestInProgress()}, enabled: !$root.requestInProgress()"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" class="fa fa-trash-o" title="{{ _('Delete Profile') }}" data-bind="click: function() { if ($root.canRemove($data) && !$root.requestInProgress()) { $root.removeProfile($data); } }, css: {disabled: !$root.canRemove($data) || $root.requestInProgress()}, enabled: $root.canRemove($data) && !$root.requestInProgress()"></a>
</td>
</tr>
</tbody>
@@ -45,15 +46,16 @@
<div class="pagination pagination-mini pagination-centered">
<ul>
<li data-bind="css: {disabled: connectionProfiles.profiles.currentPage() === 0}"><a href="#" data-bind="click: connectionProfiles.profiles.prevPage">«</a></li>
<li data-bind="css: {disabled: profiles.currentPage() === 0}"><a href="#" data-bind="click: profiles.prevPage">«</a></li>
</ul>
<ul data-bind="foreach: connectionProfiles.profiles.pages">
<li data-bind="css: { active: $data.number === $root.connectionProfiles.profiles.currentPage(), disabled: $data.number === -1 }"><a href="#" data-bind="text: $data.text, click: function() { $root.connectionProfiles.profiles.changePage($data.number); }"></a></li>
<ul data-bind="foreach: profiles.pages">
<li data-bind="css: { active: $data.number === $root.profiles.currentPage(), disabled: $data.number === -1 }"><a href="#" data-bind="text: $data.text, click: function() { $root.profiles.changePage($data.number); }"></a></li>
</ul>
<ul>
<li data-bind="css: {disabled: connectionProfiles.profiles.currentPage() === connectionProfiles.profiles.lastPage()}"><a href="#" data-bind="click: connectionProfiles.profiles.nextPage">»</a></li>
<li data-bind="css: {disabled: profiles.currentPage() === profiles.lastPage()}"><a href="#" data-bind="click: profiles.nextPage">»</a></li>
</ul>
</div>
</div>
<!--/ko-->
</div>
</form>
@@ -0,0 +1,16 @@
<!-- ko foreach: profile.protocolParameters -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: profile.expertProtocolParameters">
<div><small><a class="muted" href="javascript:void(0)" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: profile.protocolParameters -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>
@@ -0,0 +1,16 @@
<!-- ko foreach: profile.transportParameters -->
<!-- ko if: !expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<div class="advanced_options" data-bind="visible: profile.expertTransportParameters">
<div><small><a class="muted" href="javascript:void(0)" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Expert options') }}</a></small></div>
<div class="hide">
<!-- ko foreach: profile.transportParameters -->
<!-- ko if: expert -->
<!-- ko template: { name: 'connectionprofile_editor_template_' + $data.type, data: $data } --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>
</div>