Function
Static Public Summary | ||
public |
cancelRestRequests(category: *) |
|
public |
capitalize(str: *): * Capitalize the first character of a string. |
|
public |
Prompt the user to confirm an action. |
|
public |
defineFlags(options: Array, allOption: string): Object Create a set of flags that can be OR'd (|) together to define a set of options. |
|
public |
exposePluginConfig(pluginName: *, route: *) Expose a plugin configuration page via the admin plugins page. |
|
public |
fetchCurrentUser(): * |
|
public |
formatCount(n: integer, opts: Object): * Like formatSize, but more generic. |
|
public |
formatDate(datestr: *, resolution: *): * Format a date string to the given resolution. |
|
public |
formatSize(sizeBytes: *): * Format a size in bytes into a human-readable string with metric unit prefixes. |
|
public |
getApiRoot(): string Get the root path to the API. |
|
public |
getCurrentToken(): * |
|
public |
getCurrentUser(): * |
|
public |
getModelClassByName(name: *): * Return the model class name given its collection name. |
|
public |
getPluginConfigRoute(pluginName: *): * |
|
public |
getUploadChunkSize(): * |
|
public |
handleClose(name: *, options: *, nameId: *) |
|
public |
handleOpen(name: *, options: *, nameId: *) |
|
public |
localeComparator(model1: *, model2: *): * This comparator can be used by collections that wish to support locale-based sorting. |
|
public |
localeSort(a1: *, a2: *): * This comparator can be passed to the sort function on javascript arrays. |
|
public |
login(username: *, password: *, cors: *, otpToken: *): * Log in to the server. |
|
public |
logout(): * |
|
public |
numberOutstandingRestRequests(category: *): * |
|
public |
parseQueryString(queryString: *): * |
|
public |
registerPluginNamespace(pluginName: *, symbols: *) Expose the symbols for a girder plugin under the window.girder.plugins namespace. |
|
public |
restRequest(opts: Object): $.Promise Make a request to the REST API. |
|
public |
setApiRoot(root: string) Set the root path to the API. |
|
public |
setCurrentToken(token: *) |
|
public |
setCurrentUser(user: *) |
|
public |
setUploadChunkSize(val: *) |
|
public |
splitRoute(route: *): {"name": *, "base": *} |
|
public |
wrap(obj: *, funcName: *, wrapper: *) Wrap the prototype method of a given object. |
Static Private Summary | ||
private |
_whenAll(promises: *): * |
Static Public
public cancelRestRequests(category: *) source
import {cancelRestRequests} from '@girder/lint/src/rest.js'
Params:
Name | Type | Attribute | Description |
category | * |
public capitalize(str: *): * source
import {capitalize} from '@girder/lint/src/misc.js'
Capitalize the first character of a string.
Params:
Name | Type | Attribute | Description |
str | * |
Return:
* |
public confirm(params: Object) source
import {confirm} from '@girder/lint/src/dialog.js'
Prompt the user to confirm an action.
Params:
Name | Type | Attribute | Description |
params | Object |
|
Parameters controlling this function's behavior. |
params.text | String |
|
The text to prompt the user with. |
params.yesText | String |
|
The text for the confirm button. |
params.yesClass | String |
|
Class string to apply to the confirm button. |
params.noText | String |
|
The text for the no/cancel button. |
params.escapedHtml | Boolean |
|
If you want to render the text as HTML rather than plain text, set this to true to acknowledge that you have escaped any user-created data within the text to prevent XSS exploits. |
params.msgConfirmation | Boolean |
|
If you want to add a new security before perform an action. This will ask to enter a specific string "params.yesText params.name" |
params.additionalText | String |
|
Additional text to display before the confirmation input. |
params.name | String |
|
The name to enter in order to confirm an action. |
params.confirmCallback | Function |
|
Callback function when the user confirms the action. |
public defineFlags(options: Array, allOption: string): Object source
import {defineFlags} from '@girder/lint/src/misc.js'
Create a set of flags that can be OR'd (|) together to define a set of options.
public exposePluginConfig(pluginName: *, route: *) source
import {exposePluginConfig} from '@girder/lint/src/utilities/PluginUtils.js'
Expose a plugin configuration page via the admin plugins page.
Params:
Name | Type | Attribute | Description |
pluginName | * | The canonical plugin name, i.e. its directory name |
|
route | * | The route to trigger that will render the plugin config. |
public fetchCurrentUser(): * source
import {fetchCurrentUser} from '@girder/lint/src/auth.js'
Return:
* |
public formatCount(n: integer, opts: Object): * source
import {formatCount} from '@girder/lint/src/misc.js'
Like formatSize, but more generic. Returns a human-readable format of an integer using metric prefixes. The caller is expected to append any unit string if necessary.
Params:
Name | Type | Attribute | Description |
n | integer | The number to format. |
|
opts | Object |
|
Formatting options. These include:
|
Return:
* |
public formatDate(datestr: *, resolution: *): * source
import {formatDate} from '@girder/lint/src/misc.js'
Format a date string to the given resolution.
Params:
Name | Type | Attribute | Description |
datestr | * | The date string to format. |
|
resolution | * | The resolution, defaults to 'day'. Minimum is month. |
Return:
* |
public formatSize(sizeBytes: *): * source
import {formatSize} from '@girder/lint/src/misc.js'
Format a size in bytes into a human-readable string with metric unit prefixes.
Params:
Name | Type | Attribute | Description |
sizeBytes | * |
Return:
* |
public getApiRoot(): string source
import {getApiRoot} from '@girder/lint/src/rest.js'
Get the root path to the API.
This may be an absolute path, or a path relative to the application root. It will never include a trailing slash.
public getCurrentToken(): * source
import {getCurrentToken} from '@girder/lint/src/auth.js'
Return:
* |
public getModelClassByName(name: *): * source
import {getModelClassByName} from '@girder/lint/src/misc.js'
Return the model class name given its collection name.
Params:
Name | Type | Attribute | Description |
name | * | Collection name, e.g. 'user' |
Return:
* |
public getPluginConfigRoute(pluginName: *): * source
import {getPluginConfigRoute} from '@girder/lint/src/utilities/PluginUtils.js'
Params:
Name | Type | Attribute | Description |
pluginName | * |
Return:
* |
public getUploadChunkSize(): * source
import {getUploadChunkSize} from '@girder/lint/src/rest.js'
Return:
* |
public handleClose(name: *, options: *, nameId: *) source
import {handleClose} from '@girder/lint/src/dialog.js'
Params:
Name | Type | Attribute | Description |
name | * | ||
options | * | ||
nameId | * |
public handleOpen(name: *, options: *, nameId: *) source
import {handleOpen} from '@girder/lint/src/dialog.js'
Params:
Name | Type | Attribute | Description |
name | * | ||
options | * | ||
nameId | * |
public localeComparator(model1: *, model2: *): * source
import {localeComparator} from '@girder/lint/src/misc.js'
This comparator can be used by collections that wish to support locale-based sorting. The locale specifies how upper and lower case are compared.
Params:
Name | Type | Attribute | Description |
model1 | * | ||
model2 | * |
Return:
* |
public localeSort(a1: *, a2: *): * source
import {localeSort} from '@girder/lint/src/misc.js'
This comparator can be passed to the sort function on javascript arrays.
Params:
Name | Type | Attribute | Description |
a1 | * | ||
a2 | * |
Return:
* |
public login(username: *, password: *, cors: *, otpToken: *): * source
import {login} from '@girder/lint/src/auth.js'
Log in to the server. If successful, sets the value of currentUser and currentToken and triggers the "g:login" and "g:login.success". On failure, triggers the "g:login.error" event.
Params:
Name | Type | Attribute | Description |
username | * | The username or email to login as. |
|
password | * | The password to use. |
|
cors | * | If the girder server is on a different origin, set this to "true" to save the auth cookie on the current domain. Alternatively, you may set the global option "girder.corsAuth = true". |
|
otpToken | * | An optional one-time password to include with the login. |
Return:
* |
public numberOutstandingRestRequests(category: *): * source
import {numberOutstandingRestRequests} from '@girder/lint/src/rest.js'
Params:
Name | Type | Attribute | Description |
category | * |
Return:
* |
public parseQueryString(queryString: *): * source
import {parseQueryString} from '@girder/lint/src/misc.js'
Params:
Name | Type | Attribute | Description |
queryString | * |
Return:
* |
public registerPluginNamespace(pluginName: *, symbols: *) source
import {registerPluginNamespace} from '@girder/lint/src/pluginUtils.js'
Expose the symbols for a girder plugin under the window.girder.plugins namespace. Required since each plugin is loaded dynamically.
Params:
Name | Type | Attribute | Description |
pluginName | * | ||
symbols | * |
public restRequest(opts: Object): $.Promise source
import {restRequest} from '@girder/lint/src/rest.js'
Make a request to the REST API.
This is a wrapper around {@link http://api.jquery.com/jQuery.ajax/ $.ajax}, which also handles authentication and routing to the Girder API, and provides a default for error notification.
Most users of this method should attach a "done" handler to the return value. In cases where the server is ordinarily expected to return a non-200 status (e.g. validating user input), the "error: null" argument should probably be provided, and errors should be processed via an attached "fail" handler.
Before this function is called, the API root must be set (which typically happens automatically).
Params:
Name | Type | Attribute | Description |
opts | Object | Options for the request, most of which will be passed through to $.ajax. |
|
opts.url | string | The resource path, relative to the API root, without leading or trailing slashes. e.g. "user/login" |
|
opts.method | string |
|
The HTTP method to invoke. |
opts.data | string | Object |
|
The query string or form parameter object. |
opts.error | Function |
|
An error callback, as documented in {@link http://api.jquery.com/jQuery.ajax/ $.ajax}, or null. If not provided, this will have a default behavior of triggering a 'g:alert' global event, with details of the error, and logging the error to the console. It is recommended that you do not ever pass a non-null callback function, and handle errors via promise rejection handlers instead. |
opts.girderToken | string |
|
An alternative auth token to use for this request. |
Return:
$.Promise | A jqXHR promise, which resolves and rejects {@link http://api.jquery.com/jQuery.ajax/#jqXHR as documented by $.ajax}. |
public setApiRoot(root: string) source
import {setApiRoot} from '@girder/lint/src/rest.js'
Set the root path to the API.
Params:
Name | Type | Attribute | Description |
root | string | The root path for the API. |
public setCurrentToken(token: *) source
import {setCurrentToken} from '@girder/lint/src/auth.js'
Params:
Name | Type | Attribute | Description |
token | * |
public setCurrentUser(user: *) source
import {setCurrentUser} from '@girder/lint/src/auth.js'
Params:
Name | Type | Attribute | Description |
user | * |
public setUploadChunkSize(val: *) source
import {setUploadChunkSize} from '@girder/lint/src/rest.js'
Params:
Name | Type | Attribute | Description |
val | * |
public splitRoute(route: *): {"name": *, "base": *} source
import {splitRoute} from '@girder/lint/src/misc.js'
Params:
Name | Type | Attribute | Description |
route | * |
Return:
{"name": *, "base": *} |
public wrap(obj: *, funcName: *, wrapper: *) source
import {wrap} from '@girder/lint/src/utilities/PluginUtils.js'
Wrap the prototype method of a given object.
Params:
Name | Type | Attribute | Description |
obj | * | The object whose prototype to extend, e.g. MyView |
|
funcName | * | The name of the function to wrap, e.g. "render" |
|
wrapper | * | The wrapper function, which should be a function taking the underlying wrapped function as its first argument. The wrapped function should be called with .call(this[, arguments]) inside of the wrapper in order to preserve "this" semantics. |
Static Private
private _whenAll(promises: *): * source
import {_whenAll} from '@girder/lint/src/misc.js'
Params:
Name | Type | Attribute | Description |
promises | * |
Return:
* |