Skip to content

Commit

Permalink
Merge pull request #35 from bcgov/test-pr
Browse files Browse the repository at this point in the history
Test pr
  • Loading branch information
tronghieuvuong authored Nov 30, 2023
2 parents 80f0dc8 + 3b82a52 commit e426c38
Show file tree
Hide file tree
Showing 48 changed files with 12,780 additions and 100 deletions.
1 change: 1 addition & 0 deletions .github/workflows/application-status-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
required: true
type: choice
options:
- dev
- test
- prod
tagname:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/application-status-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
paths:
- "apps/application-status/**"


defaults:
run:
shell: bash
Expand Down Expand Up @@ -42,6 +41,9 @@ jobs:
- name: Install dependencies
run: |
pnpm install
- name: build
run: |
pnpm run build-check
- name: Linting
run: |
pnpm run lint
Expand All @@ -66,9 +68,12 @@ jobs:
- name: Install dependencies
run: |
pnpm install
- name: build
run: |
pnpm run build-check
- name: Testing
run: |
pnpm run test
pnpm run test --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -95,4 +100,7 @@ jobs:
version: 8
- name: Install dependencies
run: |
pnpm run build
pnpm install
- name: run test
run: |
pnpm run build-check
3 changes: 3 additions & 0 deletions apps/application-status/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ZENHUB_APIKEY
ENTITIES
NAMETEAMSPACE
12 changes: 12 additions & 0 deletions apps/application-status/apollo.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// apollo.config.js
module.exports = {
client: {
service: {
name: 'release-notes',
// URL to the GraphQL API
url: 'https://api.zenhub.com/public/graphql'
},
// Files processed by the extension
includes: ['src/**/*.vue', 'src/**/*.ts']
}
}
2 changes: 1 addition & 1 deletion apps/application-status/app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<NuxtWelcome />
<NuxtPage />
</div>
</template>
45 changes: 45 additions & 0 deletions apps/application-status/assets/css/BCSans.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@font-face {
font-family: 'BCSans';
font-style: normal;
font-weight: 400;
src: url('../fonts/BCSans-Regular_2f.woff2') format('woff2'),
/* Optimized for very modern browsers */
url('../fonts/BCSans-Regular_2f.woff') format('woff'),
local('BCSans');
/* Modern Browsers */
font-display: swap;
}

@font-face {
font-family: 'BCSans';
font-style: italic;
src: url('../fonts/BCSans-Italic_2f.woff2') format('woff2'),
/* Optimized for very modern browsers */
url('../fonts/BCSans-Italic_2f.woff') format('woff'),
local('BCSans');
/* Modern Browsers */
font-display: swap;
}

@font-face {
font-family: 'BCSans';
font-weight: 700;
src: url('../fonts/BCSans-Bold_2f.woff2') format('woff2'),
/* Optimized for very modern browsers */
url('../fonts/BCSans-Bold_2f.woff') format('woff'),
local('BCSans');
/* Modern Browsers */
font-display: swap;
}

