Skip to content

Commit 14c22db

Browse files
committed
rework progress-panel, rework checkboxes-panel, refactor theme styles,
1 parent c67fb22 commit 14c22db

File tree

11 files changed

+155
-111
lines changed

11 files changed

+155
-111
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(function () {
2+
3+
angular
4+
.module('app')
5+
.controller('ControlPanelController', [
6+
'$mdDialog', '$interval',
7+
ControlPanelController
8+
]);
9+
10+
function ControlPanelController($mdDialog, $interval) {
11+
var vm = this;
12+
13+
vm.buttonEnabled = false;
14+
vm.showProgress = false;
15+
vm.reloadServer = 'Staging';
16+
vm.performProgress = performProgress;
17+
vm.determinateValue = 10;
18+
19+
function performProgress() {
20+
vm.showProgress = true;
21+
interval = $interval(function() {
22+
vm.determinateValue += 1;
23+
if (vm.determinateValue > 100) {
24+
vm.determinateValue = 10;
25+
vm.showProgress = false;
26+
showAlert();
27+
$interval.cancel(interval)
28+
}
29+
}, 50, 0, true);
30+
}
31+
32+
function showAlert() {
33+
alert = $mdDialog.alert({
34+
title: 'Reloading done!',
35+
content: vm.reloadServer + " server reloaded.",
36+
ok: 'Close'
37+
});
38+
$mdDialog
39+
.show(alert)
40+
.finally(function () {
41+
alert = undefined;
42+
});
43+
}
44+
}
45+
46+
})();

