Skip to content

Commit 90973d2

Browse files
committed
review branch
1 parent 7ab5c5b commit 90973d2

File tree

3 files changed

+6
-33
lines changed

3 files changed

+6
-33
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ packages/tdb-dashboard/local_file
2525
*.DS_Store
2626

2727
packages/tdb-dashboard/cypress.config_local.js
28+
packages/tdb-dashboard/cypress.config.js
29+

packages/tdb-dashboard/cypress.config.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/tdb-dashboard/src/components/NewBranchModal.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import {singleSelectStyle} from "./constants"
1212
import Select from 'react-select'
1313

1414
export const NewBranchModal = ({newBranch, onCancel, createBranch, loading}) => {
15-
const {branches, branch, ref}=WOQLClientObj()
15+
const {branch, ref}=WOQLClientObj()
1616

1717
const [id, setID]=useState(false)
1818
const [select, setSelect]=useState(newBranchForm.select.head)
1919
const [reportAlert, setReportAlert]=useState(false)
2020

2121
function handleCreate (e) {
2222
event.preventDefault()
23-
if (checkSubmission(id, branches, setReportAlert)) {
23+
if (checkSubmission(id, setReportAlert)) {
2424
createBranch({id: id, branchType: select})
2525
}
2626
}
@@ -70,24 +70,16 @@ export const NewBranchModal = ({newBranch, onCancel, createBranch, loading}) =>
7070
</Modal>
7171
}
7272

73-
function checkSubmission(newID, branches, setReportAlert){
73+
function checkSubmission(newID, setReportAlert){
7474
if(newID && newID.length){
7575
let nid = newID.trim()
76-
if(typeof branches[nid] != "undefined"){
77-
let message = "A Branch already exists with the same ID - choose a new ID"
78-
setReportAlert(<Alerts message={message} type={TERMINUS_DANGER} onCancel={setReportAlert}/>)
79-
return false
80-
}
81-
else {
8276
if(!legalURLID(nid)){
8377
let message = "Branch IDs can only include lowercase characters, numbers and underscores and be no more than 40 characters long"
8478
setReportAlert(<Alerts message={message} type={TERMINUS_WARNING} onCancel={setReportAlert}/>)
8579
return false
8680
}
8781
return true
88-
}
89-
}
90-
else {
82+
}else {
9183
let message = "You must supply an ID for the new Branch"
9284
setReportAlert(<Alerts message={message} type={TERMINUS_WARNING} onCancel={setReportAlert}/>)
9385
return false

0 commit comments

Comments
 (0)