Skip to content

Commit

Permalink
add UI version to UI about page
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Sep 13, 2024
1 parent 4f42473 commit 7aa4d85
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions UI/package-lock.json

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

4 changes: 3 additions & 1 deletion UI/src/app/_components/about/about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ <h1>About</h1>
<div class="row mt-3">
<div class="col-xs-12 col-md-6 mt-3">
<div class="card p-3">
<h4>Version</h4>
<h4>Server Version</h4>
<b>{{socketService.version}}</b>
<h4>UI Version</h4>
<b>{{socketService.uiVersion}}</b>
</div>
</div>
<div class="col-xs-12 col-md-6 my-3">
Expand Down
5 changes: 5 additions & 0 deletions UI/src/app/_services/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class SocketService {
public remoteErrorOpt: boolean = true;
public initialDataLoaded = false;
public version?: string;
public uiVersion?: string;
public externalAddress?: string;
public interfaces: any[] = [];
public logs: LogItem[] = [];
Expand Down Expand Up @@ -156,6 +157,9 @@ export class SocketService {
this.socket.on("version", (version: string) => {
this.version = version;
});
this.socket.on('uiVersion', (uiVersion: string) => {
this.uiVersion = uiVersion;
});

this.socket.on("externalAddress", (externalAddress: string) => {
this.externalAddress = externalAddress;
Expand Down Expand Up @@ -359,6 +363,7 @@ export class SocketService {
this.socket.emit('get_error_reports');

this.socket.emit('version');
this.socket.emit('uiVersion');
this.socket.emit('externalAddress');
this.socket.emit('interfaces');
this.socket.emit('get_error_reports');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to make changes to the UI, you need to do the following:

When you make changes to the source code, the page in your browser will automatically reload.

The socket&#46;io / REST API requests the UI makes are automatically proxied to `http://localhost:4455`. That's the reason why the main server (see above) needs to be running.
The socket&#46;io requests the UI makes are automatically proxied to `http://localhost:4455`. That's the reason why the main server (see above) needs to be running.

Running `npm install` in the project's root folder (not in the UI directory) the UI is built automatically. As the UI's bundled dist files are excluded from the git repository in the `.gitignore` file, this is needed to ensure users which install TallyArbiter from source also have bundled UI dist. This dist is also served by the main server using `express.static()`.

Expand Down
13 changes: 5 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { Config } from './_models/Config';
import { bonjour } from './_helpers/mdns';

const version = findPackageJson(__dirname).next()?.value?.version || "unknown";
const uiVersion = findPackageJson(path.join(__dirname, '..', 'ui')).next()?.value?.version || "unknown";
const devmode = process.argv.includes('--dev') || process.env.NODE_ENV === 'development';

if(devmode) logger('TallyArbiter running in Development Mode.', 'info');
Expand Down Expand Up @@ -285,6 +286,10 @@ function initialSetup() {
socket.emit('version', version);
});

socket.on('uiVersion', () => {
socket.emit('uiVersion', uiVersion);
});

socket.on('externalAddress', () => {
socket.emit('externalAddress', currentConfig.externalAddress);
});
Expand Down Expand Up @@ -1383,25 +1388,17 @@ function initializeSource(source: Source): TallyInput {

function processSourceTallyData(sourceId: string, tallyData: SourceTallyData)
{
//console.log('got source tally data', tallyData);

writeTallyDataFile(tallyData);

for (const [address, busses] of Object.entries(tallyData)) {
//console.log('tally_data', sourceId, address, busses);
io.to('settings').emit('tally_data', sourceId, address, busses);
}

//console.log('currentSourceTallyData', currentSourceTallyData);


currentSourceTallyData = {
...currentSourceTallyData,
...tallyData,
};


console.log('currentSourceTallyData2', currentSourceTallyData);

for (const device of devices) {
UpdateDeviceState(device.id);
Expand Down

0 comments on commit 7aa4d85

Please sign in to comment.