diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index b33f28ac..7f57e125 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -33,6 +33,8 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64 + build-args: | + COMMIT=${{ github.sha }} push: true tags: | smartenergyplatform/web-ui:dev diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 998efa58..cc53e55c 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -33,6 +33,8 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64 + build-args: | + COMMIT=${{ github.sha }} push: true tags: | smartenergyplatform/web-ui:prod diff --git a/Dockerfile b/Dockerfile index 823fabe1..9870a640 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ RUN node --max_old_space_size=8192 $(npm bin)/ng build --configuration productio ## STAGE 2: Run nginx to serve application ## FROM nginx +ARG COMMIT="no commit provided" +ENV COMMIT=${COMMIT} RUN apt-get update && apt-get install -y curl ADD build-env.sh / COPY --from=builder /tmp/workspace/dist/senergy-web-ui/ /usr/share/nginx/html/ diff --git a/src/app/core/components/sidenav/sidenav.component.ts b/src/app/core/components/sidenav/sidenav.component.ts index 518c6a0d..1202e4f6 100644 --- a/src/app/core/components/sidenav/sidenav.component.ts +++ b/src/app/core/components/sidenav/sidenav.component.ts @@ -23,6 +23,7 @@ import { SidenavService } from './shared/sidenav.service'; import { SidenavSectionModel } from './shared/sidenav-section.model'; import { ResponsiveService } from '../../services/responsive.service'; import { fadeInAnimation } from '../../../animations/fade-in.animation'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'senergy-sidenav', diff --git a/src/app/core/components/toolbar/toolbar.component.html b/src/app/core/components/toolbar/toolbar.component.html index d2721449..49ae16d2 100644 --- a/src/app/core/components/toolbar/toolbar.component.html +++ b/src/app/core/components/toolbar/toolbar.component.html @@ -43,6 +43,11 @@ Settings + + + + diff --git a/src/app/modules/info/dialogs/info/info.component.spec.ts b/src/app/modules/info/dialogs/info/info.component.spec.ts new file mode 100644 index 00000000..93617f1e --- /dev/null +++ b/src/app/modules/info/dialogs/info/info.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InfoComponent } from './info.component'; + +describe('InfoComponent', () => { + let component: InfoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ InfoComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(InfoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/info/dialogs/info/info.component.ts b/src/app/modules/info/dialogs/info/info.component.ts new file mode 100644 index 00000000..c2420790 --- /dev/null +++ b/src/app/modules/info/dialogs/info/info.component.ts @@ -0,0 +1,22 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; +import { environment } from 'src/environments/environment'; + +@Component({ + selector: 'app-info', + templateUrl: './info.component.html', + styleUrls: ['./info.component.css'] +}) +export class InfoDialogComponent { + commit: string = "" + + constructor( + private dialogRef: MatDialogRef, + ) { + this.commit = environment.commit + } + + close(): void { + this.dialogRef.close(); + } +} diff --git a/src/app/modules/info/info.module.ts b/src/app/modules/info/info.module.ts new file mode 100644 index 00000000..1e23d96d --- /dev/null +++ b/src/app/modules/info/info.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { InfoDialogComponent } from './dialogs/info/info.component'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { FormsModule } from '@angular/forms'; +import { MatInputModule } from '@angular/material/input'; +import { MatButtonModule } from '@angular/material/button'; +import { FlexLayoutModule } from '@angular/flex-layout'; + + + +@NgModule({ + declarations: [ + InfoDialogComponent + ], + imports: [ + CommonModule, + MatDialogModule, + MatFormFieldModule, + MatInputModule, + MatButtonModule, + FlexLayoutModule + ] +}) +export class InfoModule { } diff --git a/src/app/modules/info/shared/info.service.spec.ts b/src/app/modules/info/shared/info.service.spec.ts new file mode 100644 index 00000000..0b18632c --- /dev/null +++ b/src/app/modules/info/shared/info.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { InfoService } from './info.service'; + +describe('InfoService', () => { + let service: InfoService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(InfoService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/modules/info/shared/info.service.ts b/src/app/modules/info/shared/info.service.ts new file mode 100644 index 00000000..a4517c58 --- /dev/null +++ b/src/app/modules/info/shared/info.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; +import { InfoDialogComponent } from '../dialogs/info/info.component'; + +@Injectable({ + providedIn: 'root' +}) +export class InfoService { + + constructor( + private dialog: MatDialog + ) { } + + openInfoDialog() { + const dialogConfig = new MatDialogConfig(); + dialogConfig.disableClose = false; + // dialogConfig.data = { + // name: name, + // permissions: permissionsIn, + // }; + const editDialogRef = this.dialog.open(InfoDialogComponent, dialogConfig); + + editDialogRef.afterClosed().subscribe(() => {}); +} +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index a49423ff..38a15506 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -29,6 +29,7 @@ export const environment = { configUrl: env.configUrl || 'http://localhost', theme: env.theme || 'senergy', title: env.title || 'SENERGY', + commit: env.commit || '', /** URLs **/ processIoUrl: '', smartServiceRepoUrl: '',