mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-15 20:48:03 +00:00
Add profile name field to import
This commit is contained in:
@@ -49,7 +49,7 @@ router.post('/profiles', (req, res) => {
|
|||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -123,7 +123,7 @@ router.post('/profiles/import', (req, res) => {
|
|||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ router.post('/samples', upload.single('sample'), (req, res, next) => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
deleteSample(req.user.id + '_' + req.body.name)
|
deleteSample(req.user.id + '_' + req.body.name)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ router.post('/users', (req, res) => {
|
|||||||
], (err) => {
|
], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -132,7 +132,7 @@ router.post('/users', (req, res) => {
|
|||||||
], function (err) {
|
], function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
|
|||||||
@@ -207,6 +207,13 @@
|
|||||||
:rules="[rules.required()]"
|
:rules="[rules.required()]"
|
||||||
/>
|
/>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
<v-row>
|
||||||
|
<v-text-field
|
||||||
|
v-model="importedProfileName"
|
||||||
|
label="Profile Name"
|
||||||
|
:rules="[rules.required()]"
|
||||||
|
/>
|
||||||
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default {
|
|||||||
isImportValid: false,
|
isImportValid: false,
|
||||||
exportDialog: false,
|
exportDialog: false,
|
||||||
importedProfile: null,
|
importedProfile: null,
|
||||||
|
importedProfileName: '',
|
||||||
exportedProfile: {},
|
exportedProfile: {},
|
||||||
infoSnackbar: false,
|
infoSnackbar: false,
|
||||||
infoSnackbarText: '',
|
infoSnackbarText: '',
|
||||||
@@ -458,7 +459,7 @@ export default {
|
|||||||
const profileJSON = JSON.parse(fileContents)
|
const profileJSON = JSON.parse(fileContents)
|
||||||
|
|
||||||
this.$http.post('/profiles/import', {
|
this.$http.post('/profiles/import', {
|
||||||
name: profileJSON.name,
|
name: this.importedProfileName,
|
||||||
isTimerEnabled: profileJSON.isTimerEnabled,
|
isTimerEnabled: profileJSON.isTimerEnabled,
|
||||||
duration: profileJSON.duration,
|
duration: profileJSON.duration,
|
||||||
volume: profileJSON.volume,
|
volume: profileJSON.volume,
|
||||||
|
|||||||
Reference in New Issue
Block a user