Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[SAPUI5] Message Box

https://experience.sap.com/fiori-design-web/message-box/
https://sapui5.hana.ondemand.com/#/entity/sap.m.MessageBox
https://sapui5.hana.ondemand.com/#/api/sap.m.MessageBox

			onRemoveItem: function (oEvent) {
				const sPath = oEvent.getSource().getParent().getBindingContext().getPath()
				const oModel = this.getView().getModel()
				MessageBox.confirm(
					this.getModel("i18n").getProperty("MessageBoxText"), 
					{
						actions: [MessageBox.Action.YES, MessageBox.Action.NO],
						emphasizedAction: MessageBox.Action.YES,
						onClose: (sAnswer) => {
							if (sAnswer === MessageBox.Action.YES) oModel.remove(sPath)
						}
					}
				)
			},

[Terminal] Using rsync with –backup and –delete together

I’m using rsync to create backups from my NAS to an external HDD. The command looks like this:

rsync -azP --delete --exclude=/.zfs -b --backup-dir=Backup /mnt/nfs/photos/ /media/nocin/externalBackup/photos/ 
rsync parameterdescription
-a –archiveThis is equivalent to -rlptgoD. It is a quick way of saying you want recursion and
want to preserve almost everything.
-z –compressWith this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted
-PThe -P option is equivalent to –partial –progress. Its purpose is to make it much easier to specify these two options for a long transfer that may be interrupted.
–deleteThis tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side)
–excludeexclude files matching PATTERN
-b –backup-dirWith this option preexisting destination files are renamed with a ~ extension as each file is transferred. You can control where the backup file goes and what (if any) suffix gets appended using the –backup-dir and –suffix options.

But somehow it always created the Backup folder recursively again inside the Backup folder. So the first run created the /Backup folder, after the second run I’ve got /Backup/Backup, after the third run /Backup/Backup/Backup and so on..

The solution was to exclude the Backup directory using the --exclude command.

rsync -azP --delete --exclude=/.zfs --exclude=Backup -b --backup-dir=Backup /mnt/nfs/photos/ /media/nocin/externalBackup/photos/ 

I found a good explanation for this behaviour here: https://www.jveweb.net/en/archives/2011/02/using-rsync-and-cron-to-automate-incremental-backups.html

“If we are storing backups in the destination folder, or in a directory inside of the destination folder, the --delete parameter is going to delete old backups, as they are not in the source folder. Or attempt to as in the following situation:

Say, we already have a folder called backup inside of the destination directory, and we use rsync again, using --backup-dir=backup one more time. As rsync is going to attempt to delete every file and folder that is not in the source directory, it would backup the backup folder, which would create a backup folder inside our already existing backup folder, and then it would attempt to delete the backup folder and fail because it is using it to backup files.”

[Nextcloud] Docker upgrade 20.0.10 to 21.0.3

As always the nextcloud update failed for me…

After a quick search I found this post. Seems like using mariadb:latest is not a good idea anymore. After switching to mariadb:10.5 and manually turning the maintenance mode off I could proceed the update process.

$ docker exec --user www-data nextcloud-app_1 php /var/www/html/occ maintenance:mode --off
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled

[CAP] Add SQLite DB for development

# install SQLite
npm i sqlite3 -D 

# create db, save configuration in package.json, stores mock data into db
cds deploy --to sqlite:db/my-app.db

# test cds deploy command with --dry. Displays ever table and view it creates
cds deploy --to sqlite:db/my-app.db --dry

# get and overview of your tables with .tables
sqlite3 db/my-app.db .tables

# open and view newly created db
sqlite3 db/my-app.db -cmd .dump

# and select single field with
SELECT field FROM mytable WHERE mykeyfield= "00505601194D1EE9B7BFC518B85";

# update a field with
UPDATE mytable SET field = "test" WHERE mykeyfield= "00505601194D1EE9B7BFC518B85";

[ABAP] Provide values of a domain in a dropdown list on selection screen

  
  PARAMETER p_test TYPE c OBLIGATORY AS LISTBOX VISIBLE LENGTH 32 DEFAULT 1.

  INITIALIZATION.

  cl_reca_ddic_doma=>get_values( EXPORTING id_name   = 'Z_MYDOMAIN'
                                 IMPORTING et_values = DATA(lt_rsdomaval) ).

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = 'P_TEST'
      values = VALUE vrm_values( FOR dvalue IN lt_rsdomaval ( key  = dvalue-domvalue_l 
                                                              text = dvalue-ddtext ) ).

[ABAP] Read personnel area with text

  DATA p0001 TYPE p0001.
  cl_hcmfab_utilities=>read_infotype_record( EXPORTING iv_pernr = pernr
                                                       iv_infty = '0001'
                                             IMPORTING es_pnnnn = p0001 ).
  DATA(personnel_area_id)   = p0001-werks.
  DATA(personnel_area_text) = cl_hr_t500p=>read( p0001-werks )-name1.

Or using the class CL_HCMFAB_EMPLOYEE_API.

  DATA(lv_employee_details) = cl_hcmfab_employee_api=>get_instance( )->get_employee_details( iv_pernr          = pernr
                                                                                             iv_application_id = if_hcmfab_constants=>gc_application_id-mypersonaldata ).
  DATA(personnel_area_id)   = lv_employee_details-personnel_area_id.
  DATA(personnel_area_text) = lv_employee_details-personnel_area_text.