moved pantacor deployment ID into the pantacor config interface

pull/93/head
Chris Veilleux 2022-09-14 13:12:01 -05:00
parent d360c9e964
commit 3f40c0b3e4
3 changed files with 14 additions and 15 deletions

View File

@ -50,7 +50,7 @@ export class DeviceDisplayComponent implements OnInit {
) { }
ngOnInit() {
if (!this.device.pantacorUpdateId) {
if (!this.device.pantacorConfig.deploymentId) {
this.softwareUpdateText = 'NO UPDATES AVAILABLE';
this.softwareUpdateDisabled = true;
} else {
@ -64,6 +64,17 @@ export class DeviceDisplayComponent implements OnInit {
return knownPlatform ? knownPlatform.displayName : device.platform;
}
applySoftwareUpdate() {
this.deviceService.applySoftwareUpdate(this.device.pantacorConfig.deploymentId).subscribe({
next: () => {
this.openSuccessSnackbar();
this.softwareUpdateText = 'NO UPDATES AVAILABLE';
this.softwareUpdateDisabled = true;
},
error: () => { this.openErrorSnackbar(); }
});
}
openErrorSnackbar() {
const config = new MatSnackBarConfig();
config.data = {type: 'error', message: 'An error occurred, device will not be updated.'};
@ -77,16 +88,4 @@ export class DeviceDisplayComponent implements OnInit {
this.snackbar.openFromComponent(SnackbarComponent, config);
}
applySoftwareUpdate() {
this.deviceService.applySoftwareUpdate(this.device.pantacorUpdateId).subscribe(
() => {
this.openSuccessSnackbar();
this.softwareUpdateText = 'NO UPDATES AVAILABLE';
this.softwareUpdateDisabled = true;
},
() => { this.openErrorSnackbar(); }
);
}
}

View File

@ -18,7 +18,7 @@ and limitations under the License.
import { City } from '@account/models/city.model';
import { Country } from '@account/models/country.model';
import { PantacorConfig } from '@account/models/pantacorConfig.model';
import { PantacorConfig } from '@account/models/pantacor-config.model';
import { Region } from '@account/models/region.model';
import { Timezone } from '@account/models/timezone.model';
import { WakeWord } from '@account/models/wake-word.model';
@ -40,5 +40,4 @@ export interface Device {
voice: Voice;
wakeWord: WakeWord;
pantacorConfig: PantacorConfig;
pantacorUpdateId: string;
}

View File

@ -20,6 +20,7 @@ export interface PantacorConfig {
autoUpdate: boolean;
ipAddress: string;
pantacorId: string;
deploymentId: string;
sshPublicKey: string;
releaseChannel: string;
}