From 30d709760c9971b05f6f9287bed72608871af58e Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Thu, 10 Aug 2017 18:55:32 -0300 Subject: [PATCH] Add support for windows containers --- provisioner/windows.go | 6 ++++-- www/assets/app.js | 4 +++- www/index.html | 7 ++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/provisioner/windows.go b/provisioner/windows.go index 18b8b81..f0a8c19 100644 --- a/provisioner/windows.go +++ b/provisioner/windows.go @@ -132,7 +132,7 @@ func (d *windows) InstanceDelete(session *types.Session, instance *types.Instanc return nil } -func (d *windows) InstanceResizeTerminal(instance *types.Instance, cols, rows uint) error { +func (d *windows) InstanceResizeTerminal(instance *types.Instance, rows, cols uint) error { dockerClient, err := d.factory.GetForSession(instance.SessionId) if err != nil { return err @@ -172,7 +172,9 @@ func (d *windows) getWindowsInstanceInfo(sessionId string) (*instanceInfo, error availInstances := make([]string, len(instances)) for i, inst := range instances { - availInstances[i] = *inst.InstanceId + if *inst.LifecycleState == "InService" { + availInstances[i] = *inst.InstanceId + } } assignedInstances, err := d.storage.InstanceGetAllWindows() diff --git a/www/assets/app.js b/www/assets/app.js index 4d921ca..f0ca4ef 100644 --- a/www/assets/app.js +++ b/www/assets/app.js @@ -27,6 +27,7 @@ $scope.isAlive = true; $scope.ttl = '--:--:--'; $scope.connected = true; + $scope.type = {windows: false}; $scope.isInstanceBeingCreated = false; $scope.newInstanceBtnText = '+ Add new instance'; $scope.deleteInstanceBtnText = 'Delete'; @@ -108,10 +109,11 @@ $scope.newInstance = function() { updateNewInstanceBtnState(true); + var instanceType = $scope.type.windows ? 'windows': 'linux'; $http({ method: 'POST', url: '/sessions/' + $scope.sessionId + '/instances', - data : { ImageName : InstanceService.getDesiredImage() } + data : { ImageName : InstanceService.getDesiredImage(), type: instanceType } }).then(function(response) { var i = $scope.upsertInstance(response.data); $scope.showInstance(i); diff --git a/www/index.html b/www/index.html index 692ab6f..0de73e5 100644 --- a/www/index.html +++ b/www/index.html @@ -48,7 +48,12 @@

Instances

- +
+
+
+ + Windows containers {{windows}} +