Permalink
Browse files

suppert comment colum

  • Loading branch information...
1 parent 71d2287 commit 6bac31282fc813f4afbb33597dc4351b45d90aa2 @winebarrel winebarrel committed Apr 22, 2012
@@ -228,6 +228,9 @@
<treecol id="instance.platform" label="&ec2ui.platform.label;"
flex="2" persist="width ordinal hidden sortDirection" />
<splitter class="tree-splitter" />
+ <treecol id="instance.comment" label="Comment"
+ flex="2" persist="width ordinal hidden sortDirection" />
+ <splitter class="tree-splitter" />
</treecols>
<treechildren context="ec2ui.instances.contextmenu" />
</tree>
@@ -22,7 +22,8 @@ var ec2ui_InstancesTreeView = {
'instance.tag',
'instance.vpcId',
'instance.subnetId',
- 'instance.rootDeviceType'
+ 'instance.rootDeviceType',
+ 'instance.comment'
],
treeBox: null,
selection: null,
@@ -39,7 +39,10 @@ function AMI(id, location, state, owner, isPublic, arch, platform, aki, ari, roo
this.isPublic = isPublic;
this.arch = arch;
this.platform = platform;
- if (tag) this.tag = tag;
+ if (tag) {
+ this.tag = tag;
+ __addCommentTagToModel__(tag, this);
+ }
this.aki = aki;
this.ari = ari;
this.rootDeviceType = rootDeviceType;
@@ -61,8 +64,8 @@ function Snapshot(id, volumeId, status, startTime, progress, volumeSize, descrip
this.ownerAlias = ownerAlias;
if (tag) {
- this.tag = tag;
- __addNameTagToModel__(tag, this);
+ this.tag = tag;
+ __addNameTagToModel__(tag, this);
}
}
@@ -114,8 +117,8 @@ function Instance(resId, ownerId, groupList, instanceId, imageId, kernelId,
this.subnetId = subnetId;
if (tag) {
- this.tag = tag;
- __addNameTagToModel__(tag, this);
+ this.tag = tag;
+ __addNameTagToModel__(tag, this);
}
this.rootDeviceType = rootDeviceType;
@@ -1229,6 +1229,8 @@ function secondsToYears(secs) {
function __addNameTagToModel__(tag, model) {
var kvs = tag.split(/\s*,\s*/);
+ model.name = null;
+ model.comment = null;
for (var i = 0; i < kvs.length; i++) {
var kv = kvs[i].split(/\s*:\s*/, 2);
@@ -1237,11 +1239,33 @@ function __addNameTagToModel__(tag, model) {
if (key == "Name") {
model.name = value;
+ }
+
+ if (key == "Comment") {
+ model.comment = value;
+ }
+
+ if (model.name && model.comment) {
return;
}
}
+}
- model.name = null;
+function __addCommentTagToModel__(tag, model) {
+ var kvs = tag.split(/\s*,\s*/);
+
+ for (var i = 0; i < kvs.length; i++) {
+ var kv = kvs[i].split(/\s*:\s*/, 2);
+ var key = kv[0].trim();
+ var value = (kv[1] || "").trim();
+
+ if (key == "Comment") {
+ model.comment = value;
+ return;
+ }
+ }
+
+ model.comment = null;
}
function __tagToName__(tag) {

0 comments on commit 6bac312

Please sign in to comment.