Skip to content

Commit

Permalink
fix(best-frontend): Fix Tab switching (#73)
Browse files Browse the repository at this point in the history
* fix(best-frontend): Fix Tab switching
* Change default title
  • Loading branch information
diervo committed Feb 6, 2018
1 parent aad9365 commit 57f2d08
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/best-frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en" data-framework="raptor">
<head>
<meta charset="UTF-8">
<title>Raptor SFX Shell</title>
<title>LWC performance</title>
<link rel="stylesheet" href="/assets/styles/salesforce-lightning-design-system.min.css">
<link rel="stylesheet" href="/assets/styles/index.css">
{JS_PRELOAD}
Expand Down
1 change: 0 additions & 1 deletion packages/best-frontend/server/api_v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function addRoutes(router, store) {

async function getLastCommitStats(store, projectName, branch, size = 30) {
const commits = await store.getCommits(projectName, branch);
console.log(`>>> ${projectName}/${branch}`, commits);
const lastCommits = commits.slice(0, size);
return Promise.all(lastCommits.map(async (commit) => {
let benchmarks = await memoizedGetBenchPerCommit(projectName, commit);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, Element } from 'engine';
import { isPureLeftClick } from 'one-tmp-utils';

const Labels = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from "engine";
import { api, Element } from "engine";
import { joinClassNames, isPureLeftClick } from "one-tmp-utils";

export default class LightningMenuItem extends Element {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, Element } from 'engine';
import HomePage from "./page-home.html";
import ProjectPage from "./page-project.html";
export default class AppRouter extends Element {
Expand Down
3 changes: 2 additions & 1 deletion packages/best-frontend/src/modules/one/app/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element, unwrap } from 'engine';
import { Element, unwrap, track } from 'engine';
import INITIAL_STATE from './state';
import { reifyBranches, emulateFetch, initializeState, normalizeStats, updateURL} from './utils';

Expand Down Expand Up @@ -42,6 +42,7 @@ export default class App extends Element {
async setProjectLastestStats(project, branch = "master") {
const projectBranch = `${project}:${branch}`;
if (!this.state.lastCommits[projectBranch]) {
this.state.pageState = {};
const response = await fetch(`/api/v1/projects/${project}/${branch}/lastcommits`);
if (response.ok) {
const stats = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion packages/best-frontend/src/modules/one/appnav/appnav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, Element } from 'engine';
import { isPureLeftClick } from 'one-tmp-utils';
const NAV_TYPE_HORIZONTAL = 'horizontal';
const NAV_TYPE_DROPDOWN = 'dropdown';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, Element } from 'engine';

export default class ComparePanel extends Element {
@api selectedCommitBenchmarks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<template if:true={isDataReady}>
<section class="charts">
<template for:each={benchmarks} for:item="benchmark">
<div class="benchmark" data-id={benchmark}></div>
<div key={benchmark} class="benchmark" data-id={benchmark}></div>
</template>
</section>
</template>
Expand Down
24 changes: 11 additions & 13 deletions packages/best-frontend/src/modules/one/page-project/page-project.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, track, Element } from 'engine';
import { normalizeForTrending, normalizeForComparison } from "./normalize-benchmarks";
import { generatePlot, cleanupPlots, isPlot } from "./plots";

Expand All @@ -15,22 +15,20 @@ export default class HomePage extends Element {

@api set projectState(newState) {
const { commitBenchmarks } = newState;
if (commitBenchmarks) {
this._projectState = newState;
this.benchmarksTrend = normalizeForTrending(commitBenchmarks);
this._projectState = newState;
this.benchmarksTrend = normalizeForTrending(commitBenchmarks);

// TODO: remove me one we have the logc for clicking correct
if (commitBenchmarks.length && this.benchmarksTrend && !this.selectedCommits.length) {
this.selectedCommits.push({
commit: newState.commits[newState.commits.length - 1],
benchmarkName: Object.keys(this.benchmarksTrend)[0]
});
}
}
// TODO: remove me one we have the logc for clicking correct
// if (commitBenchmarks && commitBenchmarks.length && this.benchmarksTrend && !this.selectedCommits.length) {
// this.selectedCommits.push({
// commit: newState.commits[newState.commits.length - 1],
// benchmarkName: Object.keys(this.benchmarksTrend)[0]
// });
// }
}

get isDataReady() {
return !!this.benchmarksTrend;
return !!(this.benchmarksTrend && Object.keys(this.benchmarksTrend).length);
}
get benchmarks() {
return Object.keys(this.benchmarksTrend);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from 'engine';
import { api, Element } from 'engine';
import { classListMutation, icon as iconUtil } from 'one-tmp-utils';

const validVariants = new Set([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from "engine";
import { api, Element } from "engine";
import { joinClassNames, isPureLeftClick } from "one-tmp-utils";

export default class LightningMenuItem extends Element {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element } from "engine";
import { Element, api } from "engine";
import { joinClassNames } from "one-tmp-utils";

export default class LightningSpinner extends Element {
Expand Down

0 comments on commit 57f2d08

Please sign in to comment.