├── .gitignore ├── Gruntfile.js ├── LICENSE ├── README.md ├── manifest.yml ├── package.json ├── src ├── Staticfile ├── app │ ├── app.config.js │ ├── app.js │ ├── app.run.js │ ├── components │ │ ├── application │ │ │ ├── application.js │ │ │ ├── applicationAdd.tpl.html │ │ │ ├── applicationAddCtrl.js │ │ │ ├── applicationDelete.tpl.html │ │ │ ├── applicationDeleteCtrl.js │ │ │ ├── applicationDetails.tpl.html │ │ │ ├── applicationDetailsCtrl.js │ │ │ ├── applicationEdit.tpl.html │ │ │ ├── applicationEditCtrl.js │ │ │ ├── applicationScale.tpl.html │ │ │ ├── applicationScaleCtrl.js │ │ │ ├── applicationService.js │ │ │ ├── applicationUserEnvAdd.tpl.html │ │ │ ├── applicationUserEnvAddCtrl.js │ │ │ ├── applicationUserEnvDelete.tpl.html │ │ │ ├── applicationUserEnvDeleteCtrl.js │ │ │ ├── applicationUserEnvEdit.tpl.html │ │ │ └── applicationUserEnvEditCtrl.js │ │ ├── authentication │ │ │ ├── auth.js │ │ │ ├── authInterceptorService.js │ │ │ └── authService.js │ │ ├── domain │ │ │ ├── domain.js │ │ │ ├── domainAdd.tpl.html │ │ │ ├── domainAddCtrl.js │ │ │ ├── domainDelete.tpl.html │ │ │ ├── domainDeleteCtrl.js │ │ │ └── domainService.js │ │ ├── featureFlag │ │ │ ├── featureFlag.js │ │ │ └── featureFlagService.js │ │ ├── info │ │ │ ├── info.js │ │ │ └── infoService.js │ │ ├── logIn │ │ │ ├── logIn.js │ │ │ ├── logIn.tpl.html │ │ │ └── logInCtrl.js │ │ ├── marketplace │ │ │ ├── marketplace.js │ │ │ ├── marketplaceAddService.tpl.html │ │ │ ├── marketplaceAddServiceCtrl.js │ │ │ ├── marketplaceAddServiceInstance.tpl.html │ │ │ ├── marketplaceAddServiceInstanceCtrl.js │ │ │ ├── marketplaceSelectServicePlan.tpl.html │ │ │ └── marketplaceSelectServicePlanCtrl.js │ │ ├── organization │ │ │ ├── organization.js │ │ │ ├── organizationAdd.tpl.html │ │ │ ├── organizationAddAuditor.tpl.html │ │ │ ├── organizationAddAuditorCtrl.js │ │ │ ├── organizationAddBillingManager.tpl.html │ │ │ ├── organizationAddBillingManagerCtrl.js │ │ │ ├── organizationAddCtrl.js │ │ │ ├── organizationAddManager.tpl.html │ │ │ ├── organizationAddManagerCtrl.js │ │ │ ├── organizationAssociateUser.tpl.html │ │ │ ├── organizationAssociateUserCtrl.js │ │ │ ├── organizationDelete.tpl.html │ │ │ ├── organizationDeleteAuditor.tpl.html │ │ │ ├── organizationDeleteAuditorCtrl.js │ │ │ ├── organizationDeleteBillingManager.tpl.html │ │ │ ├── organizationDeleteBillingManagerCtrl.js │ │ │ ├── organizationDeleteCtrl.js │ │ │ ├── organizationDeleteManager.tpl.html │ │ │ ├── organizationDeleteManagerCtrl.js │ │ │ ├── organizationDeleteUser.tpl.html │ │ │ ├── organizationDeleteUserCtrl.js │ │ │ ├── organizationDetails.tpl.html │ │ │ ├── organizationDetailsCtrl.js │ │ │ ├── organizationEdit.tpl.html │ │ │ ├── organizationEditCtrl.js │ │ │ ├── organizationPreview.tpl.html │ │ │ ├── organizationPreviewCtrl.js │ │ │ └── organizationService.js │ │ ├── route │ │ │ ├── route.js │ │ │ ├── routeAdd.tpl.html │ │ │ ├── routeAddCtrl.js │ │ │ ├── routeAssociateWithApp.tpl.html │ │ │ ├── routeAssociateWithAppCtrl.js │ │ │ ├── routeDelete.tpl.html │ │ │ ├── routeDeleteCtrl.js │ │ │ ├── routeDeleteOrphanedRoutes.tpl.html │ │ │ ├── routeDeleteOrphanedRoutesCtrl.js │ │ │ ├── routeDisassociateFromApp.tpl.html │ │ │ ├── routeMap.tpl.html │ │ │ ├── routeMapCtrl.js │ │ │ ├── routeService.js │ │ │ ├── routeUnmap.tpl.html │ │ │ └── routeUnmapCtrl.js │ │ ├── service │ │ │ ├── service.js │ │ │ └── serviceService.js │ │ ├── serviceBinding │ │ │ ├── serviceBinding.js │ │ │ ├── serviceBindingAdd.tpl.html │ │ │ ├── serviceBindingAddCtrl.js │ │ │ ├── serviceBindingDelete.tpl.html │ │ │ ├── serviceBindingDeleteCtrl.js │ │ │ └── serviceBindingService.js │ │ ├── serviceInstance │ │ │ ├── serviceInstance.js │ │ │ ├── serviceInstanceDelete.tpl.html │ │ │ ├── serviceInstanceDeleteCtrl.js │ │ │ └── serviceInstanceService.js │ │ ├── space │ │ │ ├── space.js │ │ │ ├── spaceAdd.tpl.html │ │ │ ├── spaceAddAuditor.tpl.html │ │ │ ├── spaceAddAuditorCtrl.js │ │ │ ├── spaceAddCtrl.js │ │ │ ├── spaceAddDeveloper.tpl.html │ │ │ ├── spaceAddDeveloperCtrl.js │ │ │ ├── spaceAddManager.tpl.html │ │ │ ├── spaceAddManagerCtrl.js │ │ │ ├── spaceAssociateUser.tpl.html │ │ │ ├── spaceAssociateUserCtrl.js │ │ │ ├── spaceDelete.tpl.html │ │ │ ├── spaceDeleteAuditor.tpl.html │ │ │ ├── spaceDeleteAuditorCtrl.js │ │ │ ├── spaceDeleteCtrl.js │ │ │ ├── spaceDeleteDeveloper.tpl.html │ │ │ ├── spaceDeleteDeveloperCtrl.js │ │ │ ├── spaceDeleteManager.tpl.html │ │ │ ├── spaceDeleteManagerCtrl.js │ │ │ ├── spaceDetails.tpl.html │ │ │ ├── spaceDetailsCtrl.js │ │ │ ├── spaceDisassociateUser.tpl.html │ │ │ ├── spaceDisassociateUserCtrl.js │ │ │ ├── spaceEdit.tpl.html │ │ │ ├── spaceEditCtrl.js │ │ │ └── spaceService.js │ │ └── user │ │ │ ├── user.js │ │ │ ├── userDelete.tpl.html │ │ │ ├── userDeleteCtrl.js │ │ │ └── userService.js │ └── shared │ │ ├── breadcrumb │ │ ├── breadcrumb.js │ │ ├── breadcrumb.tpl.html │ │ ├── breadcrumbCtrl.js │ │ └── breadcrumbDirective.js │ │ ├── message │ │ ├── message.js │ │ ├── messageCtrl.js │ │ ├── messageDirective.js │ │ ├── messageService.js │ │ └── messages.tpl.html │ │ ├── sidebar │ │ ├── sidebar.js │ │ ├── sidebar.tpl.html │ │ ├── sidebarCtrl.js │ │ ├── sidebarDirective.js │ │ ├── sidebarToggleSidebarDirective.js │ │ └── sidebarToggleSubnaviDirective.js │ │ └── topbar │ │ ├── topbar.js │ │ ├── topbar.tpl.html │ │ └── topbarDirective.js ├── assets │ ├── css │ │ ├── bootstrap-overrides.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ ├── font-awesome.css │ │ ├── font-awesome.min.css │ │ ├── loading-bar.css │ │ ├── loading-bar.min.css │ │ └── style.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ ├── images │ │ ├── service-CloudAMQP.png │ │ └── service-cleardb.png │ ├── less │ │ ├── _bootstrap-overrides.less │ │ ├── _breadcrumb.less │ │ ├── _content.less │ │ ├── _mixins.less │ │ ├── _sidebar.less │ │ ├── _top.less │ │ ├── _variables.less │ │ └── style.less │ └── libs │ │ ├── angular-animate.min.js │ │ ├── angular-animate.min.js.map │ │ ├── angular-resource.min.js │ │ ├── angular-resource.min.js.map │ │ ├── angular-route.min.js │ │ ├── angular-route.min.js.map │ │ ├── angular.min.js │ │ ├── angular.min.js.map │ │ ├── bootstrap.min.js │ │ ├── loading-bar.min.js │ │ └── ui-bootstrap-tpls-0.11.2.min.js ├── index.html ├── mime.types └── nginx.conf └── test.jshintrc /.gitignore: -------------------------------------------------------------------------------- 1 | # Grunt/NPM generated 2 | build/ 3 | node_modules/ 4 | 5 | # OS dependent files 6 | .DS_Store 7 | .Spotlight-V100 8 | .Trashes 9 | Thumbs.db 10 | Desktop.ini 11 | *~ 12 | # Thumbnails 13 | ._* 14 | 15 | # Gradle files 16 | build/ 17 | .gradle/ 18 | 19 | # Maven files 20 | target/ 21 | 22 | # Sublime files 23 | *.sublime-project 24 | *.sublime-workspace 25 | 26 | # IntelliJ IDEA files 27 | *.iml 28 | *.ipr 29 | *.ids 30 | *.iws 31 | .idea/ 32 | 33 | # Eclipse files 34 | .project 35 | .metadata 36 | .classpath 37 | .settings/ 38 | .loadpath 39 | bin/ 40 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | copy: { 6 | build: { 7 | cwd: 'src', 8 | src: [ '**', '!***/**/*.js', '!assets/css/*.css', '!assets/**/*.map' ], 9 | dest: 'build', 10 | expand: true 11 | }, 12 | }, 13 | 14 | clean: { 15 | prev: [ 'build/**/*' ], 16 | post: [ 'build/application.js', 'build/application.js', 'build/assets/less/', 'build/assets/css/style.css'] 17 | }, 18 | 19 | jshint: { 20 | all: ['Gruntfile.js', 'src/app/***/**/*.js'] 21 | }, 22 | 23 | ngtemplates: { 24 | app: { 25 | cwd: 'build', 26 | src: 'app/**/*.tpl.html', 27 | dest: 'build/app.templates.js' 28 | } 29 | }, 30 | 31 | htmlmin: { // Task 32 | dist: { // Target 33 | options: { // Target options 34 | removeComments: true, 35 | collapseWhitespace: true 36 | }, 37 | // Dictionary of files 38 | files: [{ 39 | expand: true, 40 | cwd: 'build', 41 | src: ['app/**/*.tpl.html', 'index.html'], 42 | dest: 'build/' 43 | }] 44 | 45 | } 46 | }, 47 | 48 | ngAnnotate: { 49 | application: { 50 | files: { 51 | 'build/application.js': ['src/app/**/*.js', '!**/app.*.js', '!**/app.js'] 52 | }, 53 | }, 54 | app: { 55 | files: { 56 | 'build/app.js': ['src/app/app.js', 'src/app/app.constant.js', 'src/app/app.config.js', 'src/app/app.run.js'] 57 | }, 58 | } 59 | }, 60 | 61 | concat: { 62 | options: { 63 | 64 | }, 65 | dist: { 66 | src: ['src/assets/libs/angular.min.js', 'src/assets/libs/angular-route.min.js', 'src/assets/libs/angular-resource.min.js', 'src/assets/libs/angular-animate.min.js', 'src/assets/libs/ui-bootstrap-tpls-0.11.2.min.js', 'src/assets/libs/loading-bar.min.js' ], 67 | dest: 'build/assets/libs/libs.min.js', 68 | }, 69 | }, 70 | 71 | 72 | 73 | uglify: { 74 | demo: { 75 | files: { 76 | 'build/application.min.js': ['build/application.js'], 77 | 'build/app.min.js': ['build/app.js'] 78 | } 79 | } 80 | }, 81 | 82 | less: { 83 | development: { 84 | files: { 85 | "src/assets/css/style.css": "src/assets/less/style.less" 86 | } 87 | } 88 | }, 89 | 90 | cssmin: { 91 | options: { 92 | shorthandCompacting: false, 93 | roundingPrecision: -1 94 | }, 95 | target: { 96 | files: { 97 | 'build/assets/css/style.css': ['src/assets/css/bootstrap.css', 'src/assets/css/font-awesome.css', 'src/assets/css/loading-bar.css', 'src/assets/css/style.css'] 98 | } 99 | }, 100 | min: { 101 | files: [{ 102 | expand: true, 103 | cwd: 'build/assets/css', 104 | src: ['style.css'], 105 | dest: 'build/assets/css', 106 | ext: '.min.css' 107 | }] 108 | } 109 | } 110 | 111 | }); 112 | 113 | grunt.loadNpmTasks('grunt-contrib-copy'); 114 | grunt.loadNpmTasks('grunt-contrib-clean'); 115 | 116 | grunt.loadNpmTasks('grunt-contrib-uglify'); 117 | 118 | grunt.loadNpmTasks('grunt-ng-annotate'); 119 | grunt.loadNpmTasks('grunt-contrib-htmlmin'); 120 | 121 | grunt.loadNpmTasks('grunt-contrib-jshint'); 122 | grunt.loadNpmTasks('grunt-contrib-concat'); 123 | 124 | grunt.loadNpmTasks('grunt-contrib-less'); 125 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 126 | 127 | grunt.loadNpmTasks('grunt-angular-templates'); 128 | 129 | // define the tasks 130 | 131 | grunt.registerTask( 132 | 'build', 133 | 'Compiles all of the assets, validate js files, annotate angular and minify files to the build directory.', 134 | ['clean:prev', 'copy', 'jshint', 'ngtemplates', 'htmlmin', 'ngAnnotate', 'uglify', 'less', 'cssmin', 'concat', 'clean:post'] 135 | ); 136 | 137 | 138 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CF WebUI 2 | 3 | [CF WebUI](https://icclab.github.io/cf-webui) is a modern single-page web-frontend for Cloud Foundry based on AngularJS and Bootstrap. 4 | 5 | [Cloud Foundry](http://cloudfoundry.org) is the OpenSource Platform as a Service (PaaS) Framework on which many PaaS offerings are based (e.g. Pivotal Web Services, HP Helion, IBM BlueMix, Swisscom Application Cloud, etc.). It allows the developers to provide, manage and scale their application in the cloud very easily and quickly. For end-users Cloud Foundry provides a REST based API and a command line interface (CLI) client. No official free and open source web front-end is currently available. 6 | 7 | ## Getting started 8 | 9 | 1\. Clone the project: `git clone https://github.com/icclab/cf-webui` 10 | 2\. Change directory to cf-webUI: `cd cf-webUI` 11 | 3\. Change the `manifest.yml` to your options and the endpoint to your desired Cloud Foundry instance. E.g.: 12 | 13 | --- 14 | applications: 15 | - name: cf-webui 16 | memory: 128M 17 | host: console-cf-webui-${random-word} 18 | path: ./build 19 | buildpack: staticfile_buildpack 20 | env: 21 | API_ENDPOINT: https://api.run.pivotal.io 22 | # Use Google DNS by default 23 | NGINX_RESOLVER: 8.8.8.8 24 | #Enforce https is used (using x_forwarded_proto check) .Default: enabled 25 | FORCE_HTTPS: 1 26 | 27 | 4\. Install npm packages: `npm install` 28 | 5\. Build the application using Grunt: `grunt build` 29 | 6\. Push this application to Cloud Foundry using the cf Command Line Interface (CLI): `cf push`. 30 | 7\. Enjoy the CF WebUI! 31 | 32 | ## Disclaimer 33 | 34 | The current version is an early release (alpha). It is not yet production-ready. Some features are still to come and it may contain major bugs. 35 | 36 | ## Community & Support 37 | 38 | Please report bugs and request features using [GitHub Issues](https://github.com/icclab/cf-webui/issues). For additional information, you can contact the maintainer directly. 39 | 40 | Community discussions about CF-WebUI happen in the CF-WebUI-discuss mailing list. Once you [subscribe to the list](https://mailman.engineering.zhaw.ch/mailman/listinfo/icclab-cf-webui), you can send mail to the list address: icclab-cf-webui@dornbirn.zhaw.ch. The mailing list archives are also [available on the web](https://mailman.engineering.zhaw.ch/pipermail/icclab-cf-webui/). 41 | 42 | Please follow the [ICCLab blog](http://blog.zhaw.ch/icclab/tag/cf-webui/) for updates. 43 | 44 | ## License 45 | 46 | CF-WebUI is licensed under the Apache License version 2.0. See the [LICENSE](./LICENSE) file. 47 | 48 | -------------------------------------------------------------------------------- /manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: cf-webui 4 | memory: 128M 5 | host: console-cf-webui-${random-word} 6 | path: ./build 7 | buildpack: https://github.com/cloudfoundry/staticfile-buildpack 8 | env: 9 | API_ENDPOINT: https://api.run.pivotal.io 10 | # Use Google DNS by default 11 | NGINX_RESOLVER: 8.8.8.8 12 | #Enforce https is used (using x_forwarded_proto check) .Default: enabled 13 | FORCE_HTTPS: 1 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cf-webui", 3 | "version": "0.0.1", 4 | "description": "grunt for cf-webui", 5 | "main": "index.php", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/icclab/cf-webui/" 12 | }, 13 | "author": "", 14 | "license": "BSD-2-Clause", 15 | "devDependencies": { 16 | "grunt": "~0.4.5", 17 | "grunt-contrib-clean": "0.5.x", 18 | "grunt-contrib-copy": "0.4.x", 19 | "grunt-contrib-cssmin": "~0.14.0", 20 | "grunt-contrib-jshint": "~0.11.2", 21 | "grunt-contrib-uglify": "0.2.x", 22 | "grunt-ng-annotate": "~1.0.1", 23 | "grunt-contrib-htmlmin": "~0.4.0", 24 | "grunt-contrib-concat": "~0.5.1", 25 | "grunt-contrib-less": "~1.1.0", 26 | "grunt-angular-templates": "~1.0.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Staticfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/Staticfile -------------------------------------------------------------------------------- /src/app/app.config.js: -------------------------------------------------------------------------------- 1 | angular.module('app').config(['$routeProvider', function($routeProvider) { 2 | $routeProvider 3 | .when('/login', { 4 | templateUrl: 'app/components/logIn/logIn.tpl.html', 5 | controller: 'LogInCtrl' 6 | }) 7 | 8 | .when('/organizations', { 9 | templateUrl: 'app/components/organization/organizationPreview.tpl.html', 10 | controller: 'OrganizationPreviewCtrl' 11 | }) 12 | 13 | .when('/organizations/:organizationId', { 14 | templateUrl: 'app/components/organization/organizationDetails.tpl.html', 15 | controller: 'OrganizationDetailsCtrl' 16 | }) 17 | 18 | .when('/organizations/:organizationId/spaces/:spaceId', { 19 | templateUrl: 'app/components/space/spaceDetails.tpl.html', 20 | controller: 'SpaceDetailsCtrl' 21 | }) 22 | 23 | .when('/organizations/:organizationId/spaces/:spaceId/marketplace', { 24 | templateUrl: 'app/components/marketplace/marketplaceAddService.tpl.html', 25 | controller: 'marketplaceAddServiceCtrl' 26 | }) 27 | 28 | .when('/organizations/:organizationId/spaces/:spaceId/marketplace/:serviceId', { 29 | templateUrl: 'app/components/marketplace/marketplaceSelectServicePlan.tpl.html', 30 | controller: 'marketplaceSelectServicePlanCtrl' 31 | }) 32 | 33 | .when('/organizations/:organizationId/spaces/:spaceId/marketplace/:serviceId/plan/:servicePlanId', { 34 | templateUrl: 'app/components/marketplace/marketplaceAddServiceInstance.tpl.html', 35 | controller: 'marketplaceAddServiceInstanceCtrl' 36 | }) 37 | 38 | .when('/organizations/:organizationId/spaces/:spaceId/applications/:applicationId', { 39 | templateUrl: 'app/components/application/applicationDetails.tpl.html', 40 | controller: 'ApplicationDetailsCtrl' 41 | }) 42 | 43 | .when('/marketplace', { 44 | templateUrl: 'app/components/marketplace/marketplaceAddService.tpl.html', 45 | controller: 'marketplaceAddServiceCtrl' 46 | }) 47 | 48 | .when('/marketplace/:serviceId', { 49 | templateUrl: 'app/components/marketplace/marketplaceSelectServicePlan.tpl.html', 50 | controller: 'marketplaceSelectServicePlanCtrl' 51 | }) 52 | 53 | .when('/marketplace/:serviceId/plan/:servicePlanId', { 54 | templateUrl: 'app/components/marketplace/marketplaceAddServiceInstance.tpl.html', 55 | controller: 'marketplaceAddServiceInstanceCtrl' 56 | }) 57 | 58 | .otherwise({ 59 | redirectTo: '/organizations' 60 | }); 61 | }]); 62 | 63 | angular.module('app').config(['$httpProvider', function($httpProvider) { 64 | $httpProvider.interceptors.push('authInterceptorService'); 65 | }]); -------------------------------------------------------------------------------- /src/app/app.js: -------------------------------------------------------------------------------- 1 | angular.module('app', [ 2 | 'ngRoute', 3 | 'ngResource', 4 | 'ngAnimate', 5 | 6 | 'ui.bootstrap', 7 | 'angular-loading-bar', 8 | 9 | // shared 10 | 'app.sidebar', 11 | 'app.topbar', 12 | 'app.breadcrumb', 13 | 'app.message', 14 | 15 | // components 16 | 'app.info', 17 | 'app.application', 18 | 'app.auth', 19 | 'app.logIn', 20 | 'app.organization', 21 | 'app.space', 22 | 'app.service', 23 | 'app.serviceInstance', 24 | 'app.user', 25 | 'app.domain', 26 | 'app.routes', 27 | 'app.serviceBinding', 28 | 'app.marketplace', 29 | 'app.featureFlag' 30 | ]); -------------------------------------------------------------------------------- /src/app/app.run.js: -------------------------------------------------------------------------------- 1 | angular.module('app').run(['$rootScope', '$location', '$route', 'authService', function($rootScope, $location, $route, authService) { 2 | $rootScope.nrOfUnauthorizedRequests = 0; 3 | $rootScope.rootFields = {}; 4 | 5 | authService.fillAuthData(); 6 | 7 | var marginSidebar= localStorage.getItem('marginSidebar'); 8 | if (marginSidebar){ 9 | $rootScope.rootFields.marginSidebar = marginSidebar; 10 | if (marginSidebar === "220px"){ 11 | $rootScope.rootFields.hidedSidebar = false; 12 | }else{ 13 | $rootScope.rootFields.hidedSidebar = true; 14 | } 15 | }else{ 16 | localStorage.setItem('marginSidebar', "220px"); 17 | $rootScope.rootFields.marginSidebar = "220px"; 18 | $rootScope.rootFields.hidedSidebar = false; 19 | } 20 | 21 | // redirect the user to the login page if he is not logged in 22 | $rootScope.$on('$routeChangeStart', function(event) { 23 | console.log($rootScope.rootFields.showContent); 24 | if ($location.path() != '/login') $rootScope.rootFields.showContent = false; 25 | $rootScope.nrOfUnauthorizedRequests = 0; 26 | var authentication = authService.authentication; 27 | 28 | if (!authentication.isAuth && $location.path() != '/login') { 29 | $location.path('/login'); 30 | $route.reload(); 31 | } 32 | }); 33 | 34 | $rootScope.$on('cfpLoadingBar:started', function (event) { 35 | 36 | $rootScope.rootFields.showContent = false; 37 | }); 38 | 39 | $rootScope.$on('cfpLoadingBar:loading', function (event) { 40 | $rootScope.rootFields.showContent = false; 41 | }); 42 | 43 | $rootScope.$on('cfpLoadingBar:completed', function (event) { 44 | $rootScope.rootFields.showContent = true; 45 | 46 | }); 47 | 48 | 49 | }]); -------------------------------------------------------------------------------- /src/app/components/application/application.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application', []); -------------------------------------------------------------------------------- /src/app/components/application/applicationAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 18 | -------------------------------------------------------------------------------- /src/app/components/application/applicationAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('AppAddCtrl', ['$route', '$scope', '$modalInstance', '$log', 'application', 'applicationService', 'organizationService', 'routeService', 'messageService', function($route, $scope, $modalInstance, $log, application, applicationService, organizationService, routeService, messageService) { 2 | 3 | $scope.application = application; 4 | $scope.route = []; 5 | 6 | // domain info 7 | $scope.domains = []; 8 | $scope.nrOfDomains = 0; 9 | $scope.domainId = null; 10 | 11 | // get organization sharedDomains 12 | organizationService.getSharedDomainsForTheOrganization($scope.application.orgId).then(function(response) { 13 | var data = response.data; 14 | $scope.nrOfDomains += 1; 15 | //$scope.sharedDomains = (data.resources); 16 | angular.forEach(data.resources, function(sharedDomain, i){ 17 | var sharedDomainObject = { 18 | id: sharedDomain.metadata.guid, 19 | name: sharedDomain.entity.name 20 | }; 21 | $scope.domains.push(sharedDomainObject); 22 | }); 23 | }, function(err) { 24 | $log.error(err.data.description); 25 | }); 26 | 27 | // get organization privateDomains 28 | organizationService.getPrivateDomainsForTheOrganization($scope.application.orgId).then(function(response) { 29 | var data = response.data; 30 | $scope.nrOfDomains += data.total_results; 31 | //$scope.privateDomains = data.resources; 32 | angular.forEach(data.resources, function(privateDomain, i){ 33 | var privateDomainObject = { 34 | id: privateDomain.metadata.guid, 35 | name: privateDomain.entity.name 36 | }; 37 | $scope.domains.push(privateDomainObject); 38 | }); 39 | }, function(err) { 40 | $log.error(err.data.description); 41 | }); 42 | 43 | $scope.ok = function () { 44 | $scope.application.bits = $scope.files; 45 | 46 | $scope.route.domainId = $scope.domainId; 47 | $scope.route.spaceId = $scope.application.spaceId; 48 | 49 | applicationService.createApplication($scope.application).then(function(response) { 50 | 51 | routeService.createRoute($scope.route).then(function(routeResponse) { 52 | messageService.addMessage('success', 'The route has been successfully added.', true); 53 | $scope.route.id=routeResponse.data.metadata.guid; 54 | routeService.associateRouteWithApp($scope.route.id, $scope.application.id).then(function(mapRouteResponse) { 55 | messageService.addMessage('success', 'The route has been successfully mapped.', true); 56 | //$modalInstance.close($scope.application); 57 | }, function(err) { 58 | messageService.addMessage('danger', 'The route has not been mapped.', true); 59 | $log.error(err); 60 | $modalInstance.dismiss('cancel'); 61 | }); 62 | }, function(err) { 63 | messageService.addMessage('danger', 'The route has not been added.', true); 64 | $log.error(err); 65 | $modalInstance.dismiss('error'); 66 | }); 67 | 68 | 69 | $scope.application.id = response.data.metadata.guid; 70 | applicationService.addApplication($scope.application).then(function(responseApp) { 71 | 72 | // set message 73 | messageService.addMessage('success', 'The application has been successfully added.', 'true'); 74 | 75 | // close the modal 76 | $modalInstance.close(); 77 | }, function(err) { 78 | // set message 79 | messageService.addMessage('danger', 'The application has not been added.'); 80 | $log.error(err.data.description); 81 | $log.error(err.config); 82 | 83 | // close the modal 84 | $modalInstance.close(); 85 | }); 86 | 87 | 88 | }, function(err) { 89 | // set message 90 | messageService.addMessage('danger', 'The application has not been added.'); 91 | $log.error(err.data); 92 | 93 | // close the modal 94 | $modalInstance.close(); 95 | }); 96 | }; 97 | 98 | $scope.uploadedFile = function(element) { 99 | $scope.$apply(function($scope) { 100 | $scope.files = element.files; 101 | }); 102 | }; 103 | 104 | $scope.cancel = function () { 105 | $modalInstance.dismiss('cancel'); 106 | }; 107 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/application/applicationDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('ApplicationDeleteCtrl', ['$route', '$scope', '$modalInstance', '$log', 'applicationId', 'applicationService', 'serviceBindingService', 'messageService', function($route, $scope, $modalInstance, $log, applicationId, applicationService, serviceBindingService, messageService) { 2 | 3 | $scope.applicationId = applicationId; 4 | 5 | $scope.ok = function () { 6 | applicationService.getServiceBindings(applicationId).then(function(responseServiceBinding){ 7 | if (responseServiceBinding.data.total_results ===0){ 8 | applicationService.deleteApplication($scope.applicationId).then(function(response) { 9 | messageService.addMessage('success', 'The application has been successfully deleted.'); 10 | $modalInstance.close(); 11 | }, function(err) { 12 | messageService.addMessage('danger', 'The application has not been deleted.'); 13 | $modalInstance.close(); 14 | $log.error(err); 15 | }); 16 | }else{ 17 | angular.forEach(responseServiceBinding.data.resources, function(serviceBinding, i) { 18 | serviceBindingService.deleteServiceBinding(serviceBinding.metadata.guid).then(function(response) { 19 | applicationService.deleteApplication($scope.applicationId, $route.reload()).then(function(response) { 20 | messageService.addMessage('success', 'The application has been successfully deleted.'); 21 | $modalInstance.close(); 22 | }, function(err) { 23 | messageService.addMessage('danger', 'The application has not been deleted.'); 24 | $modalInstance.close(); 25 | $log.error(err); 26 | }); 27 | }); 28 | }); 29 | } 30 | 31 | }); 32 | 33 | }; 34 | 35 | $scope.cancel = function () { 36 | $modalInstance.dismiss('cancel'); 37 | }; 38 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationEdit.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/application/applicationEditCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('ApplicationEditCtrl', ['$scope', '$modalInstance', '$log', 'application', 'applicationService', 'messageService', function($scope, $modalInstance, $log, application, applicationService, messageService) { 2 | 3 | $scope.application = application; 4 | 5 | $scope.ok = function () { 6 | applicationService.editApplication($scope.application).then(function(response) { 7 | messageService.addMessage('success', 'The application name has been successfully changed.'); 8 | $modalInstance.close($scope.application); 9 | }, function(err) { 10 | messageService.addMessage('danger', 'The application name has not been changed.'); 11 | $modalInstance.dismiss('cancel'); 12 | $log.error(err); 13 | }); 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationScale.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 9 | -------------------------------------------------------------------------------- /src/app/components/application/applicationScaleCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('ApplicationScaleCtrl', ['$scope', '$modalInstance', '$log', 'config', 'applicationService', 'messageService', function($scope, $modalInstance, $log, config, applicationService, messageService) { 2 | 3 | $scope.applicationId = config.applicationId; 4 | $scope.scale = config.scale; 5 | 6 | $scope.ok = function () { 7 | applicationService.scaleApplication($scope.applicationId, $scope.scale).then(function(response) { 8 | if ($scope.scale.memory===$scope.scale.initialMemoryValue){ 9 | applicationService.stopApplication($scope.applicationId).then(function(responseStop) { 10 | applicationService.startApplication($scope.applicationId).then(function(responseStart) { 11 | $modalInstance.close(); 12 | }, function(err) { 13 | $log.error('The application has not been started: ' + err.data.description + ' (' + err.data.error_code + ')'); 14 | $modalInstance.dismiss('cancel'); 15 | }); 16 | }, function(err) { 17 | $log.error('The application has not been stopped: ' + err.data.description + ' (' + err.data.error_code + ')'); 18 | $modalInstance.dismiss('cancel'); 19 | }); 20 | }else{ 21 | $modalInstance.close(); 22 | } 23 | }, function(err) { 24 | $log.error('The application has not been scaled: ' + err.data.description + ' (' + err.data.error_code + ')'); 25 | $modalInstance.dismiss('cancel'); 26 | }); 27 | }; 28 | 29 | $scope.cancel = function () { 30 | $modalInstance.dismiss('cancel'); 31 | }; 32 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 |
6 | 21 | 25 |
-------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('UserEnvAddCtrl', ['$scope', '$modalInstance', '$log', 'config', 'applicationService', 'messageService', function($scope, $modalInstance, $log, config, applicationService, messageService) { 2 | 3 | $scope.applicationId = config.applicationId; 4 | $scope.userEnvs = config.existingUserEnvs; 5 | 6 | $scope.ok = function() { 7 | // add new user env 8 | $scope.userEnvs[$scope.env.key] = $scope.env.value; 9 | 10 | applicationService.editApplicationEnv($scope.applicationId, $scope.userEnvs).then(function(response) { 11 | $modalInstance.close(); 12 | messageService.addMessage('success', 'The environment variable has been successfully added.'); 13 | }, function(err) { 14 | messageService.addMessage('danger', 'The environment variable has not been added.'); 15 | $log.error(err); 16 | }); 17 | }; 18 | 19 | $scope.cancel = function() { 20 | $modalInstance.dismiss('cancel'); 21 | }; 22 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('UserEnvDeleteCtrl', ['$scope', '$modalInstance', '$log', 'config', 'applicationService', 'messageService', function($scope, $modalInstance, $log, config, applicationService, messageService) { 2 | $scope.applicationId = config.applicationId; 3 | $scope.userEnvs = config.existingUserEnvs; 4 | $scope.userEnvToDelete = config.userEnvToDelete; 5 | 6 | $scope.ok = function() { 7 | // delete user env 8 | delete $scope.userEnvs[$scope.userEnvToDelete]; 9 | 10 | applicationService.editApplicationEnv($scope.applicationId, $scope.userEnvs).then(function(response) { 11 | $modalInstance.close(); 12 | messageService.addMessage('success', 'The environment variable has been successfully deleted.'); 13 | }, function(err) { 14 | messageService.addMessage('danger', 'The environment variable has not been deleted.'); 15 | $log.error(err); 16 | }); 17 | }; 18 | 19 | $scope.cancel = function() { 20 | $modalInstance.dismiss('cancel'); 21 | }; 22 | }]); -------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvEdit.tpl.html: -------------------------------------------------------------------------------- 1 | 5 |
6 | 21 | 25 |
-------------------------------------------------------------------------------- /src/app/components/application/applicationUserEnvEditCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.application').controller('UserEnvEditCtrl', ['$scope', '$modalInstance', '$log', 'config', 'applicationService', 'messageService', function($scope, $modalInstance, $log, config, applicationService, messageService) { 2 | 3 | $scope.applicationId = config.applicationId; 4 | $scope.userEnvs = config.existingUserEnvs; 5 | $scope.env = config.userEnvToEdit; 6 | 7 | $scope.ok = function() { 8 | // edit user env 9 | $scope.userEnvs[$scope.env.key] = $scope.env.value; 10 | 11 | applicationService.editApplicationEnv($scope.applicationId, $scope.userEnvs).then(function(response) { 12 | $modalInstance.close(); 13 | messageService.addMessage('success', 'The environment variable has been successfully edited.'); 14 | }, function(err) { 15 | messageService.addMessage('danger', 'The environment variable has not been edited.'); 16 | $log.error(err); 17 | }); 18 | }; 19 | 20 | $scope.cancel = function() { 21 | $modalInstance.dismiss('cancel'); 22 | }; 23 | }]); -------------------------------------------------------------------------------- /src/app/components/authentication/auth.js: -------------------------------------------------------------------------------- 1 | angular.module('app.auth', []); -------------------------------------------------------------------------------- /src/app/components/authentication/authInterceptorService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.auth').factory('authInterceptorService', ['$q', '$location', '$injector', '$rootScope', '$log', function($q, $location, $injector, $rootScope, $log) { 2 | var authInterceptorServiceFactory = {}; 3 | 4 | var _request = function(config) { 5 | 6 | config.headers = config.headers || {}; 7 | 8 | var accessToken = localStorage.getItem('accessToken'); 9 | var userName = localStorage.getItem('userName'); 10 | 11 | if (config.headers.Authorization === undefined && accessToken !== null && userName !== null) { 12 | config.headers.Authorization = 'Bearer ' + accessToken; 13 | //config.headers['X-Webui-Authorization'] = 'Bearer ' + accessToken; 14 | } 15 | 16 | var lastTime = localStorage.getItem('lastTime'); 17 | 18 | var timeOut = Date.now() - lastTime; 19 | 20 | if (timeOut < 1800000){ 21 | localStorage.setItem('lastTime', Date.now()); 22 | } 23 | 24 | return config; 25 | }; 26 | 27 | var _responseError = function(rejection) { 28 | 29 | var timeOut = Date.now() - localStorage.getItem('lastTime'); 30 | if ($rootScope.nrOfUnauthorizedRequests === 0 && rejection.status === 401 && (localStorage.getItem('accessToken')!== null)) { 31 | var authService = $injector.get('authService'); 32 | var $route = $injector.get('$route'); 33 | var $location = $injector.get('$location'); 34 | var messageService = $injector.get('messageService'); 35 | $log.error(timeOut); 36 | if(timeOut > 1800000){ 37 | authService.logOut(); 38 | localStorage.setItem('lastTime', 0); 39 | } 40 | 41 | authService.refresh().then(function(response) { 42 | $route.reload(); 43 | }, 44 | function (err) { 45 | authService.logOut(); 46 | $location.path('/login'); 47 | messageService.removeAllMessages(); 48 | if (err.error==='invalid_token'){ 49 | messageService.addMessage('danger', 'Your session has expired. Please, log in again.', true); 50 | }else{ 51 | messageService.addMessage('danger', err.error_description, true); 52 | } 53 | $log.error(err); 54 | }); 55 | } 56 | 57 | 58 | $rootScope.nrOfUnauthorizedRequests++; 59 | 60 | return $q.reject(rejection); 61 | }; 62 | 63 | authInterceptorServiceFactory.request = _request; 64 | authInterceptorServiceFactory.responseError = _responseError; 65 | 66 | return authInterceptorServiceFactory; 67 | }]); -------------------------------------------------------------------------------- /src/app/components/authentication/authService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.auth').factory('authService', ['$http', '$log', '$q', '$injector', '$rootScope', function($http, $log, $q, $injector, $rootScope) { 2 | var authServiceFactory = {}; 3 | var UAA_Endpoint = ""; 4 | 5 | var _authentication = { 6 | isAuth: false, 7 | userName: '' 8 | }; 9 | 10 | $http.get('/info').success(function(response) { 11 | UAA_Endpoint = response.authorization_endpoint; 12 | }); 13 | 14 | var _logIn = function(logInData) { 15 | 16 | var deferred = $q.defer(); 17 | 18 | // data to post 19 | var data = { 20 | 'grant_type': 'password', 21 | 'password': logInData.password, 22 | 'username': logInData.userName, 23 | 'scope': '' 24 | }; 25 | //'response_type': 'token' 26 | 27 | //'client_id': 'cf' 28 | //'redirect_uri': 'https://cf-webui.cfapps.io/#organizations' 29 | 30 | // http headers 31 | var headers = { 32 | 'Accept': 'application/json', 33 | 'Content-Type': 'application/x-www-form-urlencoded', 34 | 'Authorization': 'Basic Y2Y6', 35 | 'X-UAA-Endpoint': UAA_Endpoint 36 | }; 37 | 38 | data = $.param(data); 39 | 40 | $http.post('/oauth', data, { headers: headers }).success(function(response) { 41 | 42 | if (response.access_token !== null) { 43 | // save access token and username in session storage 44 | localStorage.setItem('accessToken', response.access_token); 45 | localStorage.setItem('refreshToken', response.refresh_token); 46 | localStorage.setItem('expiresIn', response.expires_in); 47 | localStorage.setItem('userName', logInData.userName); 48 | localStorage.setItem('lastTime', Date.now()); 49 | 50 | // set data of authentication object 51 | _authentication.isAuth = true; 52 | _authentication.userName = logInData.userName; 53 | 54 | deferred.resolve(response); 55 | } else { 56 | // log in failed 57 | deferred.reject(response); 58 | } 59 | }).error(function(err, status) { 60 | $log.error('Definicion del error'); 61 | $log.error(err); 62 | //_logOut(); 63 | deferred.reject(err); 64 | }); 65 | 66 | //}); 67 | 68 | return deferred.promise; 69 | }; 70 | 71 | var _refresh = function() { 72 | var refreshToken = localStorage.getItem('refreshToken'); 73 | var accessToken = localStorage.getItem('accessToken'); 74 | 75 | var deferred = $q.defer(); 76 | 77 | //$http.get('/info').success(function(response) { 78 | // data to post 79 | var data = { 80 | //'url': UAA_ENDPOINT + '/oauth/token', 81 | //'client_id': 'cf', 82 | 'grant_type': 'refresh_token', 83 | 'refresh_token': refreshToken, 84 | 'scope': '' 85 | }; 86 | 87 | // http headers 88 | var headers = { 89 | 'Accept': 'application/json', 90 | 'Content-Type': 'application/x-www-form-urlencoded', 91 | 'Authorization': 'Basic Y2Y6', 92 | //'X-Webui-Authorization': 'Basic Y2Y6', 93 | 'WWW-Authorization': 'Basic Y2Y6', 94 | 'X-UAA-Endpoint': UAA_Endpoint 95 | 96 | }; 97 | 98 | 99 | data = $.param(data); 100 | 101 | 102 | $http.post('/oauth', data, { headers: headers }).success(function(response) { 103 | if (response.access_token !== null) { 104 | // save access token and username in session storage 105 | localStorage.setItem('accessToken', response.access_token); 106 | localStorage.setItem('refreshToken', response.refresh_token); 107 | 108 | // set data of authentication object 109 | _authentication.isAuth = true; 110 | 111 | deferred.resolve(response); 112 | } else { 113 | // log in failed 114 | deferred.reject(response); 115 | } 116 | }).error(function(err, status) { 117 | _logOut(); 118 | deferred.reject(err); 119 | }); 120 | //}); 121 | 122 | return deferred.promise; 123 | }; 124 | 125 | var _logOut = function() { 126 | // remove access token and username in session storage 127 | localStorage.removeItem('accessToken'); 128 | localStorage.removeItem('refreshToken'); 129 | localStorage.removeItem('userName'); 130 | 131 | // reset authentication object 132 | _authentication.isAuth = false; 133 | _authentication.userName = ''; 134 | }; 135 | 136 | var _fillAuthData = function() { 137 | var accessToken = localStorage.getItem('accessToken'); 138 | var refreshToken = localStorage.getItem('refreshToken'); 139 | var userName = localStorage.getItem('userName'); 140 | 141 | if (accessToken !== null && userName !== null) { 142 | _authentication.isAuth = true; 143 | _authentication.userName = userName; 144 | } 145 | }; 146 | 147 | authServiceFactory.logIn = _logIn; 148 | authServiceFactory.refresh = _refresh; 149 | authServiceFactory.logOut = _logOut; 150 | authServiceFactory.fillAuthData = _fillAuthData; 151 | authServiceFactory.authentication = _authentication; 152 | 153 | return authServiceFactory; 154 | }]); -------------------------------------------------------------------------------- /src/app/components/domain/domain.js: -------------------------------------------------------------------------------- 1 | angular.module('app.domain', []); -------------------------------------------------------------------------------- /src/app/components/domain/domainAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/domain/domainAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.domain').controller('DomainAddCtrl', ['$scope', '$modalInstance', '$log', 'domain', 'domainService', 'messageService', function($scope, $modalInstance, $log, domain, domainService, messageService) { 2 | 3 | $scope.domain = domain; 4 | 5 | $scope.ok = function () { 6 | domainService.addDomain($scope.domain).then(function(response) { 7 | $modalInstance.close(response.data); 8 | messageService.addMessage('success', 'The domain has been successfully added.'); 9 | }, function(err) { 10 | messageService.addMessage('danger', 'The domain has not been added.'); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/domain/domainDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/domain/domainDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.domain').controller('DomainDeleteCtrl', ['$scope', '$modalInstance', '$log', 'domain', 'domainService', 'messageService', function($scope, $modalInstance, $log, domain, domainService, messageService) { 2 | 3 | $scope.domain = domain; 4 | 5 | $scope.ok = function () { 6 | domainService.deleteDomain($scope.domain).then(function(response) { 7 | messageService.addMessage('success', 'The domain has been successfully deleted.'); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The domain has not been deleted.'); 10 | $log.error(err); 11 | }); 12 | 13 | $modalInstance.close($scope.domain); 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/domain/domainService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.domain').factory('domainService', ['$http', function($http) { 2 | var domainServiceFactory = {}; 3 | 4 | var _getSharedDomainsForTheOrganization = function(ignoreLoadingBar) { 5 | if (typeof(ignoreLoadingBar) === 'undefined') ignoreLoadingBar = false; 6 | 7 | // params 8 | var url = '/v2/shared_domains'; 9 | 10 | // http headers 11 | headers = { 12 | 'Accept': 'application/json', 13 | 'Content-Type': 'application/json' 14 | }; 15 | 16 | var config = { 17 | headers: headers, 18 | ignoreLoadingBar: ignoreLoadingBar 19 | }; 20 | 21 | return $http.get(url, config); 22 | }; 23 | 24 | var _getPrivateDomainsForTheOrganization = function(id, ignoreLoadingBar) { 25 | if (typeof(ignoreLoadingBar) === 'undefined') ignoreLoadingBar = false; 26 | 27 | // params 28 | var url = '/v2/organizations/' + id + '/private_domains'; 29 | 30 | // http headers 31 | headers = { 32 | 'Accept': 'application/json', 33 | 'Content-Type': 'application/json' 34 | }; 35 | 36 | var config = { 37 | headers: headers, 38 | ignoreLoadingBar: ignoreLoadingBar 39 | }; 40 | 41 | return $http.get(url, config); 42 | }; 43 | 44 | var _addDomain = function(domain) { 45 | 46 | var url = '/v2/private_domains'; 47 | 48 | // data 49 | var data = { 50 | 'name': domain.name, 51 | 'owning_organization_guid': domain.organizationID 52 | }; 53 | 54 | // http headers 55 | var headers = { 56 | 'Accept': 'application/json', 57 | 'Content-Type': 'application/json' 58 | }; 59 | 60 | var config = { 61 | headers: headers 62 | }; 63 | 64 | return $http.post(url, data, config); 65 | }; 66 | 67 | var _deleteDomain = function(domain) { 68 | 69 | var url = '/v2/private_domains/' + domain.metadata.guid; 70 | 71 | // data 72 | var data = { 73 | 'guid' : domain.metadata.guid, 74 | 'name' : domain.entity.name 75 | }; 76 | 77 | // http headers 78 | var headers = { 79 | 'Accept': 'application/json', 80 | 'Content-Type': 'application/json' 81 | }; 82 | 83 | var config = { 84 | headers: headers, 85 | data: data 86 | }; 87 | 88 | return $http.delete(url, config); 89 | }; 90 | 91 | domainServiceFactory.getPrivateDomainsForTheOrganization =_getPrivateDomainsForTheOrganization; 92 | domainServiceFactory.getSharedDomainsForTheOrganization =_getSharedDomainsForTheOrganization; 93 | domainServiceFactory.addDomain = _addDomain; 94 | domainServiceFactory.deleteDomain = _deleteDomain; 95 | 96 | return domainServiceFactory; 97 | }]); -------------------------------------------------------------------------------- /src/app/components/featureFlag/featureFlag.js: -------------------------------------------------------------------------------- 1 | angular.module('app.featureFlag', []); -------------------------------------------------------------------------------- /src/app/components/featureFlag/featureFlagService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.featureFlag').factory('featureFlagService', ['$http', function($http) { 2 | var featureFlagServiceFactory = {}; 3 | 4 | var _getAllFeatureFlags = function(organization) { 5 | 6 | var url = '/v2/config/feature_flags'; 7 | 8 | // http headers 9 | var headers = { 10 | 'Accept': 'application/json', 11 | 'Content-Type': 'application/json' 12 | }; 13 | 14 | var config = { 15 | headers: headers, 16 | }; 17 | 18 | return $http.get(url, config); 19 | }; 20 | 21 | var _getUserOrgCreationFeatureFlag = function(organization) { 22 | 23 | var url = '/v2/config/feature_flags/user_org_creation'; 24 | 25 | // http headers 26 | var headers = { 27 | 'Accept': 'application/json', 28 | 'Content-Type': 'application/json' 29 | }; 30 | 31 | var config = { 32 | headers: headers 33 | }; 34 | 35 | return $http.get(url, config); 36 | }; 37 | 38 | featureFlagServiceFactory.getAllFeatureFlags = _getAllFeatureFlags; 39 | featureFlagServiceFactory.getUserOrgCreationFeatureFlag = _getUserOrgCreationFeatureFlag; 40 | 41 | 42 | return featureFlagServiceFactory; 43 | }]); -------------------------------------------------------------------------------- /src/app/components/info/info.js: -------------------------------------------------------------------------------- 1 | angular.module('app.info', []); -------------------------------------------------------------------------------- /src/app/components/info/infoService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.info').factory('infoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 | var infoServiceFactory = {}; 3 | 4 | var _getInfo = function() { 5 | 6 | // data 7 | var url = '/v2/info'; 8 | 9 | // http headers 10 | var headers = { 11 | 'Accept': 'application/json', 12 | 'Content-Type': 'application/json' 13 | }; 14 | 15 | var config = { 16 | headers: headers 17 | }; 18 | 19 | return $http.get(url, config); 20 | }; 21 | 22 | infoServiceFactory.getInfo = _getInfo; 23 | 24 | return infoServiceFactory; 25 | }]); -------------------------------------------------------------------------------- /src/app/components/logIn/logIn.js: -------------------------------------------------------------------------------- 1 | angular.module('app.logIn', []); -------------------------------------------------------------------------------- /src/app/components/logIn/logIn.tpl.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

Log In

5 | 6 |
7 |
8 |
9 | 10 |
11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 |
-------------------------------------------------------------------------------- /src/app/components/logIn/logInCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.logIn').controller('LogInCtrl', ['$scope', '$location', '$route', '$log', 'authService', 'messageService', function($scope, $location, $route, $log, authService, messageService) { 2 | $scope.logInData = { 3 | userName: '', 4 | password: '' 5 | }; 6 | //authService.logOut(); 7 | 8 | $scope.logIn = function() { 9 | authService.logOut(); 10 | //messageService.removeAllMessages(); 11 | authService.logIn($scope.logInData).then(function(response) { 12 | $location.path('/'); 13 | }, 14 | function (err) { 15 | messageService.addMessage('danger', err.error_description); 16 | $log.error(err); 17 | }); 18 | }; 19 | 20 | $scope.logOut = function() { 21 | $location.path('/login'); 22 | $route.reload(); 23 | authService.logOut(); 24 | messageService.addMessage('danger', 'Logged out successfully', true); 25 | }; 26 | }]); -------------------------------------------------------------------------------- /src/app/components/marketplace/marketplace.js: -------------------------------------------------------------------------------- 1 | angular.module('app.marketplace', []); -------------------------------------------------------------------------------- /src/app/components/marketplace/marketplaceAddServiceCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.marketplace').controller('marketplaceAddServiceCtrl', ['$q', '$rootScope', '$scope', '$routeParams', '$route', '$location', '$log', 'serviceService', 'serviceBindingService', 'organizationService', 'spaceService', 'serviceInstanceService', 'messageService', function($q, $rootScope, $scope, $routeParams, $route, $location, $log, serviceService, serviceBindingService, organizationService, spaceService, serviceInstanceService, messageService) { 2 | $rootScope.rootFields.showContent = false; 3 | 4 | $scope.organizationId = $routeParams.organizationId; 5 | $scope.spaceId = $routeParams.spaceId; 6 | $scope.applicationId = null; 7 | $scope.services = []; 8 | $scope.selectedService = null; 9 | $scope.organizations = []; 10 | $scope.spaces = []; 11 | $scope.applications = []; 12 | 13 | var getServicesPromise = null; 14 | 15 | if ($scope.organizationId){ 16 | getServicesPromise = spaceService.getServicesForTheSpace($scope.spaceId); 17 | } else{ 18 | getServicesPromise = serviceService.getServices(); 19 | } 20 | 21 | getServicesPromise.then(function(response) { 22 | 23 | angular.forEach(response.data.resources, function(service, i) { 24 | var extraData = JSON.parse(service.entity.extra); 25 | 26 | var objectService = { 27 | id: service.metadata.guid, 28 | //cope with cases where extraData is Null and avoid premature exit 29 | name: (extraData && extraData.displayName) ? extraData.displayName : service.entity.label, 30 | description: service.entity.description, 31 | longDescription: (extraData && extraData.longDescription) ? extraData.longDescription : service.entity.long_description, 32 | provider: (extraData && extraData.providerDisplayName) ? extraData.providerDisplayName : service.entity.provider, 33 | imageUrl: (extraData && extraData.imageUrl) ? extraData.imageUrl : null, 34 | documentationUrl: (extraData && extraData.documentationUrl) ? extraData.documentationUrl : service.entity.documentation_url, 35 | supportUrl: (extraData && extraData.supportUrl) ? extraData.supportUrl : null 36 | }; 37 | 38 | $scope.services.push(objectService); 39 | }); 40 | 41 | }, function(err) { 42 | messageService.addMessage('danger', 'The marketplace services have not been loaded.'); 43 | $log.error(err); 44 | }); 45 | 46 | $scope.selectService = function(selectedService) { 47 | $location.path($location.url()+'/' + selectedService.id); 48 | }; 49 | 50 | $scope.addServiceInstance = function() { 51 | var defer = $q.defer(); 52 | var serviceInstance = { 53 | name: $scope.instanceName, 54 | spaceId: $scope.spaceId, 55 | servicePlanId: $scope.selectedServicePlan.id 56 | }; 57 | }; 58 | 59 | }]); -------------------------------------------------------------------------------- /src/app/components/marketplace/marketplaceAddServiceInstance.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Services Marketplace

13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |

Add a service instance

21 |
22 |
23 |
24 |
25 |
26 | 27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 | 39 |
40 |
41 | 42 |
43 | 44 |
45 | 48 |
49 |
50 | 51 |
52 | 53 |
54 |

{{service.label}}

55 |
56 |
57 | 58 |
59 | 60 |
61 |

{{servicePlan.name}} ({{servicePlan.costs}})

62 |
63 |
64 | 65 |
66 | 67 |
68 | 69 |
70 |
71 | 72 |
73 |
74 | 75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | 85 |
86 |
87 |
-------------------------------------------------------------------------------- /src/app/components/marketplace/marketplaceSelectServicePlan.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Services Marketplace

13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |

Select a service plan

21 |
22 |
23 |
24 |
25 | {{selectedService.name}} 26 |

{{selectedService.name}}

27 |

{{selectedService.description}}

28 |
29 | 30 |
31 |

About this service

32 |

{{selectedService.longDescription}}

33 |

Documentation | Support

34 |
35 | 36 |
37 |

Provider

38 |

{{selectedService.provider}}

39 |
40 |
41 | 42 |
43 | 44 |
45 |
46 | 47 | 48 |

{{servicePlan.description}}

49 |
    50 |
  • {{bullet}}
  • 51 |
52 | 53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
-------------------------------------------------------------------------------- /src/app/components/marketplace/marketplaceSelectServicePlanCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.marketplace').controller('marketplaceSelectServicePlanCtrl', ['$q', '$rootScope', '$scope', '$routeParams', '$route', '$location', '$log', 'serviceService', 'serviceBindingService', 'organizationService', 'spaceService', 'serviceInstanceService', 'messageService', function($q, $rootScope, $scope, $routeParams, $route, $location, $log, serviceService, serviceBindingService, organizationService, spaceService, serviceInstanceService, messageService) { 2 | $rootScope.rootFields.showContent = false; 3 | 4 | $scope.serviceId = $routeParams.serviceId; 5 | 6 | $scope.servicePlans = []; 7 | 8 | 9 | var getServicePlansForTheServicePromise = serviceService.getServicePlansForTheService($scope.serviceId); 10 | 11 | serviceService.getService($scope.serviceId).then(function(response){ 12 | var service = response.data; 13 | //angular.forEach(response.data.resources, function(service, i) { 14 | var extraData = JSON.parse(response.data.entity.extra); 15 | 16 | var objectService = { 17 | id: service.metadata.guid, 18 | //cope with cases where extraData is Null and avoid premature exit 19 | name: (extraData && extraData.displayName) ? extraData.displayName : service.entity.label, 20 | description: service.entity.description, 21 | longDescription: (extraData && extraData.longDescription) ? extraData.longDescription : service.entity.long_description, 22 | provider: (extraData && extraData.providerDisplayName) ? extraData.providerDisplayName : service.entity.provider, 23 | imageUrl: (extraData && extraData.imageUrl) ? extraData.imageUrl : null, 24 | documentationUrl: (extraData && extraData.documentationUrl) ? extraData.documentationUrl : service.entity.documentation_url, 25 | supportUrl: (extraData && extraData.supportUrl) ? extraData.supportUrl : null 26 | }; 27 | 28 | $scope.selectedService=objectService; 29 | //}); 30 | 31 | }, function(err) { 32 | messageService.addMessage('danger', 'The marketplace services have not been loaded.'); 33 | $log.error(err); 34 | }); 35 | 36 | getServicePlansForTheServicePromise.then(function(response) { 37 | 38 | angular.forEach(response.data.resources, function(servicePlan, i) { 39 | var extraData = JSON.parse(servicePlan.entity.extra); 40 | 41 | // get costs 42 | var costs = null; 43 | if (extraData && extraData.costs) { 44 | var unit = extraData.costs[0].unit.replace('LY', ''); 45 | 46 | var currency = null; 47 | var amount = null; 48 | for (i in extraData.costs[0].amount) { 49 | currency = i; 50 | amount = extraData.costs[0].amount[i]; 51 | continue; 52 | } 53 | 54 | if (currency !== null && amount !== null) { 55 | costs = currency.toUpperCase() + ' ' + amount + '/' + unit; 56 | } 57 | } 58 | 59 | var objectServicePlan = { 60 | id: servicePlan.metadata.guid, 61 | name: (extraData && extraData.displayName) ? extraData.displayName : servicePlan.entity.name, 62 | description: servicePlan.entity.description, 63 | bullets: (extraData && extraData.bullets) ? extraData.bullets : null, 64 | costs: (servicePlan.entity.free) ? 'free' : costs 65 | }; 66 | 67 | $scope.servicePlans.push(objectServicePlan); 68 | }); 69 | }, function(err) { 70 | messageService.addMessage('danger', 'The service plans have not been loaded.'); 71 | $log.error(err); 72 | }); 73 | 74 | $scope.selectServicePlan = function(servicePlanId) { 75 | $location.path($location.url() + '/plan/' + servicePlanId); 76 | }; 77 | 78 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organization.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization', []); -------------------------------------------------------------------------------- /src/app/components/organization/organizationAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddAuditor.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddAuditorCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationAddAuditorCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.associateAuditorWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The auditor has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The auditor has not been added.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddBillingManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddBillingManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationAddBillingManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.associateBillingManagerWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The billing manager has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The billing manager has not been added.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationAddCtrl', ['$route', '$scope', '$modalInstance', '$log', 'organization', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, organization, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.addOrganization($scope.organization).then(function(response) { 6 | 7 | $route.reload(); 8 | 9 | // set message 10 | messageService.addMessage('success', 'The organization has been successfully added.', 'true'); 11 | 12 | // close the modal 13 | $modalInstance.close(); 14 | }, function(err) { 15 | // set message 16 | messageService.addMessage('danger', 'The organization has not been added.'); 17 | $log.error(err); 18 | 19 | // close the modal 20 | $modalInstance.close(); 21 | }); 22 | }; 23 | 24 | $scope.cancel = function () { 25 | $modalInstance.dismiss('cancel'); 26 | }; 27 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationAddManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationAddManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.associateManagerWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The manager has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The manager has not been added.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationAssociateUser.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 99 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationAssociateUserCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationAssociateUserCtrl', ['$q', '$route', '$routeParams', '$scope', '$modalInstance', '$log', 'spaces', 'organizationService', 'spaceService', 'messageService', function($q, $route, $routeParams, $scope, $modalInstance, $log, spaces, organizationService, spaceService, messageService) { 2 | 3 | $scope.spaces = spaces; 4 | $scope.spacesLength = spaces.length > 0; 5 | 6 | $scope.user = { 7 | name: '', 8 | orgManager: false, 9 | orgAuditor: false, 10 | billingManager: false, 11 | spaceManager: false, 12 | spaceAuditor: false, 13 | spaceDeveloper: false, 14 | spaceId: '', 15 | organizationId: $routeParams.organizationId 16 | }; 17 | $scope.spacesRoles = []; 18 | 19 | angular.forEach($scope.spaces, function(space, key) { 20 | var objectSpaceRoles = { 21 | spaceName: space.name, 22 | spaceId: space.id, 23 | spaceManager: false, 24 | spaceAuditor: false, 25 | spaceDeveloper: false, 26 | }; 27 | $scope.spacesRoles.push(objectSpaceRoles); 28 | }); 29 | 30 | $scope.ok = function () { 31 | messageService.removeAllMessages(); 32 | organizationService.associateUserWithOrganization($scope.user).then(function(response) { 33 | var promises = []; 34 | promises.push($scope.addOrganizationUser($scope.user)); 35 | promises.push($scope.addSpacesUser($scope.spacesRoles)); 36 | $q.all(promises).then(function(){ 37 | messageService.addMessage('success', 'The user been succesfully added. '); 38 | $modalInstance.close(); 39 | }, function(err){ 40 | messageService.addMessage('danger', 'The user has not been added. ' + err.data.description); 41 | $modalInstance.dismiss(); 42 | $log.error(err); 43 | }); 44 | 45 | }, function(err) { 46 | 47 | messageService.addMessage('danger', 'The user has not been added. ' + err.data.description); 48 | $modalInstance.close(); 49 | $log.error(err); 50 | }); 51 | }; 52 | 53 | $scope.cancel = function () { 54 | $modalInstance.dismiss('cancel'); 55 | }; 56 | 57 | $scope.addSpacesUser = function (spacesUser){ 58 | var promises = []; 59 | angular.forEach(spacesUser, function(spaceUser, key){ 60 | spaceUser.name = $scope.user.name; 61 | if (spaceUser.spaceManager) promises.push(spaceService.associateManagerWithSpace(spaceUser)); 62 | if (spaceUser.spaceAuditor) promises.push(spaceService.associateAuditorWithSpace(spaceUser)); 63 | if (spaceUser.spaceDeveloper) promises.push(spaceService.associateDeveloperWithSpace(spaceUser)); 64 | }); 65 | return $q.all(promises); 66 | }; 67 | $scope.addOrganizationUser = function (organizationUser){ 68 | var promises = []; 69 | if (organizationUser.orgManager) promises.push(organizationService.associateManagerWithOrganization(organizationUser)); 70 | if (organizationUser.orgAuditor) promises.push(organizationService.associateAuditorWithOrganization(organizationUser)); 71 | if (organizationUser.billingManager) promises.push(organizationService.associateBillingManagerWithOrganization(organizationUser)); 72 | return $q.all(promises); 73 | }; 74 | 75 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteAuditor.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteAuditorCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationDeleteAuditorCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.disassociateAuditorWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The auditor has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The auditor has not been deleted.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteBillingManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteBillingManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationDeleteBillingManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.disassociateBillingManagerWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The billing manager has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The billing manager has not been deleted.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationDeleteCtrl', ['$route', '$scope', '$modalInstance', '$log', 'organization', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, organization, organizationService, messageService) { 2 | 3 | $scope.organization = organization; 4 | 5 | $scope.ok = function () { 6 | 7 | organizationService.deleteOrganization($scope.organization, $route.reload()).then(function(response) { 8 | messageService.addMessage('success', 'The organization has been successfully deleted.'); 9 | }, function(err) { 10 | messageService.addMessage('danger', 'The organization has not been deleted.'); 11 | $log.error(err); 12 | }); 13 | 14 | $modalInstance.close($scope.organization); 15 | }; 16 | 17 | $scope.cancel = function () { 18 | $modalInstance.dismiss('cancel'); 19 | }; 20 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationDeleteManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'organizationService', 'messageService', function($route, $scope, $modalInstance, $log, user, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | organizationService.disassociateManagerWithOrganization(user).then(function(response) { 6 | messageService.addMessage('success', 'The manager has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The manager has not been deleted.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteUser.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationDeleteUserCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationDeleteUserCtrl', ['$q', '$route', '$scope', '$modalInstance', '$log', 'user', 'spaces', 'organizationService', 'spaceService', 'messageService', function($q, $route, $scope, $modalInstance, $log, user, spaces, organizationService, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | messageService.removeAllMessages(); 5 | $scope.disassociateSpacesUser(user, spaces).then(function(responseUser){ 6 | $scope.deleteOrganizationUserRoles(user).then(function(response){ 7 | organizationService.disassociateUserWithOrganization(user, $route.reload()).then(function(response) { 8 | messageService.addMessage('success', 'The user has been successfully removed from organization.', true); 9 | $modalInstance.close($scope.organization); 10 | }, function(err) { 11 | messageService.addMessage('danger', 'An error ocurred while removing the user from the organization.', true); 12 | $modalInstance.close($scope.organization); 13 | $log.error(err.data.description); 14 | }); 15 | }, function(err) { 16 | $log.error(err); 17 | messageService.addMessage('danger', 'An error ocurred while removing the user from the organization .', true); 18 | $modalInstance.close($scope.organization); 19 | }); 20 | }, function(err) { 21 | $log.error(err); 22 | messageService.addMessage('danger', 'An error ocurred while removing the user from the spaces.', true); 23 | $modalInstance.close($scope.organization); 24 | }); 25 | }; 26 | 27 | $scope.disassociateSpacesUser = function(user, spaces){ 28 | var promises = []; 29 | angular.forEach(spaces, function(space, i) { 30 | var deferred = $q.defer(); 31 | spaceService.retrieveRolesOfAllUsersForTheSpace(space.id).then(function(responseSpaceUsersRoles){ 32 | var userIsInSpace = false; 33 | angular.forEach(responseSpaceUsersRoles.data.resources, function(spaceUserRoles, j) { 34 | if (spaceUserRoles.metadata.guid===user.id) { 35 | userIsInSpace = true; 36 | var spaceUser = { 37 | id: user.id, 38 | name: user.name, 39 | spaceDeveloper: false, 40 | spaceManager: false, 41 | spaceAuditor: false, 42 | spaceId: space.id, 43 | spaceName: space.name 44 | }; 45 | angular.forEach(spaceUserRoles.entity.space_roles, function(userRole, k) { 46 | if (userRole === 'space_developer'){ 47 | spaceUser.spaceDeveloper = true; 48 | } 49 | if (userRole === 'space_manager'){ 50 | spaceUser.spaceManager = true; 51 | } 52 | if (userRole === 'space_auditor'){ 53 | spaceUser.spaceAuditor = true; 54 | } 55 | }); 56 | $scope.deleteSpaceUserRoles(spaceUser).then(function(){ 57 | deferred.resolve('Space User'); 58 | }); 59 | }else{ 60 | if (!userIsInSpace) deferred.resolve('No Space User'); 61 | } 62 | }); 63 | 64 | }, function(err) { 65 | $log.error(err); 66 | messageService.addMessage('danger', 'The user has not been removed from organization.', true); 67 | }); 68 | promises.push(deferred.promise); 69 | }); 70 | 71 | return $q.all(promises); 72 | 73 | }; 74 | 75 | 76 | $scope.deleteSpaceUserRoles = function (spaceUser) { 77 | var promises = []; 78 | 79 | if (spaceUser.spaceManager){ 80 | promises.push(spaceService.disassociateManagerWithSpace(spaceUser)); 81 | } 82 | if (spaceUser.spaceAuditor){ 83 | promises.push(spaceService.disassociateAuditorWithSpace(spaceUser)); 84 | } 85 | if (spaceUser.spaceDeveloper){ 86 | promises.push(spaceService.disassociateDeveloperWithSpace(spaceUser)); 87 | } 88 | 89 | return $q.all(promises); 90 | }; 91 | 92 | $scope.deleteOrganizationUserRoles = function (organizationUser) { 93 | 94 | var promises = []; 95 | 96 | if (organizationUser.orgManager){ 97 | promises.push(organizationService.disassociateManagerWithOrganization(organizationUser)); 98 | } 99 | if (organizationUser.orgAuditor){ 100 | promises.push(organizationService.disassociateAuditorWithOrganization(organizationUser)); 101 | } 102 | if (organizationUser.billingManager){ 103 | promises.push(organizationService.disassociateBillingManagerWithOrganization(organizationUser)); 104 | } 105 | 106 | return $q.all(promises); 107 | }; 108 | 109 | $scope.cancel = function () { 110 | $modalInstance.dismiss('cancel'); 111 | }; 112 | 113 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationEdit.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/organization/organizationEditCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationEditCtrl', ['$scope', '$route', '$modalInstance', '$log', 'organization', 'organizationService', 'messageService', function($scope, $route, $modalInstance, $log, organization, organizationService, messageService) { 2 | 3 | $scope.organization = organization; 4 | 5 | $scope.ok = function () { 6 | 7 | organizationService.editOrganization($scope.organization).then(function(response) { 8 | messageService.addMessage('success', 'The organization name has been successfully changed.'); 9 | }, function(err) { 10 | messageService.addMessage('danger', 'The organization name has not been changed.'); 11 | $log.error(err.data.description); 12 | }); 13 | 14 | $modalInstance.close($scope.organization); 15 | }; 16 | 17 | $scope.cancel = function () { 18 | $modalInstance.dismiss('cancel'); 19 | }; 20 | }]); -------------------------------------------------------------------------------- /src/app/components/organization/organizationPreview.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Organizations

13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |

Organizations {{nrOfOrganizations}}

21 |   Add a organization 22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 41 | 42 | 43 |
NameStatusAction
{{organization.name}} 35 | {{organization.status}} 36 | 38 | 39 | 40 |
44 |
45 |
46 |
47 | 48 |
49 |
50 | 51 |
-------------------------------------------------------------------------------- /src/app/components/organization/organizationPreviewCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.organization').controller('OrganizationPreviewCtrl', ['$rootScope', '$scope', '$modal', '$log', 'organizationService', 'featureFlagService', function($rootScope, $scope, $modal, $log, organizationService, featureFlagService) { 2 | $rootScope.rootFields.showContent = false; 3 | 4 | // organization info 5 | $scope.showContent = false; 6 | $scope.showOrgCreation = false; 7 | $scope.organizations = []; 8 | $scope.nrOfOrganizations = 0; 9 | 10 | organizationService.getOrganizations().then(function(response) { 11 | var data = response.data; 12 | $scope.nrOfOrganizations = data.total_results; 13 | 14 | // create organization objects 15 | angular.forEach(data.resources, function(organization, i) { 16 | 17 | var objectOrganization = { 18 | id: organization.metadata.guid, 19 | quota_definition_guid: organization.entity.quota_definition_guid, 20 | name: organization.entity.name, 21 | status: organization.entity.status 22 | }; 23 | 24 | $scope.organizations.push(objectOrganization); 25 | }); 26 | }, function (err, status) { 27 | $log.error(err); 28 | }); 29 | 30 | featureFlagService.getUserOrgCreationFeatureFlag().then(function(response) { 31 | $scope.showOrgCreation = response.data.enabled; 32 | }, function(err) { 33 | $log.error(err); 34 | }); 35 | 36 | $scope.addOrganization = function() { 37 | 38 | var organization = { }; 39 | 40 | var modalInstance = $modal.open({ 41 | templateUrl: 'app/components/organization/organizationAdd.tpl.html', 42 | controller: 'OrganizationAddCtrl', 43 | resolve: { 44 | organization: function() { 45 | return organization; 46 | } 47 | } 48 | }); 49 | 50 | modalInstance.result.then(function(addedOrganization) { 51 | 52 | if(addedOrganization !== undefined){ 53 | 54 | var createdOrganization = { 55 | id: addedOrganization.data.resources.metadata.guid, 56 | quota_definition_guid: addedOrganization.data.resources.entity.quota_definition_guid, 57 | name: addedOrganization.data.resources.entity.name, 58 | status: addedOrganization.data.resources.entity.status 59 | }; 60 | 61 | $scope.organizations.push(createdOrganization); 62 | $rootScope.organizations.push(createdOrganization); 63 | } 64 | $scope.nrOfOrganizations += 1; 65 | 66 | }); 67 | }; 68 | 69 | $scope.showOrg = function(orgId, event) { 70 | if (event.ctrlKey==1){ 71 | window.open('#/organizations/' + orgId); 72 | }else{ 73 | window.location = '#/organizations/' + orgId; 74 | } 75 | }; 76 | 77 | $scope.editOrganization = function(org) { 78 | 79 | var organization = { 80 | 'id' : org.id, 81 | 'name' : org.name, 82 | 'quota_definition_guid' : org.quota_definition_guid 83 | }; 84 | 85 | var modalInstance = $modal.open({ 86 | templateUrl: 'app/components/organization/organizationEdit.tpl.html', 87 | controller: 'OrganizationEditCtrl', 88 | resolve: { 89 | organization: function() { 90 | return organization; 91 | } 92 | } 93 | }); 94 | 95 | modalInstance.result.then(function(editedOrganization) { 96 | var orgIdx = $scope.organizations.indexOf(org); 97 | $rootScope.organizations[orgIdx].name = editedOrganization.name; 98 | }); 99 | }; 100 | 101 | $scope.deleteOrganization = function(org) { 102 | 103 | var organization = { 104 | 'id' : org.id, 105 | 'name' : org.name, 106 | 'quota_definition_guid' : org.quota_definition_guid 107 | }; 108 | 109 | var modalInstance = $modal.open({ 110 | templateUrl: 'app/components/organization/organizationDelete.tpl.html', 111 | controller: 'OrganizationDeleteCtrl', 112 | resolve: { 113 | organization: function() { 114 | return organization; 115 | } 116 | } 117 | }); 118 | 119 | modalInstance.result.then(function(response) { 120 | // redirect to organizations overview 121 | window.location = "../#/organizations"; 122 | }); 123 | 124 | }; 125 | 126 | }]); -------------------------------------------------------------------------------- /src/app/components/route/route.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes', []); -------------------------------------------------------------------------------- /src/app/components/route/routeAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/app/components/route/routeAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes').controller('RouteAddCtrl', ['$scope', '$modalInstance', '$log', 'route', 'routeService', 'organizationService', 'messageService', function($scope, $modalInstance, $log, route, routeService, organizationService, messageService) { 2 | 3 | $scope.route = route; 4 | 5 | // domain info 6 | $scope.domains = []; 7 | $scope.nrOfDomains = 0; 8 | $scope.domainId = null; 9 | 10 | // get organization sharedDomains 11 | organizationService.getSharedDomainsForTheOrganization(route.orgId).then(function(response) { 12 | var data = response.data; 13 | $scope.nrOfDomains += 1; 14 | //$scope.sharedDomains = (data.resources); 15 | angular.forEach(data.resources, function(sharedDomain, i){ 16 | var sharedDomainObject = { 17 | id: sharedDomain.metadata.guid, 18 | name: sharedDomain.entity.name 19 | }; 20 | $scope.domains.push(sharedDomainObject); 21 | }); 22 | }, function(err) { 23 | $log.error(err.data.description); 24 | }); 25 | 26 | // get organization privateDomains 27 | organizationService.getPrivateDomainsForTheOrganization(route.orgId).then(function(response) { 28 | var data = response.data; 29 | $scope.nrOfDomains += data.total_results; 30 | //$scope.privateDomains = data.resources; 31 | angular.forEach(data.resources, function(privateDomain, i){ 32 | var privateDomainObject = { 33 | id: privateDomain.metadata.guid, 34 | name: privateDomain.entity.name 35 | }; 36 | $scope.domains.push(privateDomainObject); 37 | }); 38 | }, function(err) { 39 | $log.error(err.data.description); 40 | }); 41 | 42 | $scope.ok = function () { 43 | $scope.route.domainId = $scope.domainId; 44 | routeService.createRoute($scope.route).then(function(response) { 45 | messageService.addMessage('success', 'The route has been successfully added.'); 46 | $modalInstance.close(); 47 | }, function(err) { 48 | messageService.addMessage('danger', 'The route has not been added.'); 49 | $log.error(err); 50 | $modalInstance.dismiss('error'); 51 | }); 52 | }; 53 | 54 | $scope.cancel = function () { 55 | $modalInstance.dismiss('cancel'); 56 | }; 57 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeAssociateWithApp.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/route/routeAssociateWithAppCtrl.js: -------------------------------------------------------------------------------- 1 | // route module depends on domain module 2 | angular.module('app.routes').controller('RouteAssociateWithAppCtrl', ['$scope', '$modalInstance', '$log', 'routeId', 'applications', 'routeService', 'messageService', function($scope, $modalInstance, $log, routeId, applications, routeService, messageService) { 3 | 4 | $scope.routeId = routeId; 5 | $scope.applications = applications; 6 | $scope.applicationId = null; 7 | 8 | $scope.ok = function () { 9 | routeService.associateRouteWithApp($scope.routeId, $scope.application.id).then(function(mapRouteResponse) { 10 | messageService.addMessage('success', 'The route has been successfully mapped.', true); 11 | $modalInstance.close($scope.application); 12 | }, function(err) { 13 | messageService.addMessage('danger', 'The route has not been mapped.', true); 14 | $log.error(err); 15 | $modalInstance.dismiss('cancel'); 16 | }); 17 | 18 | }; 19 | 20 | $scope.cancel = function () { 21 | $modalInstance.dismiss('cancel'); 22 | }; 23 | 24 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/route/routeDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes').controller('RouteDeleteCtrl', ['$scope', '$modalInstance', '$log', 'routeId', 'routeService', 'messageService', function($scope, $modalInstance, $log, routeId, routeService, messageService) { 2 | $scope.ok = function () { 3 | routeService.deleteRoute(routeId).then(function(response) { 4 | messageService.addMessage('success', 'The route has been successfully deleted.'); 5 | $modalInstance.close(routeId); 6 | }, function(err) { 7 | messageService.addMessage('danger', 'The route has not been deleted.'); 8 | $log.error(err); 9 | $modalInstance.dismiss('cancel'); 10 | }); 11 | }; 12 | 13 | $scope.cancel = function () { 14 | $modalInstance.dismiss('cancel'); 15 | }; 16 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeDeleteOrphanedRoutes.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/route/routeDeleteOrphanedRoutesCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes').controller('RouteDeleteOrphanedRoutesCtrl', ['$q', '$scope', '$modalInstance', '$log', 'routes', 'routeService', 'messageService', function($q, $scope, $modalInstance, $log, routes, routeService, messageService) { 2 | 3 | $scope.routes = routes; 4 | $scope.orphanedRoutes = []; 5 | 6 | angular.forEach(routes, function(route, key){ 7 | if (route.apps.length===0) $scope.orphanedRoutes.push(route); 8 | }); 9 | 10 | $scope.ok = function () { 11 | $scope.deleteOrphanedRoutes().then(function(response) { 12 | messageService.addMessage('success', 'The routes have been successfully deleted.'); 13 | $modalInstance.close(); 14 | }, function(err) { 15 | messageService.addMessage('danger', 'The routes have not been deleted.'); 16 | $log.error(err); 17 | $modalInstance.dismiss('cancel'); 18 | }); 19 | }; 20 | 21 | $scope.cancel = function () { 22 | $modalInstance.dismiss('cancel'); 23 | }; 24 | 25 | $scope.deleteOrphanedRoutes = function () { 26 | 27 | var promises = []; 28 | 29 | angular.forEach($scope.orphanedRoutes, function(orphanedRoute, key){ 30 | promises.push(routeService.deleteRoute(orphanedRoute.id)); 31 | }); 32 | 33 | return $q.all(promises); 34 | }; 35 | 36 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeDisassociateFromApp.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/route/routeMap.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 16 | -------------------------------------------------------------------------------- /src/app/components/route/routeMapCtrl.js: -------------------------------------------------------------------------------- 1 | // route module depends on domain module 2 | angular.module('app.routes').controller('RouteMapCtrl', ['$scope', '$modalInstance', '$log', 'route', 'routeService', 'domainService', 'messageService', function($scope, $modalInstance, $log, route, routeService, domainService, messageService) { 3 | 4 | $scope.route = route; 5 | $scope.existingHosts = []; 6 | $scope.domains = []; 7 | 8 | // domain module dependency 9 | domainService.getSharedDomainsForTheOrganization($scope.route.organizationId, true).then(function(sharedDomainResponse) { 10 | angular.forEach(sharedDomainResponse.data.resources, function(sharedDomain, i) { 11 | $scope.domains.push(sharedDomain); 12 | }); 13 | }, function(err) { 14 | $log.error(err); 15 | }); 16 | 17 | // domain module dependency 18 | domainService.getPrivateDomainsForTheOrganization($scope.route.organizationId, true).then(function(privateDomainResponse) { 19 | angular.forEach(privateDomainResponse.data.resources, function(privateDomain, i) { 20 | $scope.domains.push(privateDomain); 21 | }); 22 | }, function(err) { 23 | $log.error(err); 24 | }); 25 | 26 | routeService.getRoutesForApp($scope.route.applicationId, true).then(function(hosts) { 27 | angular.forEach(hosts.data.resources, function(existingHost, i) { 28 | $scope.existingHosts.push(existingHost.entity.host); 29 | }); 30 | }, function(err) { 31 | $log.error(err); 32 | }); 33 | 34 | 35 | $scope.ok = function () { 36 | 37 | var config = { 38 | 'organizationId' : $scope.route.organizationId, 39 | 'applicationId' : $scope.route.applicationId, 40 | 'domainId' : $scope.selectedDomainId, 41 | 'spaceId' : $scope.route.spaceId, 42 | 'host' : $scope.enteredHost 43 | }; 44 | 45 | routeService.mapRoute(config).then(function(mapRouteResponse) { 46 | angular.forEach($scope.domains, function(domain, i) { 47 | if(domain.metadata.guid === config.domainId){ 48 | // inject domain object 49 | var domainInjection = { 50 | guid : domain.metadata.guid, 51 | name : domain.entity.name 52 | }; 53 | mapRouteResponse.domain = domainInjection; 54 | mapRouteResponse.host = config.host; 55 | mapRouteResponse.guid = mapRouteResponse.data.metadata.guid; 56 | } 57 | }); 58 | messageService.addMessage('success', 'The route has been successfully mapped.'); 59 | $modalInstance.close(mapRouteResponse); 60 | }, function(err) { 61 | messageService.addMessage('danger', 'The route has not been mapped.'); 62 | $log.error(err); 63 | }); 64 | 65 | }; 66 | 67 | $scope.cancel = function () { 68 | $modalInstance.dismiss('cancel'); 69 | }; 70 | 71 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes').factory('routeService', ['$http', function($http) { 2 | var routeServiceFactory = {}; 3 | 4 | var globalRouteConfig; 5 | 6 | var _getRoutes = function(spaceId) { 7 | 8 | // params 9 | var url = '/v2/routes'; 10 | var params = { 11 | 'space_guid': spaceId 12 | }; 13 | 14 | // http headers 15 | var headers = { 16 | 'Accept': 'application/json', 17 | 'Content-Type': 'application/json' 18 | }; 19 | 20 | var config = { 21 | headers: headers, 22 | params: params, 23 | }; 24 | 25 | return $http.get(url, config); 26 | }; 27 | 28 | var _getRoutesForTheSpace = function(spaceId) { 29 | 30 | // params 31 | var url = '/v2/spaces/' + spaceId +'/routes'; 32 | 33 | // http headers 34 | var headers = { 35 | 'Accept': 'application/json', 36 | 'Content-Type': 'application/json' 37 | }; 38 | 39 | var config = { 40 | headers: headers 41 | }; 42 | 43 | return $http.get(url, config); 44 | }; 45 | 46 | var _getRoutesForApp = function(id, ignoreLoadingBar) { 47 | if (typeof(ignoreLoadingBar) === 'undefined') ignoreLoadingBar = false; 48 | 49 | // params 50 | var url = '/v2/apps/' + id + '/routes'; 51 | var params = { 52 | 'guid' : id 53 | }; 54 | 55 | // http headers 56 | var headers = { 57 | 'Accept': 'application/json', 58 | 'Content-Type': 'application/json' 59 | }; 60 | 61 | var config = { 62 | headers: headers, 63 | params: params, 64 | ignoreLoadingBar: ignoreLoadingBar 65 | }; 66 | 67 | return $http.get(url, config); 68 | }; 69 | 70 | var _getAppsForRoute = function(id, ignoreLoadingBar) { 71 | if (typeof(ignoreLoadingBar) === 'undefined') ignoreLoadingBar = false; 72 | 73 | var url = '/v2/routes/' + id + '/apps'; 74 | 75 | // http headers 76 | var headers = { 77 | 'Accept': 'application/json', 78 | 'Content-Type': 'application/json' 79 | }; 80 | 81 | var config = { 82 | headers: headers, 83 | ignoreLoadingBar: ignoreLoadingBar 84 | }; 85 | 86 | return $http.get(url, config); 87 | }; 88 | 89 | var _createRoute = function(route) { 90 | 91 | var url = '/v2/routes'; 92 | 93 | // data 94 | var data = { 95 | 'domain_guid': route.domainId, 96 | 'space_guid': route.spaceId, 97 | 'host' : route.host 98 | }; 99 | 100 | // http headers 101 | var headers = { 102 | 'Accept': 'application/json', 103 | 'Content-Type': 'application/json' 104 | }; 105 | 106 | config = { 107 | headers: headers 108 | }; 109 | 110 | return $http.post(url, data, config); 111 | }; 112 | 113 | var _deleteRoute = function(routeId) { 114 | 115 | var url = '/v2/routes/' + routeId + '?recursive=true'; 116 | 117 | // data 118 | var data = { 119 | 'guid': routeId 120 | }; 121 | 122 | // http headers 123 | var headers = { 124 | 'Accept': 'application/json', 125 | 'Content-Type': 'application/json' 126 | }; 127 | 128 | var config = { 129 | headers: headers, 130 | data: data 131 | }; 132 | 133 | return $http.delete(url, config); 134 | }; 135 | 136 | var _mapRoute = function(config) { 137 | 138 | globalRouteConfig = config; 139 | 140 | // First: create route 141 | return this.createRoute(config).then(function(response) { 142 | globalRouteConfig.routeId = response.data.metadata.guid; 143 | 144 | // Second: map route 145 | var url = '/v2/routes/' + globalRouteConfig.routeId + '/apps/' + globalRouteConfig.applicationId; 146 | 147 | // data 148 | var data = { 149 | 'guid': globalRouteConfig.routeId 150 | }; 151 | 152 | // http headers 153 | var headers = { 154 | 'Accept': 'application/json', 155 | 'Content-Type': 'application/json' 156 | }; 157 | 158 | var config = { 159 | headers: headers 160 | }; 161 | 162 | return $http.put(url, data, config); 163 | }); 164 | 165 | }; 166 | 167 | var _unmapRoute = function(route) { 168 | 169 | var url = '/v2/apps/' + route.applicationId + '/routes/' + route.id; 170 | 171 | // data 172 | var data = { 173 | 'guid' : route.applicationId 174 | }; 175 | 176 | // http headers 177 | var headers = { 178 | 'Accept': 'application/json', 179 | 'Content-Type': 'application/json' 180 | }; 181 | 182 | var config = { 183 | headers: headers, 184 | data: data 185 | }; 186 | 187 | return $http.delete(url, config); 188 | }; 189 | 190 | var _associateRouteWithApp = function(routeId, appId) { 191 | 192 | var url = '/v2/routes/' + routeId + '/apps/' + appId; 193 | 194 | // data 195 | var data = { 196 | 'guid': routeId 197 | }; 198 | // http headers 199 | var headers = { 200 | 'Accept': 'application/json', 201 | 'Content-Type': 'application/json' 202 | }; 203 | 204 | var config = { 205 | headers: headers 206 | }; 207 | 208 | return $http.put(url, data, config); 209 | }; 210 | 211 | 212 | routeServiceFactory.getRoutes = _getRoutes; 213 | routeServiceFactory.getRoutesForTheSpace = _getRoutesForTheSpace; 214 | routeServiceFactory.getRoutesForApp = _getRoutesForApp; 215 | routeServiceFactory.getAppsForRoute = _getAppsForRoute; 216 | routeServiceFactory.createRoute = _createRoute; 217 | routeServiceFactory.deleteRoute = _deleteRoute; 218 | routeServiceFactory.mapRoute = _mapRoute; 219 | routeServiceFactory.associateRouteWithApp = _associateRouteWithApp; 220 | routeServiceFactory.unmapRoute = _unmapRoute; 221 | 222 | return routeServiceFactory; 223 | }]); -------------------------------------------------------------------------------- /src/app/components/route/routeUnmap.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/route/routeUnmapCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.routes').controller('RouteUnmapCtrl', ['$scope', '$modalInstance', '$log', 'route', 'routeService', 'messageService', function($scope, $modalInstance, $log, route, routeService, messageService) { 2 | 3 | $scope.route = route; 4 | $scope.application = { 5 | 'id': $scope.route.applicationId 6 | }; 7 | $scope.applications = route.apps; 8 | 9 | $scope.ok = function () { 10 | $scope.route.applicationId = $scope.application.id; 11 | routeService.unmapRoute($scope.route).then(function(response) { 12 | $modalInstance.close(route, $scope.application); 13 | messageService.addMessage('success', 'The route has been successfully unmapped.'); 14 | }, function(err) { 15 | messageService.addMessage('danger', 'The route has not been unmapped.'); 16 | $log.error(err); 17 | }); 18 | }; 19 | 20 | $scope.cancel = function () { 21 | $modalInstance.dismiss('cancel'); 22 | }; 23 | }]); -------------------------------------------------------------------------------- /src/app/components/service/service.js: -------------------------------------------------------------------------------- 1 | angular.module('app.service', []); -------------------------------------------------------------------------------- /src/app/components/service/serviceService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.service').factory('serviceService', ['$http', function($http) { 2 | var serviceServiceFactory = {}; 3 | 4 | var _getServicePlans = function(serviceId) { 5 | // params 6 | var url = '/v2/service_plans'; 7 | 8 | // http headers 9 | var headers = { 10 | 'Accept': 'application/json', 11 | 'Content-Type': 'application/json' 12 | }; 13 | 14 | var config = { 15 | headers: headers 16 | }; 17 | 18 | return $http.get(url, config); 19 | }; 20 | 21 | var _getServicePlansForTheService = function(serviceId) { 22 | // params 23 | var url = '/v2/services/' + serviceId + '/service_plans'; 24 | var params = { 25 | 'inline-relations-depth': 1 26 | }; 27 | 28 | // http headers 29 | var headers = { 30 | 'Accept': 'application/json', 31 | 'Content-Type': 'application/json' 32 | }; 33 | 34 | var config = { 35 | params: params, 36 | headers: headers 37 | }; 38 | 39 | return $http.get(url, config); 40 | }; 41 | 42 | var _getServicePlanForTheService = function(servicePlanId) { 43 | // params 44 | var url = '/v2/service_plans/' + servicePlanId; 45 | var params = { 46 | 'inline-relations-depth': 1 47 | }; 48 | 49 | // http headers 50 | var headers = { 51 | 'Accept': 'application/json', 52 | 'Content-Type': 'application/json' 53 | }; 54 | 55 | var config = { 56 | params: params, 57 | headers: headers 58 | }; 59 | 60 | return $http.get(url, config); 61 | }; 62 | 63 | var _getServices= function(id) { 64 | // params 65 | var url = '/v2/services'; 66 | var params = { 67 | 'inline-relations-depth': 1 68 | }; 69 | 70 | // http headers 71 | var headers = { 72 | 'Accept': 'application/json', 73 | 'Content-Type': 'application/json' 74 | }; 75 | 76 | var config = { 77 | params: params, 78 | headers: headers 79 | }; 80 | 81 | return $http.get(url, config); 82 | }; 83 | 84 | var _getService= function(id) { 85 | // params 86 | var url = '/v2/services/' + id; 87 | var params = { 88 | 'inline-relations-depth': 1 89 | }; 90 | 91 | // http headers 92 | var headers = { 93 | 'Accept': 'application/json', 94 | 'Content-Type': 'application/json' 95 | }; 96 | 97 | var config = { 98 | params: params, 99 | headers: headers 100 | }; 101 | 102 | return $http.get(url, config); 103 | }; 104 | 105 | serviceServiceFactory.getServicePlans = _getServicePlans; 106 | serviceServiceFactory.getServicePlansForTheService = _getServicePlansForTheService; 107 | serviceServiceFactory.getServicePlanForTheService = _getServicePlanForTheService; 108 | serviceServiceFactory.getServices = _getServices; 109 | serviceServiceFactory.getService = _getService; 110 | 111 | 112 | return serviceServiceFactory; 113 | }]); -------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBinding.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceBinding', []); -------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBindingAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 |
6 | 14 | 18 |
-------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBindingAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceBinding').controller('ServiceBindingAddCtrl', ['$scope', '$modalInstance', '$log', 'config', 'serviceBindingService', 'spaceService', 'messageService', function($scope, $modalInstance, $log, config, serviceBindingService, spaceService, messageService) { 2 | 3 | $scope.config = config; 4 | $scope.alreadyBoundServices = $scope.config.alreadyBoundServices; 5 | $scope.applicationId = $scope.config.applicationId; 6 | $scope.services = []; 7 | 8 | // service summary from api 9 | var getSpaceSummaryPromise = spaceService.getSpaceSummary($scope.config.spaceId, true); 10 | getSpaceSummaryPromise.then(function(response) { 11 | 12 | // populate services 13 | if (response.data.services && response.data.services.length > 0) { 14 | angular.forEach(response.data.services, function(service, i) { 15 | var serviceCanBeBound = true; 16 | 17 | angular.forEach($scope.alreadyBoundServices, function(alreadyBoundService, k) { 18 | if (alreadyBoundService.guid === service.guid) { 19 | serviceCanBeBound = false; 20 | } 21 | }); 22 | 23 | if (serviceCanBeBound) { 24 | var objectService = { 25 | id: service.guid, 26 | name: service.name 27 | }; 28 | 29 | $scope.services.push(objectService); 30 | } 31 | }); 32 | } 33 | }, function(err) { 34 | messageService.addMessage('danger', 'The space summary has not been loaded.'); 35 | $log.error(err); 36 | }); 37 | 38 | $scope.ok = function () { 39 | var serviceBinding = { 40 | serviceInstanceId: $scope.selectedServiceId, 41 | applicationId: $scope.applicationId 42 | }; 43 | 44 | serviceBindingService.addServiceBinding(serviceBinding).then(function(response) { 45 | $modalInstance.close(serviceBinding); 46 | messageService.addMessage('success', 'The service has been successfully bound.'); 47 | }, function(err) { 48 | messageService.addMessage('danger', 'The service has not been bound.'); 49 | $log.error(err); 50 | }); 51 | }; 52 | 53 | $scope.cancel = function () { 54 | $modalInstance.dismiss('cancel'); 55 | }; 56 | }]); -------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBindingDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBindingDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceBinding').controller('ServiceBindingDeleteCtrl', ['$scope', '$modalInstance', '$log', 'service', 'serviceBindingService', 'messageService', function($scope, $modalInstance, $log, service, serviceBindingService, messageService) { 2 | 3 | $scope.service = service; 4 | 5 | $scope.ok = function () { 6 | serviceBindingService.deleteServiceBinding($scope.service.serviceBindingId).then(function(response) { 7 | $modalInstance.close($scope.service); 8 | messageService.addMessage('success', 'The service has been successfully unbound.'); 9 | }, function(err) { 10 | messageService.addMessage('danger', 'The service has not been unbound.'); 11 | $log.error(err); 12 | }); 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/serviceBinding/serviceBindingService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceBinding').factory('serviceBindingService', ['$http', function($http) { 2 | var serviceBindingServiceFactory = {}; 3 | 4 | var _addServiceBinding = function(serviceBinding) { 5 | 6 | var url = '/v2/service_bindings'; 7 | 8 | // data 9 | var data = { 10 | 'service_instance_guid': serviceBinding.serviceInstanceId, 11 | 'app_guid': serviceBinding.applicationId 12 | }; 13 | 14 | // http headers 15 | var headers = { 16 | 'Accept': 'application/json', 17 | 'Content-Type': 'application/json' 18 | }; 19 | 20 | var config = { 21 | headers: headers 22 | }; 23 | 24 | return $http.post(url, data, config); 25 | }; 26 | 27 | var _deleteServiceBinding = function(serviceBindingId) { 28 | 29 | var url = '/v2/service_bindings/' + serviceBindingId; 30 | 31 | // http headers 32 | var headers = { 33 | 'Accept': 'application/json', 34 | 'Content-Type': 'application/json' 35 | }; 36 | 37 | var config = { 38 | headers: headers 39 | }; 40 | 41 | return $http.delete(url, config); 42 | }; 43 | 44 | serviceBindingServiceFactory.addServiceBinding = _addServiceBinding; 45 | serviceBindingServiceFactory.deleteServiceBinding = _deleteServiceBinding; 46 | 47 | return serviceBindingServiceFactory; 48 | }]); -------------------------------------------------------------------------------- /src/app/components/serviceInstance/serviceInstance.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceInstance', []); -------------------------------------------------------------------------------- /src/app/components/serviceInstance/serviceInstanceDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/serviceInstance/serviceInstanceDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceInstance').controller('ServiceInstanceDeleteCtrl', ['$scope', '$q', '$modalInstance', '$log', 'serviceInstance', 'serviceInstanceService', 'serviceBindingService', 'messageService', function($scope, $q, $modalInstance, $log, serviceInstance, serviceInstanceService, serviceBindingService, messageService) { 2 | 3 | $scope.serviceInstance = serviceInstance; 4 | $scope.serviceBindings = []; 5 | 6 | serviceInstanceService.getServiceBindingsForServiceInstance(serviceInstance.id, true).then(function(response){ 7 | angular.forEach(response.data.resources, function(serviceBinding, key){ 8 | var objectServiceBinding = { 9 | id: serviceBinding.metadata.guid 10 | }; 11 | $scope.serviceBindings.push(objectServiceBinding); 12 | }); 13 | }); 14 | 15 | $scope.ok = function () { 16 | angular.forEach($scope.serviceBindings, function(serviceBinding, key){ 17 | }); 18 | 19 | $scope.deleteServiceBindings($scope.serviceBindingId).then(function(response) { 20 | serviceInstanceService.deleteServiceInstance($scope.serviceInstance.id).then(function(response) { 21 | messageService.addMessage('success', 'The service instance has been successfully deleted.'); 22 | 23 | $modalInstance.close($scope.serviceInstance); 24 | }, function(err) { 25 | messageService.addMessage('danger', 'The service instance has not been deleted.'); 26 | $log.error(err); 27 | 28 | $modalInstance.dismiss('cancel'); 29 | }); 30 | }, function(err) { 31 | messageService.addMessage('danger', 'The service has not been unbound.'); 32 | $log.error(err); 33 | }); 34 | }; 35 | 36 | $scope.cancel = function () { 37 | $modalInstance.dismiss('cancel'); 38 | }; 39 | 40 | $scope.deleteServiceBindings = function () { 41 | var promises = []; 42 | angular.forEach($scope.serviceBindings, function(serviceBinding, key){ 43 | promises.push(serviceBindingService.deleteServiceBinding(serviceBinding.id)); 44 | }); 45 | return $q.all(promises); 46 | }; 47 | }]); -------------------------------------------------------------------------------- /src/app/components/serviceInstance/serviceInstanceService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.serviceInstance').factory('serviceInstanceService', ['$http', function($http) { 2 | var serviceInstanceServiceFactory = {}; 3 | 4 | var _addServiceInstance = function(serviceInstance) { 5 | 6 | var url = '/v2/service_instances'; 7 | 8 | // data 9 | var data = { 10 | 'name': serviceInstance.name, 11 | 'service_plan_guid': serviceInstance.servicePlanId, 12 | 'space_guid': serviceInstance.spaceId 13 | }; 14 | 15 | // http headers 16 | var headers = { 17 | 'Accept': 'application/json', 18 | 'Content-Type': 'application/json' 19 | }; 20 | 21 | var config = { 22 | headers: headers 23 | }; 24 | 25 | return $http.post(url, data, config); 26 | }; 27 | 28 | var _deleteServiceInstance = function(serviceInstanceId) { 29 | 30 | var url = '/v2/service_instances/' + serviceInstanceId; 31 | 32 | // http headers 33 | var headers = { 34 | 'Accept': 'application/json', 35 | 'Content-Type': 'application/json' 36 | }; 37 | 38 | var config = { 39 | headers: headers 40 | }; 41 | 42 | return $http.delete(url, config); 43 | }; 44 | 45 | var _getServiceBindingsForServiceInstance= function(serviceInstanceId, ignoreLoadingBar) { 46 | if (typeof(ignoreLoadingBar) === 'undefined') ignoreLoadingBar = false; 47 | 48 | // params 49 | var url = '/v2/service_instances/' + serviceInstanceId + '/service_bindings'; 50 | 51 | // http headers 52 | var headers = { 53 | 'Accept': 'application/json', 54 | 'Content-Type': 'application/json' 55 | }; 56 | 57 | var config = { 58 | headers: headers, 59 | ignoreLoadingBar: ignoreLoadingBar 60 | }; 61 | 62 | return $http.get(url, config); 63 | }; 64 | 65 | serviceInstanceServiceFactory.addServiceInstance = _addServiceInstance; 66 | serviceInstanceServiceFactory.deleteServiceInstance = _deleteServiceInstance; 67 | serviceInstanceServiceFactory.getServiceBindingsForServiceInstance = _getServiceBindingsForServiceInstance; 68 | 69 | return serviceInstanceServiceFactory; 70 | }]); -------------------------------------------------------------------------------- /src/app/components/space/space.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space', []); -------------------------------------------------------------------------------- /src/app/components/space/spaceAdd.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/space/spaceAddAuditor.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceAddAuditorCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceAddAuditorCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.associateAuditorWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The auditor has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The auditor has not been added.', true); 10 | $log.error(err); 11 | $modalInstance.close(); 12 | }); 13 | 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceAddCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceAddCtrl', ['$route', '$scope', '$modalInstance', '$log', 'space', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, space, spaceService, messageService) { 2 | 3 | $scope.space = { 4 | organizationId: space.organizationId 5 | }; 6 | 7 | $scope.ok = function () { 8 | messageService.removeAllMessages(); 9 | spaceService.addSpace($scope.space).then(function(response) { 10 | // close the modal 11 | space.name = $scope.space.name; 12 | $scope.addUser(response.data.metadata.guid); 13 | // set message 14 | messageService.addMessage('success', 'The space has been successfully added.',true); 15 | }, function(err) { 16 | // set message 17 | messageService.addMessage('danger', 'The space has not been added.'); 18 | $log.error(err); 19 | 20 | // close the modal 21 | $modalInstance.close(); 22 | }); 23 | }; 24 | 25 | $scope.addUser = function (spaceId) { 26 | var currentUser = { 27 | name: localStorage.getItem('userName'), 28 | spaceId: spaceId 29 | }; 30 | spaceService.associateManagerWithSpace(currentUser).then(function(response) { 31 | spaceService.associateAuditorWithSpace(currentUser).then(function(response) { 32 | spaceService.associateDeveloperWithSpace(currentUser).then(function(response) { 33 | $modalInstance.close(); 34 | }, function(err) { 35 | messageService.addMessage('danger', 'The space developer has not been added.'); 36 | $modalInstance.close(); 37 | $log.error(err); 38 | }); 39 | }, function(err) { 40 | messageService.addMessage('danger', 'The space auditor has not been added.'); 41 | $modalInstance.close(); 42 | $log.error(err); 43 | }); 44 | }, function(err) { 45 | messageService.addMessage('danger', 'The space manager has not been added.'); 46 | $modalInstance.close(); 47 | $log.error(err); 48 | }); 49 | 50 | }; 51 | 52 | $scope.cancel = function () { 53 | $modalInstance.dismiss('cancel'); 54 | }; 55 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceAddDeveloper.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceAddDeveloperCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceAddDeveloperCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.associateDeveloperWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The developer has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The developer has not been added.', true); 10 | $log.error(err); 11 | $modalInstance.close(); 12 | }); 13 | 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceAddManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceAddManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceAddManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.associateManagerWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The manager has been successfully added.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The manager has not been added.', true); 10 | $modalInstance.close(); 11 | $log.error(err); 12 | }); 13 | 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceAssociateUser.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 99 | -------------------------------------------------------------------------------- /src/app/components/space/spaceAssociateUserCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceAssociateUserCtrl', ['$q','$route', '$routeParams', '$scope', '$modalInstance', '$log', 'users', 'spaceService', 'organizationService', 'messageService', function($q, $route, $routeParams, $scope, $modalInstance, $log, users, spaceService, organizationService, messageService) { 2 | $scope.users = users; 3 | $scope.usersLength = users.length > 0; 4 | 5 | $scope.newUser = { 6 | name: '', 7 | spaceManager: false, 8 | spaceAuditor: false, 9 | spaceDeveloper: false, 10 | spaceId: $routeParams.spaceId, 11 | organizationId: $routeParams.organizationId 12 | 13 | }; 14 | 15 | $scope.addSpaceRoles = function (spaceUsers) { 16 | var promises = []; 17 | 18 | angular.forEach(spaceUsers, function(user, key) { 19 | 20 | if (user.spaceManager){ 21 | promises.push(spaceService.associateManagerWithSpace(user)); 22 | } 23 | if (user.spaceAuditor){ 24 | promises.push(spaceService.associateAuditorWithSpace(user)); 25 | } 26 | if (user.spaceDeveloper){ 27 | promises.push(spaceService.associateDeveloperWithSpace(user)); 28 | } 29 | 30 | }); 31 | 32 | return $q.all(promises); 33 | 34 | }; 35 | 36 | $scope.ok = function () { 37 | if ($scope.newUser.name!=="") $scope.users.push($scope.newUser); 38 | messageService.removeAllMessages(); 39 | $scope.addSpaceRoles($scope.users).then(function(){ 40 | messageService.addMessage('success', 'The space user has been successfully added.'); 41 | $modalInstance.close(); 42 | }, function(err){ 43 | messageService.addMessage('danger', 'The space user has not been added.'); 44 | $modalInstance.dismiss('cancel'); 45 | }); 46 | }; 47 | 48 | $scope.cancel = function () { 49 | $modalInstance.dismiss('cancel'); 50 | }; 51 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteAuditor.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteAuditorCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceDeleteAuditorCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.disassociateAuditorWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The auditor has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The auditor has not been deleted.', true); 10 | $log.error(err); 11 | $modalInstance.close(); 12 | }); 13 | 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceDeleteCtrl', ['$q', '$route', '$scope', '$modalInstance', '$log', 'space', 'spaceService', 'applicationService', 'serviceBindingService', 'serviceInstanceService', 'routeService', 'messageService', function($q, $route, $scope, $modalInstance, $log, space, spaceService, applicationService, serviceBindingService, serviceInstanceService, routeService, messageService) { 2 | 3 | $scope.space = space; 4 | 5 | 6 | $scope.ok = function () { 7 | spaceService.deleteSpace($scope.space).then(function(response) { 8 | messageService.addMessage('success', 'The space has been successfully deleted.'); 9 | $modalInstance.close($scope.space); 10 | }, function(err) { 11 | messageService.addMessage('danger', 'The space has not been deleted.'); 12 | $log.error(err.data.description); 13 | $modalInstance.close($scope.space); 14 | }); 15 | }; 16 | 17 | 18 | $scope.cancel = function () { 19 | $modalInstance.dismiss('cancel'); 20 | }; 21 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteDeveloper.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteDeveloperCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceDeleteDeveloperCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.disassociateDeveloperWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The developer has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The developer has not been deleted.', true); 10 | $log.error(err); 11 | $modalInstance.close(); 12 | }); 13 | 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteManager.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceDeleteManagerCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceDeleteManagerCtrl', ['$route', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'messageService', function($route, $scope, $modalInstance, $log, user, spaceService, messageService) { 2 | 3 | $scope.ok = function () { 4 | 5 | spaceService.disassociateManagerWithSpace(user).then(function(response) { 6 | messageService.addMessage('success', 'The manager has been successfully deleted.', true); 7 | $modalInstance.close(); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The manager has not been deleted.', true); 10 | $log.error(err); 11 | }); 12 | 13 | }; 14 | 15 | $scope.cancel = function () { 16 | $modalInstance.dismiss('cancel'); 17 | }; 18 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceDisassociateUser.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/space/spaceDisassociateUserCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceDisassociateUserCtrl', ['$route', '$routeParams', '$scope', '$modalInstance', '$log', 'user', 'spaceService', 'organizationService', 'messageService', function($route, $routeParams, $scope, $modalInstance, $log, user, spaceService, organizationService, messageService) { 2 | 3 | $scope.ok = function () { 4 | messageService.removeAllMessages(); 5 | 6 | if (user.spaceManager){ 7 | spaceService.disassociateManagerWithSpace(user).then(function(response) { 8 | // set message 9 | messageService.addMessage('success', 'The space manager has been successfully deleted.', true); 10 | // close the modal 11 | $modalInstance.close(); 12 | }, function(err) { 13 | // set message 14 | messageService.addMessage('danger', 'The space manager has not been deleted.', true); 15 | $log.error(err); 16 | $modalInstance.close(); 17 | }); 18 | } 19 | 20 | if (user.spaceAuditor){ 21 | spaceService.disassociateAuditorWithSpace(user).then(function(response) { 22 | // set message 23 | messageService.addMessage('success', 'The space auditor has been successfully deleted.', true); 24 | $modalInstance.close(); 25 | }, function(err) { 26 | // set message 27 | messageService.addMessage('danger', 'The space auditor has not been deleted.', true); 28 | $log.error(err); 29 | $modalInstance.close(); 30 | }); 31 | } 32 | 33 | if (user.spaceDeveloper){ 34 | spaceService.disassociateDeveloperWithSpace(user).then(function(response) { 35 | // set message 36 | messageService.addMessage('success', 'The space developer has been successfully deleted.', true); 37 | $modalInstance.close(); 38 | }, function(err) { 39 | // set message 40 | messageService.addMessage('danger', 'The space developer has not been deleted.', true); 41 | $log.error(err); 42 | $modalInstance.close(); 43 | }); 44 | } 45 | 46 | }; 47 | 48 | $scope.cancel = function () { 49 | $modalInstance.dismiss('cancel'); 50 | }; 51 | }]); -------------------------------------------------------------------------------- /src/app/components/space/spaceEdit.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 15 | -------------------------------------------------------------------------------- /src/app/components/space/spaceEditCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.space').controller('SpaceEditCtrl', ['$scope', '$route', '$modalInstance', '$log', 'space', 'spaceService', 'messageService', function($scope, $route, $modalInstance, $log, space, spaceService, messageService) { 2 | 3 | $scope.space = space; 4 | 5 | $scope.ok = function () { 6 | spaceService.editSpace($scope.space).then(function(response) { 7 | messageService.addMessage('success', 'The space has been successfully changed.'); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The space has not been changed.'); 10 | $log.error(err); 11 | }); 12 | 13 | $modalInstance.close($scope.space); 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/user/user.js: -------------------------------------------------------------------------------- 1 | angular.module('app.user', []); -------------------------------------------------------------------------------- /src/app/components/user/userDelete.tpl.html: -------------------------------------------------------------------------------- 1 | 5 | 8 | -------------------------------------------------------------------------------- /src/app/components/user/userDeleteCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.user').controller('UserDeleteCtrl', ['$scope', '$modalInstance', '$log', 'user', 'userService', 'messageService', function($scope, $modalInstance, $log, user, userService, messageService) { 2 | 3 | $scope.user = user; 4 | 5 | $scope.ok = function () { 6 | userService.deleteUser($scope.user).then(function(response) { 7 | messageService.addMessage('success', 'The user has been successfully deleted.'); 8 | }, function(err) { 9 | messageService.addMessage('danger', 'The user has not been deleted.'); 10 | $log.error(err); 11 | }); 12 | 13 | $modalInstance.close($scope.user); 14 | }; 15 | 16 | $scope.cancel = function () { 17 | $modalInstance.dismiss('cancel'); 18 | }; 19 | }]); -------------------------------------------------------------------------------- /src/app/components/user/userService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.user').factory('userService', ['$http', function($http) { 2 | var userServiceFactory = {}; 3 | 4 | var _getUserSummary = function(id) { 5 | 6 | var url = '/v2/users/' + id; 7 | 8 | // http headers 9 | var headers = { 10 | 'Accept': 'application/json', 11 | 'Content-Type': 'application/json' 12 | }; 13 | 14 | var config = { 15 | headers: headers 16 | }; 17 | 18 | return $http.get(url, config); 19 | }; 20 | 21 | var _deleteUser = function(user) { 22 | 23 | var url = '/v2/users/' + user.metadata.guid; 24 | 25 | // data 26 | var data = { 27 | 'guid' : user.metadata.guid, 28 | 'async' : false 29 | }; 30 | 31 | // http headers 32 | var headers = { 33 | 'Accept': 'application/json', 34 | 'Content-Type': 'application/json' 35 | }; 36 | 37 | var config = { 38 | headers: headers, 39 | data: data 40 | }; 41 | 42 | return $http.delete(url, config); 43 | }; 44 | 45 | userServiceFactory.getUserSummary = _getUserSummary; 46 | userServiceFactory.deleteUser = _deleteUser; 47 | 48 | return userServiceFactory; 49 | }]); -------------------------------------------------------------------------------- /src/app/shared/breadcrumb/breadcrumb.js: -------------------------------------------------------------------------------- 1 | angular.module('app.breadcrumb', []); -------------------------------------------------------------------------------- /src/app/shared/breadcrumb/breadcrumb.tpl.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/shared/breadcrumb/breadcrumbCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.breadcrumb').controller('BreadcrumbCtrl', ['$rootScope', '$scope', '$location', '$log', 'organizationService', 'spaceService', 'applicationService', 'serviceService', function ($rootScope, $scope, $location, $log, organizationService, spaceService, applicationService, serviceService) { 2 | $rootScope.rootFields.showContent = false; 3 | 4 | $scope.elements = []; 5 | 6 | var organizationPath = ''; 7 | var spacePath = ''; 8 | var servicePath = ''; 9 | 10 | // get all spaces 11 | var getSpacesPromise = spaceService.getSpaces(); 12 | 13 | // get all applications 14 | var getApplicationsPromise = applicationService.getApplications(); 15 | 16 | // get all services 17 | var getServicesPromise = serviceService.getServices(); 18 | 19 | // get all plans for the services 20 | var getServicePlansPromise = serviceService.getServicePlans(); 21 | 22 | 23 | // get all organizations 24 | organizationService.getOrganizations().then(function(response) { 25 | $scope.elements.push( 26 | { 27 | link: '#/', 28 | name: 'Home' 29 | } 30 | ); 31 | 32 | var data = response.data; 33 | 34 | // create organization objects 35 | angular.forEach(data.resources, function(organization, i) { 36 | if ($location.path().indexOf('/organizations/' + organization.metadata.guid) > -1) { 37 | var objectOrganization = { 38 | link: '#/organizations/' + organization.metadata.guid, 39 | name: organization.entity.name 40 | }; 41 | 42 | $scope.elements.push(objectOrganization); 43 | organizationPath = '/organizations/' + organization.metadata.guid; 44 | } 45 | }); 46 | 47 | // push the space to the breadcrumb 48 | getSpacesPromise.then(function(response) { 49 | data = response.data; 50 | 51 | angular.forEach(data.resources, function(space, i) { 52 | if ($location.path().indexOf(organizationPath + '/spaces/' + space.metadata.guid) > -1) { 53 | var objectSpace = { 54 | link: '#' + organizationPath + '/spaces/' + space.metadata.guid, 55 | name: space.entity.name 56 | }; 57 | 58 | $scope.elements.push(objectSpace); 59 | spacePath = organizationPath + '/spaces/' + space.metadata.guid; 60 | } 61 | }); 62 | 63 | // push the application to the breadcrumb 64 | getApplicationsPromise.then(function(response) { 65 | data = response.data; 66 | 67 | angular.forEach(data.resources, function(application, i) { 68 | if ($location.path().indexOf(spacePath + '/applications/' + application.metadata.guid) > -1) { 69 | var objectApplication = { 70 | link: '#' + spacePath + '/applications/' + application.metadata.guid, 71 | name: application.entity.name 72 | }; 73 | 74 | $scope.elements.push(objectApplication); 75 | } 76 | }); 77 | }); 78 | 79 | 80 | }, function (err) { 81 | $log.error(err); 82 | }); 83 | 84 | 85 | 86 | // push the services to the breadcrumb 87 | getServicesPromise.then(function(response) { 88 | data = response.data; 89 | // push the marketplace to the breadcrumb 90 | if ($location.path().indexOf('/marketplace') > -1) { 91 | var objectOrganization = { 92 | link: '#/marketplace', 93 | name: 'Marketplace' 94 | }; 95 | 96 | $scope.elements.push(objectOrganization); 97 | } 98 | 99 | angular.forEach(data.resources, function(service, i) { 100 | var extraData = JSON.parse(service.entity.extra); 101 | if ($location.path().indexOf(spacePath + '/marketplace/' + service.metadata.guid) > -1) { 102 | var objectService = { 103 | link: '#/marketplace/' + service.metadata.guid, 104 | name: (extraData && extraData.displayName) ? extraData.displayName : service.entity.label 105 | }; 106 | 107 | $scope.elements.push(objectService); 108 | servicePath = '/marketplace/' + service.metadata.guid; 109 | } 110 | }); 111 | 112 | // push the service plans to the breadcrumb 113 | getServicePlansPromise.then(function(response) { 114 | data = response.data; 115 | 116 | angular.forEach(data.resources, function(servicePlan, i) { 117 | if ($location.path().indexOf(servicePath + '/plan/' + servicePlan.metadata.guid) > -1) { 118 | var objectServicePlan = { 119 | link: '#' + servicePath + '/plan/' + servicePlan.metadata.guid, 120 | name: servicePlan.entity.name 121 | }; 122 | 123 | $scope.elements.push(objectServicePlan); 124 | } 125 | }); 126 | }); 127 | 128 | }); 129 | 130 | }, function (err) { 131 | $log.error(err); 132 | }); 133 | 134 | }]); -------------------------------------------------------------------------------- /src/app/shared/breadcrumb/breadcrumbDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.breadcrumb').directive('breadcrumb', [function() { 2 | return { 3 | restrict: 'E', 4 | templateUrl: 'app/shared/breadcrumb/breadcrumb.tpl.html' 5 | }; 6 | }]); -------------------------------------------------------------------------------- /src/app/shared/message/message.js: -------------------------------------------------------------------------------- 1 | angular.module('app.message', []); -------------------------------------------------------------------------------- /src/app/shared/message/messageCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.message').controller('MessagesCtrl', ['$rootScope', '$scope', '$location', 'messageService', function($rootScope, $scope, $location, messageService) { 2 | $scope.messages = messageService.messages; 3 | 4 | console.log($location.path()); 5 | if($location.path() !== '/login') messageService.removeAllMessages(); 6 | console.log(messageService.messages); 7 | console.log($rootScope.rootFields.showContent); 8 | 9 | $scope.closeMessage = function(index) { 10 | $scope.messages.splice(index, 1); 11 | }; 12 | 13 | }]); -------------------------------------------------------------------------------- /src/app/shared/message/messageDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.message').directive('messages', [function() { 2 | return { 3 | restrict: 'E', 4 | templateUrl: 'app/shared/message/messages.tpl.html' 5 | }; 6 | }]); -------------------------------------------------------------------------------- /src/app/shared/message/messageService.js: -------------------------------------------------------------------------------- 1 | angular.module('app.message').factory('messageService', ['$rootScope', function($rootScope) { 2 | var messageServiceFactory = {}; 3 | 4 | var _messages = []; 5 | 6 | var _addMessage = function(type, msg, avoidDelete) { 7 | console.log('Avoid delete: ' + avoidDelete); 8 | if (avoidDelete !== true) _removeAllMessages(); 9 | var message = { 10 | type: type, 11 | msg: msg 12 | }; 13 | console.log(message); 14 | _messages.push(message); 15 | }; 16 | 17 | var _removeAllMessages = function(messageObject) { 18 | if (_messages.length > 0){ 19 | _messages.length = 0; 20 | } 21 | console.log('Remove all'); 22 | }; 23 | 24 | var _removeMessage = function(messageObject) { 25 | var index = _messages.indexOf(messageObject); 26 | _messages.splice(index, 1); 27 | console.log('Remove one'); 28 | }; 29 | 30 | messageServiceFactory.messages = _messages; 31 | messageServiceFactory.addMessage = _addMessage; 32 | messageServiceFactory.removeMessage = _removeMessage; 33 | messageServiceFactory.removeAllMessages = _removeAllMessages; 34 | 35 | return messageServiceFactory; 36 | }]); -------------------------------------------------------------------------------- /src/app/shared/message/messages.tpl.html: -------------------------------------------------------------------------------- 1 |
2 | {{message.msg}} 3 |
-------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebar.js: -------------------------------------------------------------------------------- 1 | angular.module('app.sidebar', []); -------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebar.tpl.html: -------------------------------------------------------------------------------- 1 |
2 | 15 |
-------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebarCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('app.sidebar').controller('SidebarCtrl', ['$rootScope', '$scope', '$routeParams', '$location', '$log', 'organizationService', 'spaceService', function ($rootScope, $scope, $routeParams, $location, $log, organizationService, spaceService) { 2 | $rootScope.rootFields.showContent = false; 3 | 4 | $rootScope.organizationsSidebar = []; 5 | 6 | $rootScope.orgIdx = -1; 7 | 8 | // get all spaces 9 | var getSpacesPromise = spaceService.getSpaces(); 10 | 11 | // get all organizations 12 | organizationService.getOrganizations().then(function(response) { 13 | var data = response.data; 14 | 15 | // create organization objects 16 | angular.forEach(data.resources, function(organization, i) { 17 | var objectOrganization = { 18 | id: organization.metadata.guid, 19 | name: organization.entity.name, 20 | spaces: [] 21 | }; 22 | 23 | $rootScope.organizationsSidebar.push(objectOrganization); 24 | }); 25 | 26 | // push the space objects to the organizations 27 | spaceService.getSpaces().then(function(response) { 28 | var data = response.data; 29 | 30 | // create space objects 31 | angular.forEach(data.resources, function(space, i) { 32 | var objectSpace = { 33 | id: space.metadata.guid, 34 | organizationId: space.entity.organization_guid, 35 | name: space.entity.name 36 | }; 37 | 38 | for (var j = 0; j < $rootScope.organizationsSidebar.length; j++) { 39 | if ($rootScope.organizationsSidebar[j].id === objectSpace.organizationId) { 40 | $rootScope.organizationsSidebar[j].spaces.push(objectSpace); 41 | break; 42 | } 43 | } 44 | }); 45 | }, function (err) { 46 | $log.error(err); 47 | }); 48 | }, function (err) { 49 | $log.error(err); 50 | }); 51 | 52 | $scope.isActive = function(path) { 53 | for (var j = 0; j < $rootScope.organizationsSidebar.length; j++) { 54 | if ($rootScope.organizationsSidebar[j].id === $routeParams.organizationId) { 55 | $rootScope.orgIdx = j; 56 | for (var i = 0; i < $rootScope.organizationsSidebar[j].spaces.length; i++) { 57 | if ($rootScope.organizationsSidebar[j].spaces[i].id === $routeParams.spaceId) { 58 | $rootScope.spaceIdx = i; 59 | break; 60 | } 61 | } 62 | break; 63 | } 64 | } 65 | return ($location.path().indexOf(path) > -1); 66 | }; 67 | 68 | }]); -------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebarDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.sidebar').directive('sidebar', ['$rootScope', function($rootScope) { 2 | return { 3 | restrict: 'E', 4 | templateUrl: 'app/shared/sidebar/sidebar.tpl.html' 5 | }; 6 | }]); -------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebarToggleSidebarDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.sidebar').directive('toggleSidebar', ['$rootScope', function($rootScope) { 2 | return { 3 | restrict: 'A', 4 | link: function (scope, element, attrs) { 5 | $(element).click(function(e) { 6 | e.preventDefault(); 7 | 8 | // hide sidebar 9 | if ($('#page-sidebar').is(':visible') && !$rootScope.rootFields.hidedSidebar) { 10 | $('#sidebar-minimize span').removeClass('fa-dedent').addClass('fa-indent'); 11 | 12 | $('#page-sidebar').animate({'width': 0}, 400, function() { 13 | $('#page-sidebar').hide(); 14 | }); 15 | $('#page-content').animate({'marginLeft': 0}, 400); 16 | $rootScope.rootFields.hidedSidebar = true; 17 | $rootScope.rootFields.marginSidebar = "0px"; 18 | localStorage.setItem('marginSidebar', "0px"); 19 | 20 | // show sidebar 21 | } else { 22 | $('#sidebar-minimize span').removeClass('fa-indent').addClass('fa-dedent'); 23 | 24 | $('#page-sidebar').show(); 25 | $('#page-sidebar').animate({'width': '220px'}, 400); 26 | $('#page-content').animate({'marginLeft': '220px'}, 400); 27 | $rootScope.rootFields.marginSidebar = "220px"; 28 | localStorage.setItem('marginSidebar', "220px"); 29 | $rootScope.rootFields.hidedSidebar = false; 30 | } 31 | }); 32 | } 33 | }; 34 | }]); -------------------------------------------------------------------------------- /src/app/shared/sidebar/sidebarToggleSubnaviDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.sidebar').directive('toggleSubnavi', [function() { 2 | return { 3 | restrict: 'A', 4 | link: function (scope, element, attrs) { 5 | $(element).click(function(e) { 6 | e.preventDefault(); 7 | 8 | var subNavi = $(element).next(); 9 | if (subNavi.is(':visible')) { 10 | subNavi.slideUp(); 11 | } else { 12 | subNavi.slideDown(); 13 | } 14 | }); 15 | } 16 | }; 17 | }]); -------------------------------------------------------------------------------- /src/app/shared/topbar/topbar.js: -------------------------------------------------------------------------------- 1 | angular.module('app.topbar', []); -------------------------------------------------------------------------------- /src/app/shared/topbar/topbar.tpl.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • 3 | 4 |
  • 5 |
  • 6 | 7 | 10 |
  • 11 |
-------------------------------------------------------------------------------- /src/app/shared/topbar/topbarDirective.js: -------------------------------------------------------------------------------- 1 | angular.module('app.topbar').directive('topbar', [function() { 2 | return { 3 | restrict: 'E', 4 | templateUrl: 'app/shared/topbar/topbar.tpl.html' 5 | }; 6 | }]); -------------------------------------------------------------------------------- /src/assets/css/bootstrap-overrides.css: -------------------------------------------------------------------------------- 1 | .row{margin:0}.row [class^=col-xs-],.row [class^=col-sm-],.row [class^=col-md-],.row [class^=col-lg-]{min-height:1px;padding-left:10px;padding-right:10px}.panel{-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,.2);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.2);box-shadow:0 1px 1px 0 rgba(0,0,0,.2);border:0} -------------------------------------------------------------------------------- /src/assets/css/loading-bar.css: -------------------------------------------------------------------------------- 1 | 2 | /* Make clicks pass-through */ 3 | #loading-bar, 4 | #loading-bar-spinner { 5 | pointer-events: none; 6 | -webkit-pointer-events: none; 7 | -webkit-transition: 350ms linear all; 8 | -moz-transition: 350ms linear all; 9 | -o-transition: 350ms linear all; 10 | transition: 350ms linear all; 11 | } 12 | 13 | #loading-bar.ng-enter, 14 | #loading-bar.ng-leave.ng-leave-active, 15 | #loading-bar-spinner.ng-enter, 16 | #loading-bar-spinner.ng-leave.ng-leave-active { 17 | opacity: 0; 18 | } 19 | 20 | #loading-bar.ng-enter.ng-enter-active, 21 | #loading-bar.ng-leave, 22 | #loading-bar-spinner.ng-enter.ng-enter-active, 23 | #loading-bar-spinner.ng-leave { 24 | opacity: 1; 25 | } 26 | 27 | #loading-bar .bar { 28 | -webkit-transition: width 350ms; 29 | -moz-transition: width 350ms; 30 | -o-transition: width 350ms; 31 | transition: width 350ms; 32 | 33 | background: #29d; 34 | position: fixed; 35 | z-index: 10002; 36 | top: 0; 37 | left: 0; 38 | width: 100%; 39 | height: 2px; 40 | border-bottom-right-radius: 1px; 41 | border-top-right-radius: 1px; 42 | } 43 | 44 | /* Fancy blur effect */ 45 | #loading-bar .peg { 46 | position: absolute; 47 | width: 70px; 48 | right: 0; 49 | top: 0; 50 | height: 2px; 51 | opacity: .45; 52 | -moz-box-shadow: #29d 1px 0 6px 1px; 53 | -ms-box-shadow: #29d 1px 0 6px 1px; 54 | -webkit-box-shadow: #29d 1px 0 6px 1px; 55 | box-shadow: #29d 1px 0 6px 1px; 56 | -moz-border-radius: 100%; 57 | -webkit-border-radius: 100%; 58 | border-radius: 100%; 59 | } 60 | 61 | #loading-bar-spinner { 62 | display: block; 63 | position: fixed; 64 | z-index: 10002; 65 | top: 10px; 66 | left: 10px; 67 | } 68 | 69 | #loading-bar-spinner .spinner-icon { 70 | width: 14px; 71 | height: 14px; 72 | 73 | border: solid 2px transparent; 74 | border-top-color: #29d; 75 | border-left-color: #29d; 76 | border-radius: 50%; 77 | 78 | -webkit-animation: loading-bar-spinner 400ms linear infinite; 79 | -moz-animation: loading-bar-spinner 400ms linear infinite; 80 | -ms-animation: loading-bar-spinner 400ms linear infinite; 81 | -o-animation: loading-bar-spinner 400ms linear infinite; 82 | animation: loading-bar-spinner 400ms linear infinite; 83 | } 84 | 85 | @-webkit-keyframes loading-bar-spinner { 86 | 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 87 | 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } 88 | } 89 | @-moz-keyframes loading-bar-spinner { 90 | 0% { -moz-transform: rotate(0deg); transform: rotate(0deg); } 91 | 100% { -moz-transform: rotate(360deg); transform: rotate(360deg); } 92 | } 93 | @-o-keyframes loading-bar-spinner { 94 | 0% { -o-transform: rotate(0deg); transform: rotate(0deg); } 95 | 100% { -o-transform: rotate(360deg); transform: rotate(360deg); } 96 | } 97 | @-ms-keyframes loading-bar-spinner { 98 | 0% { -ms-transform: rotate(0deg); transform: rotate(0deg); } 99 | 100% { -ms-transform: rotate(360deg); transform: rotate(360deg); } 100 | } 101 | @keyframes loading-bar-spinner { 102 | 0% { transform: rotate(0deg); } 103 | 100% { transform: rotate(360deg); } 104 | } 105 | -------------------------------------------------------------------------------- /src/assets/css/loading-bar.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * angular-loading-bar v0.6.0 3 | * https://chieffancypants.github.io/angular-loading-bar 4 | * Copyright (c) 2014 Wes Cruver 5 | * License: MIT 6 | */ 7 | 8 | #loading-bar,#loading-bar-spinner{pointer-events:none;-webkit-pointer-events:none;-webkit-transition:350ms linear all;-moz-transition:350ms linear all;-o-transition:350ms linear all;transition:350ms linear all}#loading-bar.ng-enter,#loading-bar.ng-leave.ng-leave-active,#loading-bar-spinner.ng-enter,#loading-bar-spinner.ng-leave.ng-leave-active{opacity:0}#loading-bar.ng-enter.ng-enter-active,#loading-bar.ng-leave,#loading-bar-spinner.ng-enter.ng-enter-active,#loading-bar-spinner.ng-leave{opacity:1}#loading-bar .bar{-webkit-transition:width 350ms;-moz-transition:width 350ms;-o-transition:width 350ms;transition:width 350ms;background:#29d;position:fixed;z-index:10002;top:0;left:0;width:100%;height:2px;border-bottom-right-radius:1px;border-top-right-radius:1px}#loading-bar .peg{position:absolute;width:70px;right:0;top:0;height:2px;opacity:.45;-moz-box-shadow:#29d 1px 0 6px 1px;-ms-box-shadow:#29d 1px 0 6px 1px;-webkit-box-shadow:#29d 1px 0 6px 1px;box-shadow:#29d 1px 0 6px 1px;-moz-border-radius:100%;-webkit-border-radius:100%;border-radius:100%}#loading-bar-spinner{display:block;position:fixed;z-index:10002;top:10px;left:10px}#loading-bar-spinner .spinner-icon{width:14px;height:14px;border:solid 2px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:10px;-webkit-animation:loading-bar-spinner 400ms linear infinite;-moz-animation:loading-bar-spinner 400ms linear infinite;-ms-animation:loading-bar-spinner 400ms linear infinite;-o-animation:loading-bar-spinner 400ms linear infinite;animation:loading-bar-spinner 400ms linear infinite}@-webkit-keyframes loading-bar-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes loading-bar-spinner{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes loading-bar-spinner{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes loading-bar-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loading-bar-spinner{0%{transform:rotate(0deg);transform:rotate(0deg)}100%{transform:rotate(360deg);transform:rotate(360deg)}} -------------------------------------------------------------------------------- /src/assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /src/assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/assets/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/assets/images/service-CloudAMQP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/images/service-CloudAMQP.png -------------------------------------------------------------------------------- /src/assets/images/service-cleardb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icclab/cf-webui/271d0a37120c40c804b7d9adc47fb20442a73d24/src/assets/images/service-cleardb.png -------------------------------------------------------------------------------- /src/assets/less/_bootstrap-overrides.less: -------------------------------------------------------------------------------- 1 | .row { 2 | margin: 0 -10px; 3 | } 4 | 5 | .row [class^="col-xs-"], 6 | .row [class^="col-sm-"], 7 | .row [class^="col-md-"], 8 | .row [class^="col-lg-"] { 9 | min-height: 1px; 10 | padding-left: 10px; 11 | padding-right: 10px; 12 | } 13 | 14 | .panel { 15 | -moz-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2); 16 | -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2); 17 | box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2); 18 | border: 0; 19 | 20 | > .table tr td:first-child, 21 | > .table tr th:first-child { 22 | padding-left: 15px; 23 | } 24 | 25 | > .table tr td:last-child, 26 | > .table tr th:last-child { 27 | padding-right: 15px; 28 | } 29 | } 30 | 31 | .form-horizontal .form-group { 32 | margin-left: -10px; 33 | margin-right: -10px; 34 | } 35 | 36 | #login .form-horizontal .form-group { 37 | margin-left: -15px; 38 | margin-right: -15px; 39 | } 40 | 41 | .btn { 42 | border-radius: 5px; 43 | font-size: 12px; 44 | font-weight: 400; 45 | line-height: 20px; 46 | padding: 4px 15px; 47 | transition: all 200ms ease 0s; 48 | } 49 | 50 | .tab-content>.active { 51 | padding: 15px; 52 | } 53 | 54 | 55 | 56 | @media screen and (max-width: 825px) { 57 | .label.label-responsive .toggle-text{ 58 | font-size: 0pt !important; 59 | } 60 | } 61 | 62 | @media (min-width: 992px) { 63 | .label.label-responsive .toggle-text{ 64 | font-size: 0pt !important; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/assets/less/_breadcrumb.less: -------------------------------------------------------------------------------- 1 | #breadcrumb { 2 | background-color: #e8e8e8; 3 | margin-bottom: 10px; 4 | padding: 6px 15px 7px; 5 | width: 100%; 6 | list-style: outside none none; 7 | 8 | li, li a { 9 | color: #99a0aa; 10 | line-height: 12px; 11 | font-size: 11px; 12 | } 13 | 14 | li { 15 | display: inline-block; 16 | 17 | &:last-child { 18 | color: #656d78; 19 | } 20 | } 21 | 22 | li + li:before { 23 | color: #99a0aa; 24 | content: "> "; 25 | padding: 0 5px; 26 | } 27 | } -------------------------------------------------------------------------------- /src/assets/less/_content.less: -------------------------------------------------------------------------------- 1 | #page-content { 2 | background-color: @page-content-background-color; 3 | position: relative; 4 | margin-left: 220px; 5 | min-height: 100%; 6 | } 7 | 8 | #page-content-wrap { 9 | padding: 0 10px; 10 | } 11 | 12 | #page-title { 13 | padding: 5px 10px; 14 | width: 100%; 15 | 16 | h1 { 17 | line-height: 30px; 18 | font-size: 26px; 19 | margin: 0 0 30px 0; 20 | } 21 | } 22 | 23 | /* Login */ 24 | #login { 25 | margin: 0 auto; 26 | width: 400px; 27 | color: #fff; 28 | } 29 | 30 | #login-logo { 31 | color: @logo-background-color; 32 | font-size: 40px; 33 | font-weight: bold; 34 | text-align: center; 35 | padding: 100px 0 20px 0; 36 | } 37 | 38 | #login-content { 39 | background-color: #4a5660; 40 | padding: 20px; 41 | .border-radius(5px); 42 | 43 | h1 { 44 | font-size: 19px; 45 | font-weight: bold; 46 | margin: 0 0 20px 0; 47 | } 48 | 49 | .form-control { 50 | background-color: rgba(0, 0, 0, 0.2); 51 | color: #ccc; 52 | border: 0 none; 53 | box-shadow: none; 54 | padding: 10px 15px; 55 | height: auto; 56 | } 57 | 58 | .btn-link { 59 | color: #fff; 60 | 61 | } 62 | } 63 | 64 | .action { 65 | color: @text-color; 66 | text-decoration: none; 67 | 68 | .fa { 69 | padding: 0 0 0 5px; 70 | } 71 | } 72 | 73 | .action-edit:hover { 74 | color: #f0ad4e; 75 | } 76 | 77 | .action-delete:hover { 78 | color: #d9534f; 79 | } 80 | 81 | .table { 82 | .fa-lg { 83 | vertical-align: 0; 84 | } 85 | 86 | &.has-actions tr td:last-child, 87 | &.has-actions tr th:last-child { 88 | text-align: right; 89 | } 90 | 91 | pre { 92 | white-space: pre-wrap; 93 | } 94 | } 95 | 96 | 97 | 98 | /* Services */ 99 | .service-title, 100 | .service-type { 101 | display: block; 102 | } 103 | 104 | .service-title { 105 | font-weight: bold; 106 | } 107 | 108 | .select-service a { 109 | display: block; 110 | color: inherit; 111 | padding: 10px; 112 | float: left; 113 | margin: 0 0 15px 0; 114 | width: 49%; 115 | 116 | &:hover { 117 | background-color: #eee; 118 | } 119 | } 120 | 121 | 122 | /* Application EnvVar*/ 123 | .word-break { 124 | word-break: break-all; 125 | } 126 | 127 | /* map a route input field */ 128 | .routeHost { 129 | width: 100px; 130 | float: left; 131 | margin-right: 5px; 132 | } 133 | 134 | .routeDomain { 135 | width: 260px; 136 | } 137 | 138 | 139 | /* Angular JS animation */ 140 | .fadein, 141 | .fadeout { 142 | -webkit-transition: all linear 0.5s; 143 | -moz-transition: all linear 0.5s; 144 | -o-transition: all linear 0.5s; 145 | transition: all linear 0.5s; 146 | } 147 | 148 | .fadein.ng-hide-remove, 149 | .fadeout.ng-hide-add.ng-hide-add-active { 150 | opacity: 0; 151 | display: block !important; 152 | } 153 | 154 | .fadeout.ng-hide-add, 155 | .fadein.ng-hide-remove.ng-hide-remove-active { 156 | opacity: 1; 157 | display: block !important; 158 | } -------------------------------------------------------------------------------- /src/assets/less/_mixins.less: -------------------------------------------------------------------------------- 1 | .border-radius(@radius) { 2 | -webkit-border-radius: @radius; 3 | -moz-border-radius: @radius; 4 | border-radius: @radius; 5 | } 6 | -------------------------------------------------------------------------------- /src/assets/less/_sidebar.less: -------------------------------------------------------------------------------- 1 | #page-sidebar { 2 | width: 220px; 3 | position: absolute; 4 | float: left; 5 | color: @sidebar-text-color; 6 | height: 100%; 7 | } 8 | 9 | #sidebar-navigation, 10 | #sidebar-navigation ul { 11 | display: block; 12 | list-style: outside none none; 13 | margin: 0; 14 | padding: 0; 15 | } 16 | 17 | #sidebar-navigation { 18 | li { 19 | display: block; 20 | margin: 0; 21 | padding: 0; 22 | width: 100%; 23 | 24 | &.title { 25 | border-bottom: 1px solid #2f3c48; 26 | color: #999; 27 | font-size: 13px; 28 | font-weight: 300; 29 | line-height: 20px; 30 | padding: 20px 10px 10px; 31 | } 32 | 33 | a { /* general styles for each link in the side bar navigation */ 34 | display: block; 35 | font-size: 13px; 36 | line-height: 19px; 37 | text-decoration: none; 38 | width: 100%; 39 | } 40 | 41 | > a { /* links of 1st level */ 42 | border-bottom: 1px solid #2f3c48; 43 | color: @sidebar-text-color; 44 | padding: 15px 10px 15px 15px; 45 | 46 | &:hover, 47 | &.active { 48 | background-color: #3d4e5d; 49 | transition: all 200ms ease 0s; 50 | } 51 | } 52 | 53 | ul { 54 | display: none; 55 | } 56 | 57 | > a.active + ul { 58 | display: block; 59 | } 60 | 61 | ul li > a { /* links of 2nd level */ 62 | border-bottom: 1px solid #23303b; 63 | background-color: #273541; 64 | color: #ccc; 65 | padding: 15px 10px 15px 30px; 66 | 67 | &:hover, 68 | &.active { 69 | background-color: #23303b; 70 | } 71 | } 72 | } 73 | 74 | .fa.pull-right { 75 | margin-top: 3px; 76 | } 77 | 78 | #logo a { 79 | display: block; 80 | padding: 13px 10px; 81 | text-align: center; 82 | height: 50px; 83 | background-color: @logo-background-color; 84 | color: @text-color; 85 | font-size: 20px; 86 | } 87 | } -------------------------------------------------------------------------------- /src/assets/less/_top.less: -------------------------------------------------------------------------------- 1 | #top-navigation { 2 | background-color: @background-color; 3 | height: 50px; 4 | display: block; 5 | list-style: outside none none; 6 | margin: 0; 7 | padding: 0; 8 | width: 100%; 9 | 10 | > li { 11 | display: block; 12 | float: left; 13 | margin: 0; 14 | padding: 0; 15 | position: relative; 16 | 17 | > a { 18 | display: block; 19 | padding: 15px 10px; 20 | text-align: center; 21 | width: 50px; 22 | color: #fff; 23 | 24 | &:hover { 25 | background-color: @top-link-hover-background-color; 26 | color: @top-link-hover-text-color; 27 | transition: @transition-ease; 28 | } 29 | } 30 | } 31 | } 32 | 33 | #loading-bar .bar { 34 | background: #fff; 35 | height: 4px; 36 | } 37 | 38 | #loading-bar-spinner .spinner-icon { 39 | border-top-color: #fff; 40 | border-left-color: #fff; 41 | } 42 | 43 | #loading-bar .peg { 44 | -moz-box-shadow: #fff 1px 0 6px 1px; 45 | -ms-box-shadow: #fff 1px 0 6px 1px; 46 | -webkit-box-shadow: #fff 1px 0 6px 1px; 47 | box-shadow: #fff 1px 0 6px 1px; 48 | height: 4px; 49 | } -------------------------------------------------------------------------------- /src/assets/less/_variables.less: -------------------------------------------------------------------------------- 1 | @background-color: #33414e; 2 | @page-content-background-color: #f2f2f2; 3 | @font-family: 'Open Sans', sans-serif; 4 | @text-color: #434a54; 5 | @text-size: 14px; 6 | 7 | @top-link-hover-background-color: #3d4e5d; 8 | @top-link-hover-text-color: #ffd559; 9 | 10 | @sidebar-text-color: #fff; 11 | @logo-background-color: #f2ae72; 12 | 13 | @transition-ease: all 200ms ease 0s; -------------------------------------------------------------------------------- /src/assets/less/style.less: -------------------------------------------------------------------------------- 1 | @import "_variables.less"; 2 | @import "_mixins.less"; 3 | 4 | html * { 5 | outline: medium none !important; 6 | } 7 | 8 | body, 9 | html, 10 | #page { 11 | height: 100%; 12 | } 13 | 14 | body { 15 | background-color: @background-color; 16 | font-family: @font-family; 17 | font-size: @text-size; 18 | color: @text-color; 19 | } 20 | 21 | a, a:hover { 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | 26 | #page { 27 | position: relative; 28 | } 29 | 30 | @import "_sidebar.less"; 31 | @import "_top.less"; 32 | @import "_breadcrumb.less"; 33 | @import "_content.less"; 34 | 35 | /* Bootstrap overrides */ 36 | @import "_bootstrap-overrides.less"; 37 | -------------------------------------------------------------------------------- /src/assets/libs/angular-resource.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.3.1 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(I,d,B){'use strict';function D(f,q){q=q||{};d.forEach(q,function(d,h){delete q[h]});for(var h in f)!f.hasOwnProperty(h)||"$"===h.charAt(0)&&"$"===h.charAt(1)||(q[h]=f[h]);return q}var w=d.$$minErr("$resource"),C=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;d.module("ngResource",["ng"]).provider("$resource",function(){var f=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}}; 7 | this.$get=["$http","$q",function(q,h){function t(d,g){this.template=d;this.defaults=s({},f.defaults,g);this.urlParams={}}function v(x,g,l,m){function c(b,k){var c={};k=s({},g,k);r(k,function(a,k){u(a)&&(a=a());var d;if(a&&a.charAt&&"@"==a.charAt(0)){d=b;var e=a.substr(1);if(null==e||""===e||"hasOwnProperty"===e||!C.test("."+e))throw w("badmember",e);for(var e=e.split("."),n=0,g=e.length;n=j?g():f.set(k/j)),a},responseError:function(a){return a.config.ignoreLoadingBar||h(a.config)||(k++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url,result:a}),k>=j?g():f.set(k/j)),b.reject(a)}}}];a.interceptors.push(b)}]),angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.includeSpinner=!0,this.includeBar=!0,this.latencyThreshold=100,this.startSize=.02,this.parentSelector="body",this.spinnerTemplate='
',this.loadingBarTemplate='
',this.$get=["$injector","$document","$timeout","$rootScope",function(a,b,c,d){function e(){k||(k=a.get("$animate"));var e=b.find(n).eq(0);c.cancel(m),r||(d.$broadcast("cfpLoadingBar:started"),r=!0,u&&k.enter(o,e),t&&k.enter(q,e),f(v))}function f(a){if(r){var b=100*a+"%";p.css("width",b),s=a,c.cancel(l),l=c(function(){g()},250)}}function g(){if(!(h()>=1)){var a=0,b=h();a=b>=0&&.25>b?(3*Math.random()+3)/100:b>=.25&&.65>b?3*Math.random()/100:b>=.65&&.9>b?2*Math.random()/100:b>=.9&&.99>b?.005:0;var c=h()+a;f(c)}}function h(){return s}function i(){s=0,r=!1}function j(){k||(k=a.get("$animate")),d.$broadcast("cfpLoadingBar:completed"),f(1),c.cancel(m),m=c(function(){var a=k.leave(o,i);a&&a.then&&a.then(i),k.leave(q)},500)}var k,l,m,n=this.parentSelector,o=angular.element(this.loadingBarTemplate),p=o.find("div").eq(0),q=angular.element(this.spinnerTemplate),r=!1,s=0,t=this.includeSpinner,u=this.includeBar,v=this.startSize;return{start:e,set:f,status:h,inc:g,complete:j,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}(); -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cloud Foundry Web User Interface 5 | 6 | 7 | 8 | Cloud Foundry Web User Interface 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/mime.types: -------------------------------------------------------------------------------- 1 | types { 2 | text/html html htm shtml; 3 | text/css css; 4 | text/xml xml; 5 | image/gif gif; 6 | image/jpeg jpeg jpg; 7 | application/x-javascript js; 8 | application/atom+xml atom; 9 | application/rss+xml rss; 10 | text/mathml mml; 11 | text/plain txt; 12 | text/vnd.sun.j2me.app-descriptor jad; 13 | text/vnd.wap.wml wml; 14 | text/x-component htc; 15 | text/cache-manifest manifest; 16 | image/png png; 17 | image/tiff tif tiff; 18 | image/vnd.wap.wbmp wbmp; 19 | image/x-icon ico; 20 | image/x-jng jng; 21 | image/x-ms-bmp bmp; 22 | image/svg+xml svg svgz; 23 | image/webp webp; 24 | application/java-archive jar war ear; 25 | application/mac-binhex40 hqx; 26 | application/msword doc; 27 | application/pdf pdf; 28 | application/postscript ps eps ai; 29 | application/rtf rtf; 30 | application/vnd.ms-excel xls; 31 | application/vnd.ms-powerpoint ppt; 32 | application/vnd.wap.wmlc wmlc; 33 | application/vnd.google-earth.kml+xml kml; 34 | application/vnd.google-earth.kmz kmz; 35 | application/x-7z-compressed 7z; 36 | application/x-cocoa cco; 37 | application/x-java-archive-diff jardiff; 38 | application/x-java-jnlp-file jnlp; 39 | application/x-makeself run; 40 | application/x-perl pl pm; 41 | application/x-pilot prc pdb; 42 | application/x-rar-compressed rar; 43 | application/x-redhat-package-manager rpm; 44 | application/x-sea sea; 45 | application/x-shockwave-flash swf; 46 | application/x-stuffit sit; 47 | application/x-tcl tcl tk; 48 | application/x-x509-ca-cert der pem crt; 49 | application/x-xpinstall xpi; 50 | application/xhtml+xml xhtml; 51 | application/zip zip; 52 | application/octet-stream bin exe dll; 53 | application/octet-stream deb; 54 | application/octet-stream dmg; 55 | application/octet-stream eot; 56 | application/octet-stream iso img; 57 | application/octet-stream msi msp msm; 58 | application/json json; 59 | audio/midi mid midi kar; 60 | audio/mpeg mp3; 61 | audio/ogg ogg; 62 | audio/x-m4a m4a; 63 | audio/x-realaudio ra; 64 | video/3gpp 3gpp 3gp; 65 | video/mp4 mp4; 66 | video/mpeg mpeg mpg; 67 | video/quicktime mov; 68 | video/webm webm; 69 | video/x-flv flv; 70 | video/x-m4v m4v; 71 | video/x-mng mng; 72 | video/x-ms-asf asx asf; 73 | video/x-ms-wmv wmv; 74 | video/x-msvideo avi; 75 | } -------------------------------------------------------------------------------- /src/nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes 1; 2 | daemon off; 3 | 4 | error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log error; 5 | events { worker_connections 1024; } 6 | 7 | http { 8 | log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status'; 9 | access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log cloudfoundry; 10 | default_type application/json; 11 | include mime.types; 12 | sendfile on; 13 | 14 | gzip on; 15 | gzip_disable "msie6"; 16 | gzip_comp_level 6; 17 | gzip_min_length 1100; 18 | gzip_buffers 16 8k; 19 | gzip_proxied any; 20 | gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss; 21 | 22 | tcp_nopush on; 23 | keepalive_timeout 30; 24 | port_in_redirect off; # Ensure that redirects don't include the internal container PORT - <%= ENV["PORT"] %> 25 | server_tokens on; 26 | 27 | server { 28 | listen <%= ENV["PORT"] %>; 29 | 30 | location /oauth { 31 | <% if ENV["NGINX_RESOLVER"] %> 32 | resolver <%= ENV["NGINX_RESOLVER"] %>; 33 | <% else %> 34 | resolver 8.8.8.8; 35 | <% end %> 36 | proxy_pass '${http_X_UAA_Endpoint}/oauth/token'; 37 | proxy_set_header Content-Type 'application/x-www-form-urlencoded'; 38 | proxy_set_header Authorization 'Basic Y2Y6'; 39 | } 40 | 41 | location /v2 { 42 | proxy_set_header Referer ''; 43 | proxy_pass <%= ENV["API_ENDPOINT"] %>; 44 | } 45 | 46 | location /info { 47 | proxy_set_header Referer ''; 48 | proxy_pass <%= ENV["API_ENDPOINT"] %>; 49 | } 50 | 51 | location / { 52 | root <%= ENV["APP_ROOT"] %>/public; 53 | index index.html index.htm Default.htm; 54 | <% if File.exists?(File.join(ENV["APP_ROOT"], "nginx/conf/.enable_directory_index")) %> 55 | autoindex on; 56 | <% end %> 57 | <% if ENV["FORCE_HTTPS"] %> 58 | if ($http_x_forwarded_proto != "https") { 59 | return 301 https://$host$request_uri; 60 | } 61 | <% end %> 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /test.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, // Enable globals available when code is running inside of the NodeJS runtime environment. 3 | "browser": true, // Standard browser globals e.g. `window`, `document`. 4 | "es5": true, // Allow EcmaScript 5 syntax. 5 | "esnext": true, // Allow ES.next specific features such as `const` and `let`. 6 | "bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.). 7 | "camelcase": false, // Permit only camelcase for `var` and `object indexes`. 8 | "curly": false, // Require {} for every new block or scope. 9 | "eqeqeq": true, // Require triple equals i.e. `===`. 10 | "immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` 11 | "latedef": true, // Prohibit variable use before definition. 12 | "newcap": true, // Require capitalization of all constructor functions e.g. `new F()`. 13 | "noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`. 14 | "quotmark": "single", // Define quotes to string values. 15 | "regexp": true, // Prohibit `.` and `[^...]` in regular expressions. 16 | "undef": true, // Require all non-global variables be declared before they are used. 17 | "unused": true, // Warn unused variables. 18 | "strict": false, // Require `use strict` pragma in every file. 19 | "trailing": true, // Prohibit trailing whitespaces. 20 | "smarttabs": false, // Suppresses warnings about mixed tabs and spaces 21 | "globals": { // Globals variables. 22 | "angular": true 23 | }, 24 | "predef": [ // Extra globals. 25 | "define", 26 | "require", 27 | "exports", 28 | "module", 29 | "describe", 30 | "before", 31 | "beforeEach", 32 | "after", 33 | "afterEach", 34 | "it" 35 | ], 36 | "indent": 4, // Specify indentation spacing 37 | "maxlen": 120, // Max line lenght 38 | "devel": false, // Allow development statements e.g. `console.log();`. 39 | "noempty": true // Prohibit use of empty blocks. 40 | } 41 | --------------------------------------------------------------------------------