P4VJS User Guide (2019.2)

Demo examples

In demo mode, P4V includes the example custom HTML tabs and windows listed in the following table. All examples are written in core HTML/JavaScript and P4JsApi/P4VJS (no frameworks used).

Note

This is not production code. The intent is to demonstrate possible use cases for the P4VJS API.

Example type Name Description Available from

Tab

Downloads

Shows the Perforce Downloads page.

View menu

Blogs

Shows the Perforce Blogs page.

Products

Shows the Perforce Products page.

Demo P4V Images

Shows how to retrieve images from P4V. It ports a P4JsApi example to P4VJS by emulating synchronous requests.

Demo Run Queries

Shows how to run queries and display the result in an HTML table. This example uses built-in queries that parse the JSON result into an HTML table, but you can enter your own queries.

Demo Server Info

Runs the p4 info command to show how to port a P4JsApi example to P4VJS in different files:

  • serverinfo1.html: Emulates synchronous requests
  • Serverinfo2.html: Implements an anonymous inline callback
  • Serverinfo3.html: Implements a named callback function

Window

Demo Connection Info

Runs the p4 info command.

Tools menu

Demo File Info

Shows how to handle multi-selection and run a series of commands.

Demo Submit

Shows the basic implementation of a Submit window.

Demo Edit Branch/Workspace/Job/Stream

Demonstrates how to create and populate a dynamic form (a FormSpec). This example consists of one HTML file registered as different HTML windows to support different selected object types.

Note

In demo mode, P4V does not save any changes you make using the Manage HTML Windows and Manage HTML Tabs editors.

The following folder provides a set of P4JsApi examples ported as P4VJS examples: <installation_root>\Perforce\P4VResources\p4vjs or <installation_root>/Perforce/P4VResources/p4vjs

For more information, see the P4JSAPI to P4VJS Conversion Guide.