Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 3.97 KB

CONTRIBUTING.md

File metadata and controls

44 lines (26 loc) · 3.97 KB

Azure Video Analyzer Extension for VS Code

Usage

Ensure you can access internal resources with npm run refreshVSToken, then install the dependencies using npm install.

Run in VS Code

Run npm run compile and press F5 in VS Code. You should see the extension in the bottom right, expand it if needed.

Run in Browser for Development

Run npm run dev and a new browser window should open with the editor. Changes to files will trigger a rebuild and refresh the browser. This view will only show the topology editor. To test all functionality, you need to run the actual extension as explained above.

Notes

Static Definition Files

To avoid redundant recalculation of the list of available nodes shown in the sidebar and the information about each, this information is pre-computed and stored on disk. The definitions are derived from the Swagger JSON for Video Analyzer. You should be able to find it in the azure-rest-api-specs repo.

During this pre-computation, two files are generated in the src/definitions/data folder: nodes.json and i18n.en.json. The second file contains all localizable description strings extracted from the node definitions. nodes.json only contains placeholders, the descriptions are localized when the editor runs.

If needed (for example when a new version is released), create a new folder in tools/definition-generator for the version you are introducing. Add a VideoAnalyzer.json file with the updated Swagger definitions and a list usableNodes.json. Update tools/definition-generator/entry.ts with the version you are targeting and run npm run create-definitions to create the a new set of pre-computed files.

Only new values are added to the i18n.en.json file. Already localized values are left unchanged. To regenerate this file from scratch, delete it and rerun the definition generator. You can also regenerate specific keys by deleting them from the file and running the command. The nodes.json file is overwritten each time.

Type Definitions

src/data/index.ts contains type TypeScript definitions automatically generated using AutoRest. See this document for more information on how to generate them.

  • Install AutoRest: npm install -g autorest
  • Download a copy of azure-rest-api-specs (clone or download as ZIP). You can just unzip the needed folder (VideoAnalyzer.Edge).
  • Navigate into the folder containing the LVA Swagger definition (probably cd specification/mediaservices/data-plane/VideoAnalyzer.Edge/BRANCH/VERSION),
  • Run autorest --typescript --input-file="VideoAnalyzer.json" --output-folder="output" --generate-metadata --enum-types=true --model-date-time-as-string=true
  • Open the generated index.ts file in output\src\models and make the following changes to fix errors:
    • Remove the import statements
    • Remove type definitions including references to msRest.HttpResponse
    • Remove extends ServiceClientOptions

Theme

When run in VS Code, the editor will automatically adapt to the user's theme. Avoid using pre-defined colors and try to use var(--vscode-*) CSS variables defined by VS Code to theme UI elements. You can also add new variables scoped to the user's theme kind (light, dark, high contrast) in App.css.

Since the VS Code theme variables are not available when run in the browser for development mode, variables from the default light theme have been predefined in public/index.html.