Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7fe71c68
Commit
7fe71c68
authored
Oct 08, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the ux.
parent
1a1b0699
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
40 deletions
+86
-40
redis-master-service.json
examples/guestbook/redis-master-service.json
+3
-0
datafile.go
pkg/ui/datafile.go
+0
-0
box.ng
www/box.ng
+31
-1
groups.html
www/partials/groups.html
+2
-2
podcontroller.js
www/podcontroller.js
+50
-37
No files found.
examples/guestbook/redis-master-service.json
View file @
7fe71c68
...
@@ -6,5 +6,8 @@
...
@@ -6,5 +6,8 @@
"containerPort"
:
6379
,
"containerPort"
:
6379
,
"selector"
:
{
"selector"
:
{
"name"
:
"redis-master"
"name"
:
"redis-master"
},
"labels"
:
{
"name"
:
"redis-master"
}
}
}
}
pkg/ui/datafile.go
View file @
7fe71c68
This diff is collapsed.
Click to expand it.
www/box.ng
View file @
7fe71c68
...
@@ -18,11 +18,41 @@ limitations under the License.
...
@@ -18,11 +18,41 @@ limitations under the License.
{{ groupName }}
{{ groupName }}
<div ng-if="group.kind != 'grouping'">
<div ng-if="group.kind != 'grouping'">
<div ng-if="!display || display=='box'">
<div class="content k8s-item k8s-inline" ng-repeat="item in group">
<div class="content k8s-item k8s-inline" ng-repeat="item in group">
<div class="k8s-title-font k8s-font-regular">
<div class="k8s-title-font k8s-font-regular">
<a href="#/pods/{{ item.id }}">{{ item.id }}</a>
<div ng-switch on='item.labels["type"]'>
<a ng-switch-when='pod' href="#/pods/{{ item.id }}">{{ item.id }}</a>
<a ng-switch-when='service' href="#/services/{{ item.id }}">{{ item.id }}</a>
<a ng-switch-when='replicationController' href="#/replicationControllers/{{ item.id }}">{{ item.id }}</a>
<span ng-switch-default>{{item.id}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-if="display=='list'">
<table style="width: 90%; padding: 10px">
<tr ng-repeat="item in group" ng-class-odd="'k8s-odd'" ng-class-even="'k8s-even'" valign="top">
<td class="k8s-cell">
<div ng-switch on='item.labels["type"]'>
<a ng-switch-when='pod' href="#/pods/{{ item.id }}">{{ item.id }}</a>
<a ng-switch-when='service' href="#/services/{{ item.id }}">{{ item.id }}</a>
<a ng-switch-when='replicationController' href="#/replicationControllers/{{ item.id }}">{{ item.id }}</a>
<span ng-switch-default>{{item.id}}</span>
</div>
</td>
<td class="k8s-cell">
<div ng-repeat='(key, value) in item.labels'>
<a href="#/groups/{{key}}/selector/{{controller.routeParams.selector}}">{{key}}</a> :
<a href="#/groups/{{controller.routeParams.grouping}}/selector/{{key}}={{value}}">{{value}}</a> </span>
</td>
</tr>
</table>
</div>
<div>
<a ng-click="display='box'">box</a>
<a ng-click="display='list'">list</a>
</div>
</div>
</div>
<div ng-if="group.kind == 'grouping'">
<div ng-if="group.kind == 'grouping'">
<div ng-repeat="(groupName,group) in group.items" ng-include="'box.ng'">
<div ng-repeat="(groupName,group) in group.items" ng-include="'box.ng'">
...
...
www/partials/groups.html
View file @
7fe71c68
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
-->
-->
<div
class=
"content"
style=
"width: 90%; margin-left: 5%"
ng-if=
"selector && selector.length > 0"
>
<div
class=
"content"
style=
"width: 90%; margin-left: 5%"
ng-if=
"selector && selector.length > 0"
>
<div
class=
"k8s-inline"
>
{{selector}}
</div>
<div
class=
"k8s-inline
k8s-font-regular k8s-title-font
"
>
{{selector}}
</div>
<div
class=
"k8s-inline k8s-
button"
ng-click=
"controller.clearSelector(
)"
>
X
</div>
<div
class=
"k8s-inline k8s-
title-font k8s-button"
ng-click=
"controller.clearSelector(controller.routeParams.grouping
)"
>
X
</div>
</div>
</div>
<div
ng-repeat=
"(groupName,group) in groups.items"
ng-include=
"'box.ng'"
>
<div
ng-repeat=
"(groupName,group) in groups.items"
ng-include=
"'box.ng'"
>
www/podcontroller.js
View file @
7fe71c68
...
@@ -50,7 +50,6 @@ GroupController.prototype.handlePath = function(path) {
...
@@ -50,7 +50,6 @@ GroupController.prototype.handlePath = function(path) {
var
parts
=
path
.
split
(
"/"
)
var
parts
=
path
.
split
(
"/"
)
// split leaves an empty string at the beginning.
// split leaves an empty string at the beginning.
parts
=
parts
.
slice
(
1
);
parts
=
parts
.
slice
(
1
);
console
.
log
(
parts
)
if
(
parts
.
length
==
0
)
{
if
(
parts
.
length
==
0
)
{
return
;
return
;
...
@@ -59,8 +58,8 @@ GroupController.prototype.handlePath = function(path) {
...
@@ -59,8 +58,8 @@ GroupController.prototype.handlePath = function(path) {
};
};
GroupController
.
prototype
.
clearSelector
=
function
()
{
GroupController
.
prototype
.
clearSelector
=
function
(
grouping
)
{
window
.
location
.
hash
=
"/groups/"
+
this
.
groupBy
.
join
(
"/"
)
+
"/selector
"
;
window
.
location
.
hash
=
"/groups/"
+
grouping
+
"/selector/
"
;
};
};
GroupController
.
prototype
.
createBarrier
=
function
(
count
,
callback
)
{
GroupController
.
prototype
.
createBarrier
=
function
(
count
,
callback
)
{
...
@@ -82,6 +81,7 @@ GroupController.prototype.handleGroups = function(parts, selector) {
...
@@ -82,6 +81,7 @@ GroupController.prototype.handleGroups = function(parts, selector) {
this
.
scope
.
loading
=
true
;
this
.
scope
.
loading
=
true
;
this
.
scope
.
selector
=
selector
;
this
.
scope
.
selector
=
selector
;
var
args
=
[];
var
args
=
[];
var
type
=
""
;
if
(
selector
&&
selector
.
length
>
0
)
{
if
(
selector
&&
selector
.
length
>
0
)
{
this
.
scope
.
selectorPieces
=
selector
.
split
(
","
);
this
.
scope
.
selectorPieces
=
selector
.
split
(
","
);
var
labels
=
[];
var
labels
=
[];
...
@@ -91,7 +91,14 @@ GroupController.prototype.handleGroups = function(parts, selector) {
...
@@ -91,7 +91,14 @@ GroupController.prototype.handleGroups = function(parts, selector) {
if
(
piece
[
0
]
==
'$'
)
{
if
(
piece
[
0
]
==
'$'
)
{
fields
.
push
(
piece
.
slice
(
2
));
fields
.
push
(
piece
.
slice
(
2
));
}
else
{
}
else
{
labels
.
push
(
piece
);
if
(
piece
.
indexOf
(
"type="
)
==
0
)
{
var
labelParts
=
piece
.
split
(
"="
);
if
(
labelParts
.
length
>
1
)
{
type
=
labelParts
[
1
];
}
}
else
{
labels
.
push
(
piece
);
}
}
}
}
}
if
(
labels
.
length
>
0
)
{
if
(
labels
.
length
>
0
)
{
...
@@ -103,38 +110,45 @@ GroupController.prototype.handleGroups = function(parts, selector) {
...
@@ -103,38 +110,45 @@ GroupController.prototype.handleGroups = function(parts, selector) {
}
}
var
query
=
"?"
+
args
.
join
(
"&"
);
var
query
=
"?"
+
args
.
join
(
"&"
);
var
list
=
[];
var
list
=
[];
var
barrier
=
this
.
createBarrier
(
3
,
angular
.
bind
(
this
,
function
()
{
var
count
=
type
.
length
>
0
?
1
:
3
;
var
barrier
=
this
.
createBarrier
(
count
,
angular
.
bind
(
this
,
function
()
{
this
.
scope
.
groups
=
this
.
groupData
(
list
,
0
);
this
.
scope
.
groups
=
this
.
groupData
(
list
,
0
);
this
.
scope
.
loading
=
false
;
this
.
scope
.
loading
=
false
;
}));
}));
this
.
http
.
get
(
apiBase
+
"pods"
+
query
)
if
(
type
==
""
||
type
==
"pod"
)
{
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
this
.
http
.
get
(
apiBase
+
"pods"
+
query
)
this
.
addLabel
(
"type"
,
"pod"
,
data
.
items
);
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
this
.
addLabel
(
"type"
,
"pod"
,
data
.
items
);
data
.
items
[
i
].
labels
[
"host"
]
=
data
.
items
[
i
].
currentState
.
host
;
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
list
.
push
(
data
.
items
[
i
]);
data
.
items
[
i
].
labels
[
"host"
]
=
data
.
items
[
i
].
currentState
.
host
;
}
list
.
push
(
data
.
items
[
i
]);
barrier
();
}
}))
barrier
();
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
}))
this
.
http
.
get
(
apiBase
+
"services"
+
query
)
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
}
this
.
addLabel
(
"type"
,
"service"
,
data
.
items
);
if
(
type
==
""
||
type
==
"service"
)
{
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
this
.
http
.
get
(
apiBase
+
"services"
+
query
)
list
.
push
(
data
.
items
[
i
]);
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
}
this
.
addLabel
(
"type"
,
"service"
,
data
.
items
);
barrier
();
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
}))
list
.
push
(
data
.
items
[
i
]);
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
}
this
.
http
.
get
(
apiBase
+
"replicationControllers"
+
query
)
barrier
();
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
}))
this
.
addLabel
(
"type"
,
"replicationController"
,
data
.
items
);
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
}
list
.
push
(
data
.
items
[
i
]);
if
(
type
==
""
||
type
==
"replicationController"
)
{
}
this
.
http
.
get
(
apiBase
+
"replicationControllers"
+
query
)
barrier
();
.
success
(
angular
.
bind
(
this
,
function
(
data
)
{
}))
this
.
addLabel
(
"type"
,
"replicationController"
,
data
.
items
);
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
for
(
var
i
=
0
;
data
.
items
&&
i
<
data
.
items
.
length
;
++
i
)
{
list
.
push
(
data
.
items
[
i
]);
}
barrier
();
}))
.
error
(
angular
.
bind
(
this
,
this
.
handleError
));
}
};
};
GroupController
.
prototype
.
addLabel
=
function
(
key
,
value
,
items
)
{
GroupController
.
prototype
.
addLabel
=
function
(
key
,
value
,
items
)
{
...
@@ -200,7 +214,7 @@ k8sApp.controller('GroupCtrl', function ($scope, $http, $route, $routeParams) {
...
@@ -200,7 +214,7 @@ k8sApp.controller('GroupCtrl', function ($scope, $http, $route, $routeParams) {
k8sApp
.
config
([
'$routeProvider'
,
k8sApp
.
config
([
'$routeProvider'
,
function
(
$routeProvider
)
{
function
(
$routeProvider
)
{
$routeProvider
.
$routeProvider
.
when
(
'/groups/:grouping*?
\
/selector/:selector?'
,
{
when
(
'/groups/:grouping*?
\
/selector/:selector
*
?'
,
{
templateUrl
:
'partials/groups.html'
,
templateUrl
:
'partials/groups.html'
,
controller
:
'GroupCtrl'
controller
:
'GroupCtrl'
}).
}).
...
@@ -209,6 +223,6 @@ k8sApp.config(['$routeProvider',
...
@@ -209,6 +223,6 @@ k8sApp.config(['$routeProvider',
controller
:
'PodCtrl'
controller
:
'PodCtrl'
}).
}).
otherwise
({
otherwise
({
redirectTo
:
'/groups//selector'
redirectTo
:
'/groups//selector
/
'
});
});
}]);
}]);
\ 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