2 |
3 |
4 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/src/app/main.ts:
--------------------------------------------------------------------------------
1 | import {Component, bind} from 'angular2/core';
2 | import {bootstrap} from 'angular2/platform/browser';
3 | import {HTTP_PROVIDERS} from 'angular2/http';
4 | import {FORM_PROVIDERS} from 'angular2/common';
5 | import {
6 | RouteConfig,
7 | ROUTER_DIRECTIVES,
8 | ROUTER_PROVIDERS,
9 | LocationStrategy,
10 | HashLocationStrategy
11 | } from 'angular2/router';
12 |
13 | import {Dashboard} from './components/dashboard/dashboard';
14 | import {Tables} from './components/tables/tables';
15 |
16 | import {UserListService} from './services/user_list';
17 | import {ServerListService} from './services/server_list';
18 |
19 | @RouteConfig([
20 | {path: '/', component: Dashboard, name: 'Dashboard'},
21 | {path: '/tables', component: Tables, name: 'Tables'}
22 | ])
23 | @Component({
24 | selector: 'app',
25 | templateUrl: 'app/main.html',
26 | styleUrls: ['app/main.css'],
27 | directives: [ROUTER_DIRECTIVES]
28 | })
29 | class Main {
30 |
31 | mobileView:number = 992;
32 | toggle:boolean = false;
33 |
34 | constructor() {
35 | this.attachEvents();
36 | }
37 |
38 | attachEvents() {
39 | window.onresize = ()=> {
40 | if (this.getWidth() >= this.mobileView) {
41 | if (localStorage.getItem('toggle')) {
42 | this.toggle = !localStorage.getItem('toggle') ? false : true;
43 | } else {
44 | this.toggle = true;
45 | }
46 | } else {
47 | this.toggle = false;
48 | }
49 | }
50 | }
51 |
52 | getWidth() {
53 | return window.innerWidth;
54 | }
55 |
56 | toggleSidebar() {
57 | this.toggle = !this.toggle;
58 | localStorage.setItem('toggle', this.toggle.toString());
59 | }
60 | }
61 |
62 | bootstrap(Main, [ROUTER_PROVIDERS, FORM_PROVIDERS,
63 | ROUTER_PROVIDERS, HTTP_PROVIDERS, UserListService, ServerListService,
64 | bind(LocationStrategy).toClass(HashLocationStrategy)]);
65 |
--------------------------------------------------------------------------------
/src/app/public/img/avatar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bugthesystem/rdash-angular2/f8b0d35b655969c4c481ce07e191e811d28fe604/src/app/public/img/avatar.jpg
--------------------------------------------------------------------------------
/src/app/services/server_list.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from "angular2/core";
2 |
3 | @Injectable()
4 | export class ServerListService {
5 | servers:any[] = [{
6 | name: 'RDVMPC001',
7 | ip: '238.103.133.37',
8 | 'tooltip': '',
9 | 'tooltipcls': 'text-success',
10 | 'icon': 'fa-check'
11 | },
12 | {name: 'RDVMPC002', ip: '68.66.63.170', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
13 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
14 | {name: 'RDVMPC003', ip: '76.117.212.33', 'tooltip': '', 'tooltipcls': 'text-danger', 'icon': 'fa-warning'},
15 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
16 | {
17 | name: 'RDESX003',
18 | ip: '209.25.191.61',
19 | 'tooltip': 'Could not connect!',
20 | 'tooltipcls': 'text-warning',
21 | 'icon': 'fa-flash'
22 | },
23 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
24 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
25 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'},
26 | {name: 'RDESX003', ip: '209.25.191.61', 'tooltip': '', 'tooltipcls': 'text-success', 'icon': 'fa-check'}
27 | ];
28 |
29 | add(value:any):void {
30 | this.servers.push(value);
31 | }
32 |
33 | all():any[] {
34 | return this.servers;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/app/services/user_list.ts:
--------------------------------------------------------------------------------
1 |
2 | import {Injectable} from "angular2/core";
3 |
4 | @Injectable()
5 | export class UserListService {
6 | users:any[] = [{
7 | id: 1,
8 | name: 'Joe Bloggs',
9 | role: 'Super Admin',
10 | account: 'AZ23045'
11 | }, {
12 | id: 2,
13 | name: 'Timothy Hernandez',
14 | role: 'Admin',
15 | account: 'AU24783'
16 | }, {
17 | id: 3,
18 | name: 'Joe Bickham',
19 | role: 'User',
20 | account: 'AM23781'
21 | }];
22 |
23 | add(value:any):void {
24 | this.users.push(value);
25 | }
26 |
27 | all():any[] {
28 | return this.users;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |