Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
150 changes: 27 additions & 123 deletions resources/views/components/header.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@php
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use App\Services\ProjectService;
use Illuminate\Support\Facades\Auth;
Expand All @@ -9,9 +10,14 @@

$hideRegistration = config('cdash.user_registration_form_enabled') === false;

$currentDateString = now()->toDateString();
$userInProject = false;
if (isset($project)) {
$eloquentProject = \App\Models\Project::findOrFail((int) $project->Id);

$currentDateString = Carbon::parse($eloquentProject->builds()->max('starttime'))->toDateString();

$userInProject = isset($project) && auth()->user() !== null && \App\Models\Project::findOrFail($project->Id)->users()->where('id', auth()->user()->id)->exists();
$userInProject = auth()->user() !== null && $eloquentProject->users()->where('id', auth()->user()->id)->exists();
}

$showHeaderNav = isset($build);
@endphp
Expand Down Expand Up @@ -105,124 +111,9 @@
</nav>


@if(isset($angular) && $angular === true)
<div id="headermenu" style="float: right;">
<ul id="navigation">
<li ng-if="!cdash.noproject && cdash.projectname_encoded !== undefined">
<a class="cdash-link" ng-href="{{ url('/index.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}">
Dashboard
</a>
<ul>
<li ng-if="cdash.menu.subprojects == 1">
<a class="cdash-link" ng-href="{{ url('/viewSubProjects.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}">
SubProjects
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/overview.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}">
Overview
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/buildOverview.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}@{{::cdash.extraurl}}">
Builds
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/testOverview.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}@{{::cdash.extraurl}}">
Tests
</a>
</li>
<li>
<a class="cdash-link" ng-if="!cdash.parentid || cdash.parentid <= 0"
ng-href="{{ url('/queryTests.php') }}?project=@{{::cdash.projectname_encoded}}&date=@{{::cdash.date}}@{{::cdash.extraurl}}@{{::cdash.querytestfilters}}">
Tests Query
</a>
<a class="cdash-link" ng-if="cdash.parentid > 0"
ng-href="{{ url('/queryTests.php') }}?project=@{{::cdash.projectname_encoded}}&parentid=@{{::cdash.parentid}}@{{::cdash.extraurl}}@{{::cdash.extrafilterurl}}">
Tests Query
</a>
</li>
<li class="endsubmenu">
<a class="cdash-link" ng-href="{{ url('/projects') }}/@{{::cdash.projectid}}/sites@{{::cdash.extraurl}}">
Sites
</a>
</li>
</ul>
</li>
<li id="Back" ng-if="cdash.menu.back">
<a class="cdash-link"
ng-href="@{{::cdash.menu.back}}@{{::cdash.extrafilterurl}}"
tooltip-popup-delay="1500"
tooltip-append-to-body="true"
tooltip-placement="bottom"
uib-tooltip="Go back up one level in the hierarchy of results">Up</a>
</li>
<li ng-if="cdash.showcalendar">
<a class="cdash-link" id="cal" href="" ng-click="toggleCalendar()">Calendar</a>
<span id="date_now" style="display:none;">@{{::cdash.date}}</span>
</li>
<li ng-if="!cdash.hidenav && cdash.projectname_encoded !== undefined">
<a class="cdash-link" href="#">Project</a>
<ul>
<li>
<a class="cdash-link" ng-href="@{{::cdash.home}}">Home</a>
</li>
<li ng-if="cdash.documentation.replace('https://', '').replace('http://', '').trim() !== ''">
<a class="cdash-link" ng-href="@{{::cdash.documentation}}">Documentation</a>
</li>
<li ng-if="cdash.vcs.replace('https://', '').replace('http://', '').trim() !== ''">
<a class="cdash-link" ng-href="@{{::cdash.vcs}}">Repository</a>
</li>
<li ng-if="cdash.bugtracker.replace('https://', '').replace('http://', '').trim() !== ''"
ng-class="::{endsubmenu: cdash.projectrole}">
<a class="cdash-link" ng-href="@{{::cdash.bugtracker}}"> Bug Tracker</a>
</li>
<li class="endsubmenu">
<a class="cdash-link" ng-href="{{ url('/projects') }}/@{{::cdash.projectid}}/members">Members</a>
</li>
@if($userInProject)
<li class="endsubmenu">
<a class="cdash-link" ng-href="{{ url('/subscribeProject.php') }}?projectid=@{{::cdash.projectid}}">Notifications</a>
</li>
@endif
</ul>
</li>
<li ng-if="cdash.user.admin == 1 && !cdash.noproject && cdash.projectid !== undefined" id="admin">
<a class="cdash-link" href="#">Settings</a>
<ul>
<li>
<a class="cdash-link" ng-href="{{ url('/project') }}/@{{::cdash.projectid}}/edit">
Project
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/manageBuildGroup.php') }}?projectid=@{{::cdash.projectid}}">
Groups
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/project') }}/@{{::cdash.projectid}}/testmeasurements">
Measurements
</a>
</li>
<li>
<a class="cdash-link" ng-href="{{ url('/manageSubProject.php') }}?projectid=@{{::cdash.projectid}}">
SubProjects
</a>
</li>
<li class="endsubmenu">
<a class="cdash-link" ng-href="{{ url('/manageOverview.php') }}?projectid=@{{::cdash.projectid}}">
Overview
</a>
</li>
</ul>
</li>
</ul>
</div>
@elseif(isset($project))
<div id="headermenu">
<ul id="navigation">
<div id="headermenu">
<ul id="navigation">
@if(isset($project))
<li>
<a href="#">Dashboard</a>
<ul>
Expand All @@ -242,6 +133,11 @@
Tests
</a>
</li>
<li>
<a href="{{ url('/testOverview.php') }}?project={{rawurlencode($project->Name)}}&date={{$currentDateString}}">
Test Overview
</a>
</li>
<li>
<a href="{{ url("/projects/$project->Id/sites") }}">
Sites
Expand All @@ -256,6 +152,14 @@
@endif
</ul>
</li>
@endif
@if(isset($angular) && $angular === true)
<li ng-if="cdash.showcalendar">
<a class="cdash-link" id="cal" href="" ng-click="toggleCalendar()">Calendar</a>
<span id="date_now" style="display:none;">@{{::cdash.date}}</span>
</li>
@endif
@if(isset($project))
<li>
<a href="#">Project</a>
<ul>
Expand Down Expand Up @@ -335,9 +239,9 @@
</ul>
</li>
@endcan
</ul>
</div>
@endif
@endif
</ul>
</div>
</div>

@if(isset($angular) && $angular === true)
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/query-tests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('query tests', () => {
it('displays the correct default filters', () => {
cy.visit('index.php?project=Trilinos');
const expected_url = 'queryTests.php?project=Trilinos&date=2011-07-22&filtercount=1&showfilters=1&field1=status&compare1=62&value1=passed';
cy.get('#navigation').find('a').contains('Tests Query').should('have.attr', 'href').and('contains', expected_url);
cy.get('#navigation').find('a').contains('Tests').should('have.attr', 'href').and('contains', expected_url);

// load the page and verify the expected number of tests.
cy.visit(expected_url);
Expand Down
8 changes: 0 additions & 8 deletions tests/cypress/e2e/view-test.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ describe('viewTest', () => {
});


it('shows link to queryTests.php', () => {
cy.visit('viewTest.php?buildid=1');

const default_filters = 'queryTests.php?project=TestCompressionExample&date=2009-12-18&filtercount=1&showfilters=1&field1=status&compare1=62&value1=passed';
cy.get('#navigation').find('a').contains('Tests Query').should('have.attr', 'href').and('contains', default_filters);
});


it('accounts for missing tests', () => {
// go to the viewTest page corresponding to build with name 'Win32-MSVC2009'
cy.visit('index.php?project=EmailProjectExample&date=2009-02-26');
Expand Down