mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-14 18:27:25 +08:00
Add hostname to instance name
This commit is contained in:
parent
bea093e67a
commit
46a186f28b
@ -105,7 +105,7 @@ func CreateInstance(net string, dindImage string) (*Instance, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Instance{Name: strings.Replace(cinfo.Name, "/", "", 1), IP: cinfo.NetworkSettings.Networks[net].IPAddress}, nil
|
||||
return &Instance{Name: strings.Replace(cinfo.Name, "/", "", 1), Hostname: cinfo.Config.Hostname, IP: cinfo.NetworkSettings.Networks[net].IPAddress}, nil
|
||||
}
|
||||
|
||||
func DeleteContainer(id string) error {
|
||||
|
@ -12,12 +12,13 @@ import (
|
||||
)
|
||||
|
||||
type Instance struct {
|
||||
Session *Session `json:"-"`
|
||||
Name string `json:"name"`
|
||||
IP string `json:"ip"`
|
||||
Conn *types.HijackedResponse `json:"-"`
|
||||
ExecId string `json:"-"`
|
||||
Ctx context.Context `json:"-"`
|
||||
Session *Session `json:"-"`
|
||||
Name string `json:"name"`
|
||||
Hostname string `json:"hostname"`
|
||||
IP string `json:"ip"`
|
||||
Conn *types.HijackedResponse `json:"-"`
|
||||
ExecId string `json:"-"`
|
||||
Ctx context.Context `json:"-"`
|
||||
}
|
||||
|
||||
var dindImage string
|
||||
@ -51,7 +52,7 @@ func NewInstance(session *Session) (*Instance, error) {
|
||||
|
||||
go instance.Exec()
|
||||
|
||||
wsServer.BroadcastTo(session.Id, "new instance", instance.Name, instance.IP)
|
||||
wsServer.BroadcastTo(session.Id, "new instance", instance.Name, instance.IP, instance.Hostname)
|
||||
|
||||
return instance, nil
|
||||
}
|
||||
|
@ -93,8 +93,8 @@
|
||||
socket.on('viewport', function(rows, cols) {
|
||||
});
|
||||
|
||||
socket.on('new instance', function(name, ip) {
|
||||
$scope.upsertInstance({name: name, ip: ip});
|
||||
socket.on('new instance', function(name, ip, hostname) {
|
||||
$scope.upsertInstance({name: name, ip: ip, hostname: hostname});
|
||||
$scope.$apply(function() {
|
||||
if ($scope.instances.length == 1) {
|
||||
$scope.showInstance($scope.instances[0]);
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
<md-list>
|
||||
<md-list-item class="md-3-line" ng-repeat="instance in instances" ng-click="showInstance(instance)" ng-class="instance.name == selectedInstance.name ? 'selected' : false">
|
||||
<div class="md-list-item-text">{{instance.name}}</div>
|
||||
<div class="md-list-item-text">{{instance.name}} ({{instance.hostname}})</div>
|
||||
<md-divider ng-if="!$last"></md-divider>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
|
Loading…
x
Reference in New Issue
Block a user