@font-face {
font-family: 'BCSans';
font-style: italic;
font-weight: 700;
src: url('../fonts/BCSans-BoldItalic_2f.woff2') format('woff2'),
/* Optimized for very modern browsers */
url('../fonts/BCSans-BoldItalic_2f.woff') format('woff'),
local('BCSans');
/* Modern Browsers */
font-display: swap;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@

.btn {
@apply p-4;
}

html {
font-family: "BCSans";
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
33 changes: 33 additions & 0 deletions apps/application-status/components/ButtonComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<button type="button" className="buttonClasses">
{{ text }}
</button>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue';
export default defineComponent({
props: {
text: {
type: String,
required: true,
},
},
});
</script>

<style>
.buttonClasses {
width: 88px ;
height: 34px;
border-radius: 4px;
background-color: #1669bb;
background-size: cover;
font-size: 14px;
color: #ffffff;
text-decoration: none solid rgb(255, 255, 255);
text-align: center;
}
</style>
28 changes: 28 additions & 0 deletions apps/application-status/components/navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<NuxtLink to="https://www.bcregistry.gov.bc.ca/">
<div class="rec">
<img src="../assets/images/gov_bc_logo_horiz.b6e98a7.png" alt="Logo">
<h2>BC Registries and Online Services</h2>
</div>
</NuxtLink >
</template>

<style>
.rec {
height: 53px;
color: white;
background-color: #003366;
display: flex ;
}
.rec > img {
margin-left: 2.5%;
resize: both;
}
.rec > h2 {
flex-direction: column;
margin-left: 20px;
align-self: center;
}
</style>
Empty file.
20 changes: 20 additions & 0 deletions apps/application-status/composables/getClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ApolloClient, InMemoryCache } from '@apollo/client/core'

export function getClient () {
// Get the API key from environment variables
const config = useRuntimeConfig()
const apiKey = config.public.zenhubAPI
if (!apiKey) {
console.error('API key is missing in the environment variables.')
process.exit(1) // Exit the application if the API key is missing
}

const client = new ApolloClient({
uri: 'https://api.zenhub.com/public/graphql',
cache: new InMemoryCache(),
headers: {
authorization: `Bearer ${apiKey}`
}
})
return client
}
34 changes: 34 additions & 0 deletions apps/application-status/composables/getReleases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { gql } from '@apollo/client/core'
import { getClient } from './getClient'

export async function getReleases (
workspaceID: string
) {
const client = getClient()
try {
const result = await client.query({
query: gql`
query Workspace($workspaceID: ID!) {
workspace(id: $workspaceID) {
releases (last: 100){
totalCount
nodes {
closedAt
issues {
totalCount
}
}
}
}
}
`,
variables: {
workspaceID
}
})
// console.log(result.data.workspace.sprints)
return result.data.workspace.releases
} catch (error) {
console.log(error)
}
}
38 changes: 38 additions & 0 deletions apps/application-status/composables/getSprint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { gql } from '@apollo/client/core'
import { getClient } from './getClient'

export async function getSprint (
workspaceID: string
) {
const client = getClient()
try {
const result = await client.query({
query: gql`
query Workspace($workspaceID: ID!) {
workspace(id: $workspaceID) {
activeSprint {
closedIssuesCount
completedPoints
createdAt
description
endAt
id
name
startAt
state
totalPoints
updatedAt
}
}
}
`,
variables: {
workspaceID
}
})
// console.log(result.data.workspace.sprints)
return result.data.workspace.activeSprint
} catch (error) {
console.log(error)
}
}
Empty file.
31 changes: 31 additions & 0 deletions apps/application-status/helper/castingResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Sprint } from '~/interface/interfaces'

export function castingSprint (sprint: any, noReleases: any) {
const res: Sprint = {
closedIssuesCount: sprint.closedIssuesCount,
completedPoints: sprint.completedPoints,
createdAt: sprint.createdAt,
description: sprint.description,
endAt: sprint.endAt,
id: sprint.id,
name: sprint.name,
startAt: sprint.startAt,
state: sprint.state,
totalPoints: sprint.totalPoints,
updatedAt: sprint.updatedAt,
numberOfRelease: noReleases
}
return res
}

export function castingReleases (releases: any) {
const res = []
for (let i = 0; i < releases.length; i++) {
const release = releases[i]
res.push({
closeAt: release.closeAt,
issues: release.issues.totalCount
})
}
return res
}
13 changes: 13 additions & 0 deletions apps/application-status/helper/filterRelease.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function filterReleases (releases: any, startAt: any, endAt: any) {
const releasesWithinDateRange =
releases.nodes.filter((release: any) => {
const closedAt = new Date(release.closedAt)
const startDate = new Date(startAt)
const endDate = new Date(endAt)

return closedAt >= startDate && closedAt <= endDate
})
return releasesWithinDateRange
}

export default filterReleases
26 changes: 26 additions & 0 deletions apps/application-status/helper/getData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import filterReleases from './filterRelease'
import { castingReleases, castingSprint } from './castingResponse'
import { Response } from '~/interface/interfaces'
import { getSprint } from '~/composables/getSprint'
import { getReleases } from '~/composables/getReleases'

export default async function getData (boardID: any) {
const sprint = await getSprint(boardID)
// console.log(sprint)
const releases = await getReleases(boardID)
// console.log(releases)
const releasesInRange = filterReleases(
releases,
sprint.startAt,
sprint.endAt
)
// console.log(releasesInRange)
const castedSprint = castingSprint(sprint, releasesInRange.length)
// console.log(castedSprint)
const castedReleases = castingReleases(releasesInRange)
const res: Response = {
sprint: castedSprint,
releases: castedReleases
}
return res
}
24 changes: 24 additions & 0 deletions apps/application-status/interface/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export interface Release {
closeAt: string
issues: number
}

export interface Sprint {
closedIssuesCount: number
completedPoints: number
createdAt: string
description: string
endAt: string
id: string
name: string
startAt: string
state: string
totalPoints: number
updatedAt: string
numberOfRelease: number
}

export interface Response {
sprint: Sprint
releases: Release[]
}
Empty file.
Loading

0 comments on commit e426c38

Please sign in to comment.