Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 578F87ABA for ; Tue, 4 Oct 2011 11:35:54 +0000 (UTC) Received: (qmail 37667 invoked by uid 500); 4 Oct 2011 11:35:54 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 37650 invoked by uid 500); 4 Oct 2011 11:35:54 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 37639 invoked by uid 99); 4 Oct 2011 11:35:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 11:35:54 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,T_FRT_PROFIT2 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 11:35:46 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p94BZOKg000536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 Oct 2011 07:35:24 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p94BZLPw012815 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 4 Oct 2011 07:35:23 -0400 Subject: Re: [PATCH 2/2] dmtf reference implementation coding style changes Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Michal Fojtik In-Reply-To: <1317400046-23064-1-git-send-email-litong01@us.ibm.com> Date: Tue, 4 Oct 2011 13:36:17 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <802FCE80-BB25-438D-A21D-7BA016A75850@redhat.com> References: <1317400046-23064-1-git-send-email-litong01@us.ibm.com> To: deltacloud-dev@incubator.apache.org X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 On Sep 30, 2011, at 6:27 PM, email4tong@gmail.com wrote: Hi, The subject line indicates that this patch is 2/2 but I can't see the = patch 1/2. So I cannot apply this patch against master. Do I miss something? A small nits I found meanwhile: 1.=20 > %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} It's better to use to avoid one extra space at beginning on text area: %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, :style = =3D> "width:50%;" }=3D#{@dmtfitem['description']} 2. Could you please move all :javascript to a separate .js files and = then include them?=20 -- Michal > From: Tong Li >=20 > --- > server/lib/cimi/data/collections/event.col.xml | 9 - > server/lib/cimi/data/collections/eventLog.col.xml | 9 - > server/lib/cimi/data/collections/job.col.xml | 9 - > server/lib/cimi/data/collections/machine.col.xml | 4 +- > .../lib/cimi/data/collections/machineAdmin.col.xml | 9 - > .../data/collections/machineConfiguration.col.xml | 12 - > .../lib/cimi/data/collections/machineImage.col.xml | 11 - > .../cimi/data/collections/machineTemplate.col.xml | 8 - > .../data/collections/machine_configuration.col.xml | 8 + > .../cimi/data/collections/machine_image.col.xml | 8 + > server/lib/cimi/data/collections/meter.col.xml | 10 - > .../cimi/data/collections/meterTemplate.col.xml | 10 - > server/lib/cimi/data/collections/network.col.xml | 10 - > .../cimi/data/collections/networkConfig.col.xml | 10 - > .../cimi/data/collections/networkTemplate.col.xml | 10 - > server/lib/cimi/data/collections/system.col.xml | 11 - > .../cimi/data/collections/systemTemplate.col.xml | 10 - > server/lib/cimi/data/collections/volume.col.xml | 4 +- > .../data/collections/volumeConfiguration.col.xml | 10 - > .../lib/cimi/data/collections/volumeImage.col.xml | 11 - > .../cimi/data/collections/volumeTemplate.col.xml | 9 - > server/lib/cimi/data/collections/vsp.col.xml | 10 - > server/lib/cimi/data/collections/vspConfig.col.xml | 10 - > .../lib/cimi/data/collections/vspTemplate.col.xml | 10 - > server/lib/cimi/data/defaultRes/machine.col.xml | 35 -- > .../lib/cimi/data/defaultRes/machineAdmin.col.xml | 11 - > .../data/defaultRes/machineConfiguration.col.xml | 17 - > .../lib/cimi/data/defaultRes/machineImage.col.xml | 11 - > .../cimi/data/defaultRes/machineTemplate.col.xml | 12 - > server/lib/cimi/data/defaultRes/system.col.xml | 12 - > .../cimi/data/defaultRes/systemTemplate.col.xml | 10 - > .../data/defaultRes/volumeConfiguration.col.xml | 14 - > server/lib/cimi/data/default_res/machine.col.xml | 35 ++ > .../data/default_res/machine_configuration.col.xml | 17 + > .../cimi/data/default_res/machine_image.col.xml | 11 + > server/lib/cimi/data/default_res/volume.col.xml | 14 + > server/lib/cimi/helpers/cmwgapp_helper.rb | 364 = ++++---------------- > server/lib/cimi/helpers/cmwgres_helper.rb | 134 ------- > server/lib/cimi/helpers/dmtfdep.rb | 4 +- > server/lib/cimi/server.rb | 312 = +++++++++-------- > server/public/javascripts/cmwgapp.js | 4 +- > server/views/cimi/cloudEntryPoint/index.html.haml | 8 +- > server/views/cimi/cloudEntryPoint/index.xml.haml | 6 +- > server/views/cimi/collection/index.html.haml | 55 +--- > server/views/cimi/machine/new.html.haml | 183 ---------- > server/views/cimi/machine/show.html.haml | 30 +- > server/views/cimi/machineAdmin/new.html.haml | 46 --- > server/views/cimi/machineAdmin/show.html.haml | 46 --- > .../views/cimi/machineConfiguration/new.html.haml | 172 --------- > .../views/cimi/machineConfiguration/show.html.haml | 167 --------- > server/views/cimi/machineImage/new.html.haml | 80 ----- > server/views/cimi/machineImage/show.html.haml | 82 ----- > server/views/cimi/machineTemplate/new.html.haml | 78 ----- > server/views/cimi/machineTemplate/show.html.haml | 78 ----- > .../cimi/machine_configuration/show.html.haml | 159 +++++++++ > server/views/cimi/machine_image/show.html.haml | 79 +++++ > server/views/cimi/system/new.html.haml | 79 ----- > server/views/cimi/system/show.html.haml | 79 ----- > server/views/cimi/system/show.xml.haml | 11 - > server/views/cimi/systemTemplate/new.html.haml | 68 ---- > server/views/cimi/systemTemplate/show.html.haml | 70 ---- > server/views/cimi/volume/show.html.haml | 68 ++++ > .../views/cimi/volumeConfiguration/new.html.haml | 75 ---- > .../views/cimi/volumeConfiguration/show.html.haml | 77 ---- > 64 files changed, 681 insertions(+), 2354 deletions(-) > delete mode 100644 server/lib/cimi/data/collections/event.col.xml > delete mode 100644 server/lib/cimi/data/collections/eventLog.col.xml > delete mode 100644 server/lib/cimi/data/collections/job.col.xml > delete mode 100644 = server/lib/cimi/data/collections/machineAdmin.col.xml > delete mode 100644 = server/lib/cimi/data/collections/machineConfiguration.col.xml > delete mode 100644 = server/lib/cimi/data/collections/machineImage.col.xml > delete mode 100644 = server/lib/cimi/data/collections/machineTemplate.col.xml > create mode 100644 = server/lib/cimi/data/collections/machine_configuration.col.xml > create mode 100644 = server/lib/cimi/data/collections/machine_image.col.xml > delete mode 100644 server/lib/cimi/data/collections/meter.col.xml > delete mode 100644 = server/lib/cimi/data/collections/meterTemplate.col.xml > delete mode 100644 server/lib/cimi/data/collections/network.col.xml > delete mode 100644 = server/lib/cimi/data/collections/networkConfig.col.xml > delete mode 100644 = server/lib/cimi/data/collections/networkTemplate.col.xml > delete mode 100644 server/lib/cimi/data/collections/system.col.xml > delete mode 100644 = server/lib/cimi/data/collections/systemTemplate.col.xml > delete mode 100644 = server/lib/cimi/data/collections/volumeConfiguration.col.xml > delete mode 100644 = server/lib/cimi/data/collections/volumeImage.col.xml > delete mode 100644 = server/lib/cimi/data/collections/volumeTemplate.col.xml > delete mode 100644 server/lib/cimi/data/collections/vsp.col.xml > delete mode 100644 server/lib/cimi/data/collections/vspConfig.col.xml > delete mode 100644 = server/lib/cimi/data/collections/vspTemplate.col.xml > delete mode 100644 server/lib/cimi/data/defaultRes/machine.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/machineAdmin.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/machineConfiguration.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/machineImage.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/machineTemplate.col.xml > delete mode 100644 server/lib/cimi/data/defaultRes/system.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/systemTemplate.col.xml > delete mode 100644 = server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml > create mode 100644 server/lib/cimi/data/default_res/machine.col.xml > create mode 100644 = server/lib/cimi/data/default_res/machine_configuration.col.xml > create mode 100644 = server/lib/cimi/data/default_res/machine_image.col.xml > create mode 100644 server/lib/cimi/data/default_res/volume.col.xml > delete mode 100644 server/lib/cimi/helpers/cmwgres_helper.rb > delete mode 100644 server/views/cimi/machine/new.html.haml > delete mode 100644 server/views/cimi/machineAdmin/new.html.haml > delete mode 100644 server/views/cimi/machineAdmin/show.html.haml > delete mode 100644 = server/views/cimi/machineConfiguration/new.html.haml > delete mode 100644 = server/views/cimi/machineConfiguration/show.html.haml > delete mode 100644 server/views/cimi/machineImage/new.html.haml > delete mode 100644 server/views/cimi/machineImage/show.html.haml > delete mode 100644 server/views/cimi/machineTemplate/new.html.haml > delete mode 100644 server/views/cimi/machineTemplate/show.html.haml > create mode 100644 = server/views/cimi/machine_configuration/show.html.haml > create mode 100644 server/views/cimi/machine_image/show.html.haml > delete mode 100644 server/views/cimi/system/new.html.haml > delete mode 100644 server/views/cimi/system/show.html.haml > delete mode 100644 server/views/cimi/system/show.xml.haml > delete mode 100644 server/views/cimi/systemTemplate/new.html.haml > delete mode 100644 server/views/cimi/systemTemplate/show.html.haml > create mode 100644 server/views/cimi/volume/show.html.haml > delete mode 100644 server/views/cimi/volumeConfiguration/new.html.haml > delete mode 100644 = server/views/cimi/volumeConfiguration/show.html.haml >=20 > diff --git a/server/lib/cimi/data/collections/event.col.xml = b/server/lib/cimi/data/collections/event.col.xml > deleted file mode 100644 > index b4e772f..0000000 > --- a/server/lib/cimi/data/collections/event.col.xml > +++ /dev/null > @@ -1,9 +0,0 @@ > - > - > - event > - event collection > - The event collection > - 2011-09-12 11:37:28 UTC > - 400 > - > - > diff --git a/server/lib/cimi/data/collections/eventLog.col.xml = b/server/lib/cimi/data/collections/eventLog.col.xml > deleted file mode 100644 > index df42085..0000000 > --- a/server/lib/cimi/data/collections/eventLog.col.xml > +++ /dev/null > @@ -1,9 +0,0 @@ > - > - > - eventLog > - Event log collection > - The event log collection > - 2011-09-12 11:37:28 UTC > - event log > - > - > diff --git a/server/lib/cimi/data/collections/job.col.xml = b/server/lib/cimi/data/collections/job.col.xml > deleted file mode 100644 > index 0c306e1..0000000 > --- a/server/lib/cimi/data/collections/job.col.xml > +++ /dev/null > @@ -1,9 +0,0 @@ > - > - > - job > - Job collection > - The job collection > - 2011-09-12 11:37:28 UTC > - 2000 > - > - > diff --git a/server/lib/cimi/data/collections/machine.col.xml = b/server/lib/cimi/data/collections/machine.col.xml > index 6f8af15..622a6fe 100644 > --- a/server/lib/cimi/data/collections/machine.col.xml > +++ b/server/lib/cimi/data/collections/machine.col.xml > @@ -4,7 +4,5 @@ > Machine collection > The machine collection > 2011-09-12 11:37:28 UTC > - machine prop value > - > - > + > > diff --git a/server/lib/cimi/data/collections/machineAdmin.col.xml = b/server/lib/cimi/data/collections/machineAdmin.col.xml > deleted file mode 100644 > index e4f674b..0000000 > --- a/server/lib/cimi/data/collections/machineAdmin.col.xml > +++ /dev/null > @@ -1,9 +0,0 @@ > - > - > - machineAdmin > - Machine admin collection > - The machine admin what a pity! > - 2011-09-12 11:37:28 UTC > - > - > - > diff --git = a/server/lib/cimi/data/collections/machineConfiguration.col.xml = b/server/lib/cimi/data/collections/machineConfiguration.col.xml > deleted file mode 100644 > index 89e8aa1..0000000 > --- a/server/lib/cimi/data/collections/machineConfiguration.col.xml > +++ /dev/null > @@ -1,12 +0,0 @@ > - > - > - machineConfiguration > - Machine Configuration collection > - That is jsut a test > - 2011-09-12 11:37:28 UTC > - propValue > - test > - 0513 > - > - > - > diff --git a/server/lib/cimi/data/collections/machineImage.col.xml = b/server/lib/cimi/data/collections/machineImage.col.xml > deleted file mode 100644 > index bebe097..0000000 > --- a/server/lib/cimi/data/collections/machineImage.col.xml > +++ /dev/null > @@ -1,11 +0,0 @@ > - > - > - machineImage > - Machine Config collection > - The machine config collection > - 2011-09-12 11:37:28 UTC > - Tong Li > - earth > - > - > - > diff --git a/server/lib/cimi/data/collections/machineTemplate.col.xml = b/server/lib/cimi/data/collections/machineTemplate.col.xml > deleted file mode 100644 > index bfed664..0000000 > --- a/server/lib/cimi/data/collections/machineTemplate.col.xml > +++ /dev/null > @@ -1,8 +0,0 @@ > - > - > - machineTemplate > - Machine template collection > - The machine template collection > - 2011-09-12 11:37:28 UTC > - the value > - > diff --git = a/server/lib/cimi/data/collections/machine_configuration.col.xml = b/server/lib/cimi/data/collections/machine_configuration.col.xml > new file mode 100644 > index 0000000..99af7fb > --- /dev/null > +++ b/server/lib/cimi/data/collections/machine_configuration.col.xml > @@ -0,0 +1,8 @@ > + > + > + machineConfiguration > + Machine Configuration collection > + That is jsut a test > + 2011-09-12 11:37:28 UTC > + > + > diff --git a/server/lib/cimi/data/collections/machine_image.col.xml = b/server/lib/cimi/data/collections/machine_image.col.xml > new file mode 100644 > index 0000000..2c27075 > --- /dev/null > +++ b/server/lib/cimi/data/collections/machine_image.col.xml > @@ -0,0 +1,8 @@ > + > + > + machineImage > + Machine Config collection > + The machine config collection > + 2011-09-12 11:37:28 UTC > + > + > diff --git a/server/lib/cimi/data/collections/meter.col.xml = b/server/lib/cimi/data/collections/meter.col.xml > deleted file mode 100644 > index 24b5820..0000000 > --- a/server/lib/cimi/data/collections/meter.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - meter > - Meter collection > - The meter collection > - 2011-09-12 11:37:28 UTC > - 300 > - > - > - > diff --git a/server/lib/cimi/data/collections/meterTemplate.col.xml = b/server/lib/cimi/data/collections/meterTemplate.col.xml > deleted file mode 100644 > index 0271fc4..0000000 > --- a/server/lib/cimi/data/collections/meterTemplate.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - meterTemplate > - Meter template collection > - The meter template collection > - 2011-09-12 11:37:28 UTC > - meter > - > - > - > diff --git a/server/lib/cimi/data/collections/network.col.xml = b/server/lib/cimi/data/collections/network.col.xml > deleted file mode 100644 > index 1059d3a..0000000 > --- a/server/lib/cimi/data/collections/network.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - network > - Network collection > - The network config collection > - 2011-09-12 11:37:28 UTC > - network cool > - > - > - > diff --git a/server/lib/cimi/data/collections/networkConfig.col.xml = b/server/lib/cimi/data/collections/networkConfig.col.xml > deleted file mode 100644 > index 25c2402..0000000 > --- a/server/lib/cimi/data/collections/networkConfig.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - networkConfig > - Network config collection > - The network config collection > - 2011-09-12 11:37:28 UTC > - value > - > - > - > diff --git a/server/lib/cimi/data/collections/networkTemplate.col.xml = b/server/lib/cimi/data/collections/networkTemplate.col.xml > deleted file mode 100644 > index 6af563a..0000000 > --- a/server/lib/cimi/data/collections/networkTemplate.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - networkTemplate > - Network template collection > - The network template collection > - 2011-09-12 11:37:28 UTC > - comp > - > - > - > diff --git a/server/lib/cimi/data/collections/system.col.xml = b/server/lib/cimi/data/collections/system.col.xml > deleted file mode 100644 > index fd74232..0000000 > --- a/server/lib/cimi/data/collections/system.col.xml > +++ /dev/null > @@ -1,11 +0,0 @@ > - > - > - system > - system collection > - the system collection change 01 > - 2011-09-12 11:37:28 UTC > - Tong Li > - whhhooo > - > - > - > diff --git a/server/lib/cimi/data/collections/systemTemplate.col.xml = b/server/lib/cimi/data/collections/systemTemplate.col.xml > deleted file mode 100644 > index 691f50a..0000000 > --- a/server/lib/cimi/data/collections/systemTemplate.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - systemTemplate > - system template collection asas > - the system templatyytyuyuuhghjg > - 2011-09-12 11:37:28 UTC > - developers > - > - > - > diff --git a/server/lib/cimi/data/collections/volume.col.xml = b/server/lib/cimi/data/collections/volume.col.xml > index 5231e42..e2d2b4a 100644 > --- a/server/lib/cimi/data/collections/volume.col.xml > +++ b/server/lib/cimi/data/collections/volume.col.xml > @@ -4,7 +4,5 @@ > Volume collection > The volume collection > 2011-09-12 11:37:28 UTC > - volume value > - > - > + > > diff --git = a/server/lib/cimi/data/collections/volumeConfiguration.col.xml = b/server/lib/cimi/data/collections/volumeConfiguration.col.xml > deleted file mode 100644 > index f186a3a..0000000 > --- a/server/lib/cimi/data/collections/volumeConfiguration.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - volumeConfiguration > - Volume configuration collection > - The volume config > - 2011-09-12 11:37:28 UTC > - volume value > - > - > - > diff --git a/server/lib/cimi/data/collections/volumeImage.col.xml = b/server/lib/cimi/data/collections/volumeImage.col.xml > deleted file mode 100644 > index 1f18566..0000000 > --- a/server/lib/cimi/data/collections/volumeImage.col.xml > +++ /dev/null > @@ -1,11 +0,0 @@ > - > - > - volumeImage > - Volume image collection > - The volume image collection > - 2011-09-12 11:37:28 UTC > - Tong Li > - 56 > - > - > - > diff --git a/server/lib/cimi/data/collections/volumeTemplate.col.xml = b/server/lib/cimi/data/collections/volumeTemplate.col.xml > deleted file mode 100644 > index fec2e4c..0000000 > --- a/server/lib/cimi/data/collections/volumeTemplate.col.xml > +++ /dev/null > @@ -1,9 +0,0 @@ > - > - > - volumeTemplate > - Volume template collection > - The volume template collection > - 2011-09-12 11:37:28 UTC > - > - > - > diff --git a/server/lib/cimi/data/collections/vsp.col.xml = b/server/lib/cimi/data/collections/vsp.col.xml > deleted file mode 100644 > index 6a7e092..0000000 > --- a/server/lib/cimi/data/collections/vsp.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - vsp > - Vsp collection > - The vsp collection > - 2011-09-12 11:37:28 UTC > - 200 > - > - > - > diff --git a/server/lib/cimi/data/collections/vspConfig.col.xml = b/server/lib/cimi/data/collections/vspConfig.col.xml > deleted file mode 100644 > index 258b7d7..0000000 > --- a/server/lib/cimi/data/collections/vspConfig.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - vspConfig > - Vsp collection > - The vsp collection > - 2011-09-12 11:37:28 UTC > - value > - > - > - > diff --git a/server/lib/cimi/data/collections/vspTemplate.col.xml = b/server/lib/cimi/data/collections/vspTemplate.col.xml > deleted file mode 100644 > index 912fe9d..0000000 > --- a/server/lib/cimi/data/collections/vspTemplate.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - vspTemplate > - Vsp template collection > - The vsp template collection > - 2011-09-12 11:37:28 UTC > - vsp value > - > - > - > diff --git a/server/lib/cimi/data/defaultRes/machine.col.xml = b/server/lib/cimi/data/defaultRes/machine.col.xml > deleted file mode 100644 > index 7c2bab1..0000000 > --- a/server/lib/cimi/data/defaultRes/machine.col.xml > +++ /dev/null > @@ -1,35 +0,0 @@ > - > - > - machine > - Default machine name > - Default machine description > - 2011-01-01 00:00:01 UTC > - > - Started > - Intel > - > - > - > - ntgs > - /dev/sdb0 > - SATA > - > - > - > - > - example host name > - 00:00:00:00:00:00 > - Active > - IPv6 > - Dynamic > -
10.10.10.1
> - 10.10.0.1 > - 10.10.0.1 > - 512 > -
> - > - > - > - > - > -
> \ No newline at end of file > diff --git a/server/lib/cimi/data/defaultRes/machineAdmin.col.xml = b/server/lib/cimi/data/defaultRes/machineAdmin.col.xml > deleted file mode 100644 > index a507f80..0000000 > --- a/server/lib/cimi/data/defaultRes/machineAdmin.col.xml > +++ /dev/null > @@ -1,11 +0,0 @@ > - > - > - machineAdmin > - Default machine admin name > - Default machine admin description > - 2011-01-01 11:37:28 UTC > - > - > - > - > - > \ No newline at end of file > diff --git = a/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml = b/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml > deleted file mode 100644 > index 871f4b4..0000000 > --- a/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml > +++ /dev/null > @@ -1,17 +0,0 @@ > - > - > - machineConfiguration > - Default machine configuration name > - Default machine onfiguration description > - 2011-01-01 00:00:01 UTC > - i386 > - > - > - > - SATA > - > - false > - http://www.ibm.com > - > - > - > \ No newline at end of file > diff --git a/server/lib/cimi/data/defaultRes/machineImage.col.xml = b/server/lib/cimi/data/defaultRes/machineImage.col.xml > deleted file mode 100644 > index 9e3b4d5..0000000 > --- a/server/lib/cimi/data/defaultRes/machineImage.col.xml > +++ /dev/null > @@ -1,11 +0,0 @@ > - > - > - machineImage > - Default machine image name > - Default machine image description > - 2011-01-01 00:00:01 UTC > - http://hostname:port > - > - > - > - > \ No newline at end of file > diff --git a/server/lib/cimi/data/defaultRes/machineTemplate.col.xml = b/server/lib/cimi/data/defaultRes/machineTemplate.col.xml > deleted file mode 100644 > index feaffec..0000000 > --- a/server/lib/cimi/data/defaultRes/machineTemplate.col.xml > +++ /dev/null > @@ -1,12 +0,0 @@ > - > - > - machineTemplate > - Default machine template name > - Default machine template description > - 2011-01-01 00:00:01 UTC > - > - > - > - > - > - > \ No newline at end of file > diff --git a/server/lib/cimi/data/defaultRes/system.col.xml = b/server/lib/cimi/data/defaultRes/system.col.xml > deleted file mode 100644 > index d3c7a1a..0000000 > --- a/server/lib/cimi/data/defaultRes/system.col.xml > +++ /dev/null > @@ -1,12 +0,0 @@ > - > - > - system > - Default system name > - Default system description > - 2011-01-01 00:00:01 UTC > - > - INITIATED > - STOPPED > - > - > - > \ No newline at end of file > diff --git a/server/lib/cimi/data/defaultRes/systemTemplate.col.xml = b/server/lib/cimi/data/defaultRes/systemTemplate.col.xml > deleted file mode 100644 > index 0f6be07..0000000 > --- a/server/lib/cimi/data/defaultRes/systemTemplate.col.xml > +++ /dev/null > @@ -1,10 +0,0 @@ > - > - > - systemTemplate > - Default system template name > - Default system template description > - 2011-01-01 00:00:01 UTC > - > - > - > - > \ No newline at end of file > diff --git = a/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml = b/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml > deleted file mode 100644 > index 97d240c..0000000 > --- a/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml > +++ /dev/null > @@ -1,14 +0,0 @@ > - > - > - volumeConfiguration > - Default volume configuration name > - Default volume configuration description > - 2011-01-01 00:00:01 UTC > - > - ext4 > - > - xs:boolean > - http://www.ibm.com > - > - > - > \ No newline at end of file > diff --git a/server/lib/cimi/data/default_res/machine.col.xml = b/server/lib/cimi/data/default_res/machine.col.xml > new file mode 100644 > index 0000000..7c2bab1 > --- /dev/null > +++ b/server/lib/cimi/data/default_res/machine.col.xml > @@ -0,0 +1,35 @@ > + > + > + machine > + Default machine name > + Default machine description > + 2011-01-01 00:00:01 UTC > + > + Started > + Intel > + > + > + > + ntgs > + /dev/sdb0 > + SATA > + > + > + > + > + example host name > + 00:00:00:00:00:00 > + Active > + IPv6 > + Dynamic > +
10.10.10.1
> + 10.10.0.1 > + 10.10.0.1 > + 512 > +
> + > + > + > + > + > +
> \ No newline at end of file > diff --git = a/server/lib/cimi/data/default_res/machine_configuration.col.xml = b/server/lib/cimi/data/default_res/machine_configuration.col.xml > new file mode 100644 > index 0000000..564b378 > --- /dev/null > +++ b/server/lib/cimi/data/default_res/machine_configuration.col.xml > @@ -0,0 +1,17 @@ > + > + > + machineConfiguration > + Default machine configuration name > + Default description > + 2011-01-01 00:00:01 UTC > + i386 > + > + > + > + SATA > + > + false > + http://www.ibm.com > + > + > + > \ No newline at end of file > diff --git a/server/lib/cimi/data/default_res/machine_image.col.xml = b/server/lib/cimi/data/default_res/machine_image.col.xml > new file mode 100644 > index 0000000..e7de5e7 > --- /dev/null > +++ b/server/lib/cimi/data/default_res/machine_image.col.xml > @@ -0,0 +1,11 @@ > + > + > + machineImage > + Default machine image name > + Default machine image description > + 2011-01-01 00:00:01 UTC > + http:// > + > + > + > + > \ No newline at end of file > diff --git a/server/lib/cimi/data/default_res/volume.col.xml = b/server/lib/cimi/data/default_res/volume.col.xml > new file mode 100644 > index 0000000..21b9d65 > --- /dev/null > +++ b/server/lib/cimi/data/default_res/volume.col.xml > @@ -0,0 +1,14 @@ > + > + > + volume > + Default volume name > + Default volume description > + 2011-01-01 00:00:01 UTC > + > + true > + ext4 > + true > + SATA > + > + > + > \ No newline at end of file > diff --git a/server/lib/cimi/helpers/cmwgapp_helper.rb = b/server/lib/cimi/helpers/cmwgapp_helper.rb > index a111b33..6565edd 100644 > --- a/server/lib/cimi/helpers/cmwgapp_helper.rb > +++ b/server/lib/cimi/helpers/cmwgapp_helper.rb > @@ -17,38 +17,28 @@ >=20 > # this section defines constants used in the implementation. >=20 > - > -def fixupContent(aHash, keyName=3D"content", attrName=3D"name") > +#this method is to fixup the hash object to make sure it can be = serialized into json > +#as DMTF spec requires. as the spec keeps changing, this method may = need to be revisited > +#and modified again. > +def fixup_content(hash_obj, key_name=3D"content", attr_name=3D"name") > #this check is to make sure we are not handling nil values. > - if aHash > - aHash.each_pair do |key, value| > + if hash_obj > + hash_obj.each_pair do |key, value| > if value.kind_of? Hash > #We can only handle the element without any other attribute, > #if the element also has other attribute, then we can not do = fixups since it will lose information. > - if value[keyName] && value.size =3D=3D 1 > - aHash[key] =3D value[keyName] > - elsif value[keyName] && value[attrName] && value.size =3D=3D = 2 > - aHash[key] =3D { "#{value[attrName]}" =3D> value[keyName] } > + if value[key_name] && value.size =3D=3D 1 > + hash_obj[key] =3D value[key_name] > + elsif value[key_name] && value[attr_name] && value.size =3D=3D = 2 > + hash_obj[key] =3D { "#{value[attr_name]}" =3D> = value[key_name] } > else > - fixupContent value, keyName, attrName > + fixup_content value, key_name, attr_name > end > end > end > end > end >=20 > -def is_valid? anObj > - return false unless anObj > - return false if anObj["uri"].nil? || anObj["name"].nil? || = anObj["created"].nil? > - true > -end > - > -def convert_xml_to_html xml_str > - if xml_str > - xml_str.gsub(//, ">").gsub(/\n/, "\r") > - end > -end > - > module ApplicationHelper >=20 > include Deltacloud > @@ -59,300 +49,98 @@ module ApplicationHelper > s+=3D"" > end >=20 > - def machine_action(name) > - original_instance =3D driver.instance(credentials, :id =3D> = params[:id]) > - > - @operationParam =3D { "machineId" =3D> params[:id], = "machineOperation" =3D> name} > + def respond_to_collection(collType) > + respond_to do |format| > + format.html do > + root_hash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + collType), > + { 'ForceArray' =3D> false, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) >=20 > - # If original instance doesn't include called action > - # return with 405 error (Method is not Allowed) > - if original_instance > - unless = driver.instance_actions_for(original_instance.state).include?(name.to_sym)= > - return report_error(405, 'not_allowed') > + @xml_root_node =3D root_hash.first[0] > + @dmtfitem =3D root_hash.first[1] > + haml :"collection/index" > end > - end > + format.xml do > + root_hash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + collType), > + { 'ForceArray' =3D> true, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) > + col_item_name =3D root_hash.first[0] > + content_type get_response_content_type(col_item_name, 'xml'), = :charset =3D> 'utf-8' > + col_item_name =3D col_item_name.sub(/Collection/,'') #Remove = the Collection at the end. > + col_item_name =3D col_item_name[0].downcase + = col_item_name[1, col_item_name.length] >=20 > - @instance =3D driver.send(:"#{name}_instance", credentials, = params["id"]) > + urls =3D [] > + @dmtf_col_items.map do |item| > + urls << {"href" =3D> item["href"]} > + end >=20 > - respond_to do |format| > - info "the format is " + format.to_s > - format.html { haml :"machine/operation" } > - format.xml { haml :"machine/operation" } > - format.json do > - responseXML =3D haml :"machine/operation" > - hash_response =3D XmlSimple.xml_in responseXML, {'ForceArray' = =3D> true, 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > - hash_response.to_json > - end > - end > - end > + root_hash.first[1][0]["#{col_item_name}"] =3D urls >=20 > - def link_to_action_ext(action, url, method, params) > - capture_haml do > - haml_tag :form, :method =3D> method.to_sym, :action =3D> url, = :class =3D> [:link, method] do > - params.each do |key, value| > - haml_tag :input, :type =3D> :hidden, :name =3D> key, :value = =3D> value > - end > - haml_tag :button, :type =3D> :button, :onClick =3D> "return = do#{method.capitalize}(this)" do > - haml_concat action > - end > + XmlSimple.xml_out(root_hash, { 'KeyAttr' =3D> 'name', = 'KeepRoot' =3D> true, 'ContentKey' =3D> 'content'}) > end > - end > - end > + format.json do > + root_hash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + collType), > + { 'ForceArray' =3D> false, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) > + col_item_name =3D root_hash.first[0] > + content_type get_response_content_type(col_item_name, = 'json'), :charset =3D> 'utf-8' > + #Remove the Collection at the end. > + col_item_name =3D col_item_name.sub(/Collection/,'') > + col_item_name =3D col_item_name[0].downcase + = col_item_name[1, col_item_name.length] >=20 > - def get_collection_item(collType) > - colItem =3D [] > - fileList =3D Dir.glob File.join(STOREROOT,"*." + collType) > - if fileList && (fileList.empty? =3D=3D false) > - fileList.map do |item| > - #colfile =3D File.read(item) > - rootHash =3D XmlSimple.xml_in item, {'ForceArray' =3D> false, = 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > - if rootHash.first and rootHash.first[1] > - newItem =3D { > - "name" =3D> rootHash.first[1]["name"], > - "href" =3D> HOST_API_PATH + "/" + collType + "/" + = rootHash.first[1]["uri"] > - } > - colItem.insert 0, newItem > + urls =3D [] > + @dmtf_col_items.map do |item| > + urls << {"href" =3D> item["href"]} > end > - end > - end > - info colItem.inspect > - colItem > - end >=20 > - def get_collection_item_from_DC(collType, force_array =3D false) > - colItem =3D [] > - case collType > - when "machineConfiguration" > - profiles =3D driver.hardware_profiles(credentials, nil) > - if profiles > - profiles.map do |profile| > - if force_array > - newItem =3D { "name" =3D> [profile.name],"uri" =3D> = [profile.name], > - "href" =3D> [HOST_API_PATH + "/" + collType + "/" + = profile.name] } > - else > - newItem =3D { "name" =3D> profile.name,"uri" =3D> = profile.name, > - "href" =3D> HOST_API_PATH + "/" + collType + "/" + = profile.name } > - end > - attr =3D cimi_get_profile_properties profile > - if attr > - newItem["entityMetadata"] =3D attr > - end > - colItem.insert 0, newItem > - end > - end > - when "machineImage" > - #Retrieve machine images > - images =3D driver.send(:images, credentials, {}) > - if images > - images.map do |image| > - if force_array > - newItem =3D { "name" =3D> [image.name],"description" =3D> = [image.description], > - "uri" =3D> [image.id],"href" =3D> [HOST_API_PATH + "/" + = collType + "/" + image.id] } > - else > - newItem =3D { "name" =3D> image.name,"description" =3D> = image.description, > - "uri" =3D> image.id,"href" =3D> HOST_API_PATH + "/" + = collType + "/" + image.id } > - end > - attr =3D cimi_get_image_metadata image > - if attr > - newItem["entityMetadata"] =3D attr > - end > - colItem.insert 0, newItem > - end > - end > - when "machine" > - #Retrieve instances > - instances =3D driver.send(:instances, credentials, {}) > - if instances > - instances.map do |instance| > - puts instance.inspect > - if force_array > - newItem =3D { "name" =3D> [instance.name],"status" =3D> = [instance.state],"uri" =3D> [instance.id], > - "href" =3D> [HOST_API_PATH + "/" + collType + "/" + = instance.id] } > - else > - newItem =3D { "name" =3D> instance.name,"status" =3D> = instance.state, "uri" =3D> instance.id, > - "href" =3D> HOST_API_PATH + "/" + collType + "/" + = instance.id } > - end > - attr =3D cimi_get_machine_metadata instance > - if attr > - newItem["entityMetadata"] =3D attr > - end > - colItem.insert 0, newItem > - end > - end > - when "volume" > - instances =3D driver.send(:storage_volumes, credentials, {}) > - if instances > - instances.map do |instance| > - info instance.inspect > - newItem =3D { > - "name" =3D> instance.id, > - "href" =3D> HOST_API_PATH + "/" + collType + "/" + = instance.id > - } > - colItem.insert 0, newItem > + root_hash.first[1]["#{col_item_name}"] =3D urls > + > + json_hash =3D root_hash.first[1] > + if json_hash.has_key?("xmlns") > + json_hash.delete "xmlns" > end > + fixup_content json_hash > + res =3D json_hash.to_json > end > end > - colItem > end >=20 > - def get_response_content_type(collType, format=3D"html") > + def get_response_content_type(coll_type, format=3D"html") > case format > when "text/html" > - acceptFormat =3D "" > + "" > when "xml" > - acceptFormat =3D "application/CIMI-" + collType + "+xml" > + "application/CIMI-" + coll_type + "+xml" > when "json" > - acceptFormat =3D "application/CIMI-" + collType + "+json" > + "application/CIMI-" + coll_type + "+json" > end > - acceptFormat > end >=20 > - def handle_post > - raw =3D request.env["rack.input"].read > - > - content_obj =3D is_valid_xml_input raw > - if content_obj > - @xmlRootNode =3D content_obj.first[0] > - @dmtfitem =3D content_obj.first[1][0] > - info @xmlRootNode.inspect > - fileId =3D @dmtfitem["uri"][0] > - info @dmtfitem["uri"].inspect > - > - filePath =3D File.join(STOREROOT, fileId + '.' + = params[:collType]) > - if is_valid?(@dmtfitem) && File.exist?(filePath) =3D=3D false > - > - File.open(filePath, "w") do |file| > - file.write serialize_object_to_xml(content_obj) > - end > - respond_to do |format| > - format.xml do > - response.status =3D 201 > - response['Location'] =3D HOST_API_PATH + = "#{params[:collType]}/#{fileId}" > - haml :"collection/response" > - end > - end > - else > - report_error(409) > - end > - else > - #can not accept the content. the request body is not valid. > - #412 - Precondition Failed. > - report_error(412) > - end > - end > - > - def handle_collection_put > - if RESOURCE_NAMES.include? params[:id] > - raw =3D request.env["rack.input"].read > - content_obj =3D is_valid_xml_input raw > - if content_obj > - filePath =3D File.join(STOREROOT, 'collections/' + = params[:id] + '.col.xml') > - if File.exist?(filePath) > - File.open(filePath, "w") do |file| > - file.write serialize_object_to_xml(content_obj) > - end > - status 200 > - respond_to do |format| > - format.xml { haml :"collection/response"} > - end > - else > - report_error(404) > - end > - else > - report_error(412) > - end > - else > - report_error(404) > + def get_resource_default(coll_type) > + file_path =3D File.join STOREROOT, "default_res/" + coll_type + = ".col.xml" > + if File.exist?(file_path) > + root_hash =3D XmlSimple.xml_in(file_path, {'ForceArray'=3D>false,= 'KeepRoot'=3D>true, 'KeyAttr'=3D>['name']}) > + { "xml_root_node" =3D> root_hash.first[0], "dmtfitem" =3D> = root_hash.first[1]} > end > end >=20 > - def handle_resource_put > - raw =3D request.env["rack.input"].read > - content_obj =3D is_valid_xml_input raw > - if content_obj > - @xmlRootNode =3D content_obj.first[0] > - @dmtfitem =3D content_obj.first[1][0] > - info @xmlRootNode.inspect > - fileId =3D @dmtfitem["uri"][0] > - info @dmtfitem["uri"].inspect > - > - filePath =3D File.join(STOREROOT, fileId + '.' + = params[:collType]) > - #we want to check if the file exist and if the passed in id is = the same as uri in the block passed in > - if File.exist?(filePath) && fileId =3D=3D params[:id] > - File.open(filePath, "w") do |file| > - file.write serialize_object_to_xml(content_obj) > - end > - > - respond_to do |format| > - format.xml do > - response.status =3D 200 > - response['Location'] =3D HOST_API_PATH + = "#{params[:collType]}/#{fileId}" > - haml :"collection/response" > - end > - end > - else > - report_error(404) > + def show_resource(resource_path, content_type) > + respond_to do |format| > + format.xml do > + content_type "application/CIMI-#{content_type}+xml", :charset = =3D> 'utf-8' > + haml :"#{resource_path}", :layout =3D> false > end > - else > - report_error(412) > - end > - end > - > - def handle_resource_delete > - filePath =3D File.join(STOREROOT, params[:id] + '.' + = params[:collType]) > - if File.exist?(filePath) > - colfile =3D File.delete(filePath) > - respond_to do |format| > - format.xml do > - response.status =3D 200 > - response['Location'] =3D HOST_API_PATH + = "#{params[:collType]}/#{params[:id]}" > - haml :"collection/response" > - end > - format.json do > - engine =3D Haml::Engine.new(File.read(settings.views + = "/collection/response")) > - responseXML =3D engine.render self > - hash_response =3D XmlSimple.xml_in responseXML, = {'ForceArray' =3D> true, 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > - hash_response.to_json > - end > + format.html do > + haml :"#{resource_path}" > end > - else > - report_error(404) > - end > - end > - > - def handle_resource_get > - if DC_SUPPORTED_RESOURCES.include? params[:collType] > - check_DC_Resource! > - end > - filePath =3D File.join STOREROOT, = params[:id]+'.'+params[:collType] > - if File.exist?(filePath) > - respond_to do |format| > - format.html do > - rootHash =3D XmlSimple.xml_in(filePath, = {'ForceArray'=3D>false, 'KeepRoot'=3D>true, 'KeyAttr'=3D>['name']}) > - info rootHash.inspect > - @xmlRootNode =3D rootHash.first[0] > - @dmtfitem =3D rootHash.first[1] > - info @dmtfitem > - pathName =3D params[:collType] + "/show" > - haml pathName.to_sym > - end > - format.xml do > - File.read(filePath) > - end > - format.json do > - rootHash =3D XmlSimple.xml_in(filePath, = {'ForceArray'=3D>false, 'KeepRoot'=3D>true, 'KeyAttr'=3D>['name']}) > - info rootHash > - jsonHash =3D rootHash.first[1] > - info jsonHash > - if jsonHash.has_key?("xmlns") > - jsonHash.delete "xmlns" > - end > - fixupContent jsonHash > - res =3D jsonHash.to_json > + format.json do > + content_type "application/CIMI-#{content_type}+json", = :charset =3D> 'utf-8' > + engine =3D Haml::Engine.new(File.read(settings.views + = "/#{resource_path}.xml.haml")) > + responseXML =3D engine.render self > + hash_response =3D XmlSimple.xml_in responseXML, {'ForceArray' = =3D> false, 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > + hash_response =3D hash_response.first[1] > + if hash_response.has_key?("xmlns") > + hash_response.delete "xmlns" > end > + hash_response.to_json > end > - else > - report_error(404) > end > end > -end > +end > \ No newline at end of file > diff --git a/server/lib/cimi/helpers/cmwgres_helper.rb = b/server/lib/cimi/helpers/cmwgres_helper.rb > deleted file mode 100644 > index b00339b..0000000 > --- a/server/lib/cimi/helpers/cmwgres_helper.rb > +++ /dev/null > @@ -1,134 +0,0 @@ > -# > -# Licensed to the Apache Software Foundation (ASF) under one or more > -# contributor license agreements. See the NOTICE file distributed = with > -# this work for additional information regarding copyright ownership. = The > -# ASF licenses this file to you under the Apache License, Version 2.0 = (the > -# "License"); you may not use this file except in compliance with the > -# License. You may obtain a copy of the License at > -# > -# http://www.apache.org/licenses/LICENSE-2.0 > -# > -# Unless required by applicable law or agreed to in writing, software > -# distributed under the License is distributed on an "AS IS" BASIS, = WITHOUT > -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. = See the > -# License for the specific language governing permissions and = limitations > -# under the License. > - > -module ApplicationHelper > - > - #This method will check the resource created locally and then mix = the attributes from cloud > - #then transform the data into a format that UI can handle > - def check_DC_Resource! > - if DC_SUPPORTED_RESOURCES.include? params[:collType] > - filePath =3D File.join(STOREROOT, params[:id] + '.' + = params[:collType]) > - allRes =3D get_collection_item_from_DC params[:collType], true > - #getting the resource that match the passed in id. > - aRes =3D allRes.select { |item| item["uri"][0] =3D=3D = params[:id]} > - #if the array is not empty > - if aRes.empty? =3D=3D false > - #using driver as part of the file name to have some = namespace. > - filePath =3D File.join STOREROOT, params[:id] + '.' + = params[:collType] > - #using default value xml > - defaultFilePath =3D File.join(STOREROOT, "defaultRes/" + = params[:collType] + ".col.xml") > - #read the default xml file in, then mixin the retrieved = value, then save it for further process. > - > - rootHash =3D XmlSimple.xml_in(defaultFilePath, {'ForceArray' = =3D> true, 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']}) > - info rootHash.first[0] > - > - #handling the merge > - rootHash =3D { "#{rootHash.first[0]}" =3D> = [rootHash.first[1][0].merge(aRes.first)] } > - > - if aRes.first["entityMetadata"] > - @metadata =3D XmlSimple.xml_out = aRes.first["entityMetadata"], > - = {'Indent'=3D>"   ",'RootName'=3D>'entityMetadata','KeyAttr'= =3D>'name','KeepRoot'=3D>true,'ContentKey'=3D>'content'} > - end > - > - #create a file to represent this resource > - File.open(filePath, 'w') do |file| > - file.write XmlSimple.xml_out(rootHash, { 'KeyAttr' =3D> = 'name', 'KeepRoot' =3D> true}) > - end > - end > - end > - end > - > - #this method will convert each hardware profile property into = attribute string > - def cimi_get_profile_properties profile > - #check if this profile has properties > - if profile.properties and profile.properties.length > 0 > - val =3D'' > - val +=3D '' + HOST_API_PATH + '/types/MC' > - val +=3D 'MachineConfiguration' > - val +=3D = 'http://www.dmtf.org/cimi/MachineConfiguration' > - profile.each_property do |p| > - the_value =3D '' > - if p.kind =3D=3D :range > - the_type =3D "xs:integer" > - the_value =3D '' > - else > - the_type =3D 'xs:string' > - if p.kind =3D=3D :fixed > - the_value =3D '' + p.value.to_s + '' > - elsif p.kind =3D=3D :enum > - the_value =3D '' + p.values.join(',') + '' > - end > - end > - val +=3D ' - val +=3D '" unit=3D"' + p.unit.to_s + '">' + the_value + = '' > - end > - val +=3D '' > - val =3D XmlSimple.xml_in(val, {'ForceArray' =3D> true, = 'KeepRoot'=3D>false, 'KeyAttr' =3D> ['name']}) > - return val > - end > - return nil > - end > - > - def cimi_get_image_metadata image > - if image > - val =3D'' > - val +=3D '' + HOST_API_PATH + '/types/MI' > - val +=3D 'MachineImage' > - val +=3D = 'http://www.dmtf.org/cimi/MachineImage' > - val +=3D ' - val +=3D ' required=3D"true">' + image.state + = '' > - val +=3D ' - val +=3D ' required=3D"false">' + image.architecture + = '' > - val +=3D '' > - XmlSimple.xml_in(val, {'ForceArray' =3D> true, = 'KeepRoot'=3D>false, 'KeyAttr' =3D> ['name']}) > - end > - end > - > - def cimi_get_machine_metadata instance > - if instance > - val =3D'' > - val +=3D '' + HOST_API_PATH + '/types/M' > - val +=3D 'Machine' > - val +=3D 'http://www.dmtf.org/cimi/Machine' > - val +=3D ' - val +=3D ' required=3D"true">' + instance.owner_id + = '' > - if instance.keyname > - val +=3D ' - val +=3D ' required=3D"false">' + instance.keyname + = '' > - end > - if instance.firewalls > - val +=3D ' - val +=3D ' required=3D"false">' + = instance.firewalls.join(", ") + '' > - end > - val +=3D ' - val +=3D ' required=3D"false">' + = instance.public_addresses.join(',') + '' > - val +=3D ' - val +=3D ' required=3D"false">' + = instance.private_addresses.join(',') + '' > - val +=3D '' > - XmlSimple.xml_in(val, {'ForceArray' =3D> true, = 'KeepRoot'=3D>false, 'KeyAttr' =3D> ['name']}) > - end > - end > - > - #this method will check if the xml input is valid by using simple = xml. > - def is_valid_xml_input input > - XmlSimple.xml_in input, {'ForceArray' =3D> true, = 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > - end > - > - def serialize_object_to_xml input > - XmlSimple.xml_out input, {'Indent'=3D>" ", = 'KeyAttr'=3D>'name','KeepRoot'=3D>true,'ContentKey'=3D>'content', > - 'XmlDeclaration'=3D>""} > - end > -end > \ No newline at end of file > diff --git a/server/lib/cimi/helpers/dmtfdep.rb = b/server/lib/cimi/helpers/dmtfdep.rb > index a7fab65..19ef1e0 100644 > --- a/server/lib/cimi/helpers/dmtfdep.rb > +++ b/server/lib/cimi/helpers/dmtfdep.rb > @@ -70,9 +70,7 @@ XS_NAMESPACE =3D "http://www.w3.org/2001/XMLSchema" > HEADER_API_VERSION =3D "1.0" > HEADER_CIMI_SPECIFICATION_VERSION =3D "X-CIMI-Specification-Version" + = " :" + HEADER_API_VERSION >=20 > -CIMI_RESOURCES =3D [:cloudEntryPoint, :systemTemplate, :system, = :machineTemplate, :machineConfiguration, :machineImage, :machineAdmin, > - :machine, :volumeTemplate, :volumeConfiguration, :volumeImage, = :volume, :networkTemplate, :networkConfig, :network, > - :vspTemplate, :vspConfig, :vsp, :meterTemplate, :meter, = :eventLog, :event, :job ] > +CIMI_RESOURCES =3D [:cloudEntryPoint, :machineConfiguration, = :machineImage, :machine, :volume] >=20 > all_resource_names =3D "" > CIMI_RESOURCES.map { |item| all_resource_names +=3D item.to_s + "," = unless item =3D=3D :cloudEntryPoint} > diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb > index ed406bf..5d60ccb 100644 > --- a/server/lib/cimi/server.rb > +++ b/server/lib/cimi/server.rb > @@ -15,16 +15,8 @@ >=20 >=20 > require 'cimi/helpers/dmtfdep' > -require 'cimi/helpers/cmwgres_helper' > require 'cimi/helpers/cmwgapp_helper' >=20 > - > -# FIXME: Can we get rid of the dependency on active_support ? > -#require 'active_support' > -#require 'active_support/inflector' > -#require 'active_support/core_ext/object/blank' > -#require 'active_support/core_ext/hash/conversions' > - > set :version, '0.1.0' >=20 > include Deltacloud::Drivers > @@ -33,21 +25,6 @@ set :drivers, Proc.new { driver_config } > # CIMI has different default collections > DEFAULT_COLLECTIONS =3D CIMI_RESOURCES >=20 > -# FIXME: This contains a mix of static and dynamically modified data. = This > -# needs to be separated out, and only drivers should touch dynamic = data > - > -# FIXME: There used to be code that created STOREROOT when it doesn't > -# exist. But not having storeroot leads to an error when requesting = the > -# entry point > - > -# here we setup a directory for persistence, everything will be saved = as > -# files the file format will be uuid.resourceTypeName, for example: = if > -# there is a machineTemplte, and its id is > -# dab4fdae-1451-48f4-b5b6-2b0dcc06bb14, then the file at the storage = will > -# be dab4fdae-1451-48f4-b5b6-2b0dcc06bb14.machineTemplate, each file > -# content should be in xml format. the root directory of the storage = is > -# /store so we create one if one does not exist yet. > - > STOREROOT =3D File.join($top_srcdir, 'lib', 'cimi', 'data') > #We would like to know the storage root. > puts "store root is " + STOREROOT > @@ -66,7 +43,6 @@ configure do > set :public, File::join($top_srcdir, 'public') > # Try to load the driver on startup to fail early if there are = issues > driver > - # FIXME: Reduce the places that need access to STOREROOT > set :store, STOREROOT > end >=20 > @@ -99,154 +75,204 @@ puts "application root URL:" + HOST_API_PATH >=20 > get '/' do redirect root_url, 301; end >=20 > -get "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}\/?" do > +get "cimi\/?" do > if params[:force_auth] > return [401, 'Authentication failed'] unless = driver.valid_credentials?(credentials) > end >=20 > - redirect "/api/cloudEntryPoint", 301 > + redirect "/cimi/cloudEntryPoint", 301 > end >=20 > -get "/api/cloudEntryPoint" do > +collection :cloudEntryPoint do > + description < + cloud entry point > +EOS >=20 > - @allAPIs =3D CIMI_RESOURCES > - respond_to do |format| > - format.xml do > - content_type 'application/CIMI-CloudEntryPoint+xml', :charset = =3D> 'utf-8' > - haml:"cloudEntryPoint/index" > - end > - format.html { haml:"cloudEntryPoint/index" } > - format.json do > - content_type 'application/CIMI-CloudEntryPoint+json', :charset = =3D> 'utf-8' > - engine =3D Haml::Engine.new(File.read(settings.views + = "/cloudEntryPoint/index.xml.haml")) > - responseXML =3D engine.render self > - hash_response =3D XmlSimple.xml_in responseXML, {'ForceArray' = =3D> false, 'KeepRoot'=3D>true, 'KeyAttr' =3D> ['name']} > - info hash_response > - hash_response =3D hash_response.first[1] > - info hash_response > - if hash_response.has_key?("xmlns") > - hash_response.delete "xmlns" > - end > - res =3D hash_response.to_json > + operation :index do > + description "list all resources of the cloud" > + control do > + @all_apis =3D CIMI_RESOURCES > + show_resource "cloudEntryPoint/index", "CloudEntryPoint" > end > end > end >=20 > -get "/api/collection/:collType" do > - if RESOURCE_NAMES.include? params[:collType] > - > - # here we will handle the update of changing the collection = attribute. > - # no item in the collection will be changed, this will be only = used to change properties of a collection. > - #the resources should be retrieved from DeltaCloud > - if DC_SUPPORTED_RESOURCES.include? params[:collType] > - @dmtfColItems =3D get_collection_item_from_DC params[:collType] > - else > - @dmtfColItems =3D get_collection_item params[:collType] > +collection :machine_configuration do > + global! > + > + description < +List all machine configurations > +EOS > + > + operation :index do > + description "List all machine configurations" > + control do > + profiles =3D driver.hardware_profiles(credentials, nil) > + @dmtf_col_items =3D [] > + if profiles > + profiles.map do |profile| > + new_item =3D { "name" =3D> profile.name, "href" =3D> = HOST_API_PATH + "/machine_configuration/" + profile.name } > + @dmtf_col_items.insert 0, new_item > + end > + end > + respond_to_collection "machine_configuration.col.xml" > end > + end >=20 > - respond_to do |format| > - format.html do > - rootHash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + params[:collType] + '.col.xml'), > - { 'ForceArray' =3D> false, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) > - > - @xmlRootNode =3D rootHash.first[0] > - @dmtfitem =3D rootHash.first[1] > - info @dmtfitem > - haml :"collection/index" > + operation :show do > + description "Show specific machine configuration." > + with_capability :hardware_profile > + param :id, :string, :required > + control do > + @profile =3D driver.hardware_profile(credentials, params[:id]) > + if @profile > + #setup the default values for a machine configuration > + resource_default =3D get_resource_default = "machine_configuration" > + #get the actual values from profile > + resource_value =3D { "name" =3D> @profile.name,"uri" =3D> = @profile.name, > + "href" =3D> HOST_API_PATH + "/machine_configuration/" + = @profile.name } > + #mixin actual values get from profile > + @dmtfitem =3D resource_default["dmtfitem"].merge = resource_value > + show_resource "machine_configuration/show", = "MachineConfiguration" > + else > + report_error(404) > end > - format.xml do > - rootHash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + params[:collType] + '.col.xml'), > - { 'ForceArray' =3D> true, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) > - info rootHash > - colItemName =3D rootHash.first[0] > - content_type get_response_content_type(colItemName, 'xml'), = :charset =3D> 'utf-8' > - colItemName =3D colItemName.sub(/Collection/,'') #Remove the = Collection at the end. > - colItemName =3D colItemName[0].downcase + colItemName[1, = colItemName.length] > - > - #we need to produce the url collection > - urls =3D [] > - @dmtfColItems.map do |item| > - urls << {"href" =3D> item["href"]} > - end > + end > + end > +end >=20 > - rootHash.first[1][0]["#{colItemName}"] =3D urls > +collection :machine_image do > + global! > + > + description < +List all machine images > +EOS > + > + operation :index do > + description "List all machine configurations" > + control do > + images =3D driver.send(:images, credentials, {}) > + @dmtf_col_items =3D [] > + if images > + images.map do |image| > + new_item =3D { "name" =3D> image.name,"href" =3D> = HOST_API_PATH + "/machine_image/" + image.id } > + @dmtf_col_items.insert 0, new_item > + end > + end > + respond_to_collection "machine_image.col.xml" > + end > + end >=20 > - XmlSimple.xml_out(rootHash, { 'KeyAttr' =3D> 'name', = 'KeepRoot' =3D> true, 'ContentKey' =3D> 'content'}) > + operation :show do > + description "Show specific machine image." > + with_capability :image > + param :id, :string, :required > + control do > + @image =3D driver.send(:image, credentials, { :id =3D> = params[:id]} ) > + if @image > + #setup the default values for a machine imageion > + resource_default =3D get_resource_default "machine_image" > + #get the actual values from image > + resource_value =3D { "name" =3D> @image.name,"description" =3D>= @image.description, > + "uri" =3D> @image.id,"href" =3D> HOST_API_PATH + = "/machine_image/" + @image.id } > + #mixin actual values get from the specific image > + @dmtfitem =3D resource_default["dmtfitem"].merge = resource_value > + show_resource "machine_image/show", "MachineImage" > + else > + report_error(404) > end > - format.json do > - rootHash =3D XmlSimple.xml_in(File.join(STOREROOT, = 'collections/' + params[:collType] + '.col.xml'), > - { 'ForceArray' =3D> false, 'KeepRoot'=3D>true, = 'KeyAttr' =3D> ['name']}) > - info rootHash > - colItemName =3D rootHash.first[0] > - content_type get_response_content_type(colItemName, 'json'), = :charset =3D> 'utf-8' > - colItemName =3D colItemName.sub(/Collection/,'') #Remove the = Collection at the end. > - colItemName =3D colItemName[0].downcase + colItemName[1, = colItemName.length] > - > - info colItemName > - #we need to produce the url collection > - urls =3D [] > - @dmtfColItems.map do |item| > - urls << {"href" =3D> item["href"]} > - end > + end > + end >=20 > - rootHash.first[1]["#{colItemName}"] =3D urls > +end >=20 > - jsonHash =3D rootHash.first[1] > - info jsonHash > - if jsonHash.has_key?("xmlns") > - jsonHash.delete "xmlns" > +collection :machine do > + global! > + > + description < +List all machine > +EOS > + > + operation :index do > + description "List all machines" > + control do > + instances =3D driver.send(:instances, credentials, {}) > + @dmtf_col_items =3D [] > + if instances > + instances.map do |instance| > + new_item =3D { "name" =3D> instance.name, "href" =3D> = HOST_API_PATH + "/machine/" + instance.id } > + @dmtf_col_items.insert 0, new_item > end > - fixupContent jsonHash > - res =3D jsonHash.to_json > end > + respond_to_collection "machine.col.xml" > end > - else > - "#{params[:collType]} not found!" > end > -end >=20 > -get "/api/:collType/:id" do > - > - info Time.new.to_s + " collType=3D" + params[:collType] + " id=3D" = + params[:id] > - > - if params[:id] =3D=3D "new" > - filePath =3D File.join(STOREROOT, 'defaultRes/' + = params[:collType] + '.col.xml') > - info "loading file at " + filePath > - if File.exist?(filePath) > - rootHash =3D XmlSimple.xml_in(filePath, {'ForceArray'=3D>false, = 'KeepRoot'=3D>true, 'KeyAttr'=3D>['name']}) > - info rootHash > - > - @xmlRootNode =3D rootHash.first[0] > - @dmtfitem =3D rootHash.first[1] > - @dmtfitem["uri"] =3D UUIDTools::UUID.random_create.to_s > - @dmtfitem["created"] =3D Time.new.getutc > - contentPath =3D params[:collType] + "/new" > - respond_to do |format| > - format.html { haml contentPath.to_sym } > + operation :show do > + description "Show specific machine." > + with_capability :instance > + param :id, :string, :required > + control do > + @machine =3D driver.send(:instance, credentials, { :id =3D> = params[:id]} ) > + if @machine > + #setup the default values for a machine imageion > + resource_default =3D get_resource_default "machine" > + #get the actual values from image > + resource_value =3D { "name" =3D> @machine.name,"status" =3D> = @machine.state, "uri" =3D> @machine.id, > + "href" =3D> HOST_API_PATH + "/machine/" + @machine.id } > + #mixin actual values get from the specific image > + @dmtfitem =3D resource_default["dmtfitem"].merge = resource_value > + show_resource "machine/show", "Machine" > + else > + report_error(404) > end > - else > - report_error(404) > end > - else > - #We need to first handle special resources which already exist in = DC. > - #then we do the resources defined locally. > - #TODO > - handle_resource_get > end > -end >=20 > -put "/api/collection/:id" do > - handle_collection_put > end >=20 > -post "/api/:collType" do > - handle_post > -end > +collection :volume do > + global! > + > + description < +List all volumes > +EOS > + > + operation :index do > + description "List all volumes" > + control do > + instances =3D driver.send(:storage_volumes, credentials, {}) > + @dmtf_col_items =3D [] > + if instances > + instances.map do |instance| > + new_item =3D { "name" =3D> instance.id, "href" =3D> = HOST_API_PATH + "/volume/" + instance.id } > + @dmtf_col_items.insert 0, new_item > + end > + end > + respond_to_collection "volume.col.xml" > + end > + end >=20 > -put "/api/:collType/:id" do > - handle_resource_put > -end > + operation :show do > + description "Show specific machine." > + with_capability :storage_volume > + param :id, :string, :required > + control do > + @volume =3D driver.send(:storage_volume, credentials, { :id =3D> = params[:id]} ) > + if @volume > + #setup the default values for a machine imageion > + resource_default =3D get_resource_default "volume" > + #get the actual values from image > + resource_value =3D { "name" =3D> @volume.id,"status" =3D> = @volume.state, "uri" =3D> @volume.id, > + "href" =3D> HOST_API_PATH + "/volume/" + @volume.id, > + "capacity" =3D> { "quantity" =3D> @volume.capacity, = "units" =3D> "gigabyte"} } > + #mixin actual values get from the specific image > + @dmtfitem =3D resource_default["dmtfitem"].merge = resource_value > + show_resource "volume/show", "Volume" > + else > + report_error(404) > + end > + end > + end >=20 > -delete "/api/:collType/:id" do > - handle_resource_delete > -end > +end > \ No newline at end of file > diff --git a/server/public/javascripts/cmwgapp.js = b/server/public/javascripts/cmwgapp.js > index 7289eb1..5ec7041 100644 > --- a/server/public/javascripts/cmwgapp.js > +++ b/server/public/javascripts/cmwgapp.js > @@ -215,7 +215,7 @@ function AddNewPproperty(tableId) > el.type =3D 'text'; > el.name =3D 'param_name_' + iteration; > el.id =3D 'param_name_' + iteration; > - el.size =3D 30; > + el.size =3D 25; > cellLeft.appendChild(el); >=20 >=20 > @@ -225,7 +225,7 @@ function AddNewPproperty(tableId) > em.type =3D 'text'; > em.name =3D 'param_value_' + iteration; > em.id =3D 'param_value_' + iteration; > - em.size =3D 30; > + em.size =3D 25; > cellRight.appendChild(em); >=20 > // select cell > diff --git a/server/views/cimi/cloudEntryPoint/index.html.haml = b/server/views/cimi/cloudEntryPoint/index.html.haml > index 115ac42..f0c1e6f 100644 > --- a/server/views/cimi/cloudEntryPoint/index.html.haml > +++ b/server/views/cimi/cloudEntryPoint/index.html.haml > @@ -1,6 +1,6 @@ >=20 > -- @allAPIs.each do |api| > +- @all_apis.each do |api| > - if api !=3D :cloudEntryPoint > - - newName =3D api.to_s.pluralize > - - newName =3D newName.gsub(/[A-Z]/, ' \0') > - %a{ :href =3D> '/api/collection/'+api.to_s }=3D = newName.capitalize + '
' > \ No newline at end of file > + - display_name =3D api.to_s.pluralize.gsub(/[A-Z]/, ' \0') > + - path_name =3D api.to_s.gsub(/[A-Z]/, '_\0').downcase > + %a{ :href =3D> '/api/'+path_name }=3D display_name.capitalize + = '
' > \ No newline at end of file > diff --git a/server/views/cimi/cloudEntryPoint/index.xml.haml = b/server/views/cimi/cloudEntryPoint/index.xml.haml > index 41da3c3..4643a8c 100644 > --- a/server/views/cimi/cloudEntryPoint/index.xml.haml > +++ b/server/views/cimi/cloudEntryPoint/index.xml.haml > @@ -4,7 +4,7 @@ > %name cloud entry point > %description cloud entry point > %created=3D Time.new.getutc.to_s > - - @allAPIs.each do |api| > + - @all_apis.each do |api| > - if api !=3D :cloudEntryPoint > - =3D "<#{api.to_s.pluralize} href=3D\"#{HOST_API_PATH + = "/collection/" +api.to_s} \"/>" > - %operation{ :rel =3D> "edit", :href =3D> HOST_API_PATH + = "/cloudEntryPoint" } > \ No newline at end of file > + - path_name =3D api.to_s.gsub(/[A-Z]/, '_\0').downcase > + =3D "<#{api.to_s.pluralize} href=3D\"#{HOST_API_PATH + "/" + = path_name}\"/>" > \ No newline at end of file > diff --git a/server/views/cimi/collection/index.html.haml = b/server/views/cimi/collection/index.html.haml > index 555d64b..ae747ab 100644 > --- a/server/views/cimi/collection/index.html.haml > +++ b/server/views/cimi/collection/index.html.haml > @@ -1,10 +1,10 @@ > -- newName =3D @dmtfitem["uri"] + " Collection" > -- newName =3D newName.gsub(/[A-Z]/, ' \0') > -%h1 #{newName.capitalize} > +- new_name =3D @dmtfitem["uri"] + " Collection" > +- new_name =3D new_name.gsub(/[A-Z]/, ' \0') > +%h1 #{new_name.capitalize} >=20 > %form{ :action =3D> HOST_API_PATH + "/collection/" + @dmtfitem["uri"] = } > %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > + %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xml_root_node }/ > %p > %label > Name: > @@ -18,57 +18,28 @@ > %p > %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - if @dmtfitem["operation"] > - if @dmtfitem["operation"].kind_of? (Array) > - - newPropertyObj =3D @dmtfitem["operation"] > + - property_object =3D @dmtfitem["operation"] > - else > - - newPropertyObj =3D [@dmtfitem["operation"]] > + - property_object =3D [@dmtfitem["operation"]] > - iter =3D -1 > - - newPropertyObj.map do | operation| > + - property_object.map do | operation| > - iter +=3D 1 > %br > %label > =3D operation["rel"].capitalize + ": " + HOST_API_PATH = + operation["href"] > %input{ :name =3D> "operation_"+iter.to_s, :oper_type =3D> = operation["rel"], :type =3D> :hidden, :value =3D> operation["href"] } > %br > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit changes", :onClick =3D> "return doXmlPut(this)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > %p > %br > -- newName =3D @dmtfitem["uri"] > -- newName =3D newName.gsub(/[A-Z]/, ' \0') > -- if @dmtfColItems > +- new_name =3D @dmtfitem["uri"] > +- new_name =3D new_name.gsub(/[A-Z]/, ' \0') > +- if @dmtf_col_items > %label > - =3D newName.capitalize.pluralize + ":" > + =3D new_name.capitalize.pluralize + ":" > %table{ :style =3D> "width:52%;"} > - - @dmtfColItems.map do |template| > - - puts template.inspect > + - @dmtf_col_items.map do |template| > %tr > %td > - %a{ :href =3D> template["href"] }=3D template["name"] > -%br > -%a{ :href =3D> HOST_API_PATH + "/" + @dmtfitem["uri"] + "/new"}=3D = "New " + newName.downcase > \ No newline at end of file > + %a{ :href =3D> template["href"] }=3D template["name"] > \ No newline at end of file > diff --git a/server/views/cimi/machine/new.html.haml = b/server/views/cimi/machine/new.html.haml > deleted file mode 100644 > index 334eaa3..0000000 > --- a/server/views/cimi/machine/new.html.haml > +++ /dev/null > @@ -1,183 +0,0 @@ > -%h1 Create new machine > - > -%form{ :action =3D> HOST_API_PATH + "/machine" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machine" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 20, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 20, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Status: > - %p > - %input{ :name =3D> :status, :size =3D> 50, :value =3D> = @dmtfitem["status"], :style =3D> "width:50%;" } > - %p > - %br > - %label > - CPU: > - %p > - %input{ :name =3D> :cpu, :size =3D> 50, :value =3D> = @dmtfitem["cpu"], :style =3D> "width:50%;" } > - %br > - %label > - Memory: > - %p > - %input{ :name =3D> :memory_quantity, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["quantity"], :style =3D> "width:10%;" } =       > - %input{ :name =3D> :memory_units, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["units"], :style =3D> "width:10%;" } > - %br > - %label > - Disk: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "diskTable"} > - - if @dmtfitem["disk"] > - - if @dmtfitem["disk"].kind_of?(Array) > - - newPropertyObj =3D @dmtfitem["disk"] > - - else > - - newPropertyObj =3D [@dmtfitem["disk"]] > - > - - iter =3D -1 > - %tr > - %td > - %label > - Quantity > - %td > - %label > - Units > - %td > - %label > - GuestInterface > - %td   > - - newPropertyObj.each do |disk| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "disk_quantity_" + iter.to_s, :size = =3D> 10, :value =3D> disk["capacity"]["quantity"] } > - %td > - %input{ :name =3D> "disk_units_" + iter.to_s, :size =3D> = 10, :value =3D> disk["capacity"]["units"] } > - %td > - %input{ :name =3D> "disk_guestInterface_" + iter.to_s, = :size =3D> 20, :value =3D> disk["guestInterface"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new disk", :onClick =3D> "return addDiskRow('diskTable')" } > - > - %br > - %label > - EntityMetadata: (Content must be in valid xml format) > - %br > - %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "entityMetadata"} > - > - %br > - %br > - %label > - TODO Need to handle volumes: > - %p > - %br > - %label > - TODO Need to handle network interfaces: > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("cpu").value + = ""; > - xmlData +=3D " - xmlData +=3D $(theNode.form).attr("memory_units").value + "' />" > - > - var index=3D0; > - subDisk =3D "" > - while ($(theNode.form).attr("disk_quantity_" + index)) { > - if ($(theNode.form).attr("disk_quantity_" + index).value !=3D = null && > - $(theNode.form).attr("disk_quantity_" + index).value.length = > 0) { > - subDisk +=3D " - $(theNode.form).attr("disk_units_" + index).value = + "' />"; > - subDisk +=3D "" + = $(theNode.form).attr("disk_guestInterface_" + index).value + = ""; > - } > - index++; > - } > - if (subDisk.length > 0) { > - xmlData +=3D "" + subDisk + ""; > - } > - > - //we handle entityMetadata here > - if ($(theNode.form).attr("entityMetadata").value) { > - xmlData +=3D $(theNode.form).attr("entityMetadata").value > - } > - > - xmlData +=3D ""; > - > - return xmlData; > - } > - > - function addDiskRow(tableId) { > - var tbl =3D document.getElementById(tableId); > - var lastRow =3D tbl.rows.length; > - // if there's no header row in the table, then iteration =3D = lastRow + 1 > - var iteration =3D lastRow - 1; > - var row =3D tbl.insertRow(lastRow); > - > - elNames =3D ['disk_quantity_', 'disk_units_', = 'disk_guestInterface_']; > - elSizes =3D [10, 10, 50] > - elValues =3D ["200", "megabyte", ""] > - > - for (var index=3D0; index - var aCellTD =3D row.insertCell(index); > - var aCell =3D document.createElement('input'); > - aCell.type =3D 'text'; > - aCell.name =3D elNames[index] + iteration; > - aCell.id =3D aCell.name; > - aCell.size =3D elSizes[index]; > - aCell.value =3D elValues[index]; > - aCellTD.appendChild(aCell); > - } > - > - // select cell > - var cellRightBut =3D row.insertCell(elNames.length); > - var er =3D document.createElement('input'); > - er.type =3D 'button'; > - er.name =3D 'param_remove' + iteration; > - er.id =3D 'param_remove' + iteration; > - er.value =3D "Remove"; > - er.tableRow =3D row > - $(er).click(function() { > - removeProperty(this); > - }) > - > - cellRightBut.appendChild(er); > - > - } > \ No newline at end of file > diff --git a/server/views/cimi/machine/show.html.haml = b/server/views/cimi/machine/show.html.haml > index 7d99b96..07eb358 100644 > --- a/server/views/cimi/machine/show.html.haml > +++ b/server/views/cimi/machine/show.html.haml > @@ -2,8 +2,8 @@ >=20 > %form{ :action =3D> HOST_API_PATH + "/machine" } > %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machine" }/ > + %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xml_root_node }/ > + %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/machine" }/ > %p > %label > Name: > @@ -24,18 +24,18 @@ > %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - if @dmtfitem["property"] > - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > + - property_object =3D {"#{@dmtfitem['property']['name']}" = =3D> {"content" =3D> @dmtfitem["property"]["content"]}} > - else > - - newPropertyObj =3D @dmtfitem["property"] > + - property_object =3D @dmtfitem["property"] >=20 > - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > + - property_object.each_pair do |key, value| > - iter +=3D 1 > %tr > %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 20, :value =3D> key } > + %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 25, :value =3D> key } > %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 20, :value =3D> value["content"] } > + %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 25, :value =3D> value["content"] } > %td > %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > @@ -64,9 +64,9 @@ > %table{ :style =3D> "width:50%;", :id =3D> "diskTable"} > - if @dmtfitem["disk"] > - if @dmtfitem["disk"].kind_of?(Array) > - - newPropertyObj =3D @dmtfitem["disk"] > + - property_object =3D @dmtfitem["disk"] > - else > - - newPropertyObj =3D [@dmtfitem["disk"]] > + - property_object =3D [@dmtfitem["disk"]] >=20 > - iter =3D -1 > %tr > @@ -80,7 +80,7 @@ > %label > GuestInterface > %td   > - - newPropertyObj.each do |disk| > + - property_object.each do |disk| > - iter +=3D 1 > %tr > %td > @@ -95,11 +95,7 @@ >=20 > %br > %label > - EntityMetadata: (Content must be in valid xml format) > - %br > - %textarea{:style=3D> "width:100%;height:100px;", :name =3D> = "entityMetadata"} > - =3D convert_xml_to_html @metadata > - %br > + EntityMetadata: > %br > %label > TODO Need to handle volumes: > @@ -107,8 +103,6 @@ > %br > %label > TODO Need to handle network interfaces: > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ >=20 > :javascript > function fixupXml(theNode) { > @@ -152,7 +146,7 @@ > var row =3D tbl.insertRow(lastRow); >=20 > elNames =3D ['disk_quantity_', 'disk_units_', = 'disk_guestInterface_']; > - elSizes =3D [10, 10, 50] > + elSizes =3D [10, 10, 20] > elValues =3D ["200", "megabyte", ""] >=20 > for (var index=3D0; index diff --git a/server/views/cimi/machineAdmin/new.html.haml = b/server/views/cimi/machineAdmin/new.html.haml > deleted file mode 100644 > index 1d5d80d..0000000 > --- a/server/views/cimi/machineAdmin/new.html.haml > +++ /dev/null > @@ -1,46 +0,0 @@ > -%h1 Create new machine admin > - > -%form{ :action =3D> HOST_API_PATH + "/machineAdmin" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineAdmin" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > \ No newline at end of file > diff --git a/server/views/cimi/machineAdmin/show.html.haml = b/server/views/cimi/machineAdmin/show.html.haml > deleted file mode 100644 > index fcb3348..0000000 > --- a/server/views/cimi/machineAdmin/show.html.haml > +++ /dev/null > @@ -1,46 +0,0 @@ > -%h1 Machine Admin > - > -%form{ :action =3D> HOST_API_PATH + "/machineAdmin" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineAdmin" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > \ No newline at end of file > diff --git a/server/views/cimi/machineConfiguration/new.html.haml = b/server/views/cimi/machineConfiguration/new.html.haml > deleted file mode 100644 > index c329e25..0000000 > --- a/server/views/cimi/machineConfiguration/new.html.haml > +++ /dev/null > @@ -1,172 +0,0 @@ > -%h1 Create new machine configuration > - > -%form{ :action =3D> HOST_API_PATH + "/machineConfiguration" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineConfiguration" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Cpu: > - %p > - %input{ :name =3D> :cpu, :size =3D> 50, :value =3D> = @dmtfitem["cpu"], :style =3D> "width:50%;" } > - %br > - %label > - Memory: > - %p > - %input{ :name =3D> :memory_quantity, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["quantity"], :style =3D> "width:10%;" } =       > - %input{ :name =3D> :memory_units, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["units"], :style =3D> "width:10%;" } > - %br > - %label > - Disk: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "diskTable"} > - - if @dmtfitem["disk"] > - - if @dmtfitem["disk"].kind_of?(Array) > - - newPropertyObj =3D @dmtfitem["disk"] > - - else > - - newPropertyObj =3D [@dmtfitem["disk"]] > - > - - iter =3D -1 > - %tr > - %td > - %label > - Quantity > - %td > - %label > - Units > - %td > - %label > - GuestInterface > - %td   > - - newPropertyObj.each do |disk| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "disk_quantity_" + iter.to_s, :size = =3D> 10, :value =3D> disk["capacity"]["quantity"] } > - %td > - %input{ :name =3D> "disk_units_" + iter.to_s, :size =3D> = 10, :value =3D> disk["capacity"]["units"] } > - %td > - %input{ :name =3D> "disk_guestInterface_" + iter.to_s, = :size =3D> 30, :value =3D> disk["guestInterface"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new disk", :onClick =3D> "return addDiskRow('diskTable')" } > - > - %br > - %label > - EntityMetadata: (Content must be in valid xml format) > - %br > - %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "entityMetadata"} > - > - > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("cpu").value + = ""; > - xmlData +=3D " - xmlData +=3D $(theNode.form).attr("memory_units").value + "' />" > - > - var index=3D0; > - subDisk =3D "" > - while ($(theNode.form).attr("disk_quantity_" + index)) { > - if ($(theNode.form).attr("disk_quantity_" + index).value !=3D = null && > - $(theNode.form).attr("disk_quantity_" + index).value.length = > 0) { > - subDisk +=3D " - $(theNode.form).attr("disk_units_" + index).value = + "' />"; > - subDisk +=3D "" + = $(theNode.form).attr("disk_guestInterface_" + index).value + = ""; > - } > - index++; > - } > - if (subDisk.length > 0) { > - xmlData +=3D "" + subDisk + ""; > - } > - > - //we handle entityMetadata here > - if ($(theNode.form).attr("entityMetadata").value) { > - xmlData +=3D $(theNode.form).attr("entityMetadata").value > - } > - > - xmlData +=3D ""; > - > - return xmlData; > - } > - > - function addDiskRow(tableId) { > - var tbl =3D document.getElementById(tableId); > - var lastRow =3D tbl.rows.length; > - // if there's no header row in the table, then iteration =3D = lastRow + 1 > - var iteration =3D lastRow - 1; > - var row =3D tbl.insertRow(lastRow); > - > - elNames =3D ['disk_quantity_', 'disk_units_', = 'disk_guestInterface_']; > - elSizes =3D [10, 10, 50] > - elValues =3D ["200", "megabyte", ""] > - > - for (var index=3D0; index - var aCellTD =3D row.insertCell(index); > - var aCell =3D document.createElement('input'); > - aCell.type =3D 'text'; > - aCell.name =3D elNames[index] + iteration; > - aCell.id =3D aCell.name; > - aCell.size =3D elSizes[index]; > - aCell.value =3D elValues[index]; > - aCellTD.appendChild(aCell); > - } > - > - // select cell > - var cellRightBut =3D row.insertCell(elNames.length); > - var er =3D document.createElement('input'); > - er.type =3D 'button'; > - er.name =3D 'param_remove' + iteration; > - er.id =3D 'param_remove' + iteration; > - er.value =3D "Remove"; > - er.tableRow =3D row > - $(er).click(function() { > - removeProperty(this); > - }) > - > - cellRightBut.appendChild(er); > - > - } > \ No newline at end of file > diff --git a/server/views/cimi/machineConfiguration/show.html.haml = b/server/views/cimi/machineConfiguration/show.html.haml > deleted file mode 100644 > index a3b3bda..0000000 > --- a/server/views/cimi/machineConfiguration/show.html.haml > +++ /dev/null > @@ -1,167 +0,0 @@ > -%h1 View/Edit machine configuration > - > -%form{ :action =3D> HOST_API_PATH + "/machineConfiguration" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineConfiguration" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Cpu: > - %p > - %input{ :name =3D> :cpu, :size =3D> 50, :value =3D> = @dmtfitem["cpu"], :style =3D> "width:50%;" } > - %br > - %label > - Memory: > - %p > - %input{ :name =3D> :memory_quantity, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["quantity"], :style =3D> "width:10%;" } =       > - %input{ :name =3D> :memory_units, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["units"], :style =3D> "width:10%;" } > - %br > - %label > - Disk: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "diskTable"} > - - if @dmtfitem["disk"] > - - if @dmtfitem["disk"].kind_of?(Array) > - - newPropertyObj =3D @dmtfitem["disk"] > - - else > - - newPropertyObj =3D [@dmtfitem["disk"]] > - > - - iter =3D -1 > - %tr > - %td > - %label > - Quantity > - %td > - %label > - Units > - %td > - %label > - GuestInterface > - %td   > - - newPropertyObj.each do |disk| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "disk_quantity_" + iter.to_s, :size = =3D> 10, :value =3D> disk["capacity"]["quantity"] } > - %td > - %input{ :name =3D> "disk_units_" + iter.to_s, :size =3D> = 10, :value =3D> disk["capacity"]["units"] } > - %td > - %input{ :name =3D> "disk_guestInterface_" + iter.to_s, = :size =3D> 30, :value =3D> disk["guestInterface"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new disk", :onClick =3D> "return addDiskRow('diskTable')" } > - > - %br > - %label > - EntityMetadata: > - %br > - %div{:style =3D> "width:90%;"} > - %pre > - - if @metadata > - =3D convert_xml_to_html @metadata > - %br > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("cpu").value + = ""; > - xmlData +=3D " - xmlData +=3D $(theNode.form).attr("memory_units").value + "' />" > - > - var index=3D0; > - subDisk =3D "" > - while ($(theNode.form).attr("disk_quantity_" + index)) { > - if ($(theNode.form).attr("disk_quantity_" + index).value !=3D = null && > - $(theNode.form).attr("disk_quantity_" + index).value.length = > 0) { > - subDisk +=3D " - $(theNode.form).attr("disk_units_" + index).value = + "' />"; > - subDisk +=3D "" + = $(theNode.form).attr("disk_guestInterface_" + index).value + = ""; > - } > - index++; > - } > - if (subDisk.length > 0) { > - xmlData +=3D "" + subDisk + ""; > - } > - > - xmlData +=3D ""; > - > - return xmlData; > - } > - > - function addDiskRow(tableId) { > - var tbl =3D document.getElementById(tableId); > - var lastRow =3D tbl.rows.length; > - // if there's no header row in the table, then iteration =3D = lastRow + 1 > - var iteration =3D lastRow - 1; > - var row =3D tbl.insertRow(lastRow); > - > - elNames =3D ['disk_quantity_', 'disk_units_', = 'disk_guestInterface_']; > - elSizes =3D [10, 10, 50] > - elValues =3D ["200", "megabyte", ""] > - > - for (var index=3D0; index - var aCellTD =3D row.insertCell(index); > - var aCell =3D document.createElement('input'); > - aCell.type =3D 'text'; > - aCell.name =3D elNames[index] + iteration; > - aCell.id =3D aCell.name; > - aCell.size =3D elSizes[index]; > - aCell.value =3D elValues[index]; > - aCellTD.appendChild(aCell); > - } > - > - // select cell > - var cellRightBut =3D row.insertCell(elNames.length); > - var er =3D document.createElement('input'); > - er.type =3D 'button'; > - er.name =3D 'param_remove' + iteration; > - er.id =3D 'param_remove' + iteration; > - er.value =3D "Remove"; > - er.tableRow =3D row > - $(er).click(function() { > - removeProperty(this); > - }) > - > - cellRightBut.appendChild(er); > - > - } > \ No newline at end of file > diff --git a/server/views/cimi/machineImage/new.html.haml = b/server/views/cimi/machineImage/new.html.haml > deleted file mode 100644 > index fc4d49d..0000000 > --- a/server/views/cimi/machineImage/new.html.haml > +++ /dev/null > @@ -1,80 +0,0 @@ > -%h1 Create new machine image > - > -%form{ :action =3D> HOST_API_PATH + "/machineImage" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineImage" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Image Location: > - %p > - %input{ :name =3D> :imageLocation, :size =3D> 50, :value =3D> = @dmtfitem["imageLocation"], :style =3D> "width:50%;" } > - %br > - %label > - Image Data: > - %p > - %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "imageData"} > - %br > - %label > - EntityMetadata: (Content must be in valid xml format) > - %br > - %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "entityMetadata"} > - > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D ""; > - xmlData +=3D "" + = $(theNode.form).attr("imageData").value + ""; > - > - //we handle entityMetadata here > - if ($(theNode.form).attr("entityMetadata").value) { > - xmlData +=3D $(theNode.form).attr("entityMetadata").value > - } > - > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/machineImage/show.html.haml = b/server/views/cimi/machineImage/show.html.haml > deleted file mode 100644 > index 13ab375..0000000 > --- a/server/views/cimi/machineImage/show.html.haml > +++ /dev/null > @@ -1,82 +0,0 @@ > -%h1 View/Edit machine image > - > -%form{ :action =3D> HOST_API_PATH + "/machineImage" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineImage" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Image Location: > - %p > - %input{ :name =3D> :imageLocation, :size =3D> 50, :value =3D> = @dmtfitem["imageLocation"], :style =3D> "width:50%;" } > - %br > - %label > - Image Data: > - %p > - %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "imageData"} > - %br > - %label > - EntityMetadata: > - %br > - %div{:style =3D> "width:90%;"} > - %pre > - - if @metadata > - =3D convert_xml_to_html @metadata > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D ""; > - xmlData +=3D "" + = $(theNode.form).attr("imageData").value + ""; > - > - //we handle entityMetadata here > - if ($(theNode.form).attr("entityMetadata") !=3D null && = $(theNode.form).attr("entityMetadata").value) { > - xmlData +=3D $(theNode.form).attr("entityMetadata").value > - } > - > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/machineTemplate/new.html.haml = b/server/views/cimi/machineTemplate/new.html.haml > deleted file mode 100644 > index 7bffe99..0000000 > --- a/server/views/cimi/machineTemplate/new.html.haml > +++ /dev/null > @@ -1,78 +0,0 @@ > -%h1 Create new machine template > - > -%form{ :action =3D> HOST_API_PATH + "/machineTemplate" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineTemplate" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - TODO Need to handle machineConfiguration > - %p > - %br > - %label > - TODO Need to handle machineImage > - %p > - %br > - %label > - TODO Need to handle machineAdmins > - %p > - %br > - %label > - TODO Need to handle volums > - %p > - %br > - %label > - TODO Need to handle volumeTemplates > - %p > - %br > - %label > - TODO Need to handle networkInterfaces > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/machineTemplate/show.html.haml = b/server/views/cimi/machineTemplate/show.html.haml > deleted file mode 100644 > index f420a9b..0000000 > --- a/server/views/cimi/machineTemplate/show.html.haml > +++ /dev/null > @@ -1,78 +0,0 @@ > -%h1 View/Edit machine template > - > -%form{ :action =3D> HOST_API_PATH + "/machineTemplate" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineTemplate" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - TODO Need to handle machineConfiguration > - %p > - %br > - %label > - TODO Need to handle machineImage > - %p > - %br > - %label > - TODO Need to handle machineAdmins > - %p > - %br > - %label > - TODO Need to handle volums > - %p > - %br > - %label > - TODO Need to handle volumeTemplates > - %p > - %br > - %label > - TODO Need to handle networkInterfaces > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/machine_configuration/show.html.haml = b/server/views/cimi/machine_configuration/show.html.haml > new file mode 100644 > index 0000000..cb0fbe7 > --- /dev/null > +++ b/server/views/cimi/machine_configuration/show.html.haml > @@ -0,0 +1,159 @@ > +%h1 View/Edit machine configuration > + > +%form{ :action =3D> HOST_API_PATH + "/machineConfiguration" } > + %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > + %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xml_root_node }/ > + %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineConfiguration" }/ > + %p > + %label > + Name: > + %p > + %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > + %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > + %p > + %br > + %label > + Description: > + %p > + %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > + %p > + %br > + %label > + Properties: > + %p > + %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > + - if @dmtfitem["property"] > + - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > + - property_object =3D {"#{@dmtfitem['property']['name']}" = =3D> {"content" =3D> @dmtfitem["property"]["content"]}} > + - else > + - property_object =3D @dmtfitem["property"] > + > + - iter =3D -1 > + - property_object.each_pair do |key, value| > + - iter +=3D 1 > + %tr > + %td > + %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > + %td > + %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > + %td > + %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > + %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > + %p > + %br > + %label > + Cpu: > + %p > + %input{ :name =3D> :cpu, :size =3D> 50, :value =3D> = @dmtfitem["cpu"], :style =3D> "width:50%;" } > + %br > + %label > + Memory: > + %p > + %input{ :name =3D> :memory_quantity, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["quantity"], :style =3D> "width:10%;" } =       > + %input{ :name =3D> :memory_units, :size =3D> 20, :value =3D> = @dmtfitem["memory"]["units"], :style =3D> "width:10%;" } > + %br > + %label > + Disk: > + %p > + %table{ :style =3D> "width:50%;", :id =3D> "diskTable"} > + - if @dmtfitem["disk"] > + - if @dmtfitem["disk"].kind_of?(Array) > + - property_object =3D @dmtfitem["disk"] > + - else > + - property_object =3D [@dmtfitem["disk"]] > + > + - iter =3D -1 > + %tr > + %td > + %label > + Quantity > + %td > + %label > + Units > + %td > + %label > + GuestInterface > + %td   > + - property_object.each do |disk| > + - iter +=3D 1 > + %tr > + %td > + %input{ :name =3D> "disk_quantity_" + iter.to_s, :size = =3D> 10, :value =3D> disk["capacity"]["quantity"] } > + %td > + %input{ :name =3D> "disk_units_" + iter.to_s, :size =3D> = 10, :value =3D> disk["capacity"]["units"] } > + %td > + %input{ :name =3D> "disk_guestInterface_" + iter.to_s, = :size =3D> 30, :value =3D> disk["guestInterface"] } > + %td > + %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > + %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new disk", :onClick =3D> "return addDiskRow('diskTable')" } > + > + %br > + %label > + EntityMetadata: > + %br > + > +:javascript > + function fixupXml(theNode) { > + var xmlData =3D ""; > + xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > + xmlData +=3D getStandardData(theNode); > + xmlData +=3D "" + $(theNode.form).attr("cpu").value + = ""; > + xmlData +=3D " + xmlData +=3D $(theNode.form).attr("memory_units").value + "' />" > + > + var index=3D0; > + subDisk =3D "" > + while ($(theNode.form).attr("disk_quantity_" + index)) { > + if ($(theNode.form).attr("disk_quantity_" + index).value !=3D = null && > + $(theNode.form).attr("disk_quantity_" + index).value.length = > 0) { > + subDisk +=3D " + $(theNode.form).attr("disk_units_" + index).value = + "' />"; > + subDisk +=3D "" + = $(theNode.form).attr("disk_guestInterface_" + index).value + = ""; > + } > + index++; > + } > + if (subDisk.length > 0) { > + xmlData +=3D "" + subDisk + ""; > + } > + > + xmlData +=3D ""; > + > + return xmlData; > + } > + > + function addDiskRow(tableId) { > + var tbl =3D document.getElementById(tableId); > + var lastRow =3D tbl.rows.length; > + // if there's no header row in the table, then iteration =3D = lastRow + 1 > + var iteration =3D lastRow - 1; > + var row =3D tbl.insertRow(lastRow); > + > + elNames =3D ['disk_quantity_', 'disk_units_', = 'disk_guestInterface_']; > + elSizes =3D [10, 10, 30] > + elValues =3D ["200", "megabyte", ""] > + > + for (var index=3D0; index + var aCellTD =3D row.insertCell(index); > + var aCell =3D document.createElement('input'); > + aCell.type =3D 'text'; > + aCell.name =3D elNames[index] + iteration; > + aCell.id =3D aCell.name; > + aCell.size =3D elSizes[index]; > + aCell.value =3D elValues[index]; > + aCellTD.appendChild(aCell); > + } > + > + // select cell > + var cellRightBut =3D row.insertCell(elNames.length); > + var er =3D document.createElement('input'); > + er.type =3D 'button'; > + er.name =3D 'param_remove' + iteration; > + er.id =3D 'param_remove' + iteration; > + er.value =3D "Remove"; > + er.tableRow =3D row > + $(er).click(function() { > + removeProperty(this); > + }) > + > + cellRightBut.appendChild(er); > + } > \ No newline at end of file > diff --git a/server/views/cimi/machine_image/show.html.haml = b/server/views/cimi/machine_image/show.html.haml > new file mode 100644 > index 0000000..5fdbca8 > --- /dev/null > +++ b/server/views/cimi/machine_image/show.html.haml > @@ -0,0 +1,79 @@ > +%h1 View/Edit machine image > + > +%form{ :action =3D> HOST_API_PATH + "/machineImage" } > + %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > + %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xml_root_node }/ > + %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/machineImage" }/ > + %p > + %label > + Name: > + %p > + %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > + %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > + %p > + %br > + %label > + Description: > + %p > + %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > + %p > + %br > + %label > + Properties: > + %p > + %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > + - if @dmtfitem["property"] > + - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > + - property_object =3D {"#{@dmtfitem['property']['name']}" = =3D> {"content" =3D> @dmtfitem["property"]["content"]}} > + - else > + - property_object =3D @dmtfitem["property"] > + > + - iter =3D -1 > + - property_object.each_pair do |key, value| > + - iter +=3D 1 > + %tr > + %td > + %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > + %td > + %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > + %td > + %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > + %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > + %p > + %br > + %label > + Image Location: > + %p > + %input{ :name =3D> :imageLocation, :size =3D> 50, :value =3D> = @dmtfitem["imageLocation"], :style =3D> "width:50%;" } > + %br > + %label > + Image Data: > + %p > + %textarea{:style=3D> "width:50%;height:100px;", :name =3D> = "imageData"} > + %br > + %label > + EntityMetadata: > + %br > + %div{:style =3D> "width:90%;"} > + %pre > + - if @metadata > + =3D convert_xml_to_html @metadata > + %br > + > +:javascript > + function fixupXml(theNode) { > + var xmlData =3D ""; > + xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > + xmlData +=3D getStandardData(theNode); > + xmlData +=3D ""; > + xmlData +=3D "" + = $(theNode.form).attr("imageData").value + ""; > + > + //we handle entityMetadata here > + if ($(theNode.form).attr("entityMetadata") !=3D null && = $(theNode.form).attr("entityMetadata").value) { > + xmlData +=3D $(theNode.form).attr("entityMetadata").value > + } > + > + xmlData +=3D ""; > + > + return xmlData; > + } > \ No newline at end of file > diff --git a/server/views/cimi/system/new.html.haml = b/server/views/cimi/system/new.html.haml > deleted file mode 100644 > index 9e7840e..0000000 > --- a/server/views/cimi/system/new.html.haml > +++ /dev/null > @@ -1,79 +0,0 @@ > -%h1 Create new system > - > -%form{ :action =3D> HOST_API_PATH + "/system" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/system" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - State: > - %p > - =3D @dmtfitem["state"] > - %input{ :name =3D> "state", :type =3D> :hidden, :value =3D> = @dmtfitem["state"] } > - %br > - %label > - Status: > - %p > - %input{ :name =3D> :status, :size =3D> 20, :value =3D> = @dmtfitem["status"], :style =3D> "width:50%;" } > - %p > - %br > - %label > - TODO Need to handle machines > - %p > - %br > - %label > - TODO Need to handle meters > - %p > - %br > - %label > - TODO Need to handle eventLog > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("state").value + = ""; > - xmlData +=3D "" + $(theNode.form).attr("status").value + = ""; > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/system/show.html.haml = b/server/views/cimi/system/show.html.haml > deleted file mode 100644 > index 812f1a5..0000000 > --- a/server/views/cimi/system/show.html.haml > +++ /dev/null > @@ -1,79 +0,0 @@ > -%h1 View/Edit system > - > -%form{ :action =3D> HOST_API_PATH + "/system" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/system" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - State: > - %p > - =3D @dmtfitem["state"] > - %input{ :name =3D> "state", :type =3D> :hidden, :value =3D> = @dmtfitem["state"] } > - %br > - %label > - Status: > - %p > - %input{ :name =3D> :status, :size =3D> 20, :value =3D> = @dmtfitem["status"], :style =3D> "width:50%;" } > - %p > - %br > - %label > - TODO Need to handle machines > - %p > - %br > - %label > - TODO Need to handle meters > - %p > - %br > - %label > - TODO Need to handle eventLog > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("state").value + = ""; > - xmlData +=3D "" + $(theNode.form).attr("status").value + = ""; > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/system/show.xml.haml = b/server/views/cimi/system/show.xml.haml > deleted file mode 100644 > index 0d9425f..0000000 > --- a/server/views/cimi/system/show.xml.haml > +++ /dev/null > @@ -1,11 +0,0 @@ > -!!!XML > -%System{ :xmlns =3D> "http://www.dmtf.org/cmp", :"xmlns:atom" =3D> = "http://atom.org"} > - %uri=3D HOST_API_PATH + "/system/" + @system.id > - %name=3D @system.name > - %timestamp=3D Time.new.to_i.to_s > - %properties > - %state=3D @system.state > - %limit=3D @system.limit > - %atom:link{ :rel =3D> "Machines", :href =3D> HOST_API_PATH + = "/machine?system=3D" + @system.id } > - %atom:link{ :rel =3D> "Meters", :href =3D> HOST_API_PATH + = "/meter?system=3D" + @system.id } > - %atom:link{ :rel =3D> "EventLog", :href =3D> HOST_API_PATH + = "/eventLog?system=3D" + @system.id } > diff --git a/server/views/cimi/systemTemplate/new.html.haml = b/server/views/cimi/systemTemplate/new.html.haml > deleted file mode 100644 > index 788cfd2..0000000 > --- a/server/views/cimi/systemTemplate/new.html.haml > +++ /dev/null > @@ -1,68 +0,0 @@ > -%h1 Create new system template > - > -%form{ :action =3D> HOST_API_PATH + "/systemTemplate" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/systemTemplate" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - TODO Need to handle volumeTemplates: > - %p > - %br > - %label > - TODO Need to handle machineTemplates: > - %p > - %br > - %label > - TODO Need to handle networkTemplates: > - > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/systemTemplate/show.html.haml = b/server/views/cimi/systemTemplate/show.html.haml > deleted file mode 100644 > index ef44754..0000000 > --- a/server/views/cimi/systemTemplate/show.html.haml > +++ /dev/null > @@ -1,70 +0,0 @@ > -%h1 View/Edit system template > - > -%form{ :action =3D> HOST_API_PATH + "/systemTemplate" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/systemTemplate" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - TODO Need to handle volumeTemplates: > - %p > - %br > - %label > - TODO Need to handle machineTemplates: > - %p > - %br > - %label > - TODO Need to handle networkTemplates: > - > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/volume/show.html.haml = b/server/views/cimi/volume/show.html.haml > new file mode 100644 > index 0000000..9c688ab > --- /dev/null > +++ b/server/views/cimi/volume/show.html.haml > @@ -0,0 +1,68 @@ > +%h1 View/Edit volume > + > +%form{ :action =3D> HOST_API_PATH + "/volume" } > + %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > + %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xml_root_node }/ > + %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/volume" }/ > + %p > + %label > + Name: > + %p > + %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > + %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > + %p > + %br > + %label > + Description: > + %p > + %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > + %p > + %br > + %label > + Properties: > + %p > + %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > + - if @dmtfitem["property"] > + - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > + - property_object =3D {"#{@dmtfitem['property']['name']}" = =3D> {"content" =3D> @dmtfitem["property"]["content"]}} > + - else > + - property_object =3D @dmtfitem["property"] > + > + - iter =3D -1 > + - property_object.each_pair do |key, value| > + - iter +=3D 1 > + %tr > + %td > + %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > + %td > + %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > + %td > + %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > + %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > + %p > + %br > + %label > + Capacity: > + %p > + %input{ :name =3D> :capacity_quantity, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["quantity"], :style =3D> "width:10%;" } =       > + %input{ :name =3D> :capacity_units, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["units"], :style =3D> "width:10%;" } > + %br > + %label > + EntityMetadata: > + %br > + > +:javascript > + function fixupXml(theNode) { > + var xmlData =3D ""; > + xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > + xmlData +=3D getStandardData(theNode); > + xmlData +=3D "" + $(theNode.form).attr("cpu").value + = ""; > + xmlData +=3D " + xmlData +=3D $(theNode.form).attr("memory_units").value + "' />" > + > + var index=3D0; > + > + xmlData +=3D ""; > + > + return xmlData; > + } > \ No newline at end of file > diff --git a/server/views/cimi/volumeConfiguration/new.html.haml = b/server/views/cimi/volumeConfiguration/new.html.haml > deleted file mode 100644 > index ed3566a..0000000 > --- a/server/views/cimi/volumeConfiguration/new.html.haml > +++ /dev/null > @@ -1,75 +0,0 @@ > -%h1 Create new volume configuration > - > -%form{ :action =3D> HOST_API_PATH + "/volumeConfiguration" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/columeConfiguration" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Format: > - %p > - %input{ :name =3D> :format, :size =3D> 50, :value =3D> = @dmtfitem["format"], :style =3D> "width:50%;" } > - %br > - %label > - Capacity: > - %p > - %input{ :name =3D> :quantity, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["quantity"], :style =3D> "width:10%;" } =       > - %input{ :name =3D> :units, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["units"], :style =3D> "width:10%;" } > - %br > - %label > - Guest Interface: > - %p > - %input{ :name =3D> :guestInterface, :size =3D> 50, :value =3D> = @dmtfitem["guestInterface"], :style =3D> "width:50%;" } > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPost(this, fixupXml)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("format").value + = ""; > - xmlData +=3D ""; > - xmlData +=3D "" + = $(theNode.form).attr("guestInterface").value + ""; > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > diff --git a/server/views/cimi/volumeConfiguration/show.html.haml = b/server/views/cimi/volumeConfiguration/show.html.haml > deleted file mode 100644 > index 041e2b7..0000000 > --- a/server/views/cimi/volumeConfiguration/show.html.haml > +++ /dev/null > @@ -1,77 +0,0 @@ > -%h1 View/Edit Volume configuration > - > -%form{ :action =3D> HOST_API_PATH + "/volumeConfiguration" } > - %input{ :name =3D> :id, :type =3D> :hidden, :value =3D> = @dmtfitem["uri"] }/ > - %input{ :name =3D> :xmlRootNode, :type =3D> :hidden, :value =3D> = @xmlRootNode }/ > - %input{ :name =3D> :refreshURI, :type =3D> :hidden, :value =3D> = HOST_API_PATH + "/collection/columeConfiguration" }/ > - %p > - %label > - Name: > - %p > - %input{ :name =3D> :name, :size =3D> 50, :value =3D> = @dmtfitem["name"], :style =3D> "width:50%;" } > - %input{ :name =3D> :created, :type =3D> :hidden, :size =3D> 50, = :value =3D> @dmtfitem["created"] } > - %p > - %br > - %label > - Description: > - %p > - %textarea{ :name =3D> :description, :cols =3D> 50, :rows =3D> 4, = :style =3D> "width:50%;" } #{@dmtfitem['description']} > - %p > - %br > - %label > - Properties: > - %p > - %table{ :style =3D> "width:50%;", :id =3D> "propertyTable"} > - - if @dmtfitem["property"] > - - if @dmtfitem["property"]["name"] && = @dmtfitem["property"]["content"] > - - newPropertyObj =3D {"#{@dmtfitem['property']['name']}" =3D>= {"content" =3D> @dmtfitem["property"]["content"]}} > - - else > - - newPropertyObj =3D @dmtfitem["property"] > - > - - iter =3D -1 > - - newPropertyObj.each_pair do |key, value| > - - iter +=3D 1 > - %tr > - %td > - %input{ :name =3D> "param_name_" + iter.to_s, :size =3D> = 30, :value =3D> key } > - %td > - %input{ :name =3D> "param_value_" + iter.to_s, :size =3D>= 30, :value =3D> value["content"] } > - %td > - %input{ :type =3D> :button, :value =3D> "Remove", = :onClick =3D> "return removeProperty(this)" } > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> "Add = new property", :onClick =3D> "return AddNewPproperty('propertyTable')" } > - %p > - %br > - %label > - Format: > - %p > - %input{ :name =3D> :format, :size =3D> 50, :value =3D> = @dmtfitem["format"], :style =3D> "width:50%;" } > - %br > - %label > - Capacity: > - %p > - %input{ :name =3D> :quantity, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["quantity"], :style =3D> "width:10%;" } =       > - %input{ :name =3D> :units, :size =3D> 20, :value =3D> = @dmtfitem["capacity"]["units"], :style =3D> "width:10%;" } > - %br > - %label > - Guest Interface: > - %p > - %input{ :name =3D> :guestInterface, :size =3D> 50, :value =3D> = @dmtfitem["guestInterface"], :style =3D> "width:50%;" } > - %br > - > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Submit", :onClick =3D> "return doXmlPut(this, true, fixupXml)" }/ > - %input{ :type =3D> :button, :name =3D> "commit", :value =3D> = "Delete", :onClick =3D> "return doXmlDelete(this, true)" }/ > - %input{ :name =3D> "refresh", :value =3D> false, :type =3D> = :hidden} > - > -:javascript > - function fixupXml(theNode) { > - var xmlData =3D ""; > - xmlData +=3D "<" + $(theNode.form).attr("xmlRootNode").value + " = xmlns=3D'http://www.dmtf.org/cimi'>"; > - xmlData +=3D getStandardData(theNode); > - xmlData +=3D "" + $(theNode.form).attr("format").value + = ""; > - xmlData +=3D ""; > - xmlData +=3D "" + = $(theNode.form).attr("guestInterface").value + ""; > - xmlData +=3D ""; > - > - return xmlData; > - } > \ No newline at end of file > --=20 > 1.7.4.1 >=20 ------------------------------------------------------ Michal Fojtik, mfojtik@redhat.com Deltacloud API: http://deltacloud.org