Skip to content

Commit

Permalink
add date format in settings burner
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkanoun committed Oct 9, 2020
1 parent c0664b3 commit 94b02e0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions BackEnd/controllers/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authentication = async function (req, res) {
try {
const userObject = new Users(body.username)
await userObject.checkPassword(body.password, async function(reponse) {
console.log(reponse)

if (reponse) {
let user = new Users(body.username)

Expand All @@ -29,7 +29,7 @@ authentication = async function (req, res) {

var TOKEN = jwt.sign(payload, process.env.TOKEN_SECRET, { expiresIn: '1h' });

res.cookie("tokenOrthancJs", TOKEN, {secure: true, httpOnly: true})
res.cookie("tokenOrthancJs", TOKEN, {httpOnly: true})
res.json(true)
})
} else {
Expand Down
3 changes: 2 additions & 1 deletion BackEnd/controllers/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var updateRobotOptions = async function(req, res){
body.burner_monitoring_level,
body.burner_support_type,
body.burner_delete_study_after_sent,
body.burner_transfer_syntax
body.burner_transfer_syntax,
body.date_format
)
res.json(true)
}
Expand Down
3 changes: 2 additions & 1 deletion BackEnd/model/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Options = {
},

setBurnerOptions : async (burner_monitored_path, burner_viewer_path, burner_label_path, burner_manifacturer, burner_monitoring_level,
burner_support_type, burner_delete_study_after_sent, burner_transfer_syntax ) => {
burner_support_type, burner_delete_study_after_sent, burner_transfer_syntax, date_format ) => {

const option = await db.Option.findOne(({ where: { id: 1 } }))

Expand All @@ -36,6 +36,7 @@ const Options = {
option.burner_support_type = burner_support_type
option.burner_delete_study_after_sent = burner_delete_study_after_sent
option.burner_transfer_syntax = burner_transfer_syntax
option.date_format = date_format

await option.save()

Expand Down
2 changes: 1 addition & 1 deletion BackEnd/model/monitoring/cdburner/CdBurner.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CdBurner {
this.dateOptions = { month: 'numeric', day: 'numeric', year : 'numeric' } //precision of the date

const options = await Options.getCdBurnerOptions()

//format of date (using contry convention)
if (options.date_format === "fr") {
this.format = "DD/MM/YYYY"
Expand Down
9 changes: 9 additions & 0 deletions FrontEnd/src/components/Admin/CDBurner/BurnerOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class BurnerOptions extends Component{
burner_manifacturer : '',
burner_monitoring_level : '',
burner_support_type : '',
date_format: '',
burner_delete_study_after_sent : false,
burner_transfer_syntax : null

Expand All @@ -40,6 +41,11 @@ export default class BurnerOptions extends Component{
{value : 'DVD', label : 'DVD'}
]

dateFormatOptions = [
{value: 'uk', label : 'MMDDYYYY'},
{value: 'fr', label : "DDMMYYYY"}
]

transferSyntaxOptions = [
{value: 'None', label: 'None (Original TS)'},
{value: '1.2.840.10008.1.2', label: 'Implicit VR Endian'},
Expand Down Expand Up @@ -111,6 +117,7 @@ export default class BurnerOptions extends Component{

render(){
return (
//date_format
<div>
<h2 className="card-title">CD/DVD Burner Options</h2>
<label htmlFor="burner_monitored_path">Monitored Folder : </label>
Expand All @@ -125,6 +132,8 @@ export default class BurnerOptions extends Component{
<Select single options={this.manufacturerOptions} value={this.getSelectedObject(this.manufacturerOptions, this.state.burner_manifacturer)} onChange={this.handleChangeSelect} name="burner_manifacturer"/>
<label htmlFor="burner_monitoring_level">Monitoring Level : </label>
<Select options={this.levelOptions} value={this.getSelectedObject(this.levelOptions ,this.state.burner_monitoring_level)} onChange={this.handleChangeSelect} name = "burner_monitoring_level" />
<label htmlFor="date_format">Date Format : </label>
<Select options={this.dateFormatOptions} value={this.getSelectedObject(this.dateFormatOptions ,this.state.date_format)} onChange={this.handleChangeSelect} name = "date_format" />
<label htmlFor="burner_support_type">Support Type : </label>
<Select single options={this.supportType} value={this.getSelectedObject(this.supportType, this.state.burner_support_type)} onChange={this.handleChangeSelect} name = "burner_support_type" />
<div className ="mt-3" >
Expand Down
2 changes: 0 additions & 2 deletions FrontEnd/src/components/Authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export default class Authentication extends Component {
await apis.authentication.logIn(postData).then((answer)=>{

console.log(answer)
// get token from fetch request
const token = answer;

newState = {
accessCheck : true
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/components/Main/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class Footer extends Component {
render () {
return (
<Fragment>
<div className="footer-copyright text-center">Orthanc Tools JS: 0.4.4
<div className="footer-copyright text-center">Orthanc Tools JS: 0.4.5

<button type="button" className='link-button ml-3' onClick={() => this.setState(prevState => ({show: !prevState.show}))}>About</button>
</div>
Expand Down

0 comments on commit 94b02e0

Please sign in to comment.