Skip to content

Commit

Permalink
增加portal前端页面&创建app功能
Browse files Browse the repository at this point in the history
  • Loading branch information
lepdou committed Mar 22, 2016
1 parent 26b171f commit a93c46d
Show file tree
Hide file tree
Showing 40 changed files with 11,338 additions and 4 deletions.
Expand Up @@ -28,8 +28,8 @@ public App create(@RequestBody App app) {
}

@RequestMapping("/{appid}")
public App detail(@PathVariable String appId) {
App app = appService.detail(appId);
public App detail(@PathVariable String appid) {
App app = appService.detail(appid);
if (app == null) {
throw new NotFoundException();
}
Expand All @@ -44,5 +44,4 @@ public List<App> list(Pageable pageable) {
}
return page.getContent();
}

}
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/application.yml
@@ -1,5 +1,5 @@
server:
port: 80
port: 8080

spring:
application:
Expand Down
1 change: 1 addition & 0 deletions apollo-portal/src/main/resources/static/index.html
@@ -0,0 +1 @@
ddd
30 changes: 30 additions & 0 deletions apollo-portal/src/main/resources/static/scripts/app.js
@@ -0,0 +1,30 @@
/**service module 定义*/
var appService = angular.module('app.service', ['ngResource']);

/** page module 定义*/
//项目主页
var application_module = angular.module('application', ['ngResource', 'ui.router', 'app.service']);
//创建项目页面
var create_app_module = angular.module('create_app', ['ngResource', 'app.service']);


/**router*/
application_module.config(['$stateProvider',
function ($stateProvider) {
$stateProvider
.state('config', {
templateUrl: '../../views/app/config.html',
controller: 'AppConfigController'
}).state('info', {
templateUrl: '../../views/app/info.html',
controller: 'AppInfoController'
}).state('setting', {
templateUrl: '../../views/app/setting.html'
});
}]).run(function ($state) {
$state.go('config');
});




@@ -0,0 +1,21 @@
create_app_module.controller('CreateAppController', ['$scope', '$window', 'AppService', function ($scope, $window, AppService) {

//todo 便于测试,后续删掉
$scope.app = {
appId: 1001,
name: 'lepdou',
ownerPhone: '1111',
ownerMail: 'qqq@qq.com',
owner: 'le'
};

$scope.save = function(){
AppService.add($scope.app).then(function(result){
$window.location.href = '/views/app/index.html?#appid=' + result.appId;

},function(result){
alert('添加失败!');
});
};

}]);
@@ -0,0 +1,95 @@

application_module.controller("AppConfigController", ["$scope", '$state', '$location', 'AppService',
function ($scope, $state, $location, AppService) {

//model定义
$scope.env = {
fat: false,
uat: true,
product: false

};

//mock data
$scope.config = {
baseConfigs: [
{
key: 'pageSize',
value: 10,
lastUpdateTime: '2016-01-14'
},
{
key: 'pageCount',
value: 20,
lastUpdateTime: '2016-01-14'
}
],
overrideConfigs: [
{
project: 'cat',
configs: [
{
key: 'pageSize',
value: 10,
lastUpdateTime: '2016-01-14'
},
{
key: 'pageCount',
value: 20,
lastUpdateTime: '2016-01-14'
}
]
},
{
project: 'hermas',
configs: [
{
key: 'pageSize',
value: 20,
lastUpdateTime: '2016-01-14'
},
{
key: 'pageCount',
value: 30,
lastUpdateTime: '2016-01-14'
}
]
}
]
};

$scope.switchEnv = function (env) {
clearEnvNav();
if ('fat' == env) {
switchToFat();
} else if ('uat' == env) {
switchToUat();
} else if ('product' == env) {
switchToProduct();
}

};

function switchToFat() {
$scope.env.fat = true;
}

function switchToUat() {
$scope.env.uat = true;
}

function switchToProduct() {
$scope.env.product = true;
}

function clearEnvNav() {
$scope.env = {
fat: false,
uat: false,
product: false

};
}


}]);
@@ -0,0 +1,11 @@
application_module.controller("AppInfoController", ["$scope", '$state', '$location', 'AppService',
function ($scope, $state, $location, AppService) {
$scope.appId = $location.$$url.split("=")[1];

AppService.load($scope.appId).then(function (result) {
$scope.app = result;
}, function(result){
alert("加载出错");
});

}]);
@@ -0,0 +1,34 @@
appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
var app_resource = $resource('/apps/:appId', {}, {
load_app: {
method: 'GET',
isArray: false
},
add_app: {
method: 'POST',
url: '/apps'
}
});
return {
add: function add(app) {
var d = $q.defer();
app_resource.add_app({}, app, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
},
load: function load(appId) {
var d = $q.defer();
app_resource.load_app({
appId: appId
}, function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
66 changes: 66 additions & 0 deletions apollo-portal/src/main/resources/static/styles/common-style.css
@@ -0,0 +1,66 @@
body {
color: #797979;
background: #f1f2f7;
padding: 0px !important;
margin: 0px !important;
font-size: 13px;
padding-bottom:50px;
}

.container {
width: 100%;
min-height: 550px;
}

.footer {
height: 50px;
width: 100%;
background: #F6F6F6;
padding-top: 10px;
}

/*panel*/
.panel-heading {
font-size: 16px;
background-color: #f5f5f5;
padding: 5px 20px;
}

/*sec-panel*/
.sec-panel {
padding-left: 5%;
}

.sec-panel .panel-heading {
font-size: 14px;
height: 28px;
padding: 5px 20px;
}

table th {
text-align: center;
}

.app {
background-color: #f5f5f5;
}

.app .tab-content {
background-color: #ffffff;
}

#config-info {
padding: 20px 0px;
}

#config-info .nav {
background-color: #f5f5f5;
}

#config-info .config-info-container {
padding: 20px 20px;
}

#config-info nav {
margin-top: -20px;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

0 comments on commit a93c46d

Please sign in to comment.