Skip to content

Commit

Permalink
pr feedback suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Paterick committed Jul 30, 2024
1 parent 0a2a37a commit 84a93ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions gen-web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@

setTimeout(() => {
try {
filesaver.saveAs(configFileBlob, genConfigFileName(HOLO_PORT_STARTING_DEVICE_NUMBER, deviceID))
filesaver.saveAs(configFileBlob, genConfigFileName(deviceID))
} catch (e) {
throw new Error(`Error saving config. Error: ${e}`)
}
Expand Down Expand Up @@ -446,7 +446,7 @@
buttons.prevStep.disabled = true
}
} else if (stepTracker === 5) {
inlineVariables.downloadFileName.innerHTML = genConfigFileName(deviceNumber, deviceID)
inlineVariables.downloadFileName.innerHTML = genConfigFileName(deviceID)
verifyDownloadComplete()
}
}
Expand Down
12 changes: 4 additions & 8 deletions gen-web/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@ export const toBase64 = (encodedBytes) => {
}


const FILE_PREFIX = "hp"
const FILE_PREFIX = "hp-config"
const FILE_TYPE = ".json"
const HOLO_PORT_STARTING_DEVICE_NUMBER = 1

/**
* generate file name based on the device number
* @param {number} deviceNumber
* @param {string} pubKey
*/
export const genConfigFileName = (deviceNumber, pubKey) => {
if (deviceNumber == HOLO_PORT_STARTING_DEVICE_NUMBER) {
return `${FILE_PREFIX}-primary-${pubKey.substring(0, 5)}${FILE_TYPE}`
} else {
return `${FILE_PREFIX}-secondary-${pubKey.substring(0, 5)}${FILE_TYPE}`
}
export const genConfigFileName = (pubKey) => {
return `${FILE_PREFIX}-${pubKey.substring(0, 5)}${FILE_TYPE}`

}

0 comments on commit 84a93ca

Please sign in to comment.