Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add createdat date #76

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: cd viewer && npm ci

- name: Build Angular app
run: cd viewer && npm run build -- --configuration production
run: cd viewer && npm run timestamp && npm run build -- --configuration production

- name: upload artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion viewer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"ignorePatterns": ["projects/**/*", "tools/*"],
"overrides": [
{
"files": ["*.ts"],
Expand Down
8 changes: 7 additions & 1 deletion viewer/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
"namedChunks": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
}
},
"defaultConfiguration": "production"
Expand Down
128 changes: 128 additions & 0 deletions viewer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"validate": "node tools/validate.mjs",
"validate:watch": "nodemon --watch ../data tools/validate.mjs",
"schema": "node tools/schema.mjs",
"lint": "ng lint"
"lint": "ng lint",
"timestamp": "node tools/generate-build-time.mjs"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -56,6 +57,7 @@
"karma-jasmine-html-reporter": "~2.1.0",
"nodemon": "^3.0.1",
"postcss": "^8.4.24",
"replace-in-file": "^7.0.1",
"typescript": "~5.1.3"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
>
</mat-chip-listbox>
</div>
<span id="updateDate"
>Last update: {{ updatedAt | date : 'shortDate' }}</span
>
</div>
<section class="container">
<table mat-table [dataSource]="dataSource" matSort>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@

.table-header {
border-bottom: 1px solid #E0E0E0;
}

#updateDate {
padding-right: 10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppService, Resource } from '../app.service';
import { Format, Resources } from '../resources';
import { Filter, FilterComponent } from '../filter/filter.component';
import { MatPaginator } from '@angular/material/paginator';
import { environment } from 'src/environments/environment.development';

class ColumnHeader {
key!: string;
Expand All @@ -18,6 +19,7 @@ class ColumnHeader {
styleUrls: ['./credential-profile.component.scss'],
})
export class CredentialProfileComponent implements OnInit, AfterViewInit {
updatedAt!: Date;
data!: Format;
allColumns: ColumnHeader[] = [];
displayedColumns: string[] = [];
Expand All @@ -36,6 +38,7 @@ export class CredentialProfileComponent implements OnInit, AfterViewInit {
constructor(private dialog: MatDialog, public appService: AppService) {}

ngOnInit(): void {
this.updatedAt = new Date(environment.buildTime);
this.dataSource = new MatTableDataSource<any>();
this.data = this.appService.getFormat('Credential Profile');
this.allColumns = [];
Expand Down
3 changes: 3 additions & 0 deletions viewer/src/environments/environment.development.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
buildTime: new Date(),
};
3 changes: 3 additions & 0 deletions viewer/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
buildTime: '',
};
16 changes: 16 additions & 0 deletions viewer/tools/generate-build-time.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import replace from 'replace-in-file';

const buildTime = new Date().toISOString();

const options = {
files: 'src/environments/environment.ts',
from: /buildTime: '(.*)'/g,
to: `buildTime: '${buildTime}'`,
}

try {
replace(options).then(results => console.log('Replacement results:', results));
}
catch (error) {
console.error('Error occurred:', error);
}