|
|
@@ -762,37 +762,39 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
|
|
|
</template>
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
- var JVM_MEM_PATTERN = /([0-9]+)([MG])$/;
|
|
|
- var UNITS = { 'MB' : 'M', 'GB' : 'G'};
|
|
|
-
|
|
|
- function JvmMemoryInputViewModel(params) {
|
|
|
- this.valueObservable = params.value;
|
|
|
- this.units = Object.keys(UNITS);
|
|
|
- this.selectedUnit = ko.observable();
|
|
|
- this.value = ko.observable().extend({ 'numeric' : 0 });
|
|
|
-
|
|
|
- var match = JVM_MEM_PATTERN.exec(this.valueObservable());
|
|
|
- if (match.length === 3) {
|
|
|
- this.value(match[1]);
|
|
|
- this.selectedUnit(match[2] === 'M' ? 'MB' : 'GB');
|
|
|
- }
|
|
|
-
|
|
|
- this.value.subscribe(this.updateValueObservable, this);
|
|
|
- this.selectedUnit.subscribe(this.updateValueObservable, this);
|
|
|
- }
|
|
|
+ (function() {
|
|
|
+ var JVM_MEM_PATTERN = /([0-9]+)([MG])$/;
|
|
|
+ var UNITS = { 'MB' : 'M', 'GB' : 'G' };
|
|
|
+
|
|
|
+ function JvmMemoryInputViewModel(params) {
|
|
|
+ this.valueObservable = params.value;
|
|
|
+ this.units = Object.keys(UNITS);
|
|
|
+ this.selectedUnit = ko.observable();
|
|
|
+ this.value = ko.observable().extend({ 'numeric' : 0 });
|
|
|
+
|
|
|
+ var match = JVM_MEM_PATTERN.exec(this.valueObservable());
|
|
|
+ if (match.length === 3) {
|
|
|
+ this.value(match[1]);
|
|
|
+ this.selectedUnit(match[2] === 'M' ? 'MB' : 'GB');
|
|
|
+ }
|
|
|
|
|
|
- JvmMemoryInputViewModel.prototype.updateValueObservable = function() {
|
|
|
- if (isNaN(this.value()) || this.value() === '') {
|
|
|
- this.valueObservable(undefined);
|
|
|
- } else {
|
|
|
- this.valueObservable(this.value() + UNITS[this.selectedUnit()]);
|
|
|
+ this.value.subscribe(this.updateValueObservable, this);
|
|
|
+ this.selectedUnit.subscribe(this.updateValueObservable, this);
|
|
|
}
|
|
|
- };
|
|
|
|
|
|
- ko.components.register('jvm-memory-input', {
|
|
|
- viewModel: JvmMemoryInputViewModel,
|
|
|
- template: { element: 'jvm-memory-input-template' }
|
|
|
- });
|
|
|
+ JvmMemoryInputViewModel.prototype.updateValueObservable = function() {
|
|
|
+ if (isNaN(this.value()) || this.value() === '') {
|
|
|
+ this.valueObservable(undefined);
|
|
|
+ } else {
|
|
|
+ this.valueObservable(this.value() + UNITS[this.selectedUnit()]);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ ko.components.register('jvm-memory-input', {
|
|
|
+ viewModel: JvmMemoryInputViewModel,
|
|
|
+ template: { element: 'jvm-memory-input-template' }
|
|
|
+ });
|
|
|
+ }());
|
|
|
</script>
|
|
|
|
|
|
|