Skip to content

Commit 78c6d8f

Browse files
committed
[WIP] Add catalog to web console
1 parent b3f64f8 commit 78c6d8f

File tree

6 files changed

+87
-5
lines changed

6 files changed

+87
-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

+21-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ angular
3131
'angularMoment',
3232
'ab-base64',
3333
'openshiftCommonServices',
34-
'openshiftCommonUI'
34+
'openshiftCommonUI',
35+
'webCatalog'
3536
])
3637
.config(function ($routeProvider) {
3738
var overviewRoute;
@@ -51,11 +52,26 @@ angular
5152
};
5253
}
5354

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+
5473
$routeProvider
55-
.when('/', {
56-
templateUrl: 'views/projects.html',
57-
controller: 'ProjectsController'
58-
})
74+
.when('/', landingPageRoute)
5975
.when('/create-project', {
6076
templateUrl: 'views/create-project.html',
6177
controller: 'CreateProjectController'

app/scripts/constants.js

+6
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,11 @@ angular.extend(window.OPENSHIFT_CONSTANTS, {
435435
}
436436
]
437437
}
438+
],
439+
SAAS_OFFERINGS: [
440+
{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.'},
441+
{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.'},
442+
{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.'},
443+
{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.'},
438444
]
439445
});
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
angular.module('openshiftConsole')
4+
.controller('LandingPageController', function ($scope, Constants, DataService, Navigate) {
5+
6+
$scope.saasOfferingsTitle = "What Do You Want to Build?";
7+
$scope.saasOfferings = Constants.SAAS_OFFERINGS;
8+
9+
$scope.navToProject = function(project) {
10+
Navigate.toProjectOverview(project.metadata.name);
11+
};
12+
13+
$scope.navToProjectList = function() {
14+
Navigate.toProjectList();
15+
};
16+
17+
DataService.list({
18+
group: 'servicecatalog.k8s.io',
19+
resource: 'serviceclasses'
20+
}, $scope).then(function(serviceClasses) {
21+
$scope.serviceClasses = serviceClasses.by('metadata.name');
22+
});
23+
24+
DataService.list('imagestreams', {namespace: 'openshift'}).then(function(resp) {
25+
$scope.imageStreams = resp.by('metadata.name');
26+
});
27+
});

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/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 surface-shaded">
7+
<!-- Middle section -->
8+
<div class="middle-section">
9+
<div class="middle-container">
10+
<div class="middle-content">
11+
<landing-page search-placeholder="Search Catalog">
12+
<landingheader>
13+
<div class="build-applications-view">
14+
<saas-list saas-title="saasOfferingsTitle" saas-offerings="saasOfferings"></saas-list>
15+
</div>
16+
</landingheader>
17+
<landingbody>
18+
<services-view service-classes="serviceClasses" image-streams="imageStreams"></services-view>
19+
</landingbody>
20+
<landingside>
21+
<projects-summary project-select="navToProject" show-projects="navToProjectList"></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)