diff --git a/client/package-lock.json b/client/package-lock.json index 4ac1e548394674f07bb5aca2f08f9f32304e626b..c5f81e8da40e16f62a982cdb5c9be65131176ef5 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -6468,6 +6468,14 @@ "brace": "^0.11.1" } }, + "ngx-alerts": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/ngx-alerts/-/ngx-alerts-3.4.3.tgz", + "integrity": "sha512-8XFfNcNE3ofUP1YFeZUVOTwv6YdSR4dGgYrklEmkhAIjp56PDgoQ9yKjIVIG5LYbyU3KPjRIorp7jpezczvJWQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "ngx-bootstrap": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-4.1.1.tgz", diff --git a/client/package.json b/client/package.json index 2622bef13ef027d4d86be9099c65157250f8f12d..a2bc8916f2d9152834f7dcaf967476aecc445273 100644 --- a/client/package.json +++ b/client/package.json @@ -29,6 +29,7 @@ "hammerjs": "^2.0.8", "jquery": "^3.4.0", "ng2-ace-editor": "^0.3.9", + "ngx-alerts": "^3.4.3", "ngx-bootstrap": "^4.1.1", "ngx-ui-loader": "^7.2.2", "rxjs": "~6.3.3", diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 2336699b930afd66328a1f880dca213a8c360936..32ab379c4f667a9bfec61dc59a3396c7de916d02 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -20,6 +20,7 @@ import {FormsModule} from '@angular/forms'; import {HttpClientModule} from '@angular/common/http'; import {RNotFoundComponent} from './rnot-found/rnot-found.component'; import {NgxUiLoaderModule} from 'ngx-ui-loader'; +import { AlertModule } from 'ngx-alerts'; @NgModule({ @@ -50,7 +51,8 @@ import {NgxUiLoaderModule} from 'ngx-ui-loader'; AceEditorModule, FormsModule, HttpClientModule, - NgxUiLoaderModule + NgxUiLoaderModule, + AlertModule.forRoot({maxMessages: 5, timeout: 5000, position: 'right'}) ], providers: [], diff --git a/client/src/app/kata-create/kata-create.component.html b/client/src/app/kata-create/kata-create.component.html index f4de5f580878028f1982349d0c0f3ec6d63a8a7d..1837926e6f02b3e4d2287c88fafc38cadaeb59d2 100644 --- a/client/src/app/kata-create/kata-create.component.html +++ b/client/src/app/kata-create/kata-create.component.html @@ -1,32 +1,44 @@ <div class="d-flex justify-content-center" style="margin-top:2%"> <div class="d-flex flex-column"> - <div class="p-2"><input type="text" placeholder=" Some title.." [(ngModel)]="title"/></div> - <div class="p-2"><textarea class="rules" [(ngModel)]="rules"></textarea></div> + <div class="p-2"><label (click)="toggleOptions()" class="header">Kata's options (click me)</label></div> + <div class="p-2" [hidden]="options"> + <input type="text" placeholder=" Some title.." [(ngModel)]="title"/> + <select (change)="UpdateChoice($event)"> + <option value="true" selected="selected"> + Display assert box + </option> + <option value="false">Don't display assert box</option> + </select> + Unlock solution at + <input type="number" value="0" [(ngModel)]="numberOfAttempt"/> attempts. + </div> + <div class="p-2"><label (click)="toggleInstructions()" class="header">Kata's instructions (click me)</label></div> + <div class="p-2" [hidden]="instructions"><textarea class="rules" [(ngModel)]="rules"></textarea></div> + + + <div class="p-2"><label class="header">Kata's Solution and assert</label></div> + + <div class="p-2"> <app-terminal-code [code]="solution" [type]="language" (new)="OnNewEventSolution($event)"></app-terminal-code> <app-terminal-code style="margin-left: 20px;" [code]="assert" [type]="language" (new)="OnNewEventAssert($event)"></app-terminal-code> </div> + + <div class="p-2"> <app-terminal-code [code]="canva" [type]="language" (new)="OnNewEventCanva($event)"></app-terminal-code> <textarea [ngClass]="{'success':status === 0,'error':status === 1,'':status === 2}" style="white-space: pre-wrap" disabled>{{result}}</textarea> </div> - <div class="p-2"> - Display assert box while doing kata ? - <select (change)="UpdateChoice($event)"> - <option value="true">Yes</option> - <option value="false">No</option> - </select> - <br/> - Number of tests before unlocking the complete solution - <input type="number" value="0" [(ngModel)]="numberOfAttempt"/> - <input (click)="try()" type="button" value="TRY MY SOLUTION"/> - <input (click)="publish()" type="button" style="margin-left:10px" value="PUBLISH"/> + <div class="p-2"> + <input (click)="try()" class="button" type="button" value="Try my solution"/> + <input (click)="publish()" class="button" type="button" style="float:right" value="Create kata"/> </div> + </div> </div> diff --git a/client/src/app/kata-create/kata-create.component.scss b/client/src/app/kata-create/kata-create.component.scss index f8276dc759b96b05db270b28426d475055cbe5d4..4b3ee666d36dcb50d236235c8171ff857e8c653d 100644 --- a/client/src/app/kata-create/kata-create.component.scss +++ b/client/src/app/kata-create/kata-create.component.scss @@ -35,26 +35,32 @@ textarea.rules { margin: 0; } -input[type=button] { - background-color: rgba(63, 67, 77, 1); - float: right; +:focus { + outline: none; +} + +input[type=number]{ + width: 100px; + background-color: rgba(43, 47, 57, 1); + border: 1px solid rgba(63, 67, 77, 1); border-radius: 7px; color: rgba(236, 240, 241, 1.0); - padding: .7em; + padding: .6em 1.4em .5em .8em; } +input[type=text]{ -:focus { - outline: none; + background-color: rgba(43, 47, 57, 1); + border: 1px solid rgba(63, 67, 77, 1); + border-radius: 7px; + color: rgba(236, 240, 241, 1.0); + padding: .6em 1.4em .5em .8em; } - select { - padding: .6em 1.4em .5em .8em; color: rgba(236, 240, 241, 1.0); background-color: rgba(43, 47, 57, 1); - max-width: 20%; - width: 20%; + max-width: 100%; margin: 0; border: 1px solid rgba(63, 67, 77, 1); border-radius: 7px; @@ -63,4 +69,16 @@ select { appearance: none; } +.header{ + width: 100%; + height: 20px; + background-color: rgba(43, 47, 57, 1); + font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + padding:3px 3px 3px 10px; + border-radius: 6px; +} + +.animated{ + transition: all .3s; +} diff --git a/client/src/app/kata-create/kata-create.component.ts b/client/src/app/kata-create/kata-create.component.ts index d525989073a570462aed0bf13e57e94864d9460e..89b16bb9b7f4d9bdf8e24294f6a296f1badc18e2 100644 --- a/client/src/app/kata-create/kata-create.component.ts +++ b/client/src/app/kata-create/kata-create.component.ts @@ -40,6 +40,19 @@ export class KataCreateComponent implements OnInit { keepAssertForKata = true; numberOfAttempt = 0; + options = false; + instructions = true; + + + toggleOptions() { + this.options = ! this.options; + console.log(this.options); + } + + toggleInstructions() { + this.instructions = !this.instructions; + } + getLANG(id: string): void { this.LANG = this.langservice.getLANG(id)[0]; this.assert = this.LANG.assertCanva; diff --git a/client/src/app/kata-displayer/kata-displayer.component.html b/client/src/app/kata-displayer/kata-displayer.component.html index 000edee89ea5afc3e33ba85ccd164c2d06926632..35777135473897f6bd117849d05dc74b68bc2de6 100644 --- a/client/src/app/kata-displayer/kata-displayer.component.html +++ b/client/src/app/kata-displayer/kata-displayer.component.html @@ -1,41 +1,37 @@ -<div *ngIf="!error" class="d-flex justify-content-center" style="margin-top:2%"> - - <div class="container"> - <span *ngIf="inforreceived"> - <span class="title">{{programTitle}} - <br> +<div style="margin:5rem 10rem 0 10rem" *ngIf="!error"> + <div *ngIf="inforreceived"> + <h1 class="title" style="margin:2rem 0 0 2rem;">{{programTitle}} + <br/> <span class="subtitle">{{programSensei}} <span class="language"> {{programLanguage}}</span> </span> - <input type="button" value="Create" routerLink="/kata_create/{{idProgram}}/{{programLanguage}}"/> - </span> - </span> - <span *ngIf="katas"> - <div class="d-flex justify-content-start" style="margin-top:2%"> - <div class="d-flex flex-row"> - <span *ngFor="let kata of katas"> - <div class="p-2"> - <div class="card" style="width: 18rem;"> - <div class="card-body"> - <h5 class="card-title"><a class="title" - routerLink="/kata/{{idProgram}}/{{kata.id}}">{{kata.title}}</a></h5> - <br/> - <h6 class="card-subtitle mb-2 text-muted">{{kata.difficulty}} </h6> - <span style="float: right;">{{kata.status}}</span> - <br/> - <br/> - <!--<p class="card-text">{{kata.description}}</p>--> + <input type="button" class="button" style="margin:0 3rem 0 0;float:right" value="Create a new kata" routerLink="/kata_create/{{idProgram}}/{{programLanguage}}"/> + </h1> + + </div> + <br/> + + <div *ngIf="katas"> + + <div class="d-flex flex-wrap justify-content-start"> + <span *ngFor="let kata of katas"> + <div class="card" style="width: 18rem;margin: 2rem" routerLink="/kata/{{idProgram}}/{{kata.id}}"> + <div class="card-body"> + <h5 class="card-title"><a class="title" + routerLink="/kata/{{idProgram}}/{{kata.id}}">{{kata.title}}</a><span class="difficulty">{{kata.status}}</span></h5> + <br/> + <h6 class="card-subtitle mb-2 text-muted">{{kata.difficulty}}</h6> + <br/> + <br/> + <!--<p class="card-text">{{kata.description}}</p>--> </div> </div> - </div> </span> </div> </div> - </span> - </div> - - <span *ngIf="!katas || !inforreceived"><ngx-ui-loader></ngx-ui-loader></span> </div> +<span *ngIf="!katas || !inforreceived"><ngx-ui-loader></ngx-ui-loader></span> + <div *ngIf="error"> <app-rnot-found></app-rnot-found> </div> diff --git a/client/src/app/kata-displayer/kata-displayer.component.scss b/client/src/app/kata-displayer/kata-displayer.component.scss index f399401ea2cd0e027812b08f041b3a6a322837c0..ddf2430cd9b9001eb02b626d894afe4f46dd33b9 100644 --- a/client/src/app/kata-displayer/kata-displayer.component.scss +++ b/client/src/app/kata-displayer/kata-displayer.component.scss @@ -1,25 +1,35 @@ .language { - color: rgba(230, 126, 34, 1); + color: var(--color-language); } .title { font-size: 20px; - color:rgba(236,240,241,1); + color:var(--color-cloud); } .subtitle{ font-size:15px; - color:#6c757d !important; + color:var(--color-dark-grey) !important; } * { font-family: "Helvetica Neue"; - display: inline-block + } .card { - background-color: rgba(43, 47, 57, 1); + background-color: var(--color-dark-blue); } a { text-decoration: none; } + +.difficulty{ + color:var(--color-sunflower); + float:right; +} + +.card:hover{ + background-color: var(--color-electro); + border:1px solid var(--color-electro); +} diff --git a/client/src/app/kata/kata.component.html b/client/src/app/kata/kata.component.html index 26f4e523459977e6e507e8f46a8be221f28fcd83..83e2b0c6baa7173c4532c761eb9796c290fa878e 100644 --- a/client/src/app/kata/kata.component.html +++ b/client/src/app/kata/kata.component.html @@ -5,23 +5,23 @@ <br><span class="subtitle">{{programSensei}} <span class="language"> {{kata.language}}</span></span></div> - <div class="p-2 "><label class="header">rules :</label></div> + <div class="p-2 "><label class="header">rules :</label><label style="margin-left: 20px;" class="header">{{this.filename}}</label></div> <div class="p-2 "> <textarea disabled style="text-align: justify">{{kata.rules}}</textarea> <app-terminal-code style="margin-left: 20px;" [code]="kata.canva" [type]="kata.language" (new)="OnNewEvent($event)"></app-terminal-code> </div> - +<div class="p-2 "><label [hidden]="assert" style="margin-right: 20px;" class="header">{{assertname}}</label><label class="header">output :</label></div> <div class="p-2"> - <app-terminal-assert [code]="kata.cassert" [type]="kata.language"></app-terminal-assert> + <app-terminal-assert [hidden]="assert" [code]="kata.cassert" [type]="kata.language"></app-terminal-assert> <textarea [ngClass]="{'success':status === 0,'error':status === 1,'':status === 2}" style="white-space: pre-wrap;" disabled>{{result}}</textarea> </div> <div class="p-2"> - <button (click)="compile(kata.language,kata.canva,kata.cassert)" class="code">TRY MY SOLUTION</button> - <button style="margin-right: 10px" class="code">SURRENDER</button> + <button (click)="compile(kata.language,kata.canva,kata.cassert)" class="code button" style="float:right">Run</button> + <button (click)="Surrender()" style="margin-right: 10px" class="code button">Surrender</button> </div> </div> </span> @@ -34,3 +34,4 @@ </div> +<ngx-alerts></ngx-alerts> diff --git a/client/src/app/kata/kata.component.scss b/client/src/app/kata/kata.component.scss index fe7b77186e3dad501e72b4aec2f98918901ae138..cabe00ecb56f2c430a65f82e0aebb36966b0ae2b 100644 --- a/client/src/app/kata/kata.component.scss +++ b/client/src/app/kata/kata.component.scss @@ -48,20 +48,6 @@ textarea { display: inline-block } -button { - background-color: rgba(43, 47, 57, 1); - border: 0; - color: white; - outline: none; - font-familiy: Arial; - float:right; - padding: 10px; -} - -button:hover { - background-color: rgba(52, 73, 94, 1.0); -} - .error { border: 3px rgba(192, 57, 43, 0.8) solid; background-color: rgba(192, 57, 43, 0.2); @@ -77,7 +63,7 @@ button:hover { height: 20px; background-color: rgba(43, 47, 57, 1); font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; - padding:3px; + padding:3px 3px 3px 10px; border-radius: 6px; } diff --git a/client/src/app/kata/kata.component.ts b/client/src/app/kata/kata.component.ts index 0c2d97eeb5ab0a1e600b5324438e3855028f1a20..cc603e25721b3446407baf880a619fd28c797357 100644 --- a/client/src/app/kata/kata.component.ts +++ b/client/src/app/kata/kata.component.ts @@ -6,6 +6,10 @@ import {Kata} from './kata'; import {CompilationService} from '../compilation.service'; import {FetchProgramIdService} from '../fetch-program-id.service'; import {NgxUiLoaderService} from 'ngx-ui-loader'; +import {Canva} from '../languages_canvas'; +import {LANGService} from '../lang.service'; +import {AlertService} from 'ngx-alerts'; + @Component({ selector: 'app-kata', @@ -23,7 +27,15 @@ export class KataComponent implements OnInit { programSensei: string; error = false; + nbAttempt = 0; + + filename = ''; + assertname = ''; + katareceived = false; + assert = true; + + LANG: Canva; constructor( private route: ActivatedRoute, @@ -31,10 +43,19 @@ export class KataComponent implements OnInit { private fetchKataService: FetchKataService, private compilationService: CompilationService, private fetchProgramDetailsService: FetchProgramIdService, - private ngxLoader: NgxUiLoaderService + private ngxLoader: NgxUiLoaderService, + private langservice: LANGService, + private alertService: AlertService ) { } + + getLANG(id: string): void { + this.LANG = this.langservice.getLANG(id)[0]; + this.assertname = this.LANG.assertname; + this.filename = this.LANG.filename; + } + getKata(): void { this.ngxLoader.start(); this.programID = this.route.snapshot.paramMap.get('prid'); @@ -44,6 +65,8 @@ export class KataComponent implements OnInit { this.programTitle = data[0]; this.fetchKataService.getKata(this.programID, this.idKata).subscribe((datas: Kata) => { this.kata = datas; + this.assert = !datas.keepAssert; + this.getLANG(this.kata.language); this.ngxLoader.stop(); this.katareceived = true; }, @@ -61,29 +84,33 @@ export class KataComponent implements OnInit { }); } + Surrender() { + alert('Oops.. this functionality has not been implemented yet :( !'); + } + OnNewEvent(event: any): void { this.kata.canva = event.toString(); } compile(language: string, stream: string, assert: string): void { let response; - + this.nbAttempt++; this.compilationService.compilationServer(JSON.stringify({ language: this.kata.language, - stream: stream, - assert: assert + stream, + assert })).subscribe((data: string) => { console.log(data); response = data; if (response.exit === 0) { + this.alertService.success('Executed in : ' + response.time + 'ms'); this.status = 0; - this.result = response.output + '\nExercise passed'; + this.result = response.output + 'Exercise passed'; } else { this.status = 1; this.result = response.error; + this.alertService.danger('Run failed !'); } - - this.result += '\nExecuted in : ' + response.time + 'ms'; }); } diff --git a/client/src/app/languages_canvas.ts b/client/src/app/languages_canvas.ts index feb2c781f3139b869d07b105aa3c6bc227a4c54f..21de7d38ae57cf55a4a2d5a2cf7897d09d238a0b 100644 --- a/client/src/app/languages_canvas.ts +++ b/client/src/app/languages_canvas.ts @@ -2,14 +2,20 @@ export class Canva { id: string; assertCanva: string; codeCanva: string; + filename: string; + assertname: string; } // TODO un kata n'a pas besoin de programtitile, ca devrait ĂȘtre passĂ© par la classe d'en dessus (idem pour sensei) export const LANG: Canva[] = [ { - id: 'python', assertCanva: 'from assertpy import assert_that\nimport sample as m' + '\n\n' + - '# Example : \n# assert_that(m.yourfunction(someValues)).is_equal_to(targetedValues)', codeCanva: '# Write your code here' + id: 'python', + assertCanva: 'from assertpy import assert_that\nimport sample as m' + '\n\n' + + '# Example : \n# assert_that(m.yourfunction(someValues)).is_equal_to(targetedValues)', + codeCanva: '# Write your code here', + filename: 'sample.py', + assertname: 'assert.py' }, { id: 'java', assertCanva: 'import static org.junit.Assert.*;\n' + @@ -23,6 +29,8 @@ export const LANG: Canva[] = [ '\n' + '// Write your code here' + '\n' + - '}\n' + '}\n', + assertname: 'Main.java', + filename: 'kata.java' } ]; diff --git a/client/src/app/main-left-side-nav/main-left-side-nav.component.html b/client/src/app/main-left-side-nav/main-left-side-nav.component.html index 19b9429cfbbbc88edf8be9315d2461c03ce78620..e7fd6493a8aef24ca21f603b7cd3d245cb390431 100644 --- a/client/src/app/main-left-side-nav/main-left-side-nav.component.html +++ b/client/src/app/main-left-side-nav/main-left-side-nav.component.html @@ -6,7 +6,7 @@ <mat-toolbar>DOJO HEPIA</mat-toolbar> <mat-nav-list> <a mat-list-item href="/programs">All programs</a> - <a mat-list-item href="/program_create">New Program</a> + <a mat-list-item href="/program_create">New program</a> </mat-nav-list> </mat-sidenav> <mat-sidenav-content> diff --git a/client/src/app/main-left-side-nav/main-left-side-nav.component.scss b/client/src/app/main-left-side-nav/main-left-side-nav.component.scss index 232a01eb00f5a20c61b50acb7f46741e741bec51..f483fdbadc6de2f6f154e246cf011ad304c98d44 100644 --- a/client/src/app/main-left-side-nav/main-left-side-nav.component.scss +++ b/client/src/app/main-left-side-nav/main-left-side-nav.component.scss @@ -4,11 +4,11 @@ .mat-sidenav-content{ - background-color: rgba(47,54,64,1); + background-color: var(--color-soft-light-blue); } .sidenav { width: 150px; - background-color: rgba(43,47,57,1); + background-color: var(--color-dark-blue); } .sidenav .mat-toolbar { @@ -20,3 +20,7 @@ top: 0; z-index: 1; } + +*{ + color : var(--color-cloud); +} diff --git a/client/src/app/program-create/program-create.component.html b/client/src/app/program-create/program-create.component.html index 965078ae41acc11dbb7d46dde9cefb5c6e8d0b50..31faa130fa9a2242f54471f37b696998be4faec2 100644 --- a/client/src/app/program-create/program-create.component.html +++ b/client/src/app/program-create/program-create.component.html @@ -2,19 +2,21 @@ <div class="d-flex flex-column"> <fieldset> <legend>New program</legend> - <div class="p-2"><label>Title</label><input placeholder="Some title.." type="text" [(ngModel)]="programTitle" /></div> - <div class="p-2"><label>Targeted language</label><select (change)="update($event)"><option value="python">python</option><option value="java">java</option></select></div> - <div class="p-2"><label>Program description</label><textarea [(ngModel)]="programDescr" placeholder="Some text.."></textarea></div> - <div class="p-2"><label>Tags</label><input type="text" [(ngModel)]="programTags" placeholder=" arrays,writeable,.."/></div> - <div class="p-2"> - - <input type="button" (click)="createProgram(false)" class="button" value="CREATE"/> - <input type="button" (click)="createProgram(true)" class="button" style="float:right" value="CREATE + NEW KATA"/> + <div class="p-2"><label>Title</label><input placeholder="Some title.." type="text" [(ngModel)]="programTitle"/> + </div> + <div class="p-2"><label>Targeted language</label><select (change)="update($event)"> + <option value="python">python</option> + <option value="java">java</option> + </select></div> + <div class="p-2"><label>Program description</label><textarea [(ngModel)]="programDescr" + placeholder="Some text.."></textarea></div> + <div class="p-2"><label>Tags</label><input type="text" [(ngModel)]="programTags" + placeholder=" arrays,writeable,.."/></div> + <div class="p-2"> - </div> + <input type="button" (click)="createProgram(false)" class="button" value="Create"/> + <input type="button" (click)="createProgram(true)" class="button" style="float:right" value="Create with kata"/> - <div class="p-2"> - <input type="button" class="button" style="float:right" value="addad + NEW KATA"/> </div> </fieldset> </div> diff --git a/client/src/app/program-create/program-create.component.scss b/client/src/app/program-create/program-create.component.scss index 3ca9d28a701233ef7282408f2cbbeaf374a8af3d..1f3449f079f2951692132438119dbeb6e4e6cd00 100644 --- a/client/src/app/program-create/program-create.component.scss +++ b/client/src/app/program-create/program-create.component.scss @@ -7,6 +7,8 @@ input[type=text]{ padding: .6em 1.4em .5em .8em; } + + select { padding: .6em 1.4em .5em .8em; @@ -25,28 +27,16 @@ select { label{ margin-top:.4em; } -/* -input[type=button]{ - - background-color: rgba(63, 67, 77, 1); - - border-radius: 7px; - color: rgba(236, 240, 241, 1.0); - padding:.7em; - -}:focus{ - outline:none; - }*/ textarea{ padding: .6em 1.4em .5em .8em; - color: rgba(236, 240, 241, 1.0); - background-color: rgba(43, 47, 57, 1); + color: var(--color-cloud); + background-color: var(--color-dark-blue); width: 100%; max-width: 100%; margin: 0; height: 10rem; - border: 1px solid rgba(63, 67, 77, 1); + border: 1px solid var(--color-light-blue); border-radius: 7px; -moz-appearance: none; -webkit-appearance: none; @@ -54,8 +44,9 @@ textarea{ } fieldset { - border: 3px solid rgba(63, 67, 77, 1); + border: 3px solid var(--color-light-blue); border-radius: 6px; + padding: 1rem; } @@ -63,6 +54,9 @@ legend { text-align: center; } + *{ font-family: "Helvetica Neue"; + color : var(--color-cloud); } + diff --git a/client/src/app/program-create/program-create.component.ts b/client/src/app/program-create/program-create.component.ts index a2c20abf3098fb22e4609e4ae62438d1dc505904..4ac3e14710710ac3967aaf388774fff9cb7486e3 100644 --- a/client/src/app/program-create/program-create.component.ts +++ b/client/src/app/program-create/program-create.component.ts @@ -26,7 +26,7 @@ export class ProgramCreateComponent implements OnInit { createProgram(newkata: boolean): void { this.createProgramService.createProgram(JSON.stringify({ id: this.programToKata, - sensei: 'Orestis Pileas Malaspinas', + sensei: 'Shodai', language: this.programLanguage, nbKata: 0, title: this.programTitle, diff --git a/client/src/app/program-displayer/program-displayer.component.html b/client/src/app/program-displayer/program-displayer.component.html index c71dce0abfd2a79d7a25d07430b0c6ff6c072f5b..d2bff4e64993fcad7aa142fb89080685147258b9 100644 --- a/client/src/app/program-displayer/program-displayer.component.html +++ b/client/src/app/program-displayer/program-displayer.component.html @@ -1,29 +1,30 @@ -<div class="d-flex justify-content-center" style="margin-top:2%"> - <div *ngIf="programs" class="d-flex flex-column"> - <div class="p-2"><h1>All available programs</h1></div> - <div class="p-2"> - <span *ngFor="let program of programs"> - <div class="card" style="width: 18rem;"> +<div style="margin:5rem 10rem 0 10rem" *ngIf="programs"> + <h1 style="margin:2rem 0 0 2rem;text-align: center">All available programs</h1> + <div class="d-flex flex-wrap justify-content-start"> + <div *ngFor="let program of programs"> + + <div class="card" routerLink="/kata-displayer/{{program.programID}}" style="width: 18rem;margin: 2rem"> <div class="card-body"> <a routerLink="/kata-displayer/{{program.programID}}"> <h5 class="card-title">{{program.title}}</h5></a> <h6 class="card-subtitle mb-2 text-muted"><a class="sensei" href="">{{program.sensei}} </a> <a href=""><span class="language">{{program.language}}</span></a></h6> - <br/> - <p class="card-text">{{program.description}}</p> - <span *ngFor="let tag of program.tags"> + <br/> + <p class="card-text">{{program.description}}</p> + <span *ngFor="let tag of program.tags"> <span class="tag">{{tag}}</span> </span> - <span class="nbkata">#{{program.nbKata}}</span> + <span class="nbkata">#{{program.nbKata}}</span> </div> </div> - </span> + </div> </div> - <div class="d-flex flex-column" *ngIf="programReceivedFailed"> - <div class="p-2"> - <h1>Oops.. no program available ..</h1> - </div> - <h2><a routerLink="/program_create">Create a new program</a></h2> - </div> </div> +<div *ngIf="programReceivedFailed"> + <h1 style="margin:2rem 0 0 2rem;text-align: center">Oops.. no program available ..</h1> + <h2 style="margin:2rem 0 0 2rem;text-align: center"><a routerLink="/program_create">Create a new program</a></h2> +</div> + + +<span *ngIf="!programs"><ngx-ui-loader></ngx-ui-loader></span> diff --git a/client/src/app/program-displayer/program-displayer.component.scss b/client/src/app/program-displayer/program-displayer.component.scss index 592867ec7f4187d0ba56a5d80f37c07d63661365..b6e9607df1a41e18264f56650c0d27ad0f349959 100644 --- a/client/src/app/program-displayer/program-displayer.component.scss +++ b/client/src/app/program-displayer/program-displayer.component.scss @@ -1,19 +1,19 @@ * { - color: rgba(236, 240, 241, 1); + color: var(--color-cloud); } .language { - color: rgba(230, 126, 34, 1); + color: var(--color-language); float: right; } .language:hover { - color: rgba(210, 106, 14, 1.0); + color: var(--color-language-hover); } a.sensei { - color: #6c757d !important; + color: var(--color-dark-grey) !important; } a.sensei:hover { @@ -33,10 +33,16 @@ a { .nbkata { font-size: 15px; - color: rgba(46, 204, 113, 1); + color:var(--color-amethyst); float: right; } .card { - background-color: rgba(43, 47, 57, 1); + background-color: var(--color-dark-blue); +} + + +.card:hover{ + background-color: var(--color-electro); + border:1px solid var(--color-electro); } diff --git a/client/src/app/program-displayer/program-displayer.component.ts b/client/src/app/program-displayer/program-displayer.component.ts index fff044fd0268ee455d125f07aaabca4eafbf54fa..c54995d11a1905e0483f9cc7bd10e276d3d021e0 100644 --- a/client/src/app/program-displayer/program-displayer.component.ts +++ b/client/src/app/program-displayer/program-displayer.component.ts @@ -1,6 +1,7 @@ import {Component, OnInit} from '@angular/core'; import {FetchProgramService} from '../fetch-program.service'; import {Program} from './program'; +import {NgxUiLoaderService} from 'ngx-ui-loader'; @Component({ selector: 'app-program-displayer', @@ -13,16 +14,18 @@ export class ProgramDisplayerComponent implements OnInit { programs: Program[]; programReceivedFailed = false; - constructor(private fetchProgramService: FetchProgramService) { + constructor(private fetchProgramService: FetchProgramService, private ngxLoader: NgxUiLoaderService,) { } getProgram(): void { + this.ngxLoader.start(); this.fetchProgramService.getPrograms().subscribe((data: Program[]) => { this.programs = data; - + this.ngxLoader.stop(); }, error1 => { if (error1.status === 404) { this.programReceivedFailed = true; + this.ngxLoader.stop(); } }); } diff --git a/client/src/styles.scss b/client/src/styles.scss index 126847dcd56caf69e93ae2323d7dbcff1ad064cd..e7d6f82b6881e40f9b481b2cbf0cf186d596128f 100644 --- a/client/src/styles.scss +++ b/client/src/styles.scss @@ -5,6 +5,16 @@ html, body { --color-cloud: rgba(236, 240, 241, 1); --color-dark-blue: rgba(43, 47, 57, 1); --color-light-blue: rgba(63, 67, 77, 1); + --color-soft-light-blue: rgba(47, 54, 64, 1); + --color-button-hover: rgba(52, 73, 94, 1.0); + --color-button-active: rgba(45, 66, 87, 1.0); + --color-language: rgba(230, 126, 34, 1); + --color-language-hover: rgba(210, 106, 14, 1.0); + --color-dark-grey: #6c757d; + --color-amethyst:rgba(155, 89, 182,1.0); + --color-emerald: rgba(52, 73, 94,1.0); + --color-sunflower: rgba(241, 196, 15,1.0); + --color-electro : rgba(38, 42, 52, 1); } body { @@ -18,11 +28,24 @@ body { } .button { - background-color: var(--color-light-blue) ; + background-color: var(--color-dark-blue); border: 0; padding: .4em .7em .4em .7em; border-radius: .4em; color: var(--color-cloud); - border:3px solid var(--color-cloud); + +} + +.button:hover { + background-color: var(--color-button-hover); +} + +.button:focus { + outline: none; +} + +.button:active { + background-color: var(--color-button-active); } + diff --git a/launch.sh b/launch.sh new file mode 100755 index 0000000000000000000000000000000000000000..673bf2c6915c5d1dc33ccad9a5fb3913707c1a37 --- /dev/null +++ b/launch.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd client +ng serve --open \ No newline at end of file diff --git a/server_rest/.idea/compiler.xml b/server_rest/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..2acf55ff6a2012f66f1f23294071b73c1d06afe3 --- /dev/null +++ b/server_rest/.idea/compiler.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <annotationProcessing> + <profile name="Maven default annotation processors profile" enabled="true"> + <sourceOutputDir name="target/generated-sources/annotations" /> + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> + <outputRelativeToContentRoot value="true" /> + <module name="server_rest" /> + <module name="09" /> + </profile> + </annotationProcessing> + </component> +</project> \ No newline at end of file diff --git a/server_rest/.idea/misc.xml b/server_rest/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d752e8be6c71125a532e49eb36d37e9e32d89af --- /dev/null +++ b/server_rest/.idea/misc.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="MavenProjectsManager"> + <option name="originalFiles"> + <list> + <option value="$PROJECT_DIR$/pom.xml" /> + </list> + </option> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_12" project-jdk-name="12" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/server_rest/.idea/sbt.xml b/server_rest/.idea/sbt.xml new file mode 100644 index 0000000000000000000000000000000000000000..20187435474e5ee4a31e9f6fdd531957b1ba89e3 --- /dev/null +++ b/server_rest/.idea/sbt.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ScalaSbtSettings"> + <option name="customVMPath" /> + </component> +</project> \ No newline at end of file diff --git a/server_rest/.idea/uiDesigner.xml b/server_rest/.idea/uiDesigner.xml new file mode 100644 index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8 --- /dev/null +++ b/server_rest/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Palette2"> + <group name="Swing"> + <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> + </item> + <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> + <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> + <initial-values> + <property name="text" value="Button" /> + </initial-values> + </item> + <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="RadioButton" /> + </initial-values> + </item> + <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="CheckBox" /> + </initial-values> + </item> + <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="Label" /> + </initial-values> + </item> + <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> + <preferred-size width="-1" height="20" /> + </default-constraints> + </item> + <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> + </item> + </group> + </component> +</project> \ No newline at end of file diff --git a/server_rest/.idea/vcs.xml b/server_rest/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..9378d6dc69935724d288f515b9f8acb449bdb08d --- /dev/null +++ b/server_rest/.idea/vcs.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$USER_HOME$" vcs="Git" /> + <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/server_rest/.idea/workspace.xml b/server_rest/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..ee65090bc03369f5f927b1a1b2867b6b0e19f1a4 --- /dev/null +++ b/server_rest/.idea/workspace.xml @@ -0,0 +1,502 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="e6a1f2e5-4f60-4227-82bb-83eb10fa94a5" name="Default Changelist" comment=""> + <change beforePath="$PROJECT_DIR$/../client/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../client/package-lock.json" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/../client/package.json" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/app.module.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/languages_canvas.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/languages_canvas.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/styles.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/styles.scss" afterDir="false" /> + </list> + <ignored path="$PROJECT_DIR$/out/" /> + <ignored path="$PROJECT_DIR$/target/" /> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="DefaultGradleProjectSettings"> + <option name="isMigrated" value="true" /> + </component> + <component name="FileEditorManager"> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/pom.xml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="555"> + <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/src/main/java/app.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="243"> + <caret line="52" lean-forward="true" selection-start-line="52" selection-end-line="52" /> + <folding> + <element signature="imports" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/java/LiveDB.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="585"> + <caret line="41" column="39" selection-start-line="41" selection-start-column="39" selection-end-line="41" selection-end-column="39" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/java/Kata.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="15"> + <caret line="1" column="86" selection-start-line="1" selection-start-column="86" selection-end-line="1" selection-end-column="86" /> + <folding> + <element signature="e#1681#1682#0" expanded="true" /> + <element signature="e#1712#1713#0" expanded="true" /> + <element signature="e#1760#1761#0" expanded="true" /> + <element signature="e#1800#1801#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/java/ProgramsDataBase.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="105"> + <caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="43" /> + </state> + </provider> + </entry> + </file> + </leaf> + </component> + <component name="FileTemplateManagerImpl"> + <option name="RECENT_TEMPLATES"> + <list> + <option value="Class" /> + </list> + </option> + </component> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> + </component> + <component name="IdeDocumentHistory"> + <option name="CHANGED_PATHS"> + <list> + <option value="$PROJECT_DIR$/src/main/java/programManagement.java" /> + <option value="$PROJECT_DIR$/src/main/java/liveDB.java" /> + <option value="$PROJECT_DIR$/pom.xml" /> + <option value="$PROJECT_DIR$/src/main/java/Program.java" /> + <option value="$PROJECT_DIR$/src/main/java/KataShowCase.java" /> + <option value="$PROJECT_DIR$/src/main/java/ProgramShowCase.java" /> + <option value="$PROJECT_DIR$/src/main/java/Kata.java" /> + <option value="$PROJECT_DIR$/src/main/java/ProgramsDataBase.java" /> + <option value="$PROJECT_DIR$/src/main/java/LiveDB.java" /> + <option value="$PROJECT_DIR$/src/main/java/app.java" /> + </list> + </option> + </component> + <component name="MavenImportPreferences"> + <option name="importingSettings"> + <MavenImportingSettings> + <option name="importAutomatically" value="true" /> + </MavenImportingSettings> + </option> + </component> + <component name="MavenProjectNavigator"> + <treeState> + <expand> + <path> + <item name="" type="16c1761:MavenProjectsStructure$RootNode" /> + <item name="04" type="9519ce18:MavenProjectsStructure$ProjectNode" /> + </path> + </expand> + <select /> + </treeState> + </component> + <component name="ProjectConfigurationFiles"> + <option name="files"> + <list> + <option value="$PROJECT_DIR$/.idea/compiler.xml" /> + <option value="$PROJECT_DIR$/.idea/vcs.xml" /> + </list> + </option> + </component> + <component name="ProjectFrameBounds"> + <option name="y" value="23" /> + <option name="width" value="1920" /> + <option name="height" value="1121" /> + </component> + <component name="ProjectLevelVcsManager" settingsEditedManually="true"> + <ConfirmationsSetting value="1" id="Add" /> + </component> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="ProjectPane" /> + <pane id="Scope" /> + <pane id="PackagesPane" /> + </panes> + </component> + <component name="PropertiesComponent"> + <property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> + <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="aspect.path.notification.shown" value="true" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$" /> + <property name="node.js.detected.package.eslint" value="true" /> + <property name="node.js.path.for.package.eslint" value="project" /> + <property name="node.js.selected.package.eslint" value="(autodetect)" /> + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> + <property name="restartRequiresConfirmation" value="false" /> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="RunManager"> + <configuration name="app" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> + <option name="MAIN_CLASS_NAME" value="app" /> + <module name="09" /> + <method v="2"> + <option name="Make" enabled="true" /> + </method> + </configuration> + <recent_temporary> + <list> + <item itemvalue="Application.app" /> + </list> + </recent_temporary> + </component> + <component name="SbtLocalSettings"> + <option name="projectSyncType"> + <map> + <entry key="$PROJECT_DIR$/../../scalatra/scala_heroes_provider/my-scalatra-web-app" value="PREVIEW" /> + <entry key="$PROJECT_DIR$/../../scalatra/scalatra_heroes_provider" value="PREVIEW" /> + </map> + </option> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="e6a1f2e5-4f60-4227-82bb-83eb10fa94a5" name="Default Changelist" comment="" /> + <created>1556178762532</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1556178762532</updated> + <workItem from="1556178766124" duration="8507000" /> + <workItem from="1556214856871" duration="3137000" /> + <workItem from="1556882486866" duration="3200000" /> + <workItem from="1556962451252" duration="434000" /> + <workItem from="1557124766550" duration="154000" /> + <workItem from="1557148397301" duration="9704000" /> + <workItem from="1557210949742" duration="17614000" /> + <workItem from="1557298032818" duration="4720000" /> + <workItem from="1557322451462" duration="202000" /> + <workItem from="1557327228313" duration="707000" /> + </task> + <servers /> + </component> + <component name="TimeTrackingManager"> + <option name="totallyTimeSpent" value="48450000" /> + </component> + <component name="TodoView"> + <todo-panel id="selected-file"> + <is-autoscroll-to-source value="true" /> + </todo-panel> + <todo-panel id="all"> + <are-packages-shown value="true" /> + <is-autoscroll-to-source value="true" /> + </todo-panel> + </component> + <component name="ToolWindowManager"> + <frame x="0" y="23" width="1920" height="1121" extended-state="0" /> + <editor active="true" /> + <layout> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2736954" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info id="Image Layers" order="2" /> + <window_info id="Designer" order="3" /> + <window_info id="UI Designer" order="4" /> + <window_info id="Capture Tool" order="5" /> + <window_info id="Favorites" order="6" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" /> + <window_info anchor="bottom" id="Run" order="2" weight="0.3595724" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.39941692" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" weight="0.32920355" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info anchor="bottom" id="Version Control" order="8" weight="0.32920355" /> + <window_info anchor="bottom" id="Database Changes" order="9" /> + <window_info anchor="bottom" id="Terminal" order="10" weight="0.32920355" /> + <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" /> + <window_info anchor="bottom" id="Messages" order="12" weight="0.32920355" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + <window_info anchor="right" id="Palette" order="3" /> + <window_info anchor="right" id="Database" order="4" /> + <window_info anchor="right" id="Theme Preview" order="5" /> + <window_info anchor="right" id="Maven" order="6" weight="0.32960597" /> + <window_info anchor="right" id="Capture Analysis" order="7" /> + <window_info anchor="right" id="Palette	" order="8" /> + </layout> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="XDebuggerManager"> + <breakpoint-manager> + <breakpoints> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/LiveDB.java</url> + <line>45</line> + <properties /> + <option name="timeStamp" value="4" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/app.java</url> + <line>95</line> + <properties /> + <option name="timeStamp" value="5" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/app.java</url> + <line>78</line> + <properties /> + <option name="timeStamp" value="6" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/app.java</url> + <line>73</line> + <properties /> + <option name="timeStamp" value="7" /> + </line-breakpoint> + </breakpoints> + </breakpoint-manager> + </component> + <component name="debuggerHistoryManager"> + <expressions id="watch"> + <expression> + <expression-string>kata.id == null</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata.id === null</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata.id</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata.id.equals(null)</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata.equals(new Kata())</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata.equals(null)</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>kata === null</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>prg.getId()</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>ctx.pathParam("id")</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>programs.remove(katas)</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + </expressions> + </component> + <component name="editorHistoryManager"> + <entry file="jar:///Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/lang/String.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="207"> + <caret line="134" column="15" selection-start-line="134" selection-start-column="15" selection-end-line="134" selection-end-column="15" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/programManagement.java" /> + <entry file="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/2.8.0/javalin-2.8.0.jar!/io/javalin/Context.class"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="217"> + <caret line="80" selection-start-line="80" selection-end-line="80" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/Program.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="60"> + <caret line="4" column="4" selection-start-line="4" selection-start-column="4" selection-end-line="4" selection-end-column="26" /> + <folding> + <element signature="e#1226#1227#0" expanded="true" /> + <element signature="e#1254#1255#0" expanded="true" /> + <element signature="e#1305#1306#0" expanded="true" /> + <element signature="e#1339#1340#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/ProgramShowCase.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="15"> + <caret line="1" column="57" selection-start-line="1" selection-start-column="57" selection-end-line="1" selection-end-column="57" /> + <folding> + <element signature="e#482#483#0" expanded="true" /> + <element signature="e#510#511#0" expanded="true" /> + <element signature="e#552#553#0" expanded="true" /> + <element signature="e#586#587#0" expanded="true" /> + <element signature="e#619#620#0" expanded="true" /> + <element signature="e#648#649#0" expanded="true" /> + <element signature="e#692#693#0" expanded="true" /> + <element signature="e#728#729#0" expanded="true" /> + <element signature="e#763#764#0" expanded="true" /> + <element signature="e#794#795#0" expanded="true" /> + <element signature="e#842#843#0" expanded="true" /> + <element signature="e#882#883#0" expanded="true" /> + <element signature="e#920#921#0" expanded="true" /> + <element signature="e#954#955#0" expanded="true" /> + <element signature="e#1008#1009#0" expanded="true" /> + <element signature="e#1054#1055#0" expanded="true" /> + <element signature="e#1084#1085#0" expanded="true" /> + <element signature="e#1113#1114#0" expanded="true" /> + <element signature="e#1154#1155#0" expanded="true" /> + <element signature="e#1190#1191#0" expanded="true" /> + <element signature="e#1223#1224#0" expanded="true" /> + <element signature="e#1250#1251#0" expanded="true" /> + <element signature="e#1292#1293#0" expanded="true" /> + <element signature="e#1324#1325#0" expanded="true" /> + <element signature="e#1424#1425#0" expanded="true" /> + <element signature="e#1456#1457#0" expanded="true" /> + <element signature="e#1506#1507#0" expanded="true" /> + <element signature="e#1548#1549#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/KataShowCase.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="225"> + <caret line="19" column="26" lean-forward="true" selection-start-line="19" selection-start-column="26" selection-end-line="19" selection-end-column="26" /> + <folding> + <element signature="e#443#444#0" expanded="true" /> + <element signature="e#476#477#0" expanded="true" /> + <element signature="e#737#738#0" expanded="true" /> + <element signature="e#766#767#0" expanded="true" /> + <element signature="e#810#811#0" expanded="true" /> + <element signature="e#846#847#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/2.8.0/javalin-2.8.0.jar!/io/javalin/Handler.class"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="105"> + <caret line="8" column="9" selection-start-line="8" selection-start-column="9" selection-end-line="8" selection-end-column="9" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/pom.xml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="555"> + <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/LiveDB.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="585"> + <caret line="41" column="39" selection-start-line="41" selection-start-column="39" selection-end-line="41" selection-end-column="39" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/Kata.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="15"> + <caret line="1" column="86" selection-start-line="1" selection-start-column="86" selection-end-line="1" selection-end-column="86" /> + <folding> + <element signature="e#1681#1682#0" expanded="true" /> + <element signature="e#1712#1713#0" expanded="true" /> + <element signature="e#1760#1761#0" expanded="true" /> + <element signature="e#1800#1801#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/ProgramsDataBase.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="105"> + <caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="43" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/app.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="243"> + <caret line="52" lean-forward="true" selection-start-line="52" selection-end-line="52" /> + <folding> + <element signature="imports" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </component> +</project> \ No newline at end of file diff --git a/server_rest/pom.xml b/server_rest/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..c5be4794edffccfd186a19e6f5e75d4ea4fc3a2c --- /dev/null +++ b/server_rest/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>09</groupId> + <artifactId>09</artifactId> + <version>1.0-SNAPSHOT</version> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>8</source> + <target>8</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20180813</version> + </dependency> + <dependency> + <groupId>io.javalin</groupId> + <artifactId>javalin</artifactId> + <version>2.8.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.7.26</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.9.8</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + + </dependencies> + +</project> \ No newline at end of file diff --git a/server_rest/server_rest_new.iml b/server_rest/server_rest_new.iml new file mode 100644 index 0000000000000000000000000000000000000000..78b2cc53b203f0b97534bb1184cdc7b474339fb4 --- /dev/null +++ b/server_rest/server_rest_new.iml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4" /> \ No newline at end of file diff --git a/server_rest/src/main/java/Kata.java b/server_rest/src/main/java/Kata.java new file mode 100644 index 0000000000000000000000000000000000000000..55f94dcfeed3d00b25b7f18d5e56ba392d72c0e4 --- /dev/null +++ b/server_rest/src/main/java/Kata.java @@ -0,0 +1,94 @@ +public class Kata { + private String id, title, canva, cassert, solution, rules,programID,difficulty,language; + private boolean keepAssert; + private int nbAttempt; + + + public boolean isKeepAssert() { + return keepAssert; + } + + public void setKeepAssert(boolean keepAssert) { + this.keepAssert = keepAssert; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getCanva() { + return canva; + } + + public void setCanva(String canva) { + this.canva = canva; + } + + public String getCassert() { + return cassert; + } + + public void setCassert(String cassert) { + this.cassert = cassert; + } + + public String getSolution() { + return solution; + } + + public void setSolution(String solution) { + this.solution = solution; + } + + public String getRules() { + return rules; + } + + public void setRules(String rules) { + this.rules = rules; + } + + public int getNbAttempt() { + return nbAttempt; + } + + public void setNbAttempt(int nbAttempt) { + this.nbAttempt = nbAttempt; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getProgramID() { + return programID; + } + + public void setProgramID(String programID) { + this.programID = programID; + } + + public String getDifficulty() { + return difficulty; + } + + public void setDifficulty(String difficulty) { + this.difficulty = difficulty; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } +} diff --git a/server_rest/src/main/java/KataShowCase.java b/server_rest/src/main/java/KataShowCase.java new file mode 100644 index 0000000000000000000000000000000000000000..345ea1e1390e0127dbb657610c0cd0132785180d --- /dev/null +++ b/server_rest/src/main/java/KataShowCase.java @@ -0,0 +1,42 @@ +public class KataShowCase { + private String title,difficulty,id,status; + + public KataShowCase(String title, String difficulty, String id, String status){ + this.difficulty = difficulty; + this.title = title; + this.id = id; + this.status = status; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDifficulty() { + return difficulty; + } + + public void setDifficulty(String difficulty) { + this.difficulty = difficulty; + } + + public String getId() { + return id; + } + + public void setId(String programID) { + this.id = programID; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/server_rest/src/main/java/LiveDB.java b/server_rest/src/main/java/LiveDB.java new file mode 100644 index 0000000000000000000000000000000000000000..2d8063ca68214f7d5b14668a8289e1b9bb96a63b --- /dev/null +++ b/server_rest/src/main/java/LiveDB.java @@ -0,0 +1,77 @@ +import java.util.ArrayList; + +public class LiveDB extends ProgramsDataBase { + + ArrayList<Kata> katas; + + ArrayList<Program> programs; + + public LiveDB() { + this.programs = new ArrayList<>(); + this.katas = new ArrayList<>(); + } + + public void createProgram(Program prg) { + this.programs.add(prg); + } + + public void createKata(Kata kata) { + + for (Program p : this.programs) + if (p.getId().equals(kata.getProgramID())) { + p.setNbKata(p.getNbKata() + 1); + p.getKatas().add(kata); + break; + } + } + + public ArrayList<ProgramShowCase> getProgramsDetails() { + ArrayList<ProgramShowCase> p = new ArrayList<>(); + + for (Program prg : this.programs) + p.add(new ProgramShowCase(prg.getTitle(), prg.getSensei(), prg.getLanguage(), prg.getDescription(), prg.getNbKata(), prg.getTags(), prg.getId())); + + return p; + } + + public Kata getProgramKata(String programID, String kataID) { + ArrayList<Kata> ktemp = new ArrayList<>(); + Kata kata = new Kata(); + for (Program prg : this.programs) + if (prg.getId().equals(programID)) + ktemp = prg.getKatas(); + for(Kata k : ktemp) + if(k.getId().equals(kataID)) + kata = k; + return kata; + } + + public ArrayList<KataShowCase> getProgramKatasDetails(String programID) { + ArrayList<KataShowCase> ktsc = new ArrayList<>(); + ArrayList<Kata> kt = new ArrayList<>(); + for (Program prg : this.programs) + if (prg.getId().equals(programID)) { + kt = prg.getKatas(); + break; + } + + for (Kata k : kt) + ktsc.add(new KataShowCase(k.getTitle(), k.getDifficulty(), k.getId(), "TODO")); + return ktsc; + } + + public ArrayList<String> getProgramDetailsByID(String id){ + ArrayList<String> infos = new ArrayList<>(); + + for (Program p : this.programs) + if(p.getId().equals(id)){ + infos.add(p.getTitle()); + infos.add(p.getLanguage()); + infos.add(p.getSensei()); + break; + } + + return infos; + } + +} \ No newline at end of file diff --git a/server_rest/src/main/java/Program.java b/server_rest/src/main/java/Program.java new file mode 100644 index 0000000000000000000000000000000000000000..40ced1914b050bc844664e10926797549c3bd58b --- /dev/null +++ b/server_rest/src/main/java/Program.java @@ -0,0 +1,80 @@ +import java.util.ArrayList; + +public class Program { + private String id,sensei,language,title,description; + private String[] tags; + private int nbKata; + private ArrayList<Kata> katas; + + public String getSensei() { + return sensei; + } + + public void setSensei(String sensei) { + this.sensei = sensei; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getNbKata() { + return nbKata; + } + + public void setNbKata(int nbKata) { + this.nbKata = nbKata; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String[] getTags() { + return tags; + } + + public void setTags(String[] tags) { + this.tags = tags; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ArrayList<Kata> getKatas() { + return katas; + } + + public void setKatas(ArrayList<Kata> katas) { + this.katas = katas; + } +/* + public ArrayList<Kata> getKata() { + return kata; + } + + public void setKata(ArrayList<Kata> kata) { + this.kata = kata; + }*/ +} diff --git a/server_rest/src/main/java/ProgramShowCase.java b/server_rest/src/main/java/ProgramShowCase.java new file mode 100644 index 0000000000000000000000000000000000000000..5f1974c31a6c93f62ad3c67aedf72d4c3dfc713b --- /dev/null +++ b/server_rest/src/main/java/ProgramShowCase.java @@ -0,0 +1,71 @@ +public class ProgramShowCase { + private String title,sensei,language,description,programID; + private int nbKata; + private String[] tags; + + public ProgramShowCase(String title, String sensei, String language, String description, int nbKata, String[] tags, String programID){ + this.title = title; + this.sensei = sensei; + this.language = language; + this.description = description; + this.nbKata = nbKata; + this.tags = tags; + this.programID = programID; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSensei() { + return sensei; + } + + public void setSensei(String sensei) { + this.sensei = sensei; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getNbKata() { + return nbKata; + } + + public void setNbKata(int nbKata) { + this.nbKata = nbKata; + } + + public String[] getTags() { + return tags; + } + + public void setTags(String[] tags) { + this.tags = tags; + } + + public String getProgramID() { + return programID; + } + + public void setProgramID(String programID) { + this.programID = programID; + } +} diff --git a/server_rest/src/main/java/ProgramsDataBase.java b/server_rest/src/main/java/ProgramsDataBase.java new file mode 100644 index 0000000000000000000000000000000000000000..f0ece141928330037e3ac090d576d52dd302316e --- /dev/null +++ b/server_rest/src/main/java/ProgramsDataBase.java @@ -0,0 +1,10 @@ +import java.util.ArrayList; + +public abstract class ProgramsDataBase { + public abstract void createProgram(Program prg); + public abstract void createKata(Kata kata); + public abstract ArrayList<ProgramShowCase> getProgramsDetails(); + public abstract Kata getProgramKata(String programID, String kataID); + public abstract ArrayList<KataShowCase> getProgramKatasDetails(String programID); + public abstract ArrayList<String> getProgramDetailsByID(String id); +} diff --git a/server_rest/src/main/java/app.java b/server_rest/src/main/java/app.java new file mode 100644 index 0000000000000000000000000000000000000000..a30622df207525a986be370534baa6983b50d856 --- /dev/null +++ b/server_rest/src/main/java/app.java @@ -0,0 +1,101 @@ +import com.fasterxml.jackson.databind.ObjectMapper; +import io.javalin.Javalin; + +import java.io.*; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; + +public class app { + + private static ProgramsDataBase db = new LiveDB(); + private static ObjectMapper objectMapper = new ObjectMapper(); + + public static void main(String[] args) { + + Javalin app = Javalin.create().enableCorsForAllOrigins().start(7000); + + app.post("/run/", ctx -> { + + HttpURLConnection connection = null; + + try { + URL compilator = new URL("http://localhost:6999"); + connection = (HttpURLConnection) compilator.openConnection(); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + } catch (ConnectException e) { + e.printStackTrace(); + } + + try (DataOutputStream wr = new DataOutputStream(connection.getOutputStream())) { + wr.writeBytes(ctx.body()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (ConnectException e) { + e.printStackTrace(); + } + + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String response = in.readLine(); + ctx.result(response); + } catch (IOException e) { + e.printStackTrace(); + } + + + //String inputLine; + //while ((inputLine = in.readLine()) != null) + // System.out.println(inputLine); + + // For now, we can assume we will only need to fetch one response since the compilation + // server does send one json object with all the required data. + + }); + + app.post("/program/create", ctx -> { + Program prg = objectMapper.readValue(ctx.body(), Program.class); + db.createProgram(prg); + }); + + app.post("/kata/create", ctx -> { + Kata kt = objectMapper.readValue(ctx.body(), Kata.class); + db.createKata(kt); + }); + + app.get("/program/getdetails", ctx -> { + ArrayList<ProgramShowCase> prgsc = db.getProgramsDetails(); + if (prgsc.size() == 0) + ctx.status(404); + else + ctx.json(prgsc); + }); + + app.get("/program/getkatas/details/:id", ctx -> { + ArrayList<KataShowCase> ktsc = db.getProgramKatasDetails(ctx.pathParam("id")); + ctx.json(ktsc); + }); + + app.get("/program/getkata/:prid/:id", ctx -> { + + Kata kata = db.getProgramKata(ctx.pathParam("prid"), ctx.pathParam("id")); + if (kata.getId() == null) + ctx.status(404); + else + ctx.json(kata); + }); + + app.get("program/getdetails/:id", ctx -> { + ArrayList<String> s = db.getProgramDetailsByID(ctx.pathParam("id")); + if (s.size() == 0) + ctx.status(404); + else + ctx.json(s); + }); + + } + +} diff --git a/server_rest/target/classes/Kata.class b/server_rest/target/classes/Kata.class new file mode 100644 index 0000000000000000000000000000000000000000..f25c79bcda09dd0d6749bcb29e8197d9ff1f8e99 Binary files /dev/null and b/server_rest/target/classes/Kata.class differ diff --git a/server_rest/target/classes/KataShowCase.class b/server_rest/target/classes/KataShowCase.class new file mode 100644 index 0000000000000000000000000000000000000000..0cd30bb503988e17695e5101e37861fec13e46c1 Binary files /dev/null and b/server_rest/target/classes/KataShowCase.class differ diff --git a/server_rest/target/classes/LiveDB.class b/server_rest/target/classes/LiveDB.class new file mode 100644 index 0000000000000000000000000000000000000000..ab6ebb636dbde39b1bc15d10352aff1beab6f9e2 Binary files /dev/null and b/server_rest/target/classes/LiveDB.class differ diff --git a/server_rest/target/classes/Program.class b/server_rest/target/classes/Program.class new file mode 100644 index 0000000000000000000000000000000000000000..28a6aa780e25735f56a5623fa57bcb5ccfcefe45 Binary files /dev/null and b/server_rest/target/classes/Program.class differ diff --git a/server_rest/target/classes/ProgramShowCase.class b/server_rest/target/classes/ProgramShowCase.class new file mode 100644 index 0000000000000000000000000000000000000000..787ad292fa0c3d49f6f3f9376aa49f0cc0621a24 Binary files /dev/null and b/server_rest/target/classes/ProgramShowCase.class differ diff --git a/server_rest/target/classes/ProgramsDataBase.class b/server_rest/target/classes/ProgramsDataBase.class new file mode 100644 index 0000000000000000000000000000000000000000..4f73f058ad7f7eb5a64a9773bbba0c50cc4f7ed6 Binary files /dev/null and b/server_rest/target/classes/ProgramsDataBase.class differ diff --git a/server_rest/target/classes/app.class b/server_rest/target/classes/app.class new file mode 100644 index 0000000000000000000000000000000000000000..4330328ec39ca3c488dd2ea4f9dae24083eb77d9 Binary files /dev/null and b/server_rest/target/classes/app.class differ diff --git a/serveur_compilation/.idea/compiler.xml b/serveur_compilation/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e7b9fd57fe9ac0402fda14843a0f8fc00493b0e --- /dev/null +++ b/serveur_compilation/.idea/compiler.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <annotationProcessing> + <profile name="Maven default annotation processors profile" enabled="true"> + <sourceOutputDir name="target/generated-sources/annotations" /> + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> + <outputRelativeToContentRoot value="true" /> + <module name="05" /> + <module name="serveur_compilation_new" /> + </profile> + </annotationProcessing> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/.idea/misc.xml b/serveur_compilation/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d752e8be6c71125a532e49eb36d37e9e32d89af --- /dev/null +++ b/serveur_compilation/.idea/misc.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="MavenProjectsManager"> + <option name="originalFiles"> + <list> + <option value="$PROJECT_DIR$/pom.xml" /> + </list> + </option> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_12" project-jdk-name="12" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/.idea/sbt.xml b/serveur_compilation/.idea/sbt.xml new file mode 100644 index 0000000000000000000000000000000000000000..20187435474e5ee4a31e9f6fdd531957b1ba89e3 --- /dev/null +++ b/serveur_compilation/.idea/sbt.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ScalaSbtSettings"> + <option name="customVMPath" /> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/.idea/uiDesigner.xml b/serveur_compilation/.idea/uiDesigner.xml new file mode 100644 index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8 --- /dev/null +++ b/serveur_compilation/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Palette2"> + <group name="Swing"> + <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> + </item> + <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> + <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> + <initial-values> + <property name="text" value="Button" /> + </initial-values> + </item> + <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="RadioButton" /> + </initial-values> + </item> + <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="CheckBox" /> + </initial-values> + </item> + <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> + <initial-values> + <property name="text" value="Label" /> + </initial-values> + </item> + <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> + <preferred-size width="150" height="-1" /> + </default-constraints> + </item> + <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> + <preferred-size width="150" height="50" /> + </default-constraints> + </item> + <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> + <preferred-size width="200" height="200" /> + </default-constraints> + </item> + <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> + </item> + <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> + </item> + <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> + <preferred-size width="-1" height="20" /> + </default-constraints> + </item> + <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> + <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> + </item> + <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> + <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> + </item> + </group> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/.idea/vcs.xml b/serveur_compilation/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..9378d6dc69935724d288f515b9f8acb449bdb08d --- /dev/null +++ b/serveur_compilation/.idea/vcs.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$USER_HOME$" vcs="Git" /> + <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/.idea/workspace.xml b/serveur_compilation/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..5e727c3e502c6709f5e1278f0b45eba6fae63f68 --- /dev/null +++ b/serveur_compilation/.idea/workspace.xml @@ -0,0 +1,439 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="8d8fb2c1-8426-4933-8193-ee68625cf8de" name="Default Changelist" comment=""> + <change beforePath="$PROJECT_DIR$/../client/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../client/package-lock.json" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/../client/package.json" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/app.module.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-create/kata-create.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata-displayer/kata-displayer.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/kata/kata.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/kata/kata.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/languages_canvas.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/languages_canvas.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/main-left-side-nav/main-left-side-nav.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-create/program-create.component.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.html" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/app/program-displayer/program-displayer.component.scss" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/../client/src/styles.scss" beforeDir="false" afterPath="$PROJECT_DIR$/../client/src/styles.scss" afterDir="false" /> + </list> + <ignored path="$PROJECT_DIR$/out/" /> + <ignored path="$PROJECT_DIR$/target/" /> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="DefaultGradleProjectSettings"> + <option name="isMigrated" value="true" /> + </component> + <component name="FileEditorManager"> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/pom.xml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="555"> + <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/java/app.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="135"> + <caret line="10" selection-start-line="10" selection-end-line="10" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/src/main/java/DockerCompilation.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="45"> + <caret line="6" column="11" lean-forward="true" selection-start-line="6" selection-start-column="11" selection-end-line="6" selection-end-column="11" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/docker/python/dockerfile"> + <provider selected="true" editor-type-id="text-editor"> + <state> + <caret column="17" selection-start-column="17" selection-end-column="17" /> + </state> + </provider> + </entry> + </file> + </leaf> + </component> + <component name="FileTemplateManagerImpl"> + <option name="RECENT_TEMPLATES"> + <list> + <option value="Class" /> + </list> + </option> + </component> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> + </component> + <component name="IdeDocumentHistory"> + <option name="CHANGED_PATHS"> + <list> + <option value="$PROJECT_DIR$/pom.xml" /> + <option value="$PROJECT_DIR$/share_docker_file/Main.java" /> + <option value="$PROJECT_DIR$/src/main/java/compilation.java" /> + <option value="$PROJECT_DIR$/src/main/java/Docker_compilation.java" /> + <option value="$PROJECT_DIR$/docker/java/.bashrc" /> + <option value="$PROJECT_DIR$/share_docker_file/java_test.sh" /> + <option value="$PROJECT_DIR$/docker/java/java_test.sh" /> + <option value="$PROJECT_DIR$/docker/java/dockerfile" /> + <option value="$PROJECT_DIR$/src/main/java/HostCompilation.java" /> + <option value="$PROJECT_DIR$/src/main/java/DockerCompilation.java" /> + </list> + </option> + </component> + <component name="MavenImportPreferences"> + <option name="importingSettings"> + <MavenImportingSettings> + <option name="importAutomatically" value="true" /> + </MavenImportingSettings> + </option> + </component> + <component name="ProjectFrameBounds"> + <option name="y" value="23" /> + <option name="width" value="1920" /> + <option name="height" value="1121" /> + </component> + <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="Scope" /> + <pane id="PackagesPane" /> + <pane id="ProjectPane" /> + </panes> + </component> + <component name="PropertiesComponent"> + <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="aspect.path.notification.shown" value="true" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$" /> + <property name="node.js.detected.package.eslint" value="true" /> + <property name="node.js.path.for.package.eslint" value="project" /> + <property name="node.js.selected.package.eslint" value="(autodetect)" /> + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> + <property name="project.structure.last.edited" value="Modules" /> + <property name="project.structure.proportion" value="0.15" /> + <property name="project.structure.side.proportion" value="0.2" /> + <property name="restartRequiresConfirmation" value="false" /> + </component> + <component name="RecentsManager"> + <key name="MoveFile.RECENT_KEYS"> + <recent name="$PROJECT_DIR$/docker/java/files" /> + <recent name="$PROJECT_DIR$/docker/java" /> + </key> + <key name="CopyFile.RECENT_KEYS"> + <recent name="$PROJECT_DIR$/share_docker_file" /> + <recent name="$PROJECT_DIR$/src/main/java" /> + </key> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="RunManager"> + <configuration name="app" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> + <option name="MAIN_CLASS_NAME" value="app" /> + <module name="05" /> + <method v="2"> + <option name="Make" enabled="true" /> + </method> + </configuration> + <recent_temporary> + <list> + <item itemvalue="Application.app" /> + </list> + </recent_temporary> + </component> + <component name="SbtLocalSettings"> + <option name="projectSyncType"> + <map> + <entry key="$PROJECT_DIR$/../../scalatra/scala_heroes_provider/my-scalatra-web-app" value="PREVIEW" /> + <entry key="$PROJECT_DIR$/../../scalatra/scalatra_heroes_provider" value="PREVIEW" /> + </map> + </option> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="8d8fb2c1-8426-4933-8193-ee68625cf8de" name="Default Changelist" comment="" /> + <created>1556635807220</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1556635807220</updated> + <workItem from="1556635811007" duration="263000" /> + <workItem from="1556699075828" duration="2375000" /> + <workItem from="1556724368190" duration="1020000" /> + <workItem from="1556780851092" duration="1114000" /> + <workItem from="1556782478266" duration="80000" /> + <workItem from="1556798541427" duration="1170000" /> + <workItem from="1556825709873" duration="971000" /> + <workItem from="1556827413018" duration="173000" /> + <workItem from="1556827741611" duration="619000" /> + <workItem from="1556829689470" duration="1450000" /> + <workItem from="1556864756289" duration="5129000" /> + <workItem from="1556875523919" duration="63000" /> + <workItem from="1556881783082" duration="8776000" /> + <workItem from="1556962294332" duration="589000" /> + <workItem from="1557124763282" duration="151000" /> + <workItem from="1557158060665" duration="1580000" /> + <workItem from="1557211629757" duration="2837000" /> + <workItem from="1557298034418" duration="470000" /> + <workItem from="1557322368264" duration="285000" /> + <workItem from="1557323560383" duration="425000" /> + </task> + <servers /> + </component> + <component name="TimeTrackingManager"> + <option name="totallyTimeSpent" value="29540000" /> + </component> + <component name="TodoView"> + <todo-panel id="selected-file"> + <is-autoscroll-to-source value="true" /> + </todo-panel> + <todo-panel id="all"> + <are-packages-shown value="true" /> + <is-autoscroll-to-source value="true" /> + </todo-panel> + </component> + <component name="ToolWindowManager"> + <frame x="0" y="23" width="1920" height="1121" extended-state="0" /> + <editor active="true" /> + <layout> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.29872206" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info id="Image Layers" order="2" /> + <window_info id="Designer" order="3" /> + <window_info id="UI Designer" order="4" /> + <window_info id="Capture Tool" order="5" /> + <window_info id="Favorites" order="6" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" weight="0.32891566" /> + <window_info anchor="bottom" id="Run" order="2" weight="0.4888241" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.39941692" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" weight="0.3283186" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info anchor="bottom" id="Version Control" order="8" weight="0.32891566" /> + <window_info anchor="bottom" id="Database Changes" order="9" /> + <window_info anchor="bottom" id="Terminal" order="10" weight="0.24159291" /> + <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" /> + <window_info anchor="bottom" id="Messages" order="12" weight="0.32920355" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + <window_info anchor="right" id="Palette" order="3" /> + <window_info anchor="right" id="Database" order="4" /> + <window_info anchor="right" id="Theme Preview" order="5" /> + <window_info anchor="right" id="Maven" order="6" /> + <window_info anchor="right" id="Capture Analysis" order="7" /> + <window_info anchor="right" id="Palette	" order="8" /> + </layout> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="XDebuggerManager"> + <breakpoint-manager> + <breakpoints> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/DockerCompilation.java</url> + <line>45</line> + <properties /> + <option name="timeStamp" value="11" /> + </line-breakpoint> + </breakpoints> + </breakpoint-manager> + <watches-manager> + <configuration name="Application"> + <watch expression="cmd" language="JAVA" /> + <watch expression="ctx.body()" /> + <watch expression="escapeJava()" language="JAVA" /> + <watch expression="new JSONObject(ctx.body())" /> + <watch expression="input.get("assert")" /> + </configuration> + </watches-manager> + </component> + <component name="debuggerHistoryManager"> + <expressions id="watch"> + <expression> + <expression-string>cmd</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> + <expression-string>escapeJava()</expression-string> + <language-id>JAVA</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + </expressions> + </component> + <component name="editorHistoryManager"> + <entry file="file://$PROJECT_DIR$/share_docker_file/test.txt" /> + <entry file="file://$PROJECT_DIR$/share_docker_file/Main.java" /> + <entry file="file://$PROJECT_DIR$/docker/java/files/java_test.sh" /> + <entry file="file://$PROJECT_DIR$/src/main/java/HostCompilation.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="382"> + <caret line="42" column="40" selection-start-line="42" selection-start-column="34" selection-end-line="42" selection-end-column="40" /> + <folding> + <element signature="imports" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/share_docker_file/java_test.sh"> + <provider selected="true" editor-type-id="text-editor" /> + </entry> + <entry file="file://$PROJECT_DIR$/docker/java/dockerfile"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="105"> + <caret line="7" selection-start-line="7" selection-end-line="7" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/docker/java/.bashrc"> + <provider selected="true" editor-type-id="text-editor"> + <state> + <caret column="33" selection-start-column="33" selection-end-column="33" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/share_docker_file/sample.py" /> + <entry file="file://$PROJECT_DIR$/share_docker_file/assert.py" /> + <entry file="file://$PROJECT_DIR$/pom.xml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="555"> + <caret line="37" column="20" selection-start-line="37" selection-start-column="20" selection-end-line="37" selection-end-column="20" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/app.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="135"> + <caret line="10" selection-start-line="10" selection-end-line="10" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/docker/python/dockerfile"> + <provider selected="true" editor-type-id="text-editor"> + <state> + <caret column="17" selection-start-column="17" selection-end-column="17" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/DockerCompilation.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="45"> + <caret line="6" column="11" lean-forward="true" selection-start-line="6" selection-start-column="11" selection-end-line="6" selection-end-column="11" /> + </state> + </provider> + </entry> + </component> + <component name="masterDetails"> + <states> + <state key="ArtifactsStructureConfigurable.UI"> + <settings> + <artifact-editor /> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + <state key="FacetStructureConfigurable.UI"> + <settings> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + <state key="GlobalLibrariesConfigurable.UI"> + <settings> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + <state key="JdkListConfigurable.UI"> + <settings> + <last-edited>12</last-edited> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + <state key="ModuleStructureConfigurable.UI"> + <settings> + <last-edited>05</last-edited> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + <option value="0.6" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + <state key="ProjectLibrariesConfigurable.UI"> + <settings> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + </states> + </component> +</project> \ No newline at end of file diff --git a/serveur_compilation/__pycache__/sample.cpython-37.pyc b/serveur_compilation/__pycache__/sample.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fc1f24fa24d2a8f9d515f49a3f31248170c1847 Binary files /dev/null and b/serveur_compilation/__pycache__/sample.cpython-37.pyc differ diff --git a/serveur_compilation/docker/java/.bashrc b/serveur_compilation/docker/java/.bashrc new file mode 100644 index 0000000000000000000000000000000000000000..6b34cbfe2e54e4a828b85fa1870adc78a1d7e6b1 --- /dev/null +++ b/serveur_compilation/docker/java/.bashrc @@ -0,0 +1 @@ +export CLASSPATH=junit-4.10.jar:. diff --git a/serveur_compilation/docker/java/dockerfile b/serveur_compilation/docker/java/dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..286cc6296e3581bacb5994a21dc0018e76b13d44 --- /dev/null +++ b/serveur_compilation/docker/java/dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get -y upgrade +RUN apt-get install -y default-jdk + +RUN mkdir /env/ +ADD .bashrc /root/ + +WORKDIR /env/ diff --git a/serveur_compilation/docker/java/files.tar b/serveur_compilation/docker/java/files.tar new file mode 100644 index 0000000000000000000000000000000000000000..6a6aa7353582f31310fb3701b0b0d3c873707ab5 Binary files /dev/null and b/serveur_compilation/docker/java/files.tar differ diff --git a/serveur_compilation/docker/python/dockerfile b/serveur_compilation/docker/python/dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..44733c5b9be7eb9168efe37f2c2e592852826375 --- /dev/null +++ b/serveur_compilation/docker/python/dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get -y upgrade +RUN apt-get install -y python3-pip python3-dev +RUN pip3 install assertpy + +RUN mkdir /env/ + +WORKDIR /env/ + diff --git a/serveur_compilation/pom.xml b/serveur_compilation/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..f9b5a7c0bb814964ddfda0efeb076a3565b8136a --- /dev/null +++ b/serveur_compilation/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>05</groupId> + <artifactId>05</artifactId> + <version>1.0-SNAPSHOT</version> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>8</source> + <target>8</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>io.javalin</groupId> + <artifactId>javalin</artifactId> + <version>2.8.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.7.26</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.9.8</version> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20180813</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/serveur_compilation/serveur_compilation_new.iml b/serveur_compilation/serveur_compilation_new.iml new file mode 100644 index 0000000000000000000000000000000000000000..78b2cc53b203f0b97534bb1184cdc7b474339fb4 --- /dev/null +++ b/serveur_compilation/serveur_compilation_new.iml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4" /> \ No newline at end of file diff --git a/serveur_compilation/share_docker_file/Kata.class b/serveur_compilation/share_docker_file/Kata.class new file mode 100644 index 0000000000000000000000000000000000000000..959da4d1550e115f347b94ad691e223177edf53f Binary files /dev/null and b/serveur_compilation/share_docker_file/Kata.class differ diff --git a/serveur_compilation/share_docker_file/Main.class b/serveur_compilation/share_docker_file/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..ad3d50357a4ab5201cd1114a5a4b54ac4491bda4 Binary files /dev/null and b/serveur_compilation/share_docker_file/Main.class differ diff --git a/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc b/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac5905a20d44279dd78eb5cf6c6c4545d0ad401d Binary files /dev/null and b/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc differ diff --git a/serveur_compilation/share_docker_file/java_test.sh b/serveur_compilation/share_docker_file/java_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..081d2811c6cf565eb42eaff705ca5fddc6a2d2ca --- /dev/null +++ b/serveur_compilation/share_docker_file/java_test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +source /root/.bashrc +javac -classpath ${CLASSPATH} Main.java Kata.java +java Main + + diff --git a/serveur_compilation/share_docker_file/junit-4.10.jar b/serveur_compilation/share_docker_file/junit-4.10.jar new file mode 100644 index 0000000000000000000000000000000000000000..954851e67d7424440592e8176c4aa034cc46aa85 Binary files /dev/null and b/serveur_compilation/share_docker_file/junit-4.10.jar differ diff --git a/serveur_compilation/src/main/java/DockerCompilation.java b/serveur_compilation/src/main/java/DockerCompilation.java new file mode 100644 index 0000000000000000000000000000000000000000..a1158beae7670ee15a7ecc461b9c5091950dda93 --- /dev/null +++ b/serveur_compilation/src/main/java/DockerCompilation.java @@ -0,0 +1,94 @@ +import org.json.JSONObject; + +import java.io.*; +import java.util.HashMap; + +public class DockerCompilation { + public HashMap<String, Object> execute_kata(JSONObject input) { + + + String filename = "", filename_test="todeleteifitstayslikethis", cmd = "", line, output = "", error = ""; + + switch (input.get("language").toString()) { + case "python": + filename = "share_docker_file/sample.py"; + filename_test = "share_docker_file/assert.py"; + cmd = "docker run --rm --mount type=bind,source=/Users/freak/Desktop/dojo-hepia/serveur_compilation/share_docker_file,dst=/env/ hey:1.1 python3 assert.py"; + break; + case "java": + filename = "share_docker_file/kata.java"; + filename_test = "share_docker_file/Main.java"; + cmd = "docker run --rm --mount type=bind,source=/Users/freak/Desktop/dojo-hepia/serveur_compilation/share_docker_file,dst=/env/ java:4.0 ./java_test.sh"; + break; + } + + try (PrintWriter writer = new PrintWriter(filename, "UTF-8")) { + writer.println(input.get("stream")); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + try(PrintWriter writer = new PrintWriter(filename_test,"UTF-8")){ + writer.println(input.get("assert")); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + + long start, elapsed = 0; + Process cmdProc = null; + + try { + start = System.currentTimeMillis(); + cmdProc = Runtime.getRuntime().exec(cmd); + cmdProc.waitFor(); + + // Compute the execute time + elapsed = System.currentTimeMillis() - start; + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // Create Array lists that will contain output and error values of the executed program + /**************************/ + + try (BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(cmdProc.getInputStream()))) { + while ((line = stdoutReader.readLine()) != null) + output += line + "\n"; + } catch (IOException e) { + e.printStackTrace(); + } + + try (BufferedReader stderrReader = new BufferedReader(new InputStreamReader(cmdProc.getErrorStream()))) { + while ((line = stderrReader.readLine()) != null) + error += line + "\n"; + } catch (IOException e) { + e.printStackTrace(); + } + + /**************************/ + + HashMap<String, Object> json = new HashMap<>(); + + //exit value of the ran program + json.put("exit", cmdProc.exitValue()); + json.put("output", output); + json.put("error", error); + json.put("time", elapsed); + + // For delete purpose, create a File object also targeting sample.py + File file = new File(filename); + file.delete(); + + file = new File(filename_test); + file.delete(); + + return json; + } +} diff --git a/serveur_compilation/src/main/java/HostCompilation.java b/serveur_compilation/src/main/java/HostCompilation.java new file mode 100644 index 0000000000000000000000000000000000000000..6cc4030d3da9934eb1e59c2d1bcf029fe6911cd1 --- /dev/null +++ b/serveur_compilation/src/main/java/HostCompilation.java @@ -0,0 +1,80 @@ +import org.json.JSONObject; + +import java.io.*; +import java.util.HashMap; + +/** + * First version of the compilation server + */ +public class HostCompilation { + + /** + * This method expect a json input which contains at least key 'language' and key 'code' + * @param input JSON object sent by the front-end + * @return stdout output of the executed file + * @throws IOException // for code visibility purpose + */ + public HashMap<String, Object> hostcompilation(JSONObject input) throws IOException, InterruptedException { + + PrintWriter writer = null; + File file = null; + + String filename = ""; + String cmd = ""; + + if (input.get("language").equals("python")) { + // Create a PrintWriter object targeting sample.py + + filename = "sample.py"; + writer = new PrintWriter(filename, "UTF-8"); + cmd = "python " + filename; + + } else if (input.get("language").equals("java")) { + // Create a PrintWriter object targeting sample.py + filename = "app.java"; + writer = new PrintWriter(filename, "UTF-8"); + cmd = "java " + filename; + } + + // For delete purpose, create a File object also targeting sample.py + file = new File(filename); + + // Complex file with tabulation structure for test purpose + writer.println(input.get("stream")); + + // Close the writer, the file has been filled and is ready to be executed + writer.close(); + + long start = System.currentTimeMillis(); + Process cmdProc = Runtime.getRuntime().exec(cmd); + cmdProc.waitFor(); + long elapsed = System.currentTimeMillis() - start; + + // Create Array lists that will contain output and error values of the executed program + /**************************/ + + String line, output = "", error = ""; + BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(cmdProc.getInputStream())); + while ((line = stdoutReader.readLine()) != null) + output += line + "\n"; + + BufferedReader stderrReader = new BufferedReader(new InputStreamReader(cmdProc.getErrorStream())); + while ((line = stderrReader.readLine()) != null) + error += line + "\n"; + + /**************************/ + + HashMap<String, Object> json = new HashMap<>(); + + //exit value of the ran program + json.put("exit", cmdProc.exitValue()); + json.put("output", output); + json.put("error", error); + json.put("time", elapsed); + + file.delete(); + + return json; + } +} + diff --git a/serveur_compilation/src/main/java/app.java b/serveur_compilation/src/main/java/app.java new file mode 100644 index 0000000000000000000000000000000000000000..a7edb7976cce62a80a7e63cf493b85d28432dd83 --- /dev/null +++ b/serveur_compilation/src/main/java/app.java @@ -0,0 +1,14 @@ +import io.javalin.Javalin; +import org.json.JSONObject; + +public class app { + public static void main(String[] args) { + + Javalin app = Javalin.create().enableCorsForAllOrigins().start(6999); + + app.post("/", ctx -> { + DockerCompilation cpl = new DockerCompilation(); + ctx.json(cpl.execute_kata(new JSONObject(ctx.body()))); + }); + } +} diff --git a/serveur_compilation/target/classes/DockerCompilation.class b/serveur_compilation/target/classes/DockerCompilation.class new file mode 100644 index 0000000000000000000000000000000000000000..1d41f08dd0bf2db9cbcee9b7c3a7e489b3546764 Binary files /dev/null and b/serveur_compilation/target/classes/DockerCompilation.class differ diff --git a/serveur_compilation/target/classes/HostCompilation.class b/serveur_compilation/target/classes/HostCompilation.class new file mode 100644 index 0000000000000000000000000000000000000000..298d88619445dcde43a2f193a505e6b1acb19417 Binary files /dev/null and b/serveur_compilation/target/classes/HostCompilation.class differ diff --git a/serveur_compilation/target/classes/app.class b/serveur_compilation/target/classes/app.class new file mode 100644 index 0000000000000000000000000000000000000000..4119c2d9c2e4787ee16109db9d7abacdf6b4c9e3 Binary files /dev/null and b/serveur_compilation/target/classes/app.class differ diff --git a/tests/serveur_compilation/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc b/tests/serveur_compilation/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc index 6c0cf07af8301d731603aad7b867356e8945b2f8..4b2b97347f54e0cdff7575275d98bb69a86cbb8c 100644 Binary files a/tests/serveur_compilation/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc and b/tests/serveur_compilation/serveur_compilation/share_docker_file/__pycache__/sample.cpython-34.pyc differ