Core Functions
Notifications
app.$root.notifications.push({ color: 'xd-warning', text: '...', visible: true });
Vue AJAX Functions
axget(link, dataObject, config)
axpost(link, dataObject, config, callback)
axpostArray(link, dataObject, config, callback)
getUrl(url, data)
getQueryStringFromObject(obj)
Vue SRS Functions
SRS to array of objects:
convertSRSTableToObject(this.table)
→ returns[{ key: 'value', ... }]
convertSRSTablesToObject(this.api.tables)
→ returns{ tableName: [{ key: 'value', ... }, ...] }
convertSRSColumnsRowsToArray(this.table.columns, this.row)
→ returns[{ key: 'value', ... }]
findSRSTableAndConvertToObject(tablename)
→ returns the first matching table as an array of rows
Reload:
this.parentTriggerReloadEvent()
→ refreshes the parent commandthis.parentTriggerFetchData()
→ reloads the SRS datathis.$emit('reload-event',command name);
orthis.$parent.$emit('reload-event',command name);
Vue Helper Functions
hasRole(roleName)
→ checks if the user has the specified role (from JWT claims)getAppName()
→ retrieves the current application nameisVueComponent(name)
isEmptyObject(obj)
containsAny(suffixes, string)
endsWithAny(suffixes, string)
isMobile()
- check if is mobileuuidv4
- get UUIDimages_arr()
-['.apng', '.bmp', '.gif', '.ico', '.jpg', '.jpeg', '.jfif', '.pjpeg', '.pjp', '.png', '.svg', '.webp']
video_arr()
-['.mp4', '.mov']
stringToHexColor
hexColorWithTransparencytoHex
calculateForegroundColor
getQueryStringFromObject()
copyDivToClipboard()
checkAuth()
modifyObject(obj1, obj2, keys)
→ merges keys fromobj2
intoobj1
; issues a notification if a key is missingtryFocus(selector)
→ sets focus on the specified elementgetdownloadlink(id from repository, width)
debounce(func, wait, immediate)
isLocalHost()
eraseCookie(name)
getCookie(name)
setCookie(name, value, days)
logout()
isGuid(string)
toDateInputValue
getTextWidth(text, font)
copy_text(element)
→ copies text to clipboardmodelTemplate(text, model)
→ simple template engineformatXml(xml, tab)
→ formats XML;tab
is optional (default is"\t"
)
Filters (for formatting data)
Use in templates: { value | filter }
In JavaScript: this.$options.filters.formatDate(date)
Date and Time Formats
formatTime
→HH:mm
(with UTC offset)formatTimeLong
→HH:mm:ss
(with UTC offset)formatDate
→YYYY-MM-DD
(with UTC offset)formatDateLong
→YYYY-MM-DD HH:mm
(with UTC offset)formatDateUTC
→YYYY-MM-DD
(UTC)formatDateLongUTC
→YYYY-MM-DD HH:mm
(UTC)humanDate
→ e.g.,13 minutes ago
Obsolete: formatDateIso
, formatDateTime
Other Formats
capitalize
firstLetters
formatBytes
→ "Bytes", "KB", "MB", ..., "YB"formatK
→ "K", "M"formatPrice0
→ integer (0 decimal places)formatPrice
→ two decimal placesformatPrice3
→ minimum three decimal placesformatPrice4
→ two to four decimal placesformatPercent
→ appends "%"
String Extensions
String.prototype.replaceAll(strReplace, strWith)
Array Extensions
Array.prototype.remove
-Array.prototype.pamax
- maxvalueArray.prototype.pamin
- minvalueArray.prototype.pasum
- sumArray.prototype.pasumif
- sum ifArray.prototype.pacountif
- count ifArray.prototype.pacountdistinctif
- count distinct ifArray.prototype.contains
- Example['banana', 'lemon', 'mango', 'pineapple'].contains(fruit)
Theme Functions
toggleTheme()
getTheme()
setTheme(theme)
→dark
orlight
Language Functions
toggleLang()
getLang()
setLang(lang)
→pl
,en