Skip to content

How to Use: Sites

Overview

This page explains the function of Pleasanter Code Assist that registers and updates source code on a site. It registers and updates scripts, server scripts, styles and HTML created and edited in Visual Studio Code on tables and folders.

Operation Steps

  1. In Visual Studio Code, use "Open Folder" to open the base folder you created in the setup steps.
  2. Create files in the folders under the sites folder. The file names are up to you. For the extensions, refer to the table below. The extensions can be changed in the settings. With Pleasanter Code Assist 1.3.0 and later, you can create subfolders in the folders under the sites folder.

    Type Folder Extension Remarks
    HTML htmls .html The extension can be changed with pleasanter-code-assist.fileExtensionMappings.html
    Script scripts .js The extension can be changed with pleasanter-code-assist.fileExtensionMappings.js
    Server script serverscripts .js The extension can be changed with pleasanter-code-assist.fileExtensionMappings.js
    Style styles .css The extension can be changed with pleasanter-code-assist.fileExtensionMappings.css

    An example of files created in the folders under the sites folder

  3. Write the meta information in the file you created. Write the meta information as a comment starting from the first line. You can insert a meta information template with the Ctrl+Alt+I key.

    Setting values

    Parameter Name Required Configuration Example Description
    @config Yes server.json Set the server connection information file you created in the setup steps
    @filename samplescript.js Specifies the file name. You can set the name of the file itself with the dedicated variables (*)
    @title Yes Sample script Sets the title of the script, server script, style or HTML. It is registered as the title in Manage Table
    @name Sample server script Valid for server scripts only. Sets the name of the server script. It is registered as the name in Manage Table
    @siteIds Yes 1234,5678 Sets the site IDs on which this source code is registered and updated. To set several, separate them with commas
    @siteTitles Yes WBS,Issue management Sets the titles of the sites set in siteIds. When you set several siteIds, set several of this parameter too
    @htmlPositionType Yes for HTML BodyScriptTop Specifies the insertion position of the HTML. Specify one of HeadTop / HeadBottom / BodyScriptTop / BodyScriptBottom as the value
    @disabled false Set true to disable it

    About the dedicated variables for the file name

    You can use the following variables when specifying @filename. When you set a variable, it is converted into the corresponding string and then registered or updated on Pleasanter. It is not converted in the source code file itself.

    Parameter Name Description
    ${psFileBasename} The name of the file itself
    ${psFileBasenameNoExt} The name of the file itself (without the extension)
    ${psFileExtname} The extension of the file itself

    Example of writing the meta information

    The following is an example of the meta information for a script.

    /*
       @config : connectionSetting.json
       @filename : autocalc.js
       @title : Automatic calculation of man-hours
       @siteIds : 123456
       @siteTitles : Business improvement table
    */
    
  4. Save the file. When you save it, the content of the source code is registered or updated on the specified site according to the settings in the meta information.

Specification of Registration and Update

The specification of the data registration and update by this function is as follows.

Operation Description
Read Data cannot be downloaded from Pleasanter
Register For the site identified by @siteIds (the site ID) and @siteTitles (the site title) in the meta information, if there is no data with the same title as @title (the title), which is used as the key, it is registered as new. The output destination and the conditions cannot be set from this function. Set them as appropriate from Manage Table.
Update For the site identified by @siteIds (the site ID) and @siteTitles (the site title) in the meta information, if there is data with the same title as @title (the title), which is used as the key, it is updated. The output destination and the conditions are not changed by this function. Change them from Manage Table.
Delete Data cannot be deleted. Either update @disabled in the meta information to true (disabled), or delete it from Manage Table.