Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
d9a76934
Commit
d9a76934
authored
Jun 18, 2014
by
Thomas Bosch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get single app
parent
c5428c53
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
28 deletions
+59
-28
RegistryController.java
...codecentric/boot/admin/controller/RegistryController.java
+7
-0
ApplicationRegistry.java
...e/codecentric/boot/admin/service/ApplicationRegistry.java
+23
-8
app.js
src/main/webapp/public/scripts/app.js
+4
-3
controllers.js
src/main/webapp/public/scripts/controllers/controllers.js
+12
-13
services.js
src/main/webapp/public/scripts/services/services.js
+13
-4
No files found.
src/main/java/de/codecentric/boot/admin/controller/RegistryController.java
View file @
d9a76934
...
@@ -32,6 +32,13 @@ public class RegistryController {
...
@@ -32,6 +32,13 @@ public class RegistryController {
registry
.
register
(
app
);
registry
.
register
(
app
);
}
}
@RequestMapping
(
value
=
"/api/application"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Application
get
(
@RequestBody
String
id
)
{
LOGGER
.
debug
(
"Deliver registered application with ID '{}'"
,
id
);
return
registry
.
getApplication
(
id
);
}
@RequestMapping
(
value
=
"/api/applications"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/api/applications"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
List
<
Application
>
applications
()
{
public
List
<
Application
>
applications
()
{
...
...
src/main/java/de/codecentric/boot/admin/service/ApplicationRegistry.java
View file @
d9a76934
package
de
.
codecentric
.
boot
.
admin
.
service
;
package
de
.
codecentric
.
boot
.
admin
.
service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.
Collections
;
import
java.util.
HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.Validate
;
import
org.apache.commons.lang3.Validate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -15,7 +16,7 @@ import de.codecentric.boot.admin.model.Application;
...
@@ -15,7 +16,7 @@ import de.codecentric.boot.admin.model.Application;
@Service
@Service
public
class
ApplicationRegistry
{
public
class
ApplicationRegistry
{
private
final
List
<
Application
>
registry
=
new
ArrayList
<>();
private
final
Map
<
String
,
Application
>
registry
=
new
HashMap
<>();
/**
/**
* Register application.
* Register application.
...
@@ -27,18 +28,18 @@ public class ApplicationRegistry {
...
@@ -27,18 +28,18 @@ public class ApplicationRegistry {
Validate
.
notNull
(
app
,
"Application must not be null"
);
Validate
.
notNull
(
app
,
"Application must not be null"
);
Validate
.
notNull
(
app
.
getId
(),
"Application ID must not be null"
);
Validate
.
notNull
(
app
.
getId
(),
"Application ID must not be null"
);
Validate
.
notNull
(
app
.
getUrl
(),
"Application URL must not be null"
);
Validate
.
notNull
(
app
.
getUrl
(),
"Application URL must not be null"
);
registry
.
add
(
app
);
registry
.
put
(
app
.
getId
(),
app
);
}
}
/**
/**
* Checks, if an application is already registerd.
* Checks, if an application is already registerd.
*
*
* @param
app
* @param
id
* The application.
* The application
ID
.
* @return exists?
* @return exists?
*/
*/
public
boolean
isRegistered
(
Application
app
)
{
public
boolean
isRegistered
(
String
id
)
{
return
registry
.
contains
(
app
);
return
registry
.
contains
Key
(
id
);
}
}
/**
/**
...
@@ -47,7 +48,21 @@ public class ApplicationRegistry {
...
@@ -47,7 +48,21 @@ public class ApplicationRegistry {
* @return List.
* @return List.
*/
*/
public
List
<
Application
>
getApplications
()
{
public
List
<
Application
>
getApplications
()
{
return
Collections
.
unmodifiableList
(
registry
);
return
new
ArrayList
<>(
registry
.
values
());
}
/**
* Get a specific application inside the registry.
*
* @param id
* Id.
* @return Application.
*/
public
Application
getApplication
(
String
id
)
{
if
(!
isRegistered
(
id
))
{
throw
new
IllegalArgumentException
(
"Application with ID "
+
id
+
" is not registered"
);
}
return
registry
.
get
(
id
);
}
}
}
}
src/main/webapp/public/scripts/app.js
View file @
d9a76934
...
@@ -29,11 +29,12 @@ angular.module('springBootAdmin', [
...
@@ -29,11 +29,12 @@ angular.module('springBootAdmin', [
templateUrl
:
'views/apps/details.html'
templateUrl
:
'views/apps/details.html'
})
})
.
state
(
'apps.details.infos'
,
{
.
state
(
'apps.details.infos'
,
{
url
:
'/infos'
,
url
:
'/infos/{id}'
,
templateUrl
:
'views/apps/details/infos.html'
templateUrl
:
'views/apps/details/infos.html'
,
controller
:
'infosCtrl'
})
})
.
state
(
'apps.details.metrics'
,
{
.
state
(
'apps.details.metrics'
,
{
url
:
'/metrics'
,
url
:
'/metrics
/{id}
'
,
templateUrl
:
'views/apps/details/metrics.html'
templateUrl
:
'views/apps/details/metrics.html'
});
});
})
})
...
...
src/main/webapp/public/scripts/controllers/controllers.js
View file @
d9a76934
'use strict'
;
'use strict'
;
angular
.
module
(
'springBootAdmin'
)
angular
.
module
(
'springBootAdmin'
)
.
controller
(
'overviewCtrl'
,
function
(
$scope
,
Application
,
ApplicationInfo
,
$location
,
$http
)
{
.
controller
(
'overviewCtrl'
,
function
(
$scope
,
Applications
,
ApplicationInfo
,
$location
,
$http
)
{
// Gets the service from /api/services
$scope
.
applications
=
Applications
.
query
({},
function
(
applications
)
{
$scope
.
applications
=
Application
.
query
({},
function
(
applications
)
{
for
(
var
i
=
0
;
i
<
applications
.
length
;
i
++
)
{
var
app
=
applications
[
i
];
// Get details from applications
ApplicationInfo
.
getInfo
(
app
);
for
(
var
i
=
0
;
i
<
applications
.
length
;
i
++
)
{
ApplicationInfo
.
getHealth
(
app
);
var
app
=
applications
[
i
];
}
ApplicationInfo
.
getInfo
(
app
);
ApplicationInfo
.
getHealth
(
app
);
}
});
});
})
})
.
controller
(
'navCtrl'
,
function
(
$scope
,
$location
)
{
.
controller
(
'navCtrl'
,
function
(
$scope
,
$location
)
{
$scope
.
navClass
=
function
(
page
)
{
$scope
.
navClass
=
function
(
page
)
{
...
@@ -20,6 +16,8 @@ angular.module('springBootAdmin')
...
@@ -20,6 +16,8 @@ angular.module('springBootAdmin')
return
page
==
currentRoute
?
'active'
:
''
;
return
page
==
currentRoute
?
'active'
:
''
;
};
};
})
})
.
controller
(
'metricsCtrl'
,
function
(
$scope
,
$location
)
{
.
controller
(
'infosCtrl'
,
function
(
$scope
,
Application
,
ApplicationInfo
)
{
$scope
.
application
=
Application
.
query
({},
function
(
application
)
{
ApplicationInfo
.
getInfo
(
application
);
});
});
});
\ No newline at end of file
src/main/webapp/public/scripts/services/services.js
View file @
d9a76934
'use strict'
;
'use strict'
;
angular
.
module
(
'springBootAdmin.services'
,
[
'ngResource'
])
angular
.
module
(
'springBootAdmin.services'
,
[
'ngResource'
])
.
factory
(
'Application
'
,
[
'$resource'
,
.
factory
(
'Applications
'
,
[
'$resource'
,
function
(
$resource
){
function
(
$resource
){
return
$resource
(
return
$resource
(
'/api/applications'
,
{},
{
'/api/applications'
,
{},
{
query
:
{
method
:
'GET'
,
isArray
:
true
}
query
:
{
method
:
'GET'
,
isArray
:
true
}
});
});
}])
}
])
.
factory
(
'Application'
,
[
'$resource'
,
function
(
$resource
){
return
$resource
(
'/api/application'
,
{},
{
query
:
{
method
:
'GET'
,
isArray
:
true
}
});
}
])
.
service
(
'ApplicationInfo'
,
[
'$http'
,
.
service
(
'ApplicationInfo'
,
[
'$http'
,
function
(
$http
){
function
(
$http
){
this
.
getInfo
=
function
(
app
)
{
this
.
getInfo
=
function
(
app
)
{
...
...
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