Add profile name field to import

This commit is contained in:
Kevin Thomas
2022-04-17 15:38:17 -07:00
parent 022412473f
commit da40516e10
5 changed files with 14 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ router.post('/profiles', (req, res) => {
function (err) {
if (err) {
logger.error(err)
if (err.code === 'SQLITE_CONSTRAINT') {
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
return res.sendStatus(409)
} else {
return res.sendStatus(500)
@@ -123,7 +123,7 @@ router.post('/profiles/import', (req, res) => {
function (err) {
if (err) {
logger.error(err)
if (err.code === 'SQLITE_CONSTRAINT') {
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
return res.sendStatus(409)
} else {
return res.sendStatus(500)

View File

@@ -49,7 +49,7 @@ router.post('/samples', upload.single('sample'), (req, res, next) => {
if (err) {
logger.error(err)
deleteSample(req.user.id + '_' + req.body.name)
if (err.code === 'SQLITE_CONSTRAINT') {
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
return res.sendStatus(409)
} else {
return res.sendStatus(500)

View File

@@ -101,7 +101,7 @@ router.post('/users', (req, res) => {
], (err) => {
if (err) {
logger.error(err)
if (err.code === 'SQLITE_CONSTRAINT') {
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
return res.sendStatus(409)
} else {
return res.sendStatus(500)
@@ -132,7 +132,7 @@ router.post('/users', (req, res) => {
], function (err) {
if (err) {
logger.error(err)
if (err.code === 'SQLITE_CONSTRAINT') {
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
return res.sendStatus(409)
} else {
return res.sendStatus(500)

View File

@@ -207,6 +207,13 @@
:rules="[rules.required()]"
/>
</v-row>
<v-row>
<v-text-field
v-model="importedProfileName"
label="Profile Name"
:rules="[rules.required()]"
/>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>

View File

@@ -16,6 +16,7 @@ export default {
isImportValid: false,
exportDialog: false,
importedProfile: null,
importedProfileName: '',
exportedProfile: {},
infoSnackbar: false,
infoSnackbarText: '',
@@ -458,7 +459,7 @@ export default {
const profileJSON = JSON.parse(fileContents)
this.$http.post('/profiles/import', {
name: profileJSON.name,
name: this.importedProfileName,
isTimerEnabled: profileJSON.isTimerEnabled,
duration: profileJSON.duration,
volume: profileJSON.volume,