Skip to content

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 command
  • this.parentTriggerFetchData() → reloads the SRS data
  • this.$emit('reload-event',command name); or this.$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 name
  • isVueComponent(name)
  • isEmptyObject(obj)
  • containsAny(suffixes, string)
  • endsWithAny(suffixes, string)
  • isMobile() - check if is mobile
  • uuidv4 - get UUID
  • images_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 from obj2 into obj1; issues a notification if a key is missing
  • tryFocus(selector) → sets focus on the specified element
  • getdownloadlink(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 clipboard
  • modelTemplate(text, model) → simple template engine
  • formatXml(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

  • formatTimeHH:mm (with UTC offset)
  • formatTimeLongHH:mm:ss (with UTC offset)
  • formatDateYYYY-MM-DD (with UTC offset)
  • formatDateLongYYYY-MM-DD HH:mm (with UTC offset)
  • formatDateUTCYYYY-MM-DD (UTC)
  • formatDateLongUTCYYYY-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 places
  • formatPrice3 → minimum three decimal places
  • formatPrice4 → two to four decimal places
  • formatPercent → appends "%"

String Extensions

  • String.prototype.replaceAll(strReplace, strWith)

Array Extensions

  • Array.prototype.remove -
  • Array.prototype.pamax - maxvalue
  • Array.prototype.pamin - minvalue
  • Array.prototype.pasum - sum
  • Array.prototype.pasumif - sum if
  • Array.prototype.pacountif - count if
  • Array.prototype.pacountdistinctif - count distinct if
  • Array.prototype.contains - Example ['banana', 'lemon', 'mango', 'pineapple'].contains(fruit)

Theme Functions

  • toggleTheme()
  • getTheme()
  • setTheme(theme)dark or light

Language Functions

  • toggleLang()
  • getLang()
  • setLang(lang)pl, en