diff --git a/backend/cronRouter.php b/backend/cronRouter.php index eb2f1b3..a13e1f7 100644 --- a/backend/cronRouter.php +++ b/backend/cronRouter.php @@ -114,6 +114,11 @@ function job_schedule_availability() { $schedule["minutes"] <= $now["minutes"] && $now["minutes"] - $schedule["minutes"] <= 30 ){ + $availability_last_change = $db->select("SELECT availability_last_change FROM `".DB_PREFIX."_profiles` WHERE `id` = ?", [$user_id]); + if($availability_last_change === "manual" && $last_exec["day"] === $now["day"]){ + break; + } + if(!in_array($user_id,$schedules_users)) $schedules_users[] = $user_id; if(is_null($last_exec) || (is_array($last_exec) && $schedule["hour"] == $last_exec["hour"] ? $schedule["minutes"] !== $last_exec["minutes"] : true)/* && !in_array(date('Y-m-d'), $selected_holidays_dates)*/){ $last_exec_new = $schedule["day"].";".sprintf("%02d", $schedule["hour"]).":".sprintf("%02d", $schedule["minutes"]); diff --git a/frontend/.gitignore b/frontend/.gitignore index 105c00f..baf7fdf 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -44,3 +44,5 @@ testem.log # System Files .DS_Store Thumbs.db + +src/environments/versions.ts diff --git a/frontend/git.version.js b/frontend/git.version.js new file mode 100644 index 0000000..fa9cbde --- /dev/null +++ b/frontend/git.version.js @@ -0,0 +1,28 @@ +//based on https://stackoverflow.com/a/42199863 + +const { writeFileSync } = require('fs'); +const { promisify } = require('util'); +const { exec } = require('child_process'); +const exec_promise = promisify(exec); + +async function createVersionsFile(filename) { + const revision = (await exec_promise('git rev-parse --short HEAD')).stdout.toString().trim(); + const revision_timestamp = parseInt((await exec_promise('git log -1 --format="%at"')).stdout.toString().trim())*1000; + const branch = (await exec_promise('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); + const remote_url = (await exec_promise('git config --get remote.origin.url')).stdout.toString().trim(); + + console.log(`revision: '${revision}', revision_timestamp: '${revision_timestamp}', branch: '${branch}', remote_url: '${remote_url}'`); + + const content = +`// this file is automatically generated by git.version.js script +export const versions = { + revision: '${revision}', + revision_timestamp: ${revision_timestamp}, + branch: '${branch}', + remote_url: '${remote_url}' +};`; + + writeFileSync(filename, content, {encoding: 'utf8'}); +} + +createVersionsFile('src/environments/versions.ts'); \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d34067f..128a5d1 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -33,7 +33,7 @@ "@angular/compiler-cli": "~13.0.0", "@types/jasmine": "~3.10.0", "@types/node": "16.11.17", - "jasmine-core": "~3.10.0", + "jasmine-core": "4.0.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", @@ -6792,9 +6792,9 @@ } }, "node_modules/jasmine-core": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz", - "integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.0.0.tgz", + "integrity": "sha512-tq24OCqHElgU9KDpb/8O21r1IfotgjIzalfW9eCmRR40LZpvwXT68iariIyayMwi0m98RDt16aljdbwK0sBMmQ==", "dev": true }, "node_modules/jest-worker": { @@ -7038,6 +7038,12 @@ "karma-jasmine": ">=1.1" } }, + "node_modules/karma-jasmine/node_modules/jasmine-core": { + "version": "3.99.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.0.tgz", + "integrity": "sha512-+ZDaJlEfRopINQqgE+hvzRyDIQDeKfqqTvF8RzXsvU1yE3pBDRud2+Qfh9WvGgRpuzqxyQJVI6Amy5XQ11r/3w==", + "dev": true + }, "node_modules/karma-source-map-support": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz", @@ -17570,9 +17576,9 @@ } }, "jasmine-core": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz", - "integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.0.0.tgz", + "integrity": "sha512-tq24OCqHElgU9KDpb/8O21r1IfotgjIzalfW9eCmRR40LZpvwXT68iariIyayMwi0m98RDt16aljdbwK0sBMmQ==", "dev": true }, "jest-worker": { @@ -17794,6 +17800,14 @@ "dev": true, "requires": { "jasmine-core": "^3.6.0" + }, + "dependencies": { + "jasmine-core": { + "version": "3.99.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.0.tgz", + "integrity": "sha512-+ZDaJlEfRopINQqgE+hvzRyDIQDeKfqqTvF8RzXsvU1yE3pBDRud2+Qfh9WvGgRpuzqxyQJVI6Amy5XQ11r/3w==", + "dev": true + } } }, "karma-jasmine-html-reporter": { diff --git a/frontend/package.json b/frontend/package.json index e045320..c3d0ec0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,6 +2,8 @@ "name": "allerta-vvf", "version": "0.0.0", "scripts": { + "prestart": "node git.version.js", + "prebuild": "node git.version.js", "ng": "ng", "start": "ng serve", "build": "ng build --base-href=./", @@ -35,7 +37,7 @@ "@angular/compiler-cli": "~13.0.0", "@types/jasmine": "~3.10.0", "@types/node": "16.11.17", - "jasmine-core": "~3.10.0", + "jasmine-core": "4.0.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html index 1bdd2fe..b425710 100644 --- a/frontend/src/app/app.component.html +++ b/frontend/src/app/app.component.html @@ -7,4 +7,9 @@ - \ No newline at end of file + + + diff --git a/frontend/src/app/app.component.scss b/frontend/src/app/app.component.scss index 755653d..5d514a1 100644 --- a/frontend/src/app/app.component.scss +++ b/frontend/src/app/app.component.scss @@ -63,3 +63,14 @@ text-align: left; } } + +.footer { + background-color: rgba(0, 0, 0, 0.2); + font-style: italic; + margin-top: 2em; + margin-bottom: 0; +} + +.footer > :last-child { + margin-bottom: 0; +} diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index be55595..3d8c146 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { AuthService } from './_services/auth.service'; +import { versions } from 'src/environments/versions'; @Component({ selector: 'app-root', @@ -8,6 +9,10 @@ import { AuthService } from './_services/auth.service'; }) export class AppComponent { public menuButtonClicked = false; + public revision_datetime_string; + public versions = versions; - constructor(public auth: AuthService) {} + constructor(public auth: AuthService) { + this.revision_datetime_string = new Date(versions.revision_timestamp).toLocaleString(undefined, { day: '2-digit', month: '2-digit', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }); + } }