Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Componentization #759

Merged
merged 30 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2e4dcde
[desktop]: Encapsulate p-checkbox into neb-checkbox
tiagohm Nov 29, 2024
196fad0
[desktop]: Encapsulate p-inputNumber into neb-input-number
tiagohm Nov 29, 2024
69e6f4b
[desktop]: Encapsulate pInputText into neb-input-text
tiagohm Nov 29, 2024
5bf753e
[desktop]: Encapsulate p-button and pButton into neb-button
tiagohm Nov 30, 2024
255568d
[desktop]: Encapsulate p-inputSwitch into neb-switch
tiagohm Dec 1, 2024
7bffacf
[desktop]: Encapsulate p-tag into neb-tag
tiagohm Dec 1, 2024
f808c54
[desktop]: Migrate to new control flow
tiagohm Dec 3, 2024
0845e39
[desktop]: Use neb-button on neb-device-chooser
tiagohm Dec 3, 2024
9ea517f
[desktop]: Encapsulate p-dropdown into neb-dropdown-enum
tiagohm Dec 4, 2024
f005543
[desktop]: Encapsulate p-dropdown into neb-dropdown-item
tiagohm Dec 7, 2024
4bff8ab
[desktop]: Make MoonComponent single file
tiagohm Dec 7, 2024
d4bc481
[desktop]: Make MapComponent single file
tiagohm Dec 7, 2024
312a22d
[desktop]: Make PathChooserComponent single file
tiagohm Dec 7, 2024
87d51bd
[desktop]: Make HistogramComponent single file
tiagohm Dec 7, 2024
d4f8cba
[desktop]: Make SlideMenuComponent single file
tiagohm Dec 7, 2024
0c88da2
[desktop]: Make DeviceNameComponent single file
tiagohm Dec 7, 2024
d61ae77
[desktop]: Make DeviceChooserComponent single file
tiagohm Dec 7, 2024
5257437
[desktop]: Make MenuItemComponent single file
tiagohm Dec 7, 2024
a5b3f19
[desktop]: Make CameraExposureComponent single file
tiagohm Dec 7, 2024
b95788f
[desktop]: Make DialogMenuComponent single file
tiagohm Dec 7, 2024
f8decad
[desktop]: Encapsulate p-dropdown into neb-dropdown
tiagohm Dec 7, 2024
b4eab83
[desktop]: Encapsulate p-dropdown into neb-dropdown
tiagohm Dec 8, 2024
46487c1
[desktop]: Encapsulate p-selectButton into neb-select-button-enum
tiagohm Dec 8, 2024
f2a1c64
[desktop]: Make CameraInfoComponent single file
tiagohm Dec 8, 2024
db80253
[desktop]: Make MenuBarComponent single file
tiagohm Dec 8, 2024
2b086a7
[desktop]: Make DeviceListMenuComponent single file
tiagohm Dec 8, 2024
fde3792
[desktop]: Make LocationComponent single file
tiagohm Dec 8, 2024
f72a347
[desktop]: Migrate to input/output signal
tiagohm Dec 8, 2024
692dbb4
[desktop]: Migrate to viewChild signal
tiagohm Dec 8, 2024
087b336
[desktop]: Fix property binding
tiagohm Dec 8, 2024
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
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/mounts/MountController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class MountController(
val id = pathParameters[ID].notNull()
val mount = connectionService.mount(id) ?: return
val rate = queryParameters["rate"].notNullOrBlank()
mountService.slewRate(mount, mount.slewRates.first { it.name == rate })
mountService.slewRate(mount, mount.slewRates.first { it.value == rate })
}

