Skip to content
Snippets Groups Projects
Commit 04e20995 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #15702 TIME 2:40 added version commit information

parent d513c8ff
No related branches found
No related tags found
No related merge requests found
......@@ -429,6 +429,9 @@
"workflowTemplateDeleted": "Workflow template deleted",
"entries": "entrie(s)",
"enterUserName": "Enter the last name / first name of a user",
"clearFilters": "Clear all filters"
"clearFilters": "Clear all filters",
"groupCompany": ", a Xelians group company",
"about": "About Maarch Parapheur",
"accessMenu": "Access menu"
}
}
\ No newline at end of file
}
......@@ -432,6 +432,9 @@
"font": "Police",
"color": "Couleur",
"langISO": "fr-FR",
"userName": "Nom / prénom de l'utilisateur"
"userName": "Nom / prénom de l'utilisateur",
"groupCompany": "société du groupe Xelians",
"about": "À propos de Maarch Parapheur",
"accessMenu": "Accéder au menu"
}
}
......@@ -72,6 +72,9 @@ $app->patch('/configurations/{id}', \Configuration\controllers\ConfigurationCont
$app->delete('/configurations/{id}', \Configuration\controllers\ConfigurationController::class . ':delete');
$app->get('/configurations/{id}/connection', \Configuration\controllers\ConfigurationController::class . ':testConnection');
// CommitInformation
$app->get('/commitInformation', \SrcCore\controllers\AuthenticationController::class . ':getGitCommitInformation');
//Documents
$app->post('/documents', \Document\controllers\DocumentController::class . ':create');
$app->get('/documents', \Document\controllers\DocumentController::class . ':get');
......
......@@ -370,4 +370,28 @@ class AuthenticationController
return true;
}
public function getGitCommitInformation(Request $request, Response $response)
{
$head = file_get_contents('.git/HEAD');
if ($head === false) {
return $response->withJson(['hash' => null]);
}
preg_match('#^ref:(.+)$#', $head, $matches);
$currentHead = trim($matches[1]);
if (empty($currentHead)) {
return $response->withJson(['hash' => null]);
}
$hash = file_get_contents('.git/' . $currentHead);
if ($hash === false) {
return $response->withJson(['hash' => null]);
}
$hash = explode("\n", $hash)[0];
return $response->withJson(['hash' => $hash]);
}
}
......@@ -60,6 +60,7 @@ import { DevToolComponent } from './service/debug/dev-tool.component';
import { DevLangComponent } from './service/debug/dev-lang.component';
import { DocumentDateListComponent } from './documentDateList/document-date-list.component';
import { DateOptionModalComponent } from './documentDateList/dateOption/date-option-modal.component';
import {VersionInformationComponent} from './versionInformation/version-information.component';
// ADMINISTRATION
......@@ -148,7 +149,8 @@ registerLocaleData(localeFr, 'fr-FR');
SignatureMethodModalComponent,
HistoryListComponent,
DocumentDateListComponent,
DateOptionModalComponent
DateOptionModalComponent,
VersionInformationComponent
],
imports: [
FormsModule,
......
<ion-content color="primary">
<mat-icon svgIcon="maarchLogo" class="maarchLogo"></mat-icon>
<ion-button *ngIf="signaturesService.mobileMode" class="menu-button" color="light" fill="outline" size="large" (click)="menu.open('left-menu')">Accéder au menu</ion-button>
</ion-content>
\ No newline at end of file
<mat-icon svgIcon="maarchLogo" class="maarchLogo" (click)="openInformationModal()" [title]="'lang.about' | translate"></mat-icon>
<ion-button *ngIf="signaturesService.mobileMode" class="menu-button" color="light" fill="outline" size="large" (click)="menu.open('left-menu')">
{{'lang.accessMenu' | translate}}
</ion-button>
</ion-content>
......@@ -5,6 +5,7 @@
transform: translate(-50%, -50%);
width: 250px;
height: auto;
cursor: pointer;
}
.menu-button {
......@@ -12,4 +13,4 @@
left: 50%;
top: 60%;
transform: translate(-50%, -50%);
}
\ No newline at end of file
}
import { Component, OnInit } from '@angular/core';
import { MenuController } from '@ionic/angular';
import { MenuController, ModalController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { SignaturesContentService } from '../service/signatures.service';
import { VersionInformationComponent } from '../versionInformation/version-information.component';
@Component({
templateUrl: 'home.component.html',
......@@ -13,8 +14,9 @@ export class HomeComponent implements OnInit {
constructor(
public signaturesService: SignaturesContentService,
private translate: TranslateService,
private menu: MenuController,
public translate: TranslateService,
public menu: MenuController,
public modalController: ModalController,
) { }
ngOnInit(): void {
......@@ -23,5 +25,11 @@ export class HomeComponent implements OnInit {
this.menu.open('left-menu');
}
async openInformationModal() {
const modal = await this.modalController.create({
component: VersionInformationComponent,
cssClass: 'my-custom-class'
});
await modal.present();
}
}
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-title>{{'lang.about' | translate}}</ion-title>
<ion-buttons slot="end">
<ion-button (click)="dismissModal()">
<ion-icon slot="icon-only" name="close-outline"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div style="padding: 10px">
<h3>Maarch Parapheur {{applicationVersion}} </h3>
<em>Version : <a target="blank" href="https://labs.maarch.org/maarch/MaarchParapheur/commit/{{commitHash}}">{{commitHash}}</a></em>
<hr />
<p><em>Copyright &copy; 2008-2020 Maarch SAS {{'lang.groupCompany' | translate}}</em></p>
</div>
</ion-content>
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { HttpClient } from '@angular/common/http';
import { SignaturesContentService } from '../service/signatures.service';
import { NotificationService } from '../service/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { FiltersService } from '../service/filters.service';
import { tap, catchError } from 'rxjs/operators';
import { AuthService } from '../service/auth.service';
import { of } from 'rxjs';
import { ModalController } from '@ionic/angular';
import {environment} from '../../core/environments/environment';
@Component({
selector: 'app-version-information',
templateUrl: 'version-information.component.html',
})
export class VersionInformationComponent implements OnInit {
commitHash: any = null;
applicationVersion: any;
constructor(private translate: TranslateService,
public http: HttpClient,
public sanitizer: DomSanitizer,
public notificationService: NotificationService,
public signaturesService: SignaturesContentService,
public authService: AuthService,
public filtersService: FiltersService,
public modalController: ModalController
) { }
async ngOnInit() {
this.applicationVersion = environment.VERSION;
await this.loadCommitInformation();
}
dismissModal() {
this.modalController.dismiss('cancel');
}
loadCommitInformation() {
return new Promise((resolve) => {
this.http.get('../rest/commitInformation').pipe(
tap((data: any) => {
this.commitHash = data.hash !== null ? data.hash : this.translate.instant('lang.undefined');
resolve(true);
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment