Skip to content

Commit c1db8de

Browse files
committed
feat(cherrypick): dfdv2 support
1 parent 5b3a444 commit c1db8de

31 files changed

+779
-455
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"cycle":"2101","revision":"1","name":"Navigraph Avionics", "format": "dfd", "validityPeriod": "2021-01-25/2021-02-20"}
1+
{"cycle":"2401","revision":"1","name":"Navigraph Avionics", "format": "dfdv2", "validityPeriod": "2024-01-25/2024-02-21"}
Binary file not shown.

examples/aircraft/PackageSources/NavigationData/foo.txt

Whitespace-only changes.
Binary file not shown.

examples/gauge/Components/InterfaceSample.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
2323
private readonly loadingRef = FSComponent.createRef<HTMLDivElement>()
2424
private readonly authContainerRef = FSComponent.createRef<HTMLDivElement>()
2525

26-
private readonly activeDatabase = Subject.create<null>(null)
27-
// private readonly databases = ArraySubject.create<PackageInfo>([])
28-
// private readonly resetPackageList = Subject.create<boolean>(false)
2926
private readonly mainPageIndex = Subject.create(0)
30-
// private readonly selectedDatabaseIndex = Subject.create(0)
31-
private readonly selectedDatabase = Subject.create<NavigationDataStatus | null>(null)
27+
private readonly databaseInfo = Subject.create<NavigationDataStatus | null>(null)
3228

3329
private navigationDataInterface: NavigraphNavigationDataInterface
3430

@@ -62,9 +58,15 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
6258
class="bg-ng-background-400"
6359
active={this.mainPageIndex}
6460
pages={[
65-
[0, <Dashboard selectedDatabase={this.selectedDatabase} interface={this.navigationDataInterface} />],
61+
[0, <Dashboard databaseInfo={this.databaseInfo} interface={this.navigationDataInterface} />],
6662
[1, <TestPage interface={this.navigationDataInterface} />],
67-
[2, <AuthPage navigationDataInterface={this.navigationDataInterface} />],
63+
[
64+
2,
65+
<AuthPage
66+
navigationDataInterface={this.navigationDataInterface}
67+
setDatabaseInfo={value => this.databaseInfo.set(value)}
68+
/>,
69+
],
6870
]}
6971
/>
7072
</div>
@@ -80,7 +82,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
8082
this.navigationDataInterface.onReady(async () => {
8183
const activePackage = await this.navigationDataInterface.get_navigation_data_install_status()
8284

83-
this.selectedDatabase.set(activePackage)
85+
this.databaseInfo.set(activePackage)
8486

8587
// show the auth container
8688
this.authContainerRef.instance.style.display = "block"

examples/gauge/Components/Pages/Auth/Auth.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ComponentProps, DisplayComponent, FSComponent, Subscribable, VNode } from "@microsoft/msfs-sdk"
22
import {
33
DownloadProgressPhase,
4+
NavigationDataStatus,
45
NavigraphEventType,
56
NavigraphNavigationDataInterface,
67
} from "@navigraph/msfs-navigation-data-interface"
@@ -10,6 +11,7 @@ import { AuthService } from "../../../Services/AuthService"
1011
import { Dropdown } from "../../Dropdown"
1112

1213
interface AuthPageProps extends ComponentProps {
14+
setDatabaseInfo: (value: NavigationDataStatus) => void
1315
navigationDataInterface: NavigraphNavigationDataInterface
1416
}
1517

@@ -119,7 +121,7 @@ export class AuthPage extends DisplayComponent<AuthPageProps> {
119121
await this.props.navigationDataInterface.download_navigation_data(pkg.file.url)
120122

121123
// Update navigation data status
122-
// this.props.setActiveDatabase(await this.props.navigationDataInterface.get_active_package())
124+
this.props.setDatabaseInfo(await this.props.navigationDataInterface.get_navigation_data_install_status())
123125

124126
this.displayMessage("Navigation data downloaded")
125127
} catch (err) {

examples/gauge/Components/Pages/Dashboard/Dashboard.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ComponentProps, DisplayComponent, FSComponent, Subscribable, VNode } fr
22
import { NavigationDataStatus, NavigraphNavigationDataInterface } from "@navigraph/msfs-navigation-data-interface"
33

44
interface DashboardProps extends ComponentProps {
5-
selectedDatabase: Subscribable<NavigationDataStatus | null>
5+
databaseInfo: Subscribable<NavigationDataStatus | null>
66
interface: NavigraphNavigationDataInterface
77
}
88

@@ -12,15 +12,15 @@ export class Dashboard extends DisplayComponent<DashboardProps> {
1212
<div class="size-full flex flex-col">
1313
<p class="ml-2 mb-8 text-4xl">Dashboard</p>
1414
<div class="flex flex-row flex-grow flex-auto">
15-
<ActiveDatabase selectedDatabase={this.props.selectedDatabase} />
15+
<ActiveDatabase databaseInfo={this.props.databaseInfo} />
1616
</div>
1717
</div>
1818
)
1919
}
2020
}
2121

