Upgrading a Viewpoint 14.00 Portlet to 14.01

Viewpoint
Teradata Viewpoint is Teradata's strategic and innovative SOV (single operational view) for Teradata DB, Aster, and HDP Hadoop systems management and monitoring that enables Teradata's Unified Data Architecture (UDA).
Teradata Employee

Upgrading a Viewpoint 14.00 Portlet to 14.01

A portlet developed for Viewpoint 14.0 will, for the most part, work correctly on Viewpoint 14.01. The most impactful change to consider will be to make your portlet support horizontal resizing, and to make any code changes to use the latest versions of jQuery and jQuery UI included with Viewpoint 14.01.

Modify ivy.xml to use 14.01 jars

If you are developing inside of the Teradata network you will need to modify the ivy.xml file for your portlet to use latest jar files. If you are not then go to the next step.

Edit ivy.xml and replace tdcommons-* with vp-commons-* for Viewpoint jars. You will also need to rename organization from teradata to com.teradata.viewpoint for these jars. Update your ivy.xml or project.properties, whichever contains the actual revisions with the latest revisions. The final result should look as below.

NOTE: The structure of the ivy.xml file has changed in 14.01, but the existing structure will continue to work.

ivy.xml

<dependency org="com.teradata.viewpoint" name="vp-commons-portlets" rev="14.01.00.00-SNAPSHOT" conf="runtime->runtime" changing="true" />
<dependency org="com.teradata.viewpoint" name="vp-commons-model" rev="14.01.00.00-SNAPSHOT" conf="runtime->runtime" changing="true" />
<dependency org="com.teradata.viewpoint" name="vp-commons-security" rev="14.01.00.00-SNAPSHOT" conf="runtime->runtime" changing="true" />
<dependency org="com.teradata.viewpoint" name="vp-commons-testutil" rev="14.01.00.00-SNAPSHOT" conf="build->build" changing="true" />
<dependency org="com.teradata.viewpoint" name="vp-commons-taglib" rev="14.01.00.00-SNAPSHOT" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="anterage" rev="latest.integration" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="TeraJDBC" rev="latest.integration" conf="runtime->default" />

project.properties

#
# Dependency Versions
#
cam.version=14.01.00.00-SNAPSHOT
anterage.version=latest.integration
tvilogging.version=1.3
datatools.version=latest.integration
tomcat.version=7.0.32
spring.version=3.0.5.RELEASE

#
# Java Version options used for compilation
#
javac.source=1.6
javac.target=1.6

#
# JDBC Dependency Versions
# module is TeraJDBC-PreGCA to get JDBC candidate builds
# module is TeraJDBC to get only JDBC GCA builds
#
terajdbc.module=TeraJDBC-PreGCA
terajdbc.version=latest.integration

postgresjdbc.module=postgresql-jdbc3
postgresjdbc.version=9.1-901


Manually move new jar files to your portlet

If you are developing external to the Teradata network you will need to manually update your portlet with new jar files. First delete all of the old jar files from your WEB-INF folder. There are located here:

C:\tdpdk-14.00.00.00\src\YourPortletName\web\WEB-INF\lib

Now grab the new jar files from one of the demo portlets that were generated with the 14.01.00.00 PDK, and put them in the folders that you just removed the old ones from. If you were to grab them from the DynamicQuery portlet, you would find them here:

C:\tdpdk-14.01.00.00\viewpoint-portal\webapps\DynamicQuery\web\WEB-INF\lib

Support Horizontal Resizing

This is covered in the PDK Cookbook.

Upgrade jQuery usage 

If your portlet uses jQuery or jQuery UI, you will want to check your code to remove deprecated calls. See below for a list of common gotchas and best practices to follow.

What has changed?

  • jQuery: Upgrading from 1.2.6 & 1.4.2  to 1.7.2
  • jQuery UI: Upgrading from 1.5.2 & 1.8 to 1.8.19
  • jQuery Aliases: The following aliases are deprecated and will be removed in 14.10 - JQ, jQuery12, and jQuery14. In 14.01 these aliases will point to jQuery 1.7.2. All other versions of jQuery and jQuery UI will be removed in 14.01.

What do I have to do?

  • Remove deprecated attribute selectors
    • Search code for '[@' (be careful not to accidently replace this in regular expressions within your code base)
    • Replace ?'[@' with '['
  • Ensure that $('formElementCollection').focus() is only setting the focus on visible and enabled form fields else it will throw an error in some browsers
    • If you are uncertain of a form field's state during run time you can apply filters to your selectors that are setting focus: $('formElementCollection:visible:enabled').focus()
  • $(selector).attr('foo') will return undefined if an attribute has not been set, so if you attempt to access a property such as $(selector).attr('foo').length then it will throw an error in some browsers
    • Just check for truthiness instead of trying to access a property; empty strings will return false, so a truthiness check should cover all cases
    • If you are mixing vanilla JavaScript with jQuery then trying to access attributes via $.attr()
      • BAD: var foo = document.getElementById('bar'); foo.myCustomAttr = 'baz'; // this is a property not an attribute
      • GOOD: var foo = document.getElementById('bar'); foo.setAttribute('myCustomAttr', 'baz');
      • Use jQuery.prop for getting and setting properties, e.g., checked, disabled, etc.
      • Use jQuery.attr for getting and setting attributes
      • Do NOT use jQuery.removeProp on native element properties; you should never need to use this unless your setting expandos on DOM elements which is bad practice in the first place

Upgrade Widgets

If your portlet uses the TjsDatagrid or the BigNumbers widget, refer to Displaying Tabular Data or the SkewedSessions portlet shipped with the PDK for examples of resizing widgets.

Run your new 14.01-compatible portlet

Your portlet is now ready to be deployed within the Viewpoint 14.0.1 environment.