mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
refresh LAN and more
This commit is contained in:
committed by
Aiden McClelland
parent
3e3097945f
commit
6585d91816
@@ -63,6 +63,7 @@ export abstract class ApiService {
|
||||
abstract shutdownServer (): Promise<Unit>
|
||||
abstract ejectExternalDisk (logicalName: string): Promise<Unit>
|
||||
abstract serviceAction (appId: string, serviceAction: ServiceAction): Promise<ReqRes.ServiceActionResponse>
|
||||
abstract refreshLAN (): Promise<Unit>
|
||||
}
|
||||
|
||||
export function isRpcFailure<Error, Result> (arg: { error: Error } | { result: Result}): arg is { error: Error } {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { modulateTime } from 'src/app/util/misc.util'
|
||||
import { Observable, of, throwError } from 'rxjs'
|
||||
import { catchError, mapTo } from 'rxjs/operators'
|
||||
import * as uuid from 'uuid'
|
||||
import { METHODS } from 'http'
|
||||
|
||||
@Injectable()
|
||||
export class LiveApiService extends ApiService {
|
||||
@@ -276,6 +277,10 @@ export class LiveApiService extends ApiService {
|
||||
return this.authRequest({ method: Method.POST, url: `apps/${appId}/actions`, data })
|
||||
}
|
||||
|
||||
async refreshLAN (): Promise<Unit> {
|
||||
return this.authRequest({ method: Method.POST, url: '/network/lan/reset' })
|
||||
}
|
||||
|
||||
private async authRequest<T> (opts: HttpOptions, overrides: Partial<{ version: string }> = { }): Promise<T> {
|
||||
if (!this.authenticatedRequestsEnabled) throw new Error(`Authenticated requests are not enabled. Do you need to login?`)
|
||||
|
||||
|
||||
@@ -242,6 +242,10 @@ export class MockApiService extends ApiService {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
refreshLAN (): Promise<Unit> {
|
||||
return mockRefreshLAN()
|
||||
}
|
||||
}
|
||||
|
||||
async function mockGetServer (): Promise<ReqRes.GetServerRes> {
|
||||
@@ -406,6 +410,11 @@ async function mockShutdownServer (): Promise<Unit> {
|
||||
return { }
|
||||
}
|
||||
|
||||
async function mockRefreshLAN (): Promise<Unit> {
|
||||
await pauseFor(1000)
|
||||
return { }
|
||||
}
|
||||
|
||||
const mockApiNotifications: ReqRes.GetNotificationsRes = [
|
||||
{
|
||||
id: '123e4567-e89b-12d3-a456-426655440000',
|
||||
|
||||
Reference in New Issue
Block a user