From 5a645536e78a35f4467ad8d8a17c5051eab3d54d Mon Sep 17 00:00:00 2001 From: Anant Jain Date: Tue, 19 Mar 2024 00:46:55 +0530 Subject: [PATCH] refactor(tesruns.ts): remove filter by status dead code fix #270 --- .../tes-runs/definition/tesRuns.template.ts | 16 +++------ .../components/tes-runs/definition/tesRuns.ts | 18 ---------- .../src/components/runs/runs.ts | 33 ++----------------- 3 files changed, 7 insertions(+), 60 deletions(-) diff --git a/packages/ecc-client-ga4gh-tes/src/components/tes-runs/definition/tesRuns.template.ts b/packages/ecc-client-ga4gh-tes/src/components/tes-runs/definition/tesRuns.template.ts index 2330b61b..42232773 100644 --- a/packages/ecc-client-ga4gh-tes/src/components/tes-runs/definition/tesRuns.template.ts +++ b/packages/ecc-client-ga4gh-tes/src/components/tes-runs/definition/tesRuns.template.ts @@ -8,7 +8,7 @@ import { fastTextField, } from '@microsoft/fast-components'; import { html, repeat, when } from '@microsoft/fast-element'; -import TESRuns, { stateOption } from './tesRuns.js'; +import TESRuns from './tesRuns.js'; import { TESRun } from '../../tes-run/index.js'; provideFASTDesignSystem().register( @@ -29,16 +29,6 @@ const template = html` @input=${(x, c) => x.handleNameInput(c.event)} > - x.stateInput} - @input=${(x, c) => x.handleStateInput(c.event)} - > - ALL - ${repeat( - () => stateOption, - html` x}>${(x) => x}` - )} -
@@ -113,7 +103,9 @@ const template = html` > x.tokens[x.pageNumber + 1] === undefined} + ?disabled=${(x) => + x.tokens[x.pageNumber + 1] === undefined || + Object.entries(x.data).length === 0} @click=${(x) => x.handleNext()} > { - // Reset the state filter - this.stateInput = 'ALL'; - // Calculate the next page const nextPageNumber = this.pageNumber + 1; this.pageNumber = nextPageNumber; // Increment the pageNumber @@ -121,7 +116,6 @@ export default class TESRuns extends FASTElement { // Handle prev click handlePrev = async () => { - this.stateInput = 'ALL'; const prevPageNumber = this.pageNumber - 1; const prevPageToken = this.tokens[prevPageNumber]; await this.fetchData(prevPageToken, this.searchInput); @@ -137,16 +131,4 @@ export default class TESRuns extends FASTElement { // Fetch new data this.fetchData('', this.searchInput); } - - handleStateInput(event: Event) { - this.stateInput = (event.target as HTMLInputElement).value; - - // Filter data on current page based on the filter input - if (this.stateInput === 'ALL') this.data = this.unfilterdData.tasks; - else { - this.data = this.unfilterdData.tasks.filter( - (task) => task.state === this.stateInput - ); - } - } } diff --git a/packages/ecc-client-lit-ga4gh-tes/src/components/runs/runs.ts b/packages/ecc-client-lit-ga4gh-tes/src/components/runs/runs.ts index d459d2c8..2b025d6c 100644 --- a/packages/ecc-client-lit-ga4gh-tes/src/components/runs/runs.ts +++ b/packages/ecc-client-lit-ga4gh-tes/src/components/runs/runs.ts @@ -45,7 +45,7 @@ export interface ItemProp { export interface FilterProp { key: string; - type: "search" | "select"; + type: "search"; options?: string[]; selectConfig?: { multiple?: boolean; @@ -80,7 +80,6 @@ export default class ECCClientGa4ghTesRuns extends LitElement { @property({ type: String }) private baseURL = "https://protes.rahtiapp.fi/ga4gh/tes/v1"; - @property({ type: Boolean }) private filter = true; @property({ type: Boolean }) private search = true; @property({ type: Array }) private fields: Array = [ { @@ -215,27 +214,6 @@ export default class ECCClientGa4ghTesRuns extends LitElement { type: "search", placeholder: "Search by prefix", }, - { - key: "tag", - type: "select", - options: [ - "UNKNOWN", - "QUEUED", - "INITIALIZING", - "RUNNING", - "PAUSED", - "COMPLETE", - "EXECUTOR_ERROR", - "SYSTEM_ERROR", - "CANCELED", - "PREEMPTED", - "CANCELING", - ], - placeholder: "Filter by status", - selectConfig: { - multiple: false, - }, - }, ]; @state() private items: ItemProp[] = []; @@ -268,8 +246,8 @@ export default class ECCClientGa4ghTesRuns extends LitElement { this._fetchData(1); } - // Handle filter render - if (changedProperties.has("filter") || changedProperties.has("search")) { + // Handle search by prefix render + if (changedProperties.has("search")) { this.filters = this.getUpdatedFilters(); } } @@ -278,11 +256,6 @@ export default class ECCClientGa4ghTesRuns extends LitElement { let updatedFilters = [...this.filters]; // Modify the array based on the conditions - if (!this.filter) { - updatedFilters = updatedFilters.filter( - (filter) => filter.type !== "select" - ); - } if (!this.search) { updatedFilters = updatedFilters.filter( (filter) => filter.type !== "search"