src/app/controllers/InfoPanelController.js

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,59 @@
1-
(function(){
1+
(function () {
2+
angular
3+
.module('app')
4+
.controller('TodoController', [
5+
'todoListService',
6+
TodoController
7+
]);
28

3-
angular
4-
.module('app')
5-
.controller('TodoController', [
6-
'todoListService',
7-
TodoController
8-
]);
9+
function TodoController(todoListService) {
10+
var vm = this;
911

10-
function TodoController(todoListService) {
11-
var vm = this;
12+
vm.addTodo = addTodo;
13+
vm.remaining = remaining;
14+
vm.archive = archive;
15+
vm.toggleAll = toggleAll;
16+
vm.todos = [];
1217

13-
vm.addTodo = addTodo;
14-
vm.remaining = remaining;
15-
vm.archive = archive;
16-
vm.todos = [];
18+
todoListService
19+
.loadAllItems()
20+
.then(function (todos) {
21+
vm.todos = [].concat(todos);
22+
});
1723

18-
todoListService
19-
.loadAllItems()
20-
.then(function(todos) {
21-
vm.todos = [].concat(todos);
22-
});
24+
function addTodo() {
25+
vm.todos.push({text: vm.todoText, done: false});
26+
vm.todoText = '';
27+
}
2328

24-
function addTodo() {
25-
vm.todos.push({text: vm.todoText, done: false});
26-
vm.todoText = '';
27-
}
29+
function remaining() {
30+
var count = 0;
31+
angular.forEach(vm.todos, function (todo) {
32+
count += todo.done ? 0 : 1;
33+
});
34+
return count;
35+
}
2836

29-
function remaining() {
30-
var count = 0;
31-
angular.forEach(vm.todos, function (todo) {
32-
count += todo.done ? 0 : 1;
33-
});
34-
return count;
35-
}
37+
function archive(e) {
38+
// Prevent from submitting
39+
e.preventDefault();
40+
var oldTodos = vm.todos;
41+
vm.todos = [];
42+
angular.forEach(oldTodos, function (todo) {
43+
if (!todo.done) vm.todos.push(todo);
44+
});
45+
}
3646

37-
function archive(e) {
38-
// Prevent from submitting
39-
e.preventDefault();
40-
var oldTodos = vm.todos;
41-
vm.todos = [];
42-
angular.forEach(oldTodos, function (todo) {
43-
if (!todo.done) vm.todos.push(todo);
44-
});
47+
function toggleAll() {
48+
if (remaining() == 0) {
49+
angular.forEach(vm.todos, function (todo) {
50+
todo.done = false;
51+
});
52+
} else {
53+
angular.forEach(vm.todos, function (todo) {
54+
todo.done = true;
55+
});
56+
}
57+
}
4558
}
46-
}
4759
})();

src/app/controllers/UsageController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
legend: 'none',
1515
tooltip : { isHtml: true },
1616
pieSliceText: 'none',
17-
slices: { 0: { color: 'rgb(62, 164, 152)' }, 1: { color: '#E75753' }, 2: { color: 'rgb(235, 235, 235)' } }
17+
slices: { 0: { color: 'rgb(0, 150, 136)' }, 1: { color: '#E75753' }, 2: { color: 'rgb(235, 235, 235)' } }
1818
};
1919
vm.ramChart = {
2020
type: 'PieChart',

src/app/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ angular.module('angularMaterialAdmin', ['ngAnimate', 'ngCookies', 'ngTouch',
4646
.primaryPalette('grey', {
4747
'default': '600'
4848
})
49-
.accentPalette('defaultPrimary');
49+
.accentPalette('teal', {
50+
'default': '500'
51+
})
52+
.warnPalette('defaultPrimary');
5053

5154
$mdThemingProvider.theme('dark', 'default')
5255
.primaryPalette('orange')

src/app/stylesheets/_custom.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// COLORS
22
$main-bg-color: #ECECEC;
33
$text-color: #7A7A7A;
4-
$accent-color: #E75753;
4+
$accent-color: rgb(0, 150, 136);
5+
$warning-color: #E75753;
56

67

78
// VARIABLES
@@ -27,6 +28,11 @@ body {
2728
background-color: $main-bg-color;
2829
}
2930

31+
.widget-progress {
32+
width: 95% !important;
33+
margin-left: 10px;
34+
}
35+
3036

3137
// UTILS
3238
.capitalize {
@@ -59,7 +65,7 @@ body {
5965
font-size: 12px;
6066
top: 2px;
6167
right: 2px;
62-
background-color: $accent-color;
68+
background-color: $warning-color;
6369
}
6470

6571
// panel-widget
@@ -110,6 +116,14 @@ md-sidenav.md-locked-open.md-sidenav-left {
110116
max-width: $left-sidenav-width;
111117
}
112118

119+
a.md-button.md-warn.md-raised, a.md-button.md-warn.md-fab, .md-button.md-warn.md-raised, .md-button.md-warn.md-fab {
120+
color: white;
121+
}
122+
123+
md-radio-button.md-accent.md-checked .md-label span {
124+
color: $accent-color;
125+
}
126+
113127
// libs overrides
114128
.material-icons {
115129
vertical-align: middle;

src/app/views/dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</div>
66

77
<div layout-gt-md="row">
8-
<panel-widget flex title="Information Panel" template="app/views/partials/infoPanel.html" class="fixed-height-widget"></panel-widget>
8+
<panel-widget flex title="Server Control Panel" template="app/views/partials/controlPanel.html" class="fixed-height-widget"></panel-widget>
99
<panel-widget flex title="Usage Stats" template="app/views/partials/usage.html" class="fixed-height-widget"></panel-widget>
1010
<panel-widget flex title="Autocomplete Input" template="app/views/partials/autocomplete.html" options="true" class="fixed-height-widget"></panel-widget>
1111
</div>

src/app/views/main.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<md-sidenav md-is-locked-open="$mdMedia('gt-sm')" md-component-id="left"
22
class="md-whiteframe-z2 md-sidenav-left">
33
<md-toolbar md-theme="custom" class="md-hue-1 md-whiteframe-z2">
4-
<md-button layout="row" layout-align="center center" class="md-toolbar-tools md-accent"
4+
<md-button layout="row" layout-align="center center" class="md-toolbar-tools md-warn"
55
href="https://github.com/flatlogic/angular-material-dashboard">
66
<h1>AMD</h1>
77
</md-button>
88
</md-toolbar>
99
<md-button ng-repeat-start="item in vm.menuItems" layout="column" layout-align="center center"
1010
flex class="capitalize" ng-click="vm.selectItem(item)"
11-
ui-sref-active="md-accent" ui-sref="{{item.sref}}">
11+
ui-sref-active="md-warn" ui-sref="{{item.sref}}">
1212
<div hide-sm hide-md class="md-tile-content">
1313
<i class="material-icons md-36">{{item.icon}}</i>
1414
</div>
@@ -49,7 +49,7 @@ <h1>AMD</h1>
4949
<md-sidenav md-is-locked-open="$mdMedia('gt-sm')" md-component-id="right"
5050
class="md-whiteframe-z2 md-sidenav-right">
5151
<md-toolbar layout="row" flex="80">
52-
<md-toolbar class="md-accent" layout="row" layout-align="center center">
52+
<md-toolbar class="md-warn" layout="row" layout-align="center center">
5353
<img class="img-circle" ng-src="assets/images/feynman.jpg">
5454
<md-menu>
5555
<md-button class="capitalize" ng-click="$mdOpenMenu()" aria-label="Open menu">
Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
<md-content class="md-padding" ng-controller="TodoController as vm">
2-
<h3>{{vm.remaining()}} of {{vm.todos.length}} remaining</h3>
2+
<div layout="row">
3+
<h4 flex="82">{{vm.remaining()}} of {{vm.todos.length}} remaining</h4>
4+
<md-button class="md-primary" ng-click="vm.toggleAll()">Toggle All
5+
</md-button>
6+
</div>
37

4-
<md-checkbox ng-repeat="todo in vm.todos" ng-model="todo.done">
5-
{{todo.text}}
6-
</md-checkbox>
8+
<md-checkbox ng-repeat="todo in vm.todos" ng-model="todo.done">
9+
{{todo.text}}
10+
</md-checkbox>
711

8-
<form ng-submit="vm.addTodo($event)">
9-
<md-input-container>
10-
<label>Add new todo</label>
11-
<input ng-model="vm.todoText">
12-
</md-input-container>
13-
<md-button class="md-raised md-primary">Add new</md-button>
14-
<md-button class="md-warn" ng-click="vm.archive($event)">Remove completed</md-button>
15-
</form>
12+
<form ng-submit="vm.addTodo($event)">
13+
<md-input-container>
14+
<label>Write some todo task here...</label>
15+
<input ng-model="vm.todoText">
16+
</md-input-container>
17+
<md-button class="md-fab md-warn" aria-label="Eat cake">
18+
<i class="material-icons">add</i>
19+
</md-button>
20+
<md-button class="md-primary" ng-click="vm.archive($event)">
21+
Remove completed
22+
</md-button>
23+
</form>
1624
</md-content>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<md-content ng-controller="ControlPanelController as vm" class="md-padding">
2+
<md-progress-linear class="widget-progress md-accent" md-mode="determinate"
3+
value="{{vm.determinateValue}}" ng-show="vm.showProgress">
4+
</md-progress-linear>
5+
6+
<md-radio-group ng-model="vm.reloadServer">
7+
<md-radio-button class="md-accent" value="Staging">Staging server</md-radio-button>
8+
<md-radio-button class="md-accent" value="Production">Production server</md-radio-button>
9+
</md-radio-group>
10+
11+
<md-button class="md-raised md-warn" ng-click="vm.performProgress()">
12+
Reload server
13+
</md-button>
14+
</md-content>

0 commit comments

Comments
 (0)