Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: freenas/freenas
...
head fork: freenas/freenas
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 06, 2013
@williambr williambr Hide vdev types that are not a valid choice e5fcba0
@williambr williambr Switch from ComboBox to FilteringSelect
This is better because the value of the widget is the id and not
the label. Select would be even better but it doesn't handle dynamic
options very well.
27bc0f4
Showing with 37 additions and 23 deletions.
  1. +37 −23 gui/freeadmin/static/lib/js/freeadmin/VolumeManager.js
View
60 gui/freeadmin/static/lib/js/freeadmin/VolumeManager.js
@@ -21,7 +21,7 @@ define([
"dijit/TooltipDialog",
"dijit/form/Button",
"dijit/form/CheckBox",
- "dijit/form/ComboBox",
+ "dijit/form/FilteringSelect",
"dijit/form/Form",
"dijit/form/RadioButton",
"dijit/form/Select",
@@ -58,7 +58,7 @@ define([
TooltipDialog,
Button,
CheckBox,
- ComboBox,
+ FilteringSelect,
Form,
RadioButton,
Select,
@@ -483,7 +483,7 @@ define([
id: this._currentAvail,
name: sprintf("%d - %s", aDisks[this._currentAvail].index + 1, aDisks[this._currentAvail].size)
});
- this._vdevDiskType.set('value', sprintf("%d - %s", aDisks[this._currentAvail].index + 1, aDisks[this._currentAvail].size));
+ this._vdevDiskType.set('value', this._currentAvail);
for(var i in this._disksSwitch) {
var idx = this._disksSwitch[i];
@@ -499,14 +499,7 @@ define([
},
_doSwitch: function(widget, value) {
if(value === false) return;
- var idx = widget.get("value").split(" - ")[1];
- // Hack because of ComboBox (Select doesn't work, dojo bug)
- for(var i=0;i<this.manager._avail_disks.length;i++) {
- if(this.manager._avail_disks[i].size == idx) {
- idx = i;
- break;
- }
- }
+ var idx = widget.get("value");
var num = this.disks.length;
var rows = this.rows;
while(this.disks.length > 0) {
@@ -546,23 +539,17 @@ define([
}));
this._vdevDiskType = null;
- this._vdevDiskType = new ComboBox({
+ this._vdevDiskType = new FilteringSelect({
store: this._store,
style: {width: "85px", marginRight: "0px", display: "none"},
onChange: function(value) { lang.hitch(me, me._doSwitch)(this, value); }
}, this.dapVdevDiskType);
- this.vdevtype = new Select({
- options: [
- { label: "RaidZ", value: "raidz" },
- { label: "RaidZ2", value: "raidz2" },
- { label: "RaidZ3", value: "raidz3" },
- { label: "Mirror", value: "mirror" },
- { label: "Stripe", value: "stripe" },
- { label: "Log (ZIL)", value: "log" },
- { label: "Cache (L2ARC)", value: "cache" },
- { label: "Spare", value: "spare" }
- ],
+ this._vdevstore = new Observable(new Memory());
+
+ this.vdevtype = new FilteringSelect({
+ store: this._vdevstore,
+ style: {width: "65px", marginRight: "0px"}
}, this.dapVdevType);
this.vdevtype.startup();
@@ -1138,8 +1125,35 @@ define([
return (Math.log(num - 3) / Math.LN2) % 1 == 0;
}
},
+ _vdevTypes: [
+ [3, "RaidZ", "raidz"],
+ [4, "RaidZ2", "raidz2"],
+ [5, "RaidZ3", "raidz3"],
+ [2, "Mirror", "mirror"],
+ [1, "Stripe", "stripe"],
+ [1, "Log (ZIL)", "log"],
+ [1, "Cache (L2ARC)", "cache"],
+ [1, "Spare", "spare"],
+ ],
_disksCheck: function(vdev, manual, cols, rows) {
+ vdev._vdevstore.query({}).forEach(function(item, index) {
+ vdev._vdevstore.remove(item.id);
+ });
+
+ for(var i=0;i<this._vdevTypes.length;i++) {
+ if(vdev.getCurrentCols() >= this._vdevTypes[i][0]) {
+ vdev._vdevstore.add({
+ id: this._vdevTypes[i][2],
+ name: this._vdevTypes[i][1]
+ });
+
+ }
+ }
+ if(vdev.disks.length == 0) {
+ vdev.vdevtype.set('value', '');
+ }
+
var numdisks;
vdev._isOptimal = null;
if(cols !== undefined) {

No commit comments for this range

Something went wrong with that request. Please try again.