private fun move(ctx: RoutingContext) = with(ctx.call) {
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/mounts/MountMoveTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data class MountMoveTask(
LOG.d { debug("Mount Move started. mount={}, request={}", mount, request) }

mount.slewRates.takeIf { !request.speed.isNullOrBlank() }
?.find { it.name == request.speed }
?.find { it.value == request.speed }
?.also { mount.slewRate(it) }

start()
Expand Down
36 changes: 17 additions & 19 deletions desktop/src/app/about/about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
</div>
<div class="col-9 flex-column">
<p class="align-items-center flex font-bold gap-2 mb-0 mt-2 text-5xl">
Nebulosa
<p-tag
class="flex"
styleClass="text-lg"
[value]="version" />
<p-tag
class="flex"
styleClass="text-lg"
[value]="codename"
severity="success" />
<span>Nebulosa</span>
<neb-tag
size="large"
[label]="version" />
<neb-success
size="large"
[label]="codename" />
</p>
<p class="text-sm mt-0">
{{ description }}
Expand Down Expand Up @@ -57,13 +54,14 @@
<div
class="w-full flex flex-column overflow-y-auto py-2 gap-1"
style="height: 100px">
@for (dep of dependencies; track $index) {
<a
*ngIf="dep.link"
target="_blank"
[attr.href]="dep.link">
{{ dep.name }} ({{ dep.version }})
</a>
@for (dep of dependencies; track dep.name) {
@if (dep.link) {
<a
target="_blank"
[attr.href]="dep.link">
{{ dep.name }} ({{ dep.version }})
</a>
}
}
</div>
</p-tabPanel>
Expand All @@ -76,12 +74,12 @@
href="https://www.paypal.com/donate/?hosted_button_id=U8TGGJTKSZUCA">
<img
src="assets/images/donate-with-paypal-blue.svg"
style="height: 31px" />
style="height: 28px" />
</a>
<a
target="_blank"
href="https://github.com/sponsors/tiagohm">
<p-button
<neb-button
icon="mdi mdi-heart"
label="GitHub Sponsor" />
</a>
Expand Down
225 changes: 85 additions & 140 deletions desktop/src/app/alignment/alignment.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
[devices]="cameras"
[(device)]="camera"
(deviceChange)="cameraChanged()" />
<p-button
[text]="true"
<neb-button
[disabled]="!camera?.name || running"
icon="mdi mdi-cog"
(onClick)="showCameraDialog()"
size="small"
pTooltip="Camera"
tooltipPosition="bottom" />
(action)="showCameraDialog()"
tooltip="Camera" />
@if (tab === 0) {
<neb-device-chooser
title="MOUNT"
Expand Down Expand Up @@ -43,17 +40,18 @@
#cameraExposure
[info]="status" />

<div
*ngIf="method === 'TPPA'"
class="absolute flex flex-row align-items-center gap-1"
style="right: 8px; top: -2px">
<p-tag
value="RA: {{ tppaResult.rightAscension }}"
[severity]="tppaResult.failed ? 'danger' : 'info'" />
<p-tag
value="DEC: {{ tppaResult.declination }}"
[severity]="tppaResult.failed ? 'danger' : 'info'" />
</div>
@if (method === 'TPPA') {
<div
class="absolute flex flex-row align-items-center gap-1"
style="right: 8px; top: -2px">
<neb-tag
label="RA: {{ tppaResult.rightAscension }}"
[severity]="tppaResult.failed ? 'danger' : 'info'" />
<neb-tag
label="DEC: {{ tppaResult.declination }}"
[severity]="tppaResult.failed ? 'danger' : 'info'" />
</div>
}
</div>
</div>
<div class="grid relative">
Expand All @@ -62,64 +60,40 @@
<p-tabPanel header="TPPA">
<div class="grid mt-3">
<div class="col-5 gap-2 align-items-center">
<p-floatLabel class="w-full">
<p-dropdown
[options]="'PLATE_SOLVER' | dropdownOptions | enumDropdown"
[(ngModel)]="tppaRequest.plateSolver.type"
styleClass="p-inputtext-sm border-0"
optionLabel="label"
optionValue="value"
[autoDisplayFirst]="false"
(ngModelChange)="savePreference()" />
<label>Plate Solver</label>
</p-floatLabel>
<neb-dropdown-enum
label="Plate Solver"
[options]="'PLATE_SOLVER' | dropdownOptions"
[(value)]="tppaRequest.plateSolver.type"
(valueChange)="savePreference()" />
</div>
<div class="col-4 align-items-center">
<p-floatLabel>
<p-inputNumber
styleClass="p-inputtext-sm border-0 max-w-full"
[(ngModel)]="tppaRequest.stepDuration"
[showButtons]="true"
[min]="1"
[max]="60"
(ngModelChange)="savePreference()"
spinnableNumber />
<label>Step duration (s)</label>
</p-floatLabel>
<neb-input-number
label="Step duration (s)"
[min]="1"
[max]="60"
[(value)]="tppaRequest.stepDuration"
(valueChange)="savePreference()" />
</div>
<div class="col-3 flex flex-column align-items-center justify-content-start">
<p-floatLabel class="w-full">
<p-dropdown
[options]="'GUIDE_DIRECTION_WE' | dropdownOptions | enumDropdown"
[(ngModel)]="tppaRequest.stepDirection"
optionsLabel="label"
optionsValue="value"
styleClass="p-inputtext-sm border-0"
[autoDisplayFirst]="false"
(ngModelChange)="savePreference()" />
<label>Direction</label>
</p-floatLabel>
<neb-dropdown-enum
label="Direction"
[options]="'GUIDE_DIRECTION_WE' | dropdownOptions"
[(value)]="tppaRequest.stepDirection"
(valueChange)="savePreference()" />
</div>
<div class="col-5 align-items-center">
<p-floatLabel class="w-full">
<p-dropdown
[disabled]="!mount?.connected"
[options]="mount?.slewRates"
[(ngModel)]="tppaRequest.stepSpeed"
styleClass="p-inputtext-sm border-0"
optionLabel="label"
optionValue="name"
[autoDisplayFirst]="false"
(ngModelChange)="savePreference()" />
<label>Step speed</label>
</p-floatLabel>
<neb-dropdown-item
label="Step speed"
[disabled]="!mount?.connected"
[options]="mount?.slewRates ?? []"
[(value)]="tppaRequest.stepSpeed"
(valueChange)="savePreference()" />
</div>
<div class="col-7 flex align-items-center justify-content-center text-center gap-2 text-sm">
<p-checkbox
[binary]="true"
[(ngModel)]="tppaRequest.stopTrackingWhenDone"
<neb-checkbox
label="Stop tracking when done"
(ngModelChange)="savePreference()" />
[(value)]="tppaRequest.stopTrackingWhenDone"
(valueChange)="savePreference()" />
</div>
</div>
<div class="grid mt-2">
Expand All @@ -141,66 +115,51 @@
<div class="grid mt-2">
<div class="col-12 flex align-items-center justify-content-center gap-1">
@if (pausingOrPaused) {
<p-button
<neb-button
[disabled]="status === 'PAUSING'"
label="Unpause"
(onClick)="tppaUnpause()"
(action)="tppaUnpause()"
icon="mdi mdi-play"
severity="success"
size="small"
[text]="true" />
severity="success" />
} @else if (!running) {
<p-button
<neb-button
[disabled]="!camera || !camera.connected || !mount || !mount.connected || mount.parked || mount.parking || mount.slewing || running"
label="Start"
(onClick)="tppaStart()"
(action)="tppaStart()"
icon="mdi mdi-play"
severity="success"
size="small"
[text]="true" />
severity="success" />
} @else {
<neb-button
label="Pause"
(action)="tppaPause()"
icon="mdi mdi-pause"
severity="info" />
}
<p-button
*ngIf="running && !pausingOrPaused"
label="Pause"
(onClick)="tppaPause()"
icon="mdi mdi-pause"
severity="info"
size="small"
[text]="true" />
<p-button
<neb-button
[disabled]="!camera || !camera.connected || !mount || !mount.connected || !running"
label="Abort"
(onClick)="tppaStop()"
(action)="tppaStop()"
icon="mdi mdi-stop"
severity="danger"
size="small"
[text]="true" />
<p-button
severity="danger" />
<neb-button
[disabled]="!camera?.connected"
(onClick)="openCameraImage()"
(action)="openCameraImage()"
icon="mdi mdi-image"
[text]="true"
styleClass="ml-4"
pTooltip="View image"
tooltipPosition="bottom"
size="small" />
class="ml-4"
tooltip="View image"
tooltipPosition="top" />
</div>
</div>
</p-tabPanel>
<p-tabPanel header="DARV">
<div class="grid mt-3">
<div class="col-4">
<p-floatLabel>
<p-inputNumber
styleClass="p-inputtext-sm border-0 max-w-full"
[(ngModel)]="darvRequest.capture.exposureDelay"
[showButtons]="true"
[min]="1"
[max]="60"
(ngModelChange)="savePreference()"
spinnableNumber />
<label>Initial pause (s)</label>
</p-floatLabel>
<neb-input-number
label="Initial pause (s)"
[min]="1"
[max]="60"
[(value)]="darvRequest.capture.exposureDelay"
(valueChange)="savePreference()" />
</div>
<div class="col-4">
<neb-exposure-time
Expand All @@ -212,59 +171,45 @@
label="Drift for" />
</div>
<div class="col-4">
<p-floatLabel class="w-full">
<p-dropdown
[options]="'HEMISPHERE' | dropdownOptions | enumDropdown"
[(ngModel)]="preference.darvHemisphere"
styleClass="p-inputtext-sm border-0"
optionsLabel="label"
optionsValue="value"
[autoDisplayFirst]="false"
(ngModelChange)="savePreference()" />
<label>Hemisphere</label>
</p-floatLabel>
<neb-dropdown-enum
label="Hemisphere"
[options]="'HEMISPHERE' | dropdownOptions"
[(value)]="preference.darvHemisphere"
(valueChange)="savePreference()" />
</div>
</div>
<div class="grid mt-2">
<div class="col-12 flex align-items-center justify-content-center gap-1">
<p-button
<neb-button
[disabled]="!camera || !camera.connected || !guideOutput || !guideOutput.connected || running"
label="Start"
(onClick)="darvStart()"
(action)="darvStart()"
icon="mdi mdi-play"
severity="success"
size="small"
[text]="true" />
<p-button
severity="success" />
<neb-button
[disabled]="!camera || !camera.connected || !guideOutput || !guideOutput.connected || !running"
label="Abort"
(onClick)="darvStop()"
(action)="darvStop()"
icon="mdi mdi-stop"
severity="danger"
size="small"
[text]="true" />
<p-button
severity="danger" />
<neb-button
[disabled]="!camera?.connected"
(onClick)="openCameraImage()"
(action)="openCameraImage()"
icon="mdi mdi-image"
[text]="true"
styleClass="ml-4"
pTooltip="View image"
tooltipPosition="bottom"
size="small"
[text]="true" />
class="ml-4"
tooltip="View image"
tooltipPosition="top" />
</div>
</div>
</p-tabPanel>
</p-tabView>
</div>
<p-button
[text]="true"
<neb-button
severity="info"
icon="mdi mdi-information"
styleClass="absolute"
class="absolute"
[style]="{ right: '8px', top: '5px' }"
(onClick)="tab === 0 ? tppaInfo.toggle($event) : darvInfo.toggle($event)" />
(action)="tab === 0 ? tppaInfo.toggle($event) : darvInfo.toggle($event)" />

<p-overlayPanel
#tppaInfo
Expand Down
Loading
Loading