Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New look and feel for event page #1040

Merged
merged 16 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/components/app-header/component.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import Component from '@ember/component';
import ENV from 'screwdriver-ui/config/environment';
import { computed, get } from '@ember/object';
import { inject as service } from '@ember/service';
import { jwtDecode } from 'jwt-decode';

export default Component.extend({
router: service(),
session: service(),
tagName: 'header',
showSearch: false,
docUrl: ENV.APP.SDDOC_URL,
slackUrl: ENV.APP.SLACK_URL,
releaseVersion: ENV.APP.RELEASE_VERSION,
searchTerm: '',
isAdmin: computed('session.data.authenticated.token', function isAdmin() {
adong marked this conversation as resolved.
Show resolved Hide resolved
const token = this.get('session.data.authenticated.token');

return (jwtDecode(token).scope || []).includes('admin');
}),
isNewUI: computed('router.{currentRouteName,currentURL}', {
get() {
const currentURL = get(this, 'router.currentURL');
const isNewUIRoute = currentURL.includes('/v2/');

return isNewUIRoute;
}
}),
actions: {
invalidateSession() {
this.onInvalidate();
Expand All @@ -26,6 +44,17 @@ export default Component.extend({
},
openSearchForm() {
this.set('showSearch', true);
},
switchUI() {
const currentURL = get(this, 'router.currentURL');

let targetURL = `/v2${currentURL}`;

if (this.isNewUI) {
targetURL = currentURL.split('/v2/').join('/');
}

this.router.transitionTo(targetURL);
}
}
});
4 changes: 4 additions & 0 deletions app/components/app-header/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@
pointer-events: none;
}

.dropdown-item.switch-ui {
cursor: pointer;
}

.dropdown-item > a.active > span {
font-size: 12px;
color: $sd-text-light;
Expand Down
9 changes: 9 additions & 0 deletions app/components/app-header/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@
{{/unless}}
{{/each}}
{{ddm.divider}}
{{#if this.isAdmin}}
<ddm.item>
<span class="switch-ui dropdown-item"
title="Switch to {{if this.isNewUIRoute "Old" "New"}}"
{{action "switchUI"}}
>Switch to {{if this.isNewUI "Old" "New"}} UI
</span>
</ddm.item>
{{/if}}
{{#if (not @session.data.authenticated.isGuest)}}
<ddm.item>
<ddm.linkTo @route="user-settings" @title="User Settings">
Expand Down
11 changes: 11 additions & 0 deletions app/components/newui-pipeline-nav/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// import Component from '@glimmer/component';
adong marked this conversation as resolved.
Show resolved Hide resolved

// export default class NewuiPipelineNavComponent extends Component {

// }

import Component from '@ember/component';

export default Component.extend({
// pipeline: null
});
52 changes: 52 additions & 0 deletions app/components/newui-pipeline-nav/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ul.pipeline-nav {
list-style-type: none;
margin: 0;
padding: 0;

text-align: center;

display: grid;
grid-column-gap: 0px;
grid-row-gap: 0px;

grid-template-columns: auto;
grid-template-rows: 40px 40px 40px 40px auto;

grid-template-areas:
'builds'
'secrets'
'options'
'metrics'
'rest';

a {
&.active {
color: #1c64f2;
}

color: #6b7280;
}

&:first-child {
padding-top: 20px;
}

.svg-inline--fa {
cursor: pointer;
}

.builds {
grid-area: builds;
}

.secrets {
grid-area: secrets;
}

.options {
grid-area: options;
}
.metrics {
grid-area: metrics;
}
}
14 changes: 14 additions & 0 deletions app/components/newui-pipeline-nav/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ul class="pipeline-nav">
<li class="builds" title="Builds">
<LinkTo @route="v2.pipeline.builds"><FaIcon @icon="cubes" @size="16x"/></LinkTo>
</li>
<li class="secrets" title="Secrets">
<LinkTo @route="v2.pipeline.secrets"><FaIcon @icon="key" @size="16x"/></LinkTo>
</li>
<li class="options" title="Options">
<LinkTo @route="v2.pipeline.options"><FaIcon @icon="wrench" @size="16x"/></LinkTo>
</li>
<li class="metrics" title="Metrics">
<LinkTo @route="v2.pipeline.metrics"><FaIcon @icon="water" @size="16x"/></LinkTo>
</li>
</ul>
34 changes: 33 additions & 1 deletion app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Router.map(function route() {
'pipeline',
{ path: '/pipelines/:pipeline_id' },
function secretsRoute() {
this.route('jobs', function eventsRoute() {
this.route('jobs', function jobsRoute() {
this.route('index', { path: '/' });
});
this.route('events', function eventsRoute() {
Expand Down Expand Up @@ -124,6 +124,38 @@ Router.map(function route() {
this.route('404', { path: '/*path' });

this.route('pipeline-visualizer');

this.route('v2', function v2Route() {
this.route('home');
adong marked this conversation as resolved.
Show resolved Hide resolved
this.route(
'pipeline',
{ path: '/pipelines/:pipeline_id' },
function pipelinesRoute() {
this.route('index', { path: '/' });
this.route('builds');
this.route('secrets');
this.route('options');
this.route('metrics');

this.route('events', function eventsRoute() {
this.route('show', { path: '/:event_id' });
});
this.route('jobs', function jobsRoute() {
this.route('index', { path: '/' });
});
this.route('pulls');
}
);

this.route(
adong marked this conversation as resolved.
Show resolved Hide resolved
'dashboard',
{ path: '/dashboards' },
function dashboardsRoute() {
this.route('index', { path: '/' });
this.route('show', { path: '/:collection_id' });
}
);
});
});
/* eslint-enable array-callback-return */

Expand Down
1 change: 1 addition & 0 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ $pipeline-header-height-max: 134px;
@import 'app/styles/user-settings';
@import 'app/styles/create';
@import 'app/styles/commands-templates';
@import 'app/styles/new-ui';

.container {
box-sizing: border-box;
Expand Down
84 changes: 84 additions & 0 deletions app/styles/new-ui.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.new-ui {
// to accommodate and offset old ui margins
margin-right: -15px;
margin-left: -15px;
height: 100%;
// height: 100vh;

.grid-container {
display: grid;
height: 100%;

grid-column-gap: 0px;
grid-row-gap: 0px;

grid-template-columns: 50px;
grid-template-rows: auto;

grid-template-areas: 'left right';

.grid-item.left {
background-color: #fff;
border-left: 1px solid #f2f2f2;
border-right: 1px solid #f2f2f2;

grid-area: left;
}

.grid-item.right {
grid-area: right;

display: grid;
grid-column-gap: 0px;
grid-row-gap: 0px;

grid-template-areas:
'pipeline-header pipeline-header pipeline-header pipeline-header pipeline-header'
'pipeline-tab pipeline-tab pipeline-tab pipeline-tab pipeline-tab'
'pipeline-content pipeline-content pipeline-workflowgraph pipeline-workflowgraph pipeline-workflowgraph';
adong marked this conversation as resolved.
Show resolved Hide resolved

grid-template-rows: 80px 52px 1fr;

.grid-item.pipeline-header {
grid-area: pipeline-header;
}

.grid-item.pipeline-tab {
grid-area: pipeline-tab;

display: grid;
padding-top: 8px;
padding-bottom: 1px;

ul.nav-tabs.nav {
border: none;

li {
border-bottom: 3px solid #fff;
padding-left: 15px;
padding-right: 15px;
text-align: center;

&.active {
border-bottom-color: #1c64f2;
}

a {
&.active {
color: #1c64f2;
}

color: #6b7280;
border: none;
padding: 8px 16px 9px 16px;
}
}
}
}

.grid-item.pipeline-content {
grid-area: pipeline-content;
}
}
}
}
10 changes: 10 additions & 0 deletions app/v2/dashboard/index/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Route from '@ember/routing/route';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default class NewDashboardIndexRoute extends Route.extend(
AuthenticatedRouteMixin
) {
model() {
return this;
}
}
2 changes: 2 additions & 0 deletions app/v2/dashboard/index/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{page-title "Index"}}
{{outlet}}
12 changes: 12 additions & 0 deletions app/v2/dashboard/show/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Route from '@ember/routing/route';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default class NewDashboardShowRoute extends Route.extend(
AuthenticatedRouteMixin
) {
/* eslint-disable camelcase */
model({ collection_id }) {
return this;
}
/* eslint-enable camelcase */
}
2 changes: 2 additions & 0 deletions app/v2/dashboard/show/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{page-title "Show"}}
{{outlet}}
6 changes: 6 additions & 0 deletions app/v2/home/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Route from '@ember/routing/route';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default class NewHomeRoute extends Route.extend(
AuthenticatedRouteMixin
) {}
13 changes: 13 additions & 0 deletions app/v2/home/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{page-title "Home"}}

<div class="new-ui">
<div class="grid-container">
<div class="grid-item left">
<NewuiPipelineNav />
</div>
<div class="grid-item right">
PIPELINE STUFF
</div>
</div>
</div>
{{outlet}}
3 changes: 3 additions & 0 deletions app/v2/pipeline/builds/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Route from '@ember/routing/route';

export default class NewPipelineBuildsRoute extends Route {}
2 changes: 2 additions & 0 deletions app/v2/pipeline/builds/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{page-title "Builds"}}
{{outlet}}
27 changes: 27 additions & 0 deletions app/v2/pipeline/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Controller from '@ember/controller';
import { service } from '@ember/service';
import { action } from '@ember/object';
// import { tracked } from '@glimmer/tracking';

export default class NewPipelineController extends Controller {
@service session;

get collections() {
return this.model.collections;
}

get pipeline() {
return this.model.pipeline;
}

@action
addToCollection(pipelineId, collection) {
const { pipelineIds } = collection;

if (!pipelineIds.includes(pipelineId)) {
collection.set('pipelineIds', [...pipelineIds, pipelineId]);
}

return collection.save();
}
}
3 changes: 3 additions & 0 deletions app/v2/pipeline/events/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Controller from '@ember/controller';

export default class NewPipelineEventsController extends Controller {}
Loading