-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding ui for general settings | adding 'working hours' as new feature
- Loading branch information
1 parent
2899dfc
commit 97858b7
Showing
18 changed files
with
694 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
{ | ||
"interval": 30, | ||
"port": 9998, | ||
"scrapingAnt": { | ||
"apiKey": "" | ||
} | ||
} | ||
{"interval":"30","port":9998,"scrapingAnt":{"apiKey":""},"workingHours":{"from":"","to":""}} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const service = require('restana')(); | ||
const generalSettingsRouter = service.newRouter(); | ||
const config = require('../../../conf/config.json'); | ||
const fs = require('fs'); | ||
|
||
generalSettingsRouter.get('/', async (req, res) => { | ||
res.body = Object.assign({}, config); | ||
res.send(); | ||
}); | ||
|
||
generalSettingsRouter.post('/', async (req, res) => { | ||
const settings = req.body; | ||
|
||
try { | ||
fs.writeFileSync(`${__dirname}/../../../conf/config.json`, JSON.stringify(settings)); | ||
} catch (err) { | ||
console.error(err); | ||
res.send(new Error('Error while trying to write settings.')); | ||
return; | ||
} | ||
res.send(); | ||
}); | ||
|
||
exports.generalSettingsRouter = generalSettingsRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { xhrGet } from '../../xhr'; | ||
|
||
export const generalSettings = { | ||
state: { | ||
settings: {}, | ||
}, | ||
reducers: { | ||
//only admins | ||
setGeneralSettings: (state, payload) => { | ||
return { | ||
...state, | ||
settings: payload, | ||
}; | ||
}, | ||
}, | ||
effects: { | ||
async getGeneralSettings() { | ||
try { | ||
const response = await xhrGet('/api/admin/generalSettings'); | ||
this.setGeneralSettings(response.json); | ||
} catch (Exception) { | ||
console.error('Error while trying to get resource for api/admin/generalSettings. Error:', Exception); | ||
} | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.