Skip to content

Commit dad8b42

Browse files
committed
[WIP] Add catalog to web console
1 parent 5911991 commit dad8b42

File tree

8 files changed

+121
-5
lines changed

8 files changed

+121
-5
lines changed

app/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ <h1>JavaScript Required</h1>
210210
<script src="scripts/services/fullscreen.js"></script>
211211
<script src="scripts/services/apps.js"></script>
212212
<script src="scripts/services/resourceAlerts.js"></script>
213+
<script src="scripts/controllers/landingPage.js"></script>
213214
<script src="scripts/controllers/projects.js"></script>
214215
<script src="scripts/controllers/pods.js"></script>
215216
<script src="scripts/controllers/pod.js"></script>

app/scripts/app.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,26 @@ angular
5252
};
5353
}
5454

55+
var landingPageRoute;
56+
var projectsPageRoute = {
57+
templateUrl: 'views/projects.html',
58+
controller: 'ProjectsController'
59+
};
60+
if (_.get(window, 'OPENSHIFT_CONSTANTS.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page')) {
61+
landingPageRoute = {
62+
templateUrl: 'views/landing-page.html',
63+
controller: 'LandingPageController'
64+
};
65+
$routeProvider.when('/projects', projectsPageRoute);
66+
} else {
67+
landingPageRoute = projectsPageRoute;
68+
$routeProvider.when('/projects', {
69+
redirectTo: '/'
70+
});
71+
}
72+
5573
$routeProvider
56-
.when('/', {
57-
templateUrl: 'views/projects.html',
58-
controller: 'ProjectsController'
59-
})
74+
.when('/', landingPageRoute)
6075
.when('/create-project', {
6176
templateUrl: 'views/create-project.html',
6277
controller: 'CreateProjectController'

app/scripts/constants.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ angular.extend(window.OPENSHIFT_CONSTANTS, {
8989
],
9090

9191
ENABLE_TECH_PREVIEW_FEATURE: {
92-
service_catalog_landing_page: false,
92+
service_catalog_landing_page: true,
9393
pod_presets: false
9494
},
9595

@@ -436,5 +436,11 @@ angular.extend(window.OPENSHIFT_CONSTANTS, {
436436
}
437437
]
438438
}
439+
],
440+
SAAS_OFFERINGS: [
441+
{id: 1, title: 'Microservices Application', icon: 'fa fa-cubes', url: 'https://www.redhat.com/en/technologies/virtualization', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.'},
442+
{id: 2, title: 'Mobile Application', icon: 'fa fa-mobile', url: 'https://www.redhat.com/en/technologies/mobile', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.'},
443+
{id: 3, title: 'Integration Application', icon: 'fa fa-plug', url: 'https://www.redhat.com/en/technologies/cloud-computing', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.'},
444+
{id: 4, title: 'Business Process Application', icon: 'fa fa-cubes', url: 'https://www.redhat.com/en/technologies/management', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.'},
439445
]
440446
});
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
3+
angular.module('openshiftConsole')
4+
.controller('LandingPageController',
5+
function($scope,
6+
AuthService,
7+
Constants,
8+
DataService,
9+
Navigate) {
10+
$scope.saasOfferings = Constants.SAAS_OFFERINGS;
11+
12+
$scope.navToProject = function(project) {
13+
Navigate.toProjectOverview(project.metadata.name);
14+
};
15+
16+
$scope.navToProjectList = function() {
17+
Navigate.toProjectList();
18+
};
19+
20+
AuthService.withUser().then(function() {
21+
DataService.list({
22+
group: 'servicecatalog.k8s.io',
23+
resource: 'serviceclasses'
24+
}, $scope).then(function(resp) {
25+
$scope.serviceClasses = resp.by('metadata.name');
26+
});
27+
28+
DataService.list('imagestreams', { namespace: 'openshift' }).then(function(resp) {
29+
$scope.imageStreams = resp.by('metadata.name');
30+
});
31+
});
32+
});

app/scripts/services/navigate.js

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ angular.module("openshiftConsole")
7070
return "project/" + encodeURIComponent(projectName) + "/overview";
7171
},
7272

73+
toProjectList: function(){
74+
$location.path('projects');
75+
},
76+
7377
quotaURL: function(projectName) {
7478
return "project/" + encodeURIComponent(projectName) + "/quota";
7579
},

app/styles/_catalog.less

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@landing-side-bar-top-offset: @navbar-os-header-height-desktop;
2+
@landing-side-bar-width-lg: 425px;
3+
@landing-side-bar-width-md: 375px;
4+
@landing-side-bar-width-sm: 325px;
5+
6+
.console-os .wrap.no-sidebar .middle.landing-page {
7+
background: @panel-shaded;
8+
flex: none;
9+
h1, .nav-tabs {
10+
margin-bottom: 0;
11+
}
12+
@media(min-width: @screen-sm-min){
13+
overflow-y: auto;
14+
width: calc(100% ~"-" @landing-side-bar-width-sm);
15+
}
16+
@media(min-width: @screen-md-min) {
17+
width: calc(100% ~"-" @landing-side-bar-width-md);
18+
}
19+
20+
@media(min-width: @screen-lg-min) {
21+
width: calc(100% ~"-" @landing-side-bar-width-lg);
22+
}
23+
}
24+
25+
@media(min-width: @screen-sm-min) {
26+
.landing-side-bar {
27+
top: @landing-side-bar-top-offset;
28+
}
29+
}

app/styles/main.less

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
@import "_buttons.less";
1313
@import "_forms.less";
1414
@import "_cards.less";
15+
@import "_catalog.less";
1516
@import "_component-animations.less";
1617
@import "_components.less";
1718
@import "_core.less";

app/views/landing-page.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<default-header class="top-header"></default-header>
2+
<div class="wrap no-sidebar">
3+
<div class="sidebar-left collapse navbar-collapse navbar-collapse-2">
4+
<navbar-utility-mobile></navbar-utility-mobile>
5+
</div>
6+
<div class="middle landing-page">
7+
<!-- Middle section -->
8+
<div class="middle-section">
9+
<div class="middle-container">
10+
<div class="middle-content">
11+
<landing-page service-classes="serviceClasses" image-streams="imageStreams">
12+
<landingheader>
13+
<div class="build-applications-view">
14+
<saas-list saas-offerings="saasOfferings"></saas-list>
15+
</div>
16+
</landingheader>
17+
<landingbody>
18+
<services-view base-project-url="project" service-classes="serviceClasses" image-streams="imageStreams"></services-view>
19+
</landingbody>
20+
<landingside>
21+
<projects-summary base-project-url="project" projects-url="projects"></projects-summary>
22+
</landingside>
23+
</landing-page>
24+
</div><!-- /middle-content -->
25+
</div><!-- /middle-container -->
26+
</div><!-- /middle-section -->
27+
</div><!-- /middle -->
28+
</div><!-- /wrap -->

0 commit comments

Comments
 (0)