Interface: tc

tc

This is the main entry point for Javascript API. It has been exposed globally so can be accessed in the Browsers console simply by typing 'tc'.
Source:

Methods

admin(facilityName) → {Admin}

Returns an object that represents a user with admin access. This is a convenience method for tc.facility(name).admin().
Parameters:
Name Type Description
facilityName string the name of the facility
Source:
Returns:
Type
Admin

adminFacilities() → {Array.<Facility>}

Returns a list of all the facilies where the user has admin access.
Source:
Returns:
Type
Array.<Facility>

cache() → {Cache}

Returns an object that can be used for caching
Source:
Returns:
Type
Cache

config() → {object}

Returns the site configuration in topcat.json
Source:
Returns:
the topcat.json site configuration
Type
object

facilities() → {Array.<Facility>}

Returns an array of all the available facilities
Source:
Returns:
Type
Array.<Facility>

facility(name) → {Facility}

Returns a facility by name.
Parameters:
Name Type Description
name string The name of the facility as it appears on the database
Source:
Returns:
Type
Facility

getConfVar(name, options) → {Promise.<object>}

Gets a json object stored on the Topcat server.
Parameters:
Name Type Description
name string the name of the json object
options object as specified in the Angular documentation
Source:
Returns:
resolves when purging is complete
Type
Promise.<object>

getConfVar(name, timeout) → {Promise.<object>}

Gets a json object stored on the Topcat server.
Parameters:
Name Type Description
name string the name of the json object
timeout Promise will cancel request if resolved
Source:
Returns:
resolves when purging is complete
Type
Promise.<object>

getConfVar(name) → {Promise.<object>}

Gets a json object stored on the Topcat server.
Parameters:
Name Type Description
name string the name of the json object
Source:
Returns:
resolves when purging is complete
Type
Promise.<object>

icat(facilityName) → {Icat}

Returns an object that represents an Icat. This is a convenience method for tc.facility(name).icat().
Parameters:
Name Type Description
facilityName string the name of the facility
Source:
Returns:
Type
Icat

ids(facilityName) → {IDS}

Returns an object that represents an IDS. This is a convenience method for tc.facility(name).ids().
Parameters:
Name Type Description
facilityName string the name of the facility
Source:
Returns:
Type
IDS

nonUserFacilities() → {Array.<Facility>}

Returns a list of all the facilies where the user is not logged in.
Source:
Returns:
Type
Array.<Facility>

purgeSessions() → {Promise}

Removes any non valid sessions.
Source:
Returns:
resolves when purging is complete
Type
Promise

refresh()

Clears all caches and broadcasts a global:refresh event (on $rootScope).
Source:
Parameters:
Name Type Description
facilityNames Array.<string> the names of the facilities to search across as they appear on the database
query object as specified in the Icat documentation
options object {@ https://docs.angularjs.org/api/ng/service/$http#usage|as specified in the Angular documentation}
Source:
Returns:
Type
Promise.<Array.<IcatEntity>>
Parameters:
Name Type Description
facilityNames Array.<string> the names of the facilities to search across as they appear on the database
timeout Promise will cancel request if resolved
query object as specified in the Icat documentation
Source:
Returns:
Type
Promise.<Array.<IcatEntity>>
Parameters:
Name Type Description
facilityNames Array.<string> the names of the facilities to search across as they appear on the database
query object as specified in the Icat documentation
Source:
Returns:
Type
Promise.<Array.<IcatEntity>>
Parameters:
Name Type Description
facilityNames Array.<string> the names of the facilities to search across as they appear on the database
target string the entity type e.g. 'investigation', 'dataset' or 'datafile'
text string the search phrase
Source:
Returns:
Type
Promise.<Array.<IcatEntity>>

setMonitoring(enable)

Enables/disables monitor reports in the browser console. When enabled, regular console messages show the max length and wait time for the low-priority queue.
Parameters:
Name Type Description
enable bool or disable monitoring
Source:

smartclient(facilityName) → {Smartclient}

Returns an object that represents a smartclient. This is a convenience method for tc.facility(name).admin().
Parameters:
Name Type Description
facilityName string the name of the facility
Source:
Returns:
Type
Smartclient

ui() → {UI}

Returns an object that is used to alter the Topcat interface.
Source:
Returns:
Type
UI

user(facilityName) → {User}

Returns an object that represents a general topcat user. This is a convenience method for tc.facility(name).admin().
Parameters:
Name Type Description
facilityName string the name of the facility
Source:
Returns:
Type
User

userFacilities() → {Array.<Facility>}

Returns a list of all the facilies where the user is logged in.
Source:
Returns:
Type
Array.<Facility>

version() → {Promise.<string>}

Source:
Returns:
Type
Promise.<string>