Skip to content
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
24 changes: 23 additions & 1 deletion package-lock.json

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

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
"main": "server/dist/server/code.js",
"type": "module",
"scripts": {
"build": "npm run-script build-server && npm run-script build-client",
"build-client": "cd public && npm install && npm run-script build",
"build-server": "cd server && npm install && npm run-script build",
"prebuild": "run-script-os",
"prebuild:windows": "tools\\_prebuild.bat",
"prebuild:default": "./tools/_prebuild.sh",
"postbuild": "git checkout shared/version.ts",
"build": "npm ci && npm run-script prebuild && npm run-script build-server && npm run-script build-client && npm run-script postbuild",
"build-client": "cd public && npm ci && npm run-script build",
"build-server": "cd server && npm ci && npm run-script build",
"start-client": "cd public && npm run-script start",
"start-server": "cd server && npm run-script start",
"test": "cd server && npx mocha --import=./_mocha_register.js",
"log": "az webapp log tail --resource-group keyman --name com-keyman-status"
},
"author": "Marc Durdin",
"license": "MIT"
"license": "MIT",
"devDependencies": {
"run-script-os": "^1.1.6"
}
}
2 changes: 2 additions & 0 deletions public/src/app/data/data.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface OtherSites {
export class DataModel {
status: Status = EMPTY_STATUS;

serverBuildVersion: string = '';

serviceState: {service: ServiceIdentifier, state: ServiceState, message?: string}[];

platforms: PlatformSpec[] = JSON.parse(JSON.stringify(platforms)); // makes a copy of the constant platform data for this component
Expand Down
4 changes: 4 additions & 0 deletions public/src/app/home/home.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
overflow-y: scroll;
}

#navbar-reload-page-link {
margin-left: 16px;
}

.navbar-phase {
background: rgb(240,240,240);
border-radius: 3px;
Expand Down
4 changes: 4 additions & 0 deletions public/src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<div class="navbar-header">
<span class="navbar-brand">
<app-service-state-popup [serviceState]="serviceState"></app-service-state-popup>
@if (clientBuildVersion != data.serverBuildVersion) {
<a class="btn btn-sm btn-warning" id='navbar-reload-page-link' href="javascript:void(0)" (click)="reloadPage()"
title="A new version of status.keyman.com is available - current sha: {{clientBuildVersion}} / new sha: {{data.serverBuildVersion}}">Reload page</a>
}
</span>
<span class="navbar-phase">
<a target='_blank' href='https://github.com/keymanapp/keyman/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+milestone%3A{{phase?.title}}+org%3Akeymanapp'>{{phase?.title}}</a>
Expand Down
11 changes: 7 additions & 4 deletions public/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class HomeComponent {
title = 'Keyman Status';

activeTab = 'overview';
clientBuildVersion = buildVersion;

TIMER_INTERVAL = 60000; //msec //TODO: make this static for dev side?

Expand Down Expand Up @@ -71,10 +72,8 @@ export class HomeComponent {
this.zone.run(() => {
if(data.startsWith('version:')) {
const json = JSON.parse(data.substring('version:'.length));
console.log(`Server version: ${json.buildVersion}; client version: ${buildVersion}`);
if(json.buildVersion != buildVersion) {
window.location.reload();
}
this.data.serverBuildVersion = json.buildVersion;
console.log(`Server version: ${this.data.serverBuildVersion}; client version: ${this.clientBuildVersion}`);
} else if(data.startsWith('service-state:')) {
const json = JSON.parse(data.substring('service-state:'.length));
this.data.updateServiceState(json);
Expand All @@ -90,6 +89,10 @@ export class HomeComponent {
this.statusService.refreshBackend();
}

reloadPage() {
window.location.reload();
}

refreshStatus(source: ServiceIdentifier) {
// Suck in Keyman Status from code.js (server side)
this.statusService.getStatus(source, this.sprintOverride)
Expand Down
1 change: 1 addition & 0 deletions shared/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// WARNING: this file is overwritten during builds (see _prebuild.bat/.sh)
export const buildVersion = '1.0';
4 changes: 4 additions & 0 deletions tools/_prebuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
for /f %%i in ('git rev-parse HEAD') do set NEWVERSION=%%i
echo "Setting build version to %NEWVERSION%"
echo export const buildVersion = '%NEWVERSION%'; > shared\version.ts
4 changes: 4 additions & 0 deletions tools/_prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
NEWVERSION="$(git rev-parse HEAD)"
echo "Writing version '$NEWVERSION' to version.ts"
echo "export const buildVersion = '$NEWVERSION';" > shared/version.ts
Loading