Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #779 from Netflix/fix/restrict-auto-complete-to-la…
Browse files Browse the repository at this point in the history
…test-version

added workflow name uniqueification
  • Loading branch information
apanicker-nflx authored Sep 25, 2018
2 parents 35053eb + 46caf94 commit 12087b5
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions ui/src/components/workflow/executions/WorkflowList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Typeahead from 'react-bootstrap-typeahead';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import { Input, Button, Panel, Popover, OverlayTrigger, ButtonGroup, Grid, Row, Col } from 'react-bootstrap';

let versionSuffix = /\/[0-9]+$/;

function linkMaker(cell) {
return <Link to={`/workflow/id/${cell}`}>{cell}</Link>;
}
Expand Down Expand Up @@ -114,7 +116,10 @@ class Workflow extends React.Component {
let {workflows = [], location} = nextProps;
let {query} = location;
let {h,start, status = '', q} = query;
const workflowDefs = workflows.map(workflowDef => workflowDef.name);

const workflowDefs = workflows.map((workflowDef) => {
return workflowDef.name + "/" + workflowDef.version;
});

let search = q;
if (search == null || search === 'undefined' || search === '') {
Expand Down Expand Up @@ -166,10 +171,9 @@ class Workflow extends React.Component {

urlUpdate = () => {
const { workflowTypes, status, start, h, search: q } = this.state;

this.props.history.pushState(
null,
`/workflow?q=${q}&h=${h}&workflowTypes=${workflowTypes}&status=${status}&start=${start}`
`/workflow?q=${q}&h=${h}&workflowTypes=${encodeURIComponent(workflowTypes)}&status=${status}&start=${start}`
);
};

Expand All @@ -178,11 +182,15 @@ class Workflow extends React.Component {
const query = [];

if (this.state.workflowTypes.length > 0) {
query.push(`workflowType IN (${this.state.workflowTypes.join(',')}) `);
query.push(`workflowType IN (${this.state.workflowTypes.map((workFlowString) => {
return workFlowString.replace(versionSuffix, "");
}).join(',')}) `);
}

if (this.state.status.length > 0) {
query.push(`status IN (${this.state.status.join(',')}) `);
}

this.props.dispatch(
searchWorkflows(query.join(' AND '), search, this.state.h, this.state.fullstr, this.state.start)
);
Expand Down Expand Up @@ -358,7 +366,13 @@ class Workflow extends React.Component {
if (found < 100) {
max = start + found;
}
const workflowNames = this.state.workflows ? this.state.workflows : [];
let allWorkflowNames = this.state.workflows ? this.state.workflows : [];

const workflowNames = Object.keys(allWorkflowNames.reduce((red, val) => {
red[val] = true;
return red;
}, {}));

const statusList = ['RUNNING', 'COMPLETED', 'FAILED', 'TIMED_OUT', 'TERMINATED', 'PAUSED'];


Expand Down

0 comments on commit 12087b5

Please sign in to comment.