Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<md-dialog flex="40">
|
||||
<form name="envForm" ng-submit="envForm.$valid && ok()">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools md-portal">
|
||||
<span>{{header}}</span>
|
||||
<md-button class="md-icon-button" ng-click="addEnvVar()">
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">New Environment Variable</md-tooltip>
|
||||
<md-icon class="md-icon-default-color">note_add</md-icon>
|
||||
</md-button>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="cancel()">
|
||||
<md-icon aria-label="Close dialog">close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<md-dialog-content flex>
|
||||
<md-list flex>
|
||||
<md-list-item ng-repeat="param in envVars" class="secondary-button-padding">
|
||||
<div layout="row" flex="100" style="background: {{$index % 2 === 0 ? 'white' : '#DCDCDC'}}; padding-left:5px; padding-right:5px;">
|
||||
<div layout="row" flex>
|
||||
<md-input-container flex>
|
||||
<label>Variable Name</label>
|
||||
<input type="text" ng-model="param.name" class="answerInput" required/>
|
||||
</md-input-container>
|
||||
<span flex="5"></span>
|
||||
<md-input-container flex>
|
||||
<label>Variable Value</label>
|
||||
<input type="text" ng-model="param.value" class="answerInput" required/>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div layout="column" flex="10">
|
||||
<div layout="row" layout-align="end center" flex>
|
||||
<md-button class="md-icon-button" ng-click="delete($index, envVars)" >
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Remove Environment Variable</md-tooltip>
|
||||
<md-icon>delete</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions layout="row" class="modal-footer">
|
||||
<div class="text-danger">{{error}}</div>
|
||||
<md-button id="okButton" type="submit" class="md-raised md-primary" >OK</md-button>
|
||||
<md-button id="cancelButton" class="md-raised md-warn" ng-click="cancel()">Cancel</md-button>
|
||||
</md-dialog-actions>
|
||||
</form>
|
||||
</md-dialog>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.common.partials.addEnvVars', ['ui.router']).controller('AddEnvVarCtrl', addEnvVarCtrlController);
|
||||
|
||||
function addEnvVarCtrlController($scope, modalInstance, cache, $mdDialog, scriptObjects,
|
||||
systemProvider, systemStores, portalUtils) {
|
||||
|
||||
$scope.header = modalInstance.header;
|
||||
|
||||
$scope.submitted = false;
|
||||
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.isNew = modalInstance.envVars.length === 0;
|
||||
|
||||
$scope.envVars = [];
|
||||
|
||||
if (!$scope.isNew) {
|
||||
for (var i = 0; i < modalInstance.envVars.length; i++) {
|
||||
$scope.envVars.push( new scriptObjects.ScriptEnvironmentVariable(modalInstance.envVars[i]) );
|
||||
}
|
||||
}
|
||||
|
||||
$scope.valid = false;
|
||||
|
||||
/**
|
||||
* OK button handler
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.ok = function () {
|
||||
|
||||
$scope.loadingBlock = true;
|
||||
var status = $scope.isNew ? 'added': 'edited';
|
||||
$scope.submitted = true;
|
||||
|
||||
systemProvider.addEnvVars($scope.envVars).then(function(data) {
|
||||
$scope.loadingBlock = false;
|
||||
portalUtils.toast('Script ' + status + ' successfully', ['top', 'left'], 2000);
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.loadingBlock = false;
|
||||
$scope.error = err.message;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addEnvVar = function() {
|
||||
var env = new scriptObjects.ScriptEnvironmentVariable();
|
||||
$scope.envVars.push(env);
|
||||
};
|
||||
|
||||
$scope.moveUp = function(index, array) {
|
||||
var ent1 = array[index];
|
||||
var ent2 = array[index-1];
|
||||
array[index] = ent2;
|
||||
array[index-1] = ent1;
|
||||
};
|
||||
|
||||
$scope.moveDown = function(index, array) {
|
||||
var ent1 = array[index];
|
||||
var ent2 = array[index+1];
|
||||
array[index] = ent2;
|
||||
array[index+1] = ent1;
|
||||
};
|
||||
|
||||
$scope.delete = function (id, array) {
|
||||
array.splice(id, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel button handler.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.cancel = function () {
|
||||
//Dismiss the modal
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
|
||||
} //end addEnvVarCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user