From 0cf6044f598dc4763566cde403b7fb1488c373db Mon Sep 17 00:00:00 2001 From: Dmitriy Borzenko Date: Sat, 14 Sep 2024 09:48:07 +0300 Subject: [PATCH 1/3] Replace mock account --- src/app/account/account.component.html | 4 +-- .../account-flows-tab.component.ts | 28 ++++++------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/app/account/account.component.html b/src/app/account/account.component.html index d84a02ee..9cdb466c 100644 --- a/src/app/account/account.component.html +++ b/src/app/account/account.component.html @@ -2,7 +2,7 @@
- + avatarOrganizations > - +
Organizations
diff --git a/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.ts b/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.ts index 037bb302..47628662 100644 --- a/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.ts +++ b/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, inject, Input, OnInit } from "@angu import { combineLatest, map, of, switchMap, timer } from "rxjs"; import { MaybeNull } from "src/app/common/app.types"; import { - AccountType, + AccountFragment, DatasetListFlowsDataFragment, FlowStatus, FlowSummaryDataFragment, @@ -11,7 +11,6 @@ import { import { AccountService } from "src/app/services/account.service"; import { AccountTabs } from "../../account.constants"; import { environment } from "src/environments/environment"; -import { TEST_ACCOUNT_ID } from "src/app/search/mock.data"; import { FlowsTableProcessingBaseComponent } from "src/app/common/components/flows-table/flows-table-processing-base.component"; import { FlowsTableFiltersOptions } from "src/app/common/components/flows-table/flows-table.types"; @@ -22,7 +21,7 @@ import { FlowsTableFiltersOptions } from "src/app/common/components/flows-table/ changeDetection: ChangeDetectionStrategy.OnPush, }) export class AccountFlowsTabComponent extends FlowsTableProcessingBaseComponent implements OnInit { - @Input({ required: true }) accountName: string; + @Input({ required: true }) loggedUser: AccountFragment; public nodes: FlowSummaryDataFragment[] = []; public searchByDataset: DatasetListFlowsDataFragment[] = []; public readonly DISPLAY_COLUMNS = ["description", "information", "creator", "dataset", "options"]; @@ -44,7 +43,7 @@ export class AccountFlowsTabComponent extends FlowsTableProcessingBaseComponent switchMap(() => combineLatest([ this.accountService.getAccountListFlows({ - accountName: this.accountName, + accountName: this.loggedUser.accountName, page: page - 1, perPageTable: this.TABLE_FLOW_RUNS_PER_PAGE, perPageTiles: this.WIDGET_FLOW_RUNS_PER_PAGE, @@ -55,17 +54,8 @@ export class AccountFlowsTabComponent extends FlowsTableProcessingBaseComponent byDatasetIds: datasetsIds ?? [], }, }), - this.accountService.accountAllFlowsPaused(this.accountName), - // TODO: Implemented all accounts with flows from API - of([ - { - accountName: "kamu", - accountType: AccountType.User, - id: TEST_ACCOUNT_ID, - displayName: "kamu", - isAdmin: true, - }, - ]), + this.accountService.accountAllFlowsPaused(this.loggedUser.accountName), + of([this.loggedUser]), ]), ), map(([flowsData, allFlowsPaused, flowInitiators]) => { @@ -76,18 +66,18 @@ export class AccountFlowsTabComponent extends FlowsTableProcessingBaseComponent public onPageChange(page: number): void { if (page === 1) { - this.navigationService.navigateToOwnerView(this.accountName, AccountTabs.FLOWS); + this.navigationService.navigateToOwnerView(this.loggedUser.accountName, AccountTabs.FLOWS); } else { - this.navigationService.navigateToOwnerView(this.accountName, AccountTabs.FLOWS, page); + this.navigationService.navigateToOwnerView(this.loggedUser.accountName, AccountTabs.FLOWS, page); } this.fetchTableData(page); } public toggleStateAccountFlowConfigs(paused: boolean): void { if (!paused) { - this.accountService.accountPauseFlows(this.accountName).subscribe(); + this.accountService.accountPauseFlows(this.loggedUser.accountName).subscribe(); } else { - this.accountService.accountResumeFlows(this.accountName).subscribe(); + this.accountService.accountResumeFlows(this.loggedUser.accountName).subscribe(); } setTimeout(() => { this.refreshFlow(); From 81c5882946fbed856b1907d26f1ad8f69264b35b Mon Sep 17 00:00:00 2001 From: Dmitriy Borzenko Date: Sat, 14 Sep 2024 10:13:21 +0300 Subject: [PATCH 2/3] fixed unit tests --- .../account-flows-tab/account-flows-tab.component.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.spec.ts b/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.spec.ts index b4b2238e..e10def10 100644 --- a/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.spec.ts +++ b/src/app/account/additional-components/account-flows-tab/account-flows-tab.component.spec.ts @@ -20,6 +20,7 @@ import { mockDatasets } from "src/app/common/components/flows-table/flows-table. import { FlowsTableFiltersOptions } from "src/app/common/components/flows-table/flows-table.types"; import { NgbPaginationModule } from "@ng-bootstrap/ng-bootstrap"; import { AngularMultiSelectModule } from "angular2-multiselect-dropdown"; +import { mockAccountDetails } from "src/app/api/mock/auth.mock"; describe("AccountFlowsTabComponent", () => { let component: AccountFlowsTabComponent; @@ -63,7 +64,7 @@ describe("AccountFlowsTabComponent", () => { navigationService = TestBed.inject(NavigationService); datasetFlowsService = TestBed.inject(DatasetFlowsService); component = fixture.componentInstance; - component.accountName = "mockAccountName"; + component.loggedUser = mockAccountDetails; }); it("should create", () => { @@ -73,13 +74,13 @@ describe("AccountFlowsTabComponent", () => { it("should check navigate to owner view with page=1 ", () => { const navigateToOwnerViewSpy = spyOn(navigationService, "navigateToOwnerView"); component.onPageChange(1); - expect(navigateToOwnerViewSpy).toHaveBeenCalledOnceWith(component.accountName, AccountTabs.FLOWS); + expect(navigateToOwnerViewSpy).toHaveBeenCalledOnceWith(component.loggedUser.accountName, AccountTabs.FLOWS); }); it("should check navigate to owner view with page>1 ", () => { const navigateToOwnerViewSpy = spyOn(navigationService, "navigateToOwnerView"); component.onPageChange(2); - expect(navigateToOwnerViewSpy).toHaveBeenCalledOnceWith(component.accountName, AccountTabs.FLOWS, 2); + expect(navigateToOwnerViewSpy).toHaveBeenCalledOnceWith(component.loggedUser.accountName, AccountTabs.FLOWS, 2); }); it("should check cancel flow button", fakeAsync(() => { From d886f722477fb03559a37846b719afd4b6ff4ada Mon Sep 17 00:00:00 2001 From: Dmitriy Borzenko Date: Sat, 14 Sep 2024 10:15:50 +0300 Subject: [PATCH 3/3] changed CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b3b6263..17a357a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased +### Fixed +- Replaced mock initiator for flows tab for account + ## [0.26.3] - 2024-09-13 ### Fixed - Hid the `force-update` link