2222
interface ActiveDatabaseProps extends ComponentProps {
23-
selectedDatabase: Subscribable<NavigationDataStatus | null>
23+
databaseInfo: Subscribable<NavigationDataStatus | null>
2424
// : MappedSubscribable<boolean>
2525
}
2626

@@ -33,31 +33,31 @@ class ActiveDatabase extends DisplayComponent<ActiveDatabaseProps> {
3333
<div class="p-4 flex flex-col align-middle items-start flex-start space-y-6 vertical">
3434
<div class="flex flex-row space-x-2">
3535
<span class="text-2xl">Latest Cycle:</span>
36-
<span class="text-xl text-gray-400">{this.props.selectedDatabase.map(s => s?.latestCycle ?? "N/A")}</span>
36+
<span class="text-xl text-gray-400">{this.props.databaseInfo.map(s => s?.latestCycle ?? "N/A")}</span>
3737
</div>
3838
<div class="flex flex-col space-y-2">
3939
<p class="text-3xl">Bundled</p>
40-
<p class="text-2xl text-gray-400">{this.props.selectedDatabase.map(s => s?.status ?? "N/A")}</p>
40+
<p class="text-2xl text-gray-400">{this.props.databaseInfo.map(s => s?.status ?? "N/A")}</p>
4141
</div>
4242
<div class="flex flex-col space-y-2">
4343
<p class="text-3xl">Installed format</p>
4444
<p class="text-2xl text-gray-400">
45-
{this.props.selectedDatabase.map(
45+
{this.props.databaseInfo.map(
4646
s => `${s?.installedFormat ?? "N/A"} revision ${s?.installedRevision ?? "N/A"}`,
4747
)}
4848
</p>
4949
</div>
5050
<div class="flex flex-col space-y-2">
5151
<p class="text-3xl">Active path</p>
52-
<p class="text-2xl text-gray-400">{this.props.selectedDatabase.map(s => s?.installedPath ?? "N/A")}</p>
52+
<p class="text-2xl text-gray-400">{this.props.databaseInfo.map(s => s?.installedPath ?? "N/A")}</p>
5353
</div>
5454
<div class="flex flex-col space-y-2">
5555
<p class="text-3xl">Active cycle</p>
56-
<p class="text-2xl text-gray-400">{this.props.selectedDatabase.map(s => s?.installedCycle ?? "N/A")}</p>
56+
<p class="text-2xl text-gray-400">{this.props.databaseInfo.map(s => s?.installedCycle ?? "N/A")}</p>
5757
</div>
5858
<div class="flex flex-col space-y-2">
5959
<p class="text-3xl">Validity period</p>
60-
<p class="text-2xl text-gray-400">{this.props.selectedDatabase.map(s => s?.validityPeriod ?? "N/A")}</p>
60+
<p class="text-2xl text-gray-400">{this.props.databaseInfo.map(s => s?.validityPeriod ?? "N/A")}</p>
6161
</div>
6262
</div>
6363
</div>

0 commit comments

Comments
 (0)