Global Configuration Object
The RISKSHEET application exposes configuration and context through window.risksheet:
Property Type Description window.risksheet.versionstringFull version string including build timestamp window.risksheet.shortVersionstringShort version string without build metadata window.risksheet.projectIdstringPolarion project identifier window.risksheet.canAdminbooleanWhether current user has admin permissions window.risksheet.debugbooleanDebug mode enabled (provides extended logging) window.risksheet.baseUrlstringBase URL of RISKSHEET application server window.risksheet.revisionstringCurrent revision being viewed (empty for HEAD) window.risksheet.currentRevisionstringLatest revision identifier
Configuration Data
Property Type Description window.risksheet.appConfigAppConfigComplete configuration object with columns, levels, data types, and settings window.risksheet.ratingsMap<string, Rating>Registry of rating scales (severity, occurrence, detection) window.risksheet.enumsMap<string, Enum>All enumeration types available in the project window.risksheet.relationsRelation[]Work item link relationship definitions window.risksheet.refsMap<string, Reference>Reference field enumerations
URL Template Functions
Function Parameters Returns Description window.risksheet.dataUrlTemplate(){baseUrl, projectId, documentId, revision}stringGenerates data service API URL for RISKSHEET data window.risksheet.risksheetUrlTemplate(){baseUrl, projectId, documentId, revision, comparingTo}stringGenerates shareable RISKSHEET URL with optional comparison
Example URL Construction
const dataUrl = window . risksheet . dataUrlTemplate ({
baseUrl: window . risksheet . baseUrl ,
projectId: 'PROJ001' ,
documentId: 'risksheet-v1' ,
revision: '2024-01-15'
});
// Result: /risksheet/api/data?project=PROJ001&doc=risksheet-v1&rev=2024-01-15
Settings and Application Config
Property Type Description window.risksheet.appConfig.columnsColumn[]Array of column definitions with headers, bindings, types window.risksheet.appConfig.levelsLevel[]Hierarchical levels configuration window.risksheet.appConfig.dataTypesDataTypeWork item types configuration (tasks, risks, etc.) window.risksheet.appConfig.reviewsReviewConfigReview workflow configuration window.risksheet.appConfig.globalGlobalSettingsGlobal settings (culture, help URL, refresh behavior) window.risksheet.appConfig.readonlybooleanRISKSHEET is in read-only mode (true for historical revisions)
Column Definition Structure
{
id : 'severity' ,
header : 'Severity' ,
type : 'enum' ,
binding : 'fields.severity' ,
width : 120 ,
sortable : true ,
filterable : true ,
editable : true ,
dataSource : 'SeverityEnum' ,
tooltip : 'Risk severity rating'
}
Level Configuration
Property Type Description namestringDisplay name for hierarchical level controlColumnstringColumn ID controlling expand/collapse zoomColumnstringColumn ID for zoom/focus operations showInMenubooleanDisplay this level in navigation menu
Data Type Configuration
{
task : {
type : 'Task' , // Polarion work item type
role : 'mitigates' , // Link role to parent risk
name : 'Mitigation Task' , // Display name
zoomColumn : 'id' ,
showInMenu : true
}
}
Review Manager Configuration
Property Type Description reviews.reviewManagerstringReview manager type: approval, comment, or workitem reviews.typePropertiesobjectType-specific review configuration
Accessing Enumerations
const severityEnum = window . risksheet . enums [ 'SeverityEnum' ];
if ( severityEnum ) {
severityEnum . values . forEach ( value => {
console . log ( ` ${ value . id } : ${ value . name } ` );
});
}
Working with Relations
const relations = window . risksheet . relations ;
const mitigatesRelation = relations . find ( r => r . role === 'mitigates' );
if ( mitigatesRelation ) {
console . log ( `From: ${ mitigatesRelation . fromType } ` );
console . log ( `To: ${ mitigatesRelation . toType } ` );
}
// Fetch document metadata
fetch ( ` ${ window . risksheet . baseUrl } /api/document` )
. then ( r => r . json ())
. then ( metadata => {
console . log ( 'Version:' , metadata . version );
console . log ( 'Revision:' , metadata . revision );
console . log ( 'License Status:' , metadata . licenseStatus );
});
Session Keep-Alive
Maintain session during long editing operations:
// Keep-alive endpoint prevents automatic logout
setInterval (() => {
fetch ( ` ${ window . risksheet . baseUrl } /api/keepalive` )
. catch ( e => console . error ( 'Keep-alive failed:' , e ));
}, 5 * 60 * 1000 ); // Every 5 minutes
Grid Data Access
Function Parameters Returns Description window.risksheet.getGridData()- Promise<GridData>Fetch current grid data and work items window.risksheet.refresh()- Promise<void>Refresh grid from server window.risksheet.exportData(){format}Promise<Blob>Export grid data in specified format
Read-Only Mode Detection
if ( window . risksheet . appConfig . readonly ) {
console . log ( 'RISKSHEET is in read-only mode' );
console . log ( 'Viewing revision:' , window . risksheet . revision );
}
Custom Renderer Integration
// Access column rendering context
const columnContext = {
column: window . risksheet . appConfig . columns [ 0 ],
data: rowData ,
settings: window . risksheet . appConfig
};
Event Handling
// Listen for configuration changes
document . addEventListener ( 'risksheet:config-changed' , ( event ) => {
console . log ( 'Config updated:' , event . detail . changes );
});
// Listen for data refresh
document . addEventListener ( 'risksheet:data-refreshed' , ( event ) => {
console . log ( 'Grid refreshed at:' , new Date ());
});
Culture and Localization
const culture = window . risksheet . appConfig . global . culture ;
console . log ( 'Current culture:' , culture ); // e.g., 'en-US', 'de-DE'
// Format dates according to culture
const formatter = new Intl . DateTimeFormat ( culture );
const formatted = formatter . format ( new Date ());
Debug Mode
When debug mode is enabled (window.risksheet.debug === true):
if ( window . risksheet . debug ) {
console . log ( 'Debug output enabled' );
console . log ( 'Full config:' , window . risksheet . appConfig );
console . log ( 'Available enums:' , window . risksheet . enums );
}
You can inspect the RISKSHEET configuration at runtime by opening the browser developer console and accessing window.risksheet directly. This is useful for debugging custom configurations and verifying that settings are loaded correctly.
The JavaScript API may change between versions. Always check window.risksheet.version before relying on specific properties. Properties marked as internal (prefixed with _) should not be used in custom code.
API calls from embedded contexts (IFRAME, nested documents) must respect CORS policies. Requests must originate from trusted domains configured in Polarion security settings.
Source Code
AppConfig.ts
risksheet.json
AppConfigParser.ts