Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Jamakeev committed Aug 25, 2017
1 parent 3b4ae6c commit b4a991e
Show file tree
Hide file tree
Showing 6 changed files with 378 additions and 342 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -907,14 +907,14 @@ function AdvancedEnvironmentCtrl($scope, $rootScope, $stateParams, $location, en

function initJointJs() {

setTimeout(function () {
document.getElementById('js-environment-creation').addEventListener('destroyEnvironment', function (e) {
if (vm.editingEnv && vm.editingEnv.id == e.detail) {
clearWorkspace();
vm.editingEnv = false;
}
}, false);
}, 1000);
// setTimeout(function () {
// document.getElementById('js-environment-creation').addEventListener('destroyEnvironment', function (e) {
// if (vm.editingEnv && vm.editingEnv.id == e.detail) {
// clearWorkspace();
// vm.editingEnv = false;
// }
// }, false);
// }, 1000);

paper = new joint.dia.Paper({
el: $('#js-environment-creation'),
Expand Down Expand Up @@ -1014,7 +1014,7 @@ function AdvancedEnvironmentCtrl($scope, $rootScope, $stateParams, $location, en

function editEnvironment(environment) {

if (environment.dataSource == "hub") {
if (environment && environment.dataSource == "hub") {
SweetAlert.swal("Feature coming soon...", "This environment is created on Hub. Please use Hub to manage it.", "success");

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ angular.module('subutai.environment.controller', [])
.controller('EnvironmentViewCtrl', EnvironmentViewCtrl)
.directive('fileModel', fileModel)
.directive('onErrorSrc', onErrorSrc)
.directive('onReadFile', onReadFile)
.filter( 'sshEmail', function () {
return function( input, modify )
{
if( !modify )
return input;
var newVal = input.split(' ');
return newVal[newVal.length - 1];
}
})
.filter('isEmpty', [function() {
return function(object, editStatus) {
if(editStatus === true || angular.equals({}, object)) {
return true
} else {
return false;
}
}
}]);//.factory('DTLoadingTemplate', dtLoadingTemplate);
.directive('onReadFile', onReadFile)
.filter('sshEmail', function () {
return function (input, modify) {
if (!modify)
return input;
var newVal = input.split(' ');
return newVal[newVal.length - 1];
}
})
.filter('isEmpty', [function () {
return function (object, editStatus) {
if (editStatus === true || angular.equals({}, object)) {
return true
} else {
return false;
}
}
}]);//.factory('DTLoadingTemplate', dtLoadingTemplate);

// function dtLoadingTemplate() {
// return {
Expand Down Expand Up @@ -60,6 +59,7 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,
vm.nodeStatus = 'Add to';
vm.nodeList = [];
vm.colors = quotaColors;
vm.colors = quotaColors;
vm.containersType = [];
vm.containersTypeInfo = [];
vm.listOfUsers = [];
Expand Down Expand Up @@ -89,6 +89,8 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,
vm.minimizeLogs = minimizeLogs;
vm.getQuotaColor = getQuotaColor;
vm.initDataTable = initDataTable;
vm.createFrom = createFrom;
vm.createEnvironment = createEnvironment;

//share environment functions
vm.shareEnvironmentWindow = shareEnvironmentWindow;
Expand All @@ -98,8 +100,19 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,
vm.removeUserFromStack = removeUserFromStack;
vm.humanFileSize = humanFileSize;

function changeView(view, environment) {
$location.path(view+'/'+environment.id); // path not hash
function createFrom() {
ngDialog.open({
template: 'subutai-app/environment/partials/popups/createForm.html',
scope: $scope
});
}

// function changeView(view, environment) {
// $location.path(view + '/' + (environment ? environment.id : '')); // path not hash
// }

function changeView(view) {
$location.path(view); // path not hash
}

function humanFileSize(bytes, si) {
Expand Down Expand Up @@ -325,6 +338,14 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,

}

function createEnvironment(mode) {
console.log(this.activeMode)
console.log(mode)
// vm.environmentSimpleViewCtrl.editEnvironment()
if (mode === 'simple' || mode === 'advanced')
changeView('/environment/' + mode + '/')
}

function shareEnvironment() {
var arr = [];
for (var i = 0; i < vm.users2Add.length; ++i) {
Expand Down Expand Up @@ -433,7 +454,7 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,
);

var destroyEnvEvent = new CustomEvent('destroyEnvironment', {'detail': environmentId});
document.getElementById('js-environment-creation').dispatchEvent(destroyEnvEvent);
// document.getElementById('js-environment-creation').dispatchEvent(destroyEnvEvent);

vm.environments[key].status = 'UNDER_MODIFICATION';

Expand Down Expand Up @@ -567,14 +588,14 @@ function EnvironmentViewCtrl($scope, $rootScope, environmentService, trackerSrv,
LOADING_SCREEN();
environmentService.removeSshKey(vm.sshKeyForEnvironment, sshKey).success(function (data) {

vm.sshKeysList.splice(index, 1);
LOADING_SCREEN('none');
}).error( function(data) {
SweetAlert.swal("Error", "Error: " + data.ERROR, "error");
ngDialog.closeAll();
LOADING_SCREEN('none');
});
}
vm.sshKeysList.splice(index, 1);
LOADING_SCREEN('none');
}).error(function (data) {
SweetAlert.swal("Error", "Error: " + data.ERROR, "error");
ngDialog.closeAll();
LOADING_SCREEN('none');
});
}

function sshKeyFormat(sshKey) {
var splitedSSH = sshKey.split('==');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
<div class="b-popup b-popup_min">
<div class="b-popup__header">
Add peer
Create environment
<a href ng-click="closeThisDialog()">
<img src="assets/elements/buttons/b-icon-close.svg" class="b-icon g-right"/>
</a>
</div>
<form ng-submit="peerRegistrationCtrl.addPeer(newPeer)">
<form ng-submit="environmentViewCtrl.createEnvironment(activeMode)">
<div class="b-popup__body">

<div class="popup-body-box">
<label class="b-popup-body-label">Enter IP</label>
<input type="text"
id="subt_input__peer-ip"
class="b-popup-body-input b-popup-body-input_box"
ng-model="newPeer.ip" required>
<i ng-show="peerRegistrationCtrl.peerStatusIco == 'check'" class="g-right fa fa-check b-tags_green"></i>
<i ng-show="peerRegistrationCtrl.peerStatusIco == 'times'" class="g-right fa fa-times b-tags_red"></i>
<div class="clear"></div>
</div>
<label class="b-popup-body-label">Please select editing mode:</label>
<br/>

<label>
<input type="radio" ng-model="activeMode" value="simple" class="radio">
Simple
</label><br/>
<label>
<input type="radio" ng-model="activeMode" value="advanced" class="radio">
Advanced
</label><br/>

<div class="popup-body-box">
<label class="b-popup-body-label">Key phrase</label>
<input type="text"
id="subt_input__peer-key-phrase"
class="b-popup-body-input b-popup-body-input_box"
ng-model="newPeer.keyphrase" required>
<div class="clear"></div>
</div>

Expand All @@ -34,9 +30,9 @@
<button class="b-btn b-btn_green g-right" type="submit" id="subt_button__create-peer" style="margin-left: 5px">
Create
</button>
<a class="b-btn b-btn_green g-right" ng-click="peerRegistrationCtrl.checkResourceHost(newPeer)">
Check
</a>
<button class="b-btn b-btn_green g-right" ng-click="closeThisDialog()">
Close
</button>
<div class="clear"></div>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@
<div class="popup-body-box">
<label class="b-popup-body-label">Domain Strategy</label>
<select ng-init="domain.strategy = environmentViewCtrl.domainStrategies[0]"
class="b-popup-body-input b-popup-body-input_box"
class="b-popup-body-input b-popup-body-input_box"
ng-model="domain.strategy"
ng-options="strategy for strategy in environmentViewCtrl.domainStrategies">
</select>
<div class="clear"></div>
</div>
</div>

<div class="popup-body-box">
<label class="b-popup-body-label">SSL certificate</label>
<div class="b-file-uploader">
<input type="text"
id="js-uploadFile"
id="js-uploadFile"
placeholder="Choose File"
class="b-popup-body-input"
disabled="disabled">

<label for="js-uploadBtn" class="b-popup-body-label">Upload SSL cert</label>

<input id="js-uploadBtn"
type="file"
class="upload"
ng-hide="true"
ngf-select
ng-hide="true"
ngf-select
file-model="test" />
</div>
<div class="clear"></div>
Expand All @@ -55,8 +55,8 @@
<button class="b-btn b-btn_green g-right" type="submit" id="subt_button__environment-add-domain">
Save
</button>
<button class="b-btn b-btn_green g-right b-btn_margin-r"
ng-click="environmentViewCtrl.removeDomain(environmentViewCtrl.environmentForDomain)"
<button class="b-btn b-btn_green g-right b-btn_margin-r"
ng-click="environmentViewCtrl.removeDomain(environmentViewCtrl.environmentForDomain)"
id="subt_button__environment-remove-domain"
ng-if="environmentViewCtrl.currentDomain != null">
Remove Domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ <h1 class="b-title"><span class="b-title_breadcrumbs">Environment list</span></h
</div>
-->


</div>

<div class="b-workspace__content b-workspace__content_cloud-env">

<div class="b-cloud-space__table">
<a class="b-btn b-btn_green b-btn_search-field-level"
href
id="subt_link__create-peer"
ng-click="environmentViewCtrl.createFrom()">
<i class="fa fa-plus"></i> Create
</a>
<div class="b-cloud-space__row">
<table id="envTable" datatable="ng"
ng-init="environmentViewCtrl.initDataTable()"
dt-options="environmentViewCtrl.dtOptionsInstallTable"
Expand Down Expand Up @@ -85,14 +91,14 @@ <h1 class="b-title"><span class="b-title_breadcrumbs">Environment list</span></h
class="b-icon b-icon_edit"
tooltips
tooltip-template='Edit'
ng-click="environmentViewCtrl.changeView('/environment/simple', environment)"
ng-click="environmentViewCtrl.changeView('/environment/simple/'+environment.id, environment)"
style="visibility: visible">
</a>
<a href
class="b-icon b-icon_edit"
tooltips
tooltip-template='Edit in advanced mode'
ng-click="environmentViewCtrl.changeView('/environment/advanced', environment)"
ng-click="environmentViewCtrl.changeView('/environment/advanced/'+environment.id, environment)"
style="visibility: visible">
</a>
<a href
Expand Down
Loading

0 comments on commit b4a991e

Please sign in to comment.