Skip to content

Commit

Permalink
fix(#2465): Replace time selection component in data explorer download (
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer authored Feb 9, 2024
1 parent e343f18 commit 5c4d6f8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 48 deletions.
3 changes: 3 additions & 0 deletions ui/src/app/core-ui/core-ui.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import { SelectDataMissingValuesComponent } from './data-download-dialog/compone
import { StatusWidgetComponent } from './status/status-widget.component';
import { SpSimpleMetricsComponent } from './monitoring/simple-metrics/simple-metrics.component';
import { SpSimpleLogsComponent } from './monitoring/simple-logs/simple-logs.component';
import { DateInputComponent } from './date-input/date-input.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -108,6 +109,7 @@ import { SpSimpleLogsComponent } from './monitoring/simple-logs/simple-logs.comp
declarations: [
ConfigureLabelsComponent,
DataDownloadDialogComponent,
DateInputComponent,
DisplayRecommendedPipe,
ObjectPermissionDialogComponent,
PipelineElementTemplateConfigComponent,
Expand Down Expand Up @@ -150,6 +152,7 @@ import { SpSimpleLogsComponent } from './monitoring/simple-logs/simple-logs.comp
exports: [
ConfigureLabelsComponent,
DataDownloadDialogComponent,
DateInputComponent,
PipelineElementTemplateConfigComponent,
StaticAnyInputComponent,
StaticPropertyComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,19 @@ <h5>Data Range</h5>

<div
fxLayout="row"
fxLayoutAlign="start center"
fxLayoutGap="10px"
class="ml-35"
*ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'"
>
<mat-form-field class="form-field-date">
<input
matInput
[owlDateTime]="dt1"
[owlDateTimeTrigger]="dt1"
[(ngModel)]="datePickerSelection"
[selectMode]="'range'"
(dateTimeChange)="setDateRangeFromSelection()"
/>
<mat-icon
matSuffix
[owlDateTimeTrigger]="dt1"
*ngIf="
dataExportConfig.dataRangeConfiguration === 'customInterval'
"
>
event
</mat-icon>
<mat-icon
matSuffix
class="event-color"
*ngIf="
dataExportConfig.dataRangeConfiguration !== 'customInterval'
"
>
event
</mat-icon>
<owl-date-time #dt1></owl-date-time>
</mat-form-field>
<div>
<h5>From&nbsp;</h5>
<sp-date-input [(date)]="dataExportConfig.dateRange.startDate">
</sp-date-input>
</div>
<div>
<h5>To&nbsp;</h5>
<sp-date-input [(date)]="dataExportConfig.dateRange.endDate">
</sp-date-input>
</div>
</div>
</mat-radio-group>
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
* limitations under the License.
*
*/

.ml-35 {
margin-left: 35px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class SelectDataRangeComponent implements OnInit {
@Input() dataExplorerDataConfig: DataExplorerDataConfig;
@Input() dataExportConfig: DataExportConfig;

datePickerSelection: Date[] = [];

ngOnInit(): void {
if (!this.dataExportConfig.dateRange) {
this.initDateSelection();
Expand All @@ -46,19 +44,6 @@ export class SelectDataRangeComponent implements OnInit {
initDateSelection() {
const startDate = new Date();
startDate.setDate(startDate.getDate() - 5);
this.datePickerSelection[0] = startDate;
this.datePickerSelection[1] = new Date();
this.dataExportConfig.dateRange = new DateRange(
this.datePickerSelection[0],
this.datePickerSelection[1],
);
this.setDateRangeFromSelection();
}

private setDateRangeFromSelection() {
this.dataExportConfig.dateRange = new DateRange(
this.datePickerSelection[0],
this.datePickerSelection[1],
);
this.dataExportConfig.dateRange = new DateRange(startDate, new Date());
}
}
2 changes: 0 additions & 2 deletions ui/src/app/data-explorer/data-explorer.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ import { NgxEchartsModule } from 'ngx-echarts';
import { ImageViewerComponent } from './components/widgets/image/image-viewer/image-viewer.component';
import { ImageBarComponent } from './components/widgets/image/image-bar/image-bar.component';
import { ImageBarPreviewComponent } from './components/widgets/image/image-bar/image-bar-preview/image-bar-preview.component';
import { DateInputComponent } from './components/date-input/date-input.component';
import { SpEchartsWidgetComponent } from './components/widgets/base/echarts-widget.component';
import { SpValueHeatmapWidgetConfigComponent } from './components/widgets/value-heatmap/config/value-heatmap-chart-widget-config.component';
import { SpHistogramChartWidgetConfigComponent } from './components/widgets/histogram/config/histogram-chart-widget-config.component';
Expand Down Expand Up @@ -176,7 +175,6 @@ import { SpVisualizationConfigOuterComponent } from './components/widgets/utils/
DataExplorerVisualisationSettingsComponent,
WidgetDirective,
TooMuchDataComponent,
DateInputComponent,
SpEchartsWidgetComponent,
SpValueHeatmapWidgetConfigComponent,
SpHistogramChartWidgetConfigComponent,
Expand Down

0 comments on commit 5c4d6f8

Please sign in to comment.