Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sfcode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush
sfcode
Commits
49246421
Commit
49246421
authored
Dec 04, 2020
by
Adarsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file upload frontend
parent
0d45b97a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
164 additions
and
1 deletion
+164
-1
src/app/app-routing.module.ts
src/app/app-routing.module.ts
+2
-0
src/app/app.module.ts
src/app/app.module.ts
+3
-1
src/app/file.service.spec.ts
src/app/file.service.spec.ts
+16
-0
src/app/file.service.ts
src/app/file.service.ts
+32
-0
src/app/file.ts
src/app/file.ts
+7
-0
src/app/file/file.component.html
src/app/file/file.component.html
+18
-0
src/app/file/file.component.scss
src/app/file/file.component.scss
+36
-0
src/app/file/file.component.spec.ts
src/app/file/file.component.spec.ts
+25
-0
src/app/file/file.component.ts
src/app/file/file.component.ts
+24
-0
src/app/header/header.component.html
src/app/header/header.component.html
+1
-0
No files found.
src/app/app-routing.module.ts
View file @
49246421
...
@@ -7,12 +7,14 @@ import { IdeComponent } from './ide/ide.component';
...
@@ -7,12 +7,14 @@ import { IdeComponent } from './ide/ide.component';
import
{
LoginComponent
}
from
'
./login/login.component
'
;
import
{
LoginComponent
}
from
'
./login/login.component
'
;
import
{
RegisterComponent
}
from
'
./register/register.component
'
;
import
{
RegisterComponent
}
from
'
./register/register.component
'
;
import
{
AuthGuard
}
from
'
./auth.guard
'
;
import
{
AuthGuard
}
from
'
./auth.guard
'
;
import
{
FileComponent
}
from
'
./file/file.component
'
;
const
routes
:
Routes
=
[
const
routes
:
Routes
=
[
{
path
:
'
home
'
,
component
:
HomeComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
home
'
,
component
:
HomeComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
arena/:id
'
,
component
:
ArenaComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
arena/:id
'
,
component
:
ArenaComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
arena
'
,
component
:
IdeComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
arena
'
,
component
:
IdeComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
user
'
,
component
:
UserComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
user
'
,
component
:
UserComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
files
'
,
component
:
FileComponent
,
canActivate
:
[
AuthGuard
]
},
{
path
:
'
login
'
,
component
:
LoginComponent
},
{
path
:
'
login
'
,
component
:
LoginComponent
},
{
path
:
'
register
'
,
component
:
RegisterComponent
},
{
path
:
'
register
'
,
component
:
RegisterComponent
},
{
path
:
'
**
'
,
redirectTo
:
'
/home
'
},
{
path
:
'
**
'
,
redirectTo
:
'
/home
'
},
...
...
src/app/app.module.ts
View file @
49246421
...
@@ -10,13 +10,15 @@ import { HeaderComponent } from './header/header.component';
...
@@ -10,13 +10,15 @@ import { HeaderComponent } from './header/header.component';
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'
@angular/core
'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'
@angular/core
'
;
import
{
LDModeComponent
}
from
'
./l-d-mode/l-d-mode.component
'
;
import
{
LDModeComponent
}
from
'
./l-d-mode/l-d-mode.component
'
;
import
{
ApiService
}
from
'
./api.service
'
;
import
{
ApiService
}
from
'
./api.service
'
;
import
{
FileComponent
}
from
'
./file/file.component
'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
declarations
:
[
AppComponent
,
AppComponent
,
HeaderComponent
,
HeaderComponent
,
routerComponents
,
routerComponents
,
LDModeComponent
LDModeComponent
,
FileComponent
],
],
imports
:
[
imports
:
[
BrowserModule
,
BrowserModule
,
...
...
src/app/file.service.spec.ts
0 → 100644
View file @
49246421
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
FileService
}
from
'
./file.service
'
;
describe
(
'
FileService
'
,
()
=>
{
let
service
:
FileService
;
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
FileService
);
});
it
(
'
should be created
'
,
()
=>
{
expect
(
service
).
toBeTruthy
();
});
});
src/app/file.service.ts
0 → 100644
View file @
49246421
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
File
}
from
'
./file
'
;
import
{
Observable
,
of
}
from
'
rxjs
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
FileService
{
constructor
(
private
httpClient
:
HttpClient
)
{
}
getFiles
():
Observable
<
File
[]
>
{
const
ret
:
File
[]
=
[];
const
arr
:
number
[]
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
];
for
(
const
item
of
arr
)
{
ret
.
push
({
id
:
item
,
filename
:
"
lambda
"
,
language
:
"
cpp/py/java
"
,
text
:
"
Random Shit
"
,
});
}
return
of
(
ret
);
}
}
src/app/file.ts
0 → 100644
View file @
49246421
export
interface
File
{
id
:
number
;
filename
:
string
;
language
:
string
;
text
:
string
;
}
\ No newline at end of file
src/app/file/file.component.html
0 → 100644
View file @
49246421
<div
id=
"tray"
>
<button>
Upload A File
</button>
</div>
<div>
All submitted Files are listed Below!
</div>
<div
*ngFor=
"let file of files"
class=
"card"
>
<div
class=
"title"
>
{{file.filename}}
</div>
<div
class=
"lang"
>
{{file.language}}
</div>
<div
class=
"details"
>
{{file.text}}
</div>
<button
style=
"margin-right: 20px;"
>
Run File
</button>
<button
style=
"margin-left: 20px;"
>
Remove from Database
</button>
<!-- <button [routerLink]="['/arena', problem.id]" class="attempt">Attempt</button> -->
</div>
src/app/file/file.component.scss
0 → 100644
View file @
49246421
#tray
{
text-align
:
center
;
// border: 3px solid white;
width
:
100%
;
button
{
margin-top
:
10px
;
margin-bottom
:
10px
;
display
:
inline-block
;
text-align
:
center
;
font-size
:
1rem
;
}
}
.card
{
margin
:
50px
20px
;
border
:
2px
solid
var
(
--
color
);
padding
:
15px
;
background
:
var
(
--
dark
);
.title
{
position
:
absolute
;
transform
:
translateY
(
calc
(
-25px
-
1
.2em
));
background
:
var
(
--
color
);
color
:
var
(
--
bgcolor
);
padding
:
10px
20px
;
font-size
:
1
.1em
;
}
.details
{
margin
:
10px
;
}
.lang
{
margin
:
10px
;
}
}
\ No newline at end of file
src/app/file/file.component.spec.ts
0 → 100644
View file @
49246421
import
{
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
FileComponent
}
from
'
./file.component
'
;
describe
(
'
FileComponent
'
,
()
=>
{
let
component
:
FileComponent
;
let
fixture
:
ComponentFixture
<
FileComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
declarations
:
[
FileComponent
]
})
.
compileComponents
();
});
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
FileComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'
should create
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/file/file.component.ts
0 → 100644
View file @
49246421
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
File
}
from
'
../file
'
;
import
{
FileService
}
from
'
../file.service
'
;
@
Component
({
selector
:
'
app-file
'
,
templateUrl
:
'
./file.component.html
'
,
styleUrls
:
[
'
./file.component.scss
'
]
})
export
class
FileComponent
implements
OnInit
{
constructor
(
private
fileService
:
FileService
)
{
}
files
:
File
[];
fileToUpload
:
File
=
null
;
ngOnInit
():
void
{
this
.
getFiles
();
}
getFiles
():
void
{
this
.
fileService
.
getFiles
()
.
subscribe
(
files
=>
this
.
files
=
files
);
}
}
src/app/header/header.component.html
View file @
49246421
...
@@ -3,5 +3,6 @@
...
@@ -3,5 +3,6 @@
<a
*ngIf=
"!loggedIn"
routerLink=
"/login"
routerLinkActive=
"active"
>
Login
</a>
<a
*ngIf=
"!loggedIn"
routerLink=
"/login"
routerLinkActive=
"active"
>
Login
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/home"
routerLinkActive=
"active"
>
Home
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/home"
routerLinkActive=
"active"
>
Home
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/arena"
routerLinkActive=
"active"
>
Arena
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/arena"
routerLinkActive=
"active"
>
Arena
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/files"
routerLinkActive=
"active"
>
Files
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/user"
routerLinkActive=
"active"
>
User
</a>
<a
*ngIf=
"loggedIn"
routerLink=
"/user"
routerLinkActive=
"active"
>
User
</a>
</nav>
</nav>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment