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
68 changes: 68 additions & 0 deletions .github/workflows/generator-generic-ossf-slsa3-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow lets you generate SLSA provenance file for your project.
# The generation satisfies level 3 for the provenance requirements - see https://slsa.dev/spec/v0.1/requirements
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
# https://github.com/slsa-framework/slsa-github-generator.
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.

name: SLSA generic generator
on:
workflow_dispatch:
release:
types: [created]

permissions: read-all

jobs:
build:
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.hash.outputs.digests }}

steps:
- uses: actions/checkout@v3

# ========================================================
#
# Step 1: Build your artifacts.
#
# ========================================================
- name: Build artifacts
run: |
# These are some amazing artifacts.
echo "artifact1" > artifact1
echo "artifact2" > artifact2

# ========================================================
#
# Step 2: Add a step to generate the provenance subjects
# as shown below. Update the sha256 sum arguments
# to include all binaries that you generate
# provenance for.
#
# ========================================================
- name: Generate subject
id: hash
run: |
set -euo pipefail

# List the artifacts the provenance will refer to.
files=$(ls artifact*)
# Generate the subjects (base64 encoded).
echo "::set-output name=digests::$(sha256sum $files | base64 -w0)"

provenance:
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.0
with:
base64-subjects: "${{ needs.build.outputs.digests }}"
upload-assets: true # Optional: Upload to a new release
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
@Controller
@RequestMapping(value = "list")
public class ListController {

static HashMap<String, String> columnChoices = new HashMap<>();
static HashMap<String, Object> tableChoices = new HashMap<>();

public ListController () {
columnChoices.put("all", "All");
columnChoices.put("employer", "Employer");
columnChoices.put("location", "Location");
columnChoices.put("positionType", "Position Type");
columnChoices.put("coreCompetency", "Skill");


tableChoices.put("all",JobData.findAll());
tableChoices.put("employer", JobData.getAllEmployers());
tableChoices.put("location", JobData.getAllLocations());
tableChoices.put("positionType", JobData.getAllPositionTypes());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
package org.launchcode.techjobs.mvc.controllers;

import org.launchcode.techjobs.mvc.models.Job;
import org.launchcode.techjobs.mvc.models.JobData;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static org.launchcode.techjobs.mvc.controllers.ListController.columnChoices;
import java.util.ArrayList;

import static org.launchcode.techjobs.mvc.controllers.ListController.columnChoices;

/**
* Created by LaunchCode
*/
@Controller
@RequestMapping("search")
public class SearchController {

@GetMapping(value = "")
public String search(Model model) {
model.addAttribute("columns", columnChoices);
return "search";
}

// TODO #3 - Create a handler to process a search request and render the updated search view.

@PostMapping("results")
public String displaySearchResults(Model model, @RequestParam String searchType, @RequestParam String searchTerm){
ArrayList<Job> jobsReturned = new ArrayList<>();
if(searchTerm.toLowerCase().equals("all") || searchTerm.isEmpty()){
jobsReturned = JobData.findAll();
model.addAttribute("jobs",jobsReturned);
} else {
jobsReturned = JobData.findByColumnAndValue(searchType,searchTerm);
model.addAttribute("columns",columnChoices);
}
model.addAttribute("jobs",jobsReturned);
return "search";
}
}
3 changes: 2 additions & 1 deletion src/main/resources/templates/fragments.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<link th:href="@{/css/bootstrap.css}" rel="stylesheet" />
<link th:href="@{/css/techjobs.css}" rel="stylesheet" />
<script type="text/javascript" th:src="@{/js/bootstrap.js}"></script>

<title th:text="'TechJobs' + ${title == null ? '' : ' :: ' + title}">TechJobs</title>


</head>

<body>
Expand Down
32 changes: 30 additions & 2 deletions src/main/resources/templates/list-jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<html xmlns:th="http://www.thymeleaf.org/">
<head th:replace="fragments :: head">
</head>
<body>
<body class="container">


<div th:replace="fragments :: page-header"></div>

Expand All @@ -11,8 +12,35 @@
<h1 th:text="${#strings.capitalizeWords(title)}"></h1>

<!-- TODO #1 - Use a loop to display job results in a table. -->
<th:block th:each ="job : ${jobs}">
<table class="table job-listing">
<tr>
<td>ID</td>
<td th:text="${job.id}"></td>
</tr>
<tr>
<td>Name</td>
<td th:text="${job.name}"></td>
</tr>
<tr>
<td>Employer</td>
<td th:text="${job.employer}"></td>
</tr>
<tr>
<td>Location</td>
<td th:text="${job.location}"></td>
</tr>
<tr>
<td>Position</td>
<td th:text="${job.positionType}"></td>
</tr>
<tr>
<td>Skill</td>
<td th:text="${job.coreCompetency}"></td>
</tr>

</table>
</th:block>
</div>

</body>
</html>
59 changes: 30 additions & 29 deletions src/main/resources/templates/list.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org/">
<head th:replace="fragments :: head"></head>
<head th:replace="fragments :: head"></head>

<body>

<div th:replace="fragments :: page-header"></div>
<body>
<div th:replace="fragments :: page-header"></div>

<div class="container body-content">
<h1 th:text="${#strings.capitalizeWords(title)}"></h1>
<h2 class = "centered">View Jobs By Category</h2>
</div>
<div class="container body-content">
<h1 th:text="${#strings.capitalizeWords(title)}"></h1>
<h2 class = "centered">View Jobs By Category</h2>
</div>

<table class="centeredTable">
<tr>
<th:block th:each="column : ${columns}">
<th th:text = "${column.value}"></th>
</th:block>
</tr>
<tr>
<!-- TODO #2: Complete the View Jobs By Category Table. -->

<td></td> <!-- Feel free to remove or modify this element if necessary. -->

<td th:each="category : ${tableChoices}">
<ul>
<li th:each="item : ${category.value}">
<a th:href="@{/list/jobs(column=${category.key},value=${item})}" th:text="${item}"></a>
</li>
</ul>
</td>
</tr>
</table>

</body>
<table class="centeredTable">
<tr>
<th:block th:each="column : ${columns}">
<th th:text = "${column.value}"></th>
</th:block>
</tr>
<tr>
<!-- TODO #2: Complete the View Jobs By Category Table. -->
<td>
<li>
<a th:href="@{/list/jobs(column='All',value='View All')}">View All</a>
</li>
</td> <!-- Feel free to remove or modify this element if necessary. -->
<td th:each="category : ${tableChoices}">
<ul>
<li th:each="item : ${category.value}">
<a th:href="@{/list/jobs(column=${category.key},value=${item})}" th:text="${item}"></a>
</li>
</ul>
</td>
</tr>
</table>
</body>
</html>
33 changes: 29 additions & 4 deletions src/main/resources/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head th:replace="fragments :: head">
</head>
<body>

<div th:replace="fragments :: page-header"></div>

<div class="container body-content">
Expand Down Expand Up @@ -31,14 +30,40 @@ <h2>Search by:</h2>
<input type="text" name="searchTerm" id="searchTerm" />
</p>


<input type="submit" value="Search" />
</form>

<hr />

<!-- TODO #4 - Loop over the search results to display all job fields. -->
<th:block th:each ="job : ${jobs}">
<table class="table job-listing">

<tr>
<td>ID</td>
<td th:text="${job.id}"></td>
</tr>
<tr>
<td>Name</td>
<td th:text="${job.name}"></td>
</tr>
<tr>
<td>Employer</td>
<td th:text="${job.employer}"></td>
</tr>
<tr>
<td>Location</td>
<td th:text="${job.location}"></td>
</tr>
<tr>
<td>Position</td>
<td th:text="${job.positionType}"></td>
</tr>
<tr>
<td>Skill</td>
<td th:text="${job.coreCompetency}"></td>
</tr>
</table>
</th:block>
</div>

</body>
</html>