-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Psilo
committed
Sep 20, 2021
1 parent
0f7837f
commit 9a14fef
Showing
5 changed files
with
242 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
export function toggleItem (item, array) { | ||
const index = array.indexOf(item) | ||
if (index === -1) { | ||
array.push(item) | ||
} else { | ||
array.splice(index, 1) | ||
} | ||
} | ||
export default { | ||
toggleItem: function (item, array) { | ||
const index = array.indexOf(item) | ||
if (index === -1) { | ||
array.push(item) | ||
} else { | ||
array.splice(index, 1) | ||
} | ||
}, | ||
|
||
export function removeItem (item, array) { | ||
const index = array.indexOf(item) | ||
if (index !== -1) { | ||
array.splice(index, 1) | ||
} | ||
} | ||
removeItem: function (item, array) { | ||
const index = array.indexOf(item) | ||
if (index !== -1) { | ||
array.splice(index, 1) | ||
} | ||
}, | ||
|
||
export function containsItem (item, array) { | ||
return array.indexOf(item) !== -1 | ||
} | ||
containsItem: function (item, array) { | ||
return array.indexOf(item) !== -1 | ||
}, | ||
|
||
/** | ||
* Returns the value itself, or an empty string, if the value was null or undefined. | ||
* @param value the value to sanitize | ||
*/ | ||
export function sanitize (value) { | ||
if (value === null || value === undefined) { | ||
return '' | ||
/** | ||
* Returns the value itself, or an empty string, if the value was null or undefined. | ||
* @param value the value to sanitize | ||
*/ | ||
sanitize: function (value) { | ||
if (value === null || value === undefined) { | ||
return '' | ||
} | ||
return value | ||
} | ||
return value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,50 @@ | ||
import store from '@/store' | ||
|
||
/** | ||
* Logs a message to the snackbar. | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param level the level to use ('error', 'warning') | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
export function log (message, group, level, status) { | ||
store.dispatch('gui/snackbar/snackbarEnqueue', { | ||
color: `${level}`, | ||
headingTKey: `message.${level}.heading`, | ||
descriptionTKey: `message.${level}.${group}`, | ||
status, | ||
message | ||
}, { root: true }) | ||
} | ||
export default { | ||
/** | ||
* Logs a message to the snackbar. | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param level the level to use ('error', 'warning') | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
log: function (message, group, level, status) { | ||
store.dispatch('gui/snackbar/snackbarEnqueue', { | ||
color: `${level}`, | ||
headingTKey: `message.${level}.heading`, | ||
descriptionTKey: `message.${level}.${group}`, | ||
status, | ||
message | ||
}, { root: true }) | ||
}, | ||
|
||
/** | ||
* Logs a success message to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
export function success (message, group, status?) { | ||
log(message, group, 'success', status) | ||
} | ||
/** | ||
* Logs a success message to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
success: function (message, group, status?) { | ||
this.log(message, group, 'success', status) | ||
}, | ||
|
||
/** | ||
* Logs a warning to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
export function warning (message, group, status?) { | ||
log(message, group, 'warning', status) | ||
} | ||
/** | ||
* Logs a warning to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
warning: function (message, group, status?) { | ||
this.log(message, group, 'warning', status) | ||
}, | ||
|
||
/** | ||
* Logs an error to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
export function error (message, group, status?) { | ||
log(message, group, 'error', status) | ||
/** | ||
* Logs an error to the snackbar | ||
* @param message the message to log | ||
* @param group the group to use ('internal', 'communication', ...) which is a path in the message-object in localization. | ||
* @param status the status-code (integer) (may be omitted) | ||
*/ | ||
error: function (message, group, status?) { | ||
this.log(message, group, 'error', status) | ||
} | ||
} |
Oops, something went wrong.