Deploy custom HTML pages

You typically develop custom HTML Tabs and HTML Windows locally. Next, you deploy the files to either:

  • an HTTP server, as shown in Step 3 below

  • a shared drive by using a file URL. For example,

P4VJS.HTMLTabs = file://hostname/htmltools/htmltabs_admin.xml

where hostname represents the computer that provides a shared drive.

To deploy custom HTML tabs, windows, or actions:

  1. In the Edit HTML Tab or Edit HTML Window dialog, respectively, in the URL field, change the specifier for each HTML Tab or HTML Window from file:///… to http://….
  2. Test the custom tabs or windows to make sure the deployed version works in P4V.
  3. Export the definition file and copy it to your web server. Test the URL in a browser to make sure it points to the XML definition file. P4V recognizes the following properties:

    • P4VJS.HTMLTabs: A URL search path to the definition of custom HTML Tabs
    • P4VJS.HTMLWindows: A URL search path to the definition of custom HTML Windows
    • P4VJS.HTMLActions: A URL search path to the definition of custom HTML Actions
    • P4VJS.HTMLAllowList: Overwrites the local useAllowList and allowList preferences. See HTML Tools preferences in Helix Core Visual Client (P4V) Guide.

    These properties support a set of URLs separated by ::: as shown in these examples:

    $ p4 property -a -n P4VJS.HTMLAllowList -v "https://www.server1.com:::https://www.server2.com"

    or

    $ p4 property -n P4VJS.HTMLTabs -l
    P4VJS.HTMLTabs = http://internal.company.com:8002/htmltabs.xml:::http://external.company.com:8002/htmltabs.xml

    P4V tries to download the internal htmltabs.xml first. If it fails, it attempts to download htmltabs.xml using the external URL.

  4. Move the definition file to the HTTP server and set the properties to point to this file.

    When running, P4V should now connect to this server. Deployed tabs and windows are defined per connection. Each server determines which tabs and windows are provided for this connection. Because deployment is driven by properties, different users can be offered different tools.

    Note

    P4Admin does not have the concept of deployed tabs or windows per connection. However, you can distribute your tabs and windows by exporting them from your development machine and then importing them onto your users' machines.

  5. In P4V, make sure the menu items for the now deployed custom HTML Tabs or HTML Windows are available from the View or Tools menu, respectively.

If you deployed HTML pages prior to P4V 21.1

If you deployed HTML pages prior to P4V 21.1 and want to use the newer functionality, deploy the latest p4vjs.js script.

If you only need to support P4V 21.1 and later, you no longer need to deploy p4vjs.js, and you no longer need to include p4vjs.js in your code. See the examples in the <installation_root>\Perforce\P4VResources\p4vjs or <installation_root>/Perforce/P4VResources/p4vjs folder.

Note

Running or developing P4VJS HTML pages in a Browser outside P4V is no longer supported.

Restricting pages hosted by P4V

In P4V, HTML Tools Preferences the "Limit access to these targets only" dialog lets the user specify the Permitted Base URLs that are allowed to be hosted by P4V. However, the administrator can override the user's list of permitted base URLs. To do so, the adminstrator sets the P4VJS.HTMLAllowList property that is documented under Feature-related P4V properties in the Helix Core Server Administrator Guide.

Note
  • To test an allowed list in P4V before deployment, consider using the Copy to Clipboard button of that dialog, which copies the property -a statement to the clipboard.

  • If the P4VJS.HTMLAllowList property is not set, there is no restriction on URLs.

  • Local files are always allowed to be hosted by P4V.

Tip

Additional ways to enforce security include:

p4 property -a -n P4VJS.HTMLAllowList -v "none" [ -u restricted-user | -g restricted-group ]

and

p4 property -a -n P4V.Features.HTMLTools -v "Off" [ -u restricted-user | -g restricted-group ]

Next step

Continue with Walkthrough of development and deployment.