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

Kamu 172 set polling source add prepare/preprocess from UI #109

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NgbPopoverModule, NgbRatingModule } from "@ng-bootstrap/ng-bootstrap";
import { DisplayTimeModule } from "src/app/components/display-time/display-time.module";
import { MatChipsModule } from "@angular/material/chips";
import { MatDividerModule } from "@angular/material/divider";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetsTabComponent", () => {
let component: DatasetsTabComponent;
Expand All @@ -26,6 +27,7 @@ describe("DatasetsTabComponent", () => {
MatChipsModule,
NgbPopoverModule,
MatDividerModule,
SharedTestModule,
],
providers: [DatasetApi],
declarations: [DatasetsTabComponent, DatasetListItemComponent],
Expand Down
1 change: 1 addition & 0 deletions src/app/common/app.values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class AppValues {
public static readonly URL_PATTERN = /^(http:\/\/)|(https:\/\/)/i;
public static readonly SCHEMA_NAME_PATTERN =
/^[a-zA-Z0-9]+[a-zA-Z0-9\s(_)]*$/i;
public static readonly SPLIT_ARGUMENTS_PATTERN = /\w+|"[^"]+"/g;

public static readonly DISPLAY_DATE_FORMAT = "DD MMM YYYY";
public static readonly DISPLAY_TOOLTIP_DATE_FORMAT = "MMM D, YYYY, HH:mm A";
Expand Down
20 changes: 20 additions & 0 deletions src/app/common/base.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
import { inject } from "@angular/core";
import { ActivatedRoute, ParamMap } from "@angular/router";
import { DatasetInfo } from "../interface/navigation.interface";
import ProjectLinks from "../project-links";
import { requireValue } from "./app.helpers";
import { UnsubscribeOnDestroyAdapter } from "./unsubscribe.ondestroy.adapter";

export abstract class BaseComponent extends UnsubscribeOnDestroyAdapter {
public activatedRoute = inject(ActivatedRoute);

public get searchString(): string {
return window.location.search;
}

public getDatasetInfoFromUrl(): DatasetInfo {
const paramMap: ParamMap = this.activatedRoute.snapshot.paramMap;
return {
// Both parameters are mandatory in URL, router would not activate this component otherwise
accountName: requireValue(
paramMap.get(ProjectLinks.URL_PARAM_ACCOUNT_NAME),
),
datasetName: requireValue(
paramMap.get(ProjectLinks.URL_PARAM_DATASET_NAME),
),
};
}
}
28 changes: 5 additions & 23 deletions src/app/common/base.processing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ import {
} from "../dataset-view/dataset-view.interface";
import { searchAdditionalButtonsEnum } from "../search/search.interface";
import { NavigationService } from "./../services/navigation.service";
import { promiseWithCatch, requireValue } from "./app.helpers";
import { promiseWithCatch } from "./app.helpers";
import { BaseComponent } from "./base.component";
import { ActivatedRoute, ParamMap } from "@angular/router";
import ProjectLinks from "../project-links";
import { inject } from "@angular/core";

export class BaseProcessingComponent extends BaseComponent {
constructor(
protected navigationService: NavigationService,
protected modalService: ModalService,
protected activatedRoute: ActivatedRoute,
) {
super();
}
public navigationService = inject(NavigationService);
public modalService = inject(ModalService);

public showOwnerPage(ownerName: string): void {
this.navigationService.navigateToOwnerView(ownerName);
}
Expand Down Expand Up @@ -90,17 +85,4 @@ export class BaseProcessingComponent extends BaseComponent {
private onClickDeriveFrom(): void {
console.log("onClickDeriveFrom");
}

public getDatasetInfoFromUrl(): DatasetInfo {
const paramMap: ParamMap = this.activatedRoute.snapshot.paramMap;
return {
// Both parameters are mandatory in URL, router would not activate this component otherwise
accountName: requireValue(
paramMap.get(ProjectLinks.URL_PARAM_ACCOUNT_NAME),
),
datasetName: requireValue(
paramMap.get(ProjectLinks.URL_PARAM_DATASET_NAME),
),
};
}
}
7 changes: 7 additions & 0 deletions src/app/common/shared-test.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NgModule } from "@angular/core";
import { snapshotParamMapMock } from "./base-test.helpers.spec";

@NgModule({
providers: [snapshotParamMapMock],
})
export class SharedTestModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { emitClickOnElementByDataTestId } from "src/app/common/base-test.helpers
import { DisplayTimeModule } from "../display-time/display-time.module";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { AngularSvgIconModule } from "angular-svg-icon";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetListItemComponent", () => {
let component: DatasetListItemComponent;
Expand All @@ -28,6 +29,7 @@ describe("DatasetListItemComponent", () => {
DisplayTimeModule,
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import timekeeper from "timekeeper";

import { DisplayTimeComponent } from "./display-time.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DisplayTimeComponent", () => {
let component: DisplayTimeComponent;
Expand All @@ -24,6 +25,7 @@ describe("DisplayTimeComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DisplayTimeComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DisplayTimeComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { BlockHeaderComponent } from "./block-header.component";
import { Apollo } from "apollo-angular";
import { MatMenuModule } from "@angular/material/menu";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("BlockHeaderComponent", () => {
let component: BlockHeaderComponent;
Expand All @@ -14,7 +15,12 @@ describe("BlockHeaderComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [BlockHeaderComponent],
imports: [MatMenuModule, MatIconModule, MatDividerModule],
imports: [
MatMenuModule,
MatIconModule,
MatDividerModule,
SharedTestModule,
],
providers: [Apollo, DatasetApi],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { HttpClientTestingModule } from "@angular/common/http/testing";
import { TooltipIconComponent } from "../../../tooltip-icon/tooltip-icon.component";
import { MatIconModule } from "@angular/material/icon";
import { NgbTooltipModule } from "@ng-bootstrap/ng-bootstrap";
import { snapshotParamMapMock } from "src/app/common/base-test.helpers.spec";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("AddDataEventComponent", () => {
let component: AddDataEventComponent;
Expand All @@ -37,7 +37,6 @@ describe("AddDataEventComponent", () => {
BlockRowDataComponent,
TooltipIconComponent,
],
providers: [snapshotParamMapMock],
imports: [
DisplaySizeModule,
ApolloModule,
Expand All @@ -46,6 +45,7 @@ describe("AddDataEventComponent", () => {
ToastrModule.forRoot(),
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
})
.overrideComponent(AddDataEventComponent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DisplayHashModule } from "src/app/components/display-hash/dispaly-hash.
import { ToastrModule } from "ngx-toastr";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { AngularSvgIconModule } from "angular-svg-icon";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("BlockIntervalPropertyComponent", () => {
let component: BlockIntervalPropertyComponent;
Expand All @@ -23,6 +24,7 @@ describe("BlockIntervalPropertyComponent", () => {
ToastrModule.forRoot(),
AngularSvgIconModule.forRoot(),
HttpClientTestingModule,
SharedTestModule,
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CachePropertyComponent } from "./cache-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("CachePropertyComponent", () => {
let component: CachePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("CachePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CachePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(CachePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CardsPropertyComponent } from "./cards-property.component";
import { ActivatedRoute } from "@angular/router";

describe("CardsPropertyComponent", () => {
let component: CardsPropertyComponent;
Expand All @@ -9,6 +10,25 @@ describe("CardsPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CardsPropertyComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
paramMap: {
get: (key: string) => {
switch (key) {
case "accountName":
return "accountName";
case "datasetName":
return "datasetName";
}
},
},
},
},
},
],
}).compileComponents();

fixture = TestBed.createComponent(CardsPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { CommandPropertyComponent } from "./command-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("CommandPropertyComponent", () => {
let component: CommandPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("CommandPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CommandPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(CommandPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DatasetNameByIdPropertyComponent } from "./dataset-name-by-id-property.
import { of } from "rxjs";
import { DatasetService } from "src/app/dataset-view/dataset.service";
import { mockDatasetMainDataResponse } from "src/app/search/mock.data";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetIdAndNamePropertyComponent", () => {
let component: DatasetNameByIdPropertyComponent;
Expand All @@ -20,7 +21,7 @@ describe("DatasetIdAndNamePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DatasetNameByIdPropertyComponent],
imports: [ApolloTestingModule],
imports: [ApolloTestingModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DatasetNameByIdPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NavigationService } from "./../../../../../../../services/navigation.se
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { DatasetNamePropertyComponent } from "./dataset-name-property.component";
import { DatasetViewTypeEnum } from "src/app/dataset-view/dataset-view.interface";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("DatasetNamePropertyComponent", () => {
let component: DatasetNamePropertyComponent;
Expand All @@ -11,6 +12,7 @@ describe("DatasetNamePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DatasetNamePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(DatasetNamePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { EnginePropertyComponent } from "./engine-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EnginePropertyComponent", () => {
let component: EnginePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("EnginePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EnginePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EnginePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { EnvVariablesPropertyComponent } from "./env-variables-property.component";
import { DynamicTableComponent } from "src/app/components/dynamic-table/dynamic-table.component";
import { MatTableModule } from "@angular/material/table";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EnvVariablesPropertyComponent", () => {
let component: EnvVariablesPropertyComponent;
Expand All @@ -13,7 +14,7 @@ describe("EnvVariablesPropertyComponent", () => {
EnvVariablesPropertyComponent,
DynamicTableComponent,
],
imports: [MatTableModule],
imports: [MatTableModule, SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EnvVariablesPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { EventTimePropertyComponent } from "./event-time-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("EventTimePropertyComponent", () => {
let component: EventTimePropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("EventTimePropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EventTimePropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(EventTimePropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { HashPropertyComponent } from "./hash-property.component";
import { DisplayHashModule } from "src/app/components/display-hash/dispaly-hash.module";
import { ToastrModule } from "ngx-toastr";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("HashPropertyComponent", () => {
let component: HashPropertyComponent;
Expand All @@ -10,7 +11,11 @@ describe("HashPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HashPropertyComponent],
imports: [DisplayHashModule, ToastrModule.forRoot()],
imports: [
DisplayHashModule,
ToastrModule.forRoot(),
SharedTestModule,
],
}).compileComponents();

fixture = TestBed.createComponent(HashPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { LinkPropertyComponent } from "./link-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("LinkPropertyComponent", () => {
let component: LinkPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("LinkPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [LinkPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(LinkPropertyComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { MergeStrategyPropertyComponent } from "./merge-strategy-property.component";
import { SharedTestModule } from "src/app/common/shared-test.module";

describe("MergeStrategyPropertyComponent", () => {
let component: MergeStrategyPropertyComponent;
Expand All @@ -9,6 +9,7 @@ describe("MergeStrategyPropertyComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MergeStrategyPropertyComponent],
imports: [SharedTestModule],
}).compileComponents();

fixture = TestBed.createComponent(MergeStrategyPropertyComponent);
Expand Down
Loading
Loading