Skip to content

Commit

Permalink
Updates to Readme and Pipline
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Wilson committed Nov 25, 2021
1 parent 25ab0a8 commit dfb478f
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 16 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Richard A Wilson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion NZCOVIDPass/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<control namespace="RAW" constructor="NZCOVIDPass" version="0.0.8" display-name-key="NZ COVID Pass" description-key="NZCOVIDPass description" control-type="standard" preview-image="img/preview.png">
<control namespace="RAW" constructor="NZCOVIDPass" version="0.0.10" display-name-key="NZ COVID Pass" description-key="NZCOVIDPass description" control-type="standard" preview-image="img/preview.png">
<property name="QRCode" display-name-key="QR Code" description-key="The contents of the QR Code" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="offlineMode" display-name-key="Offline Mode" description-key="If offline mode is set to true the component will attempt to validate the COVID-19 Pass using a prefetched DID document, otherwise it will attempt to resolve the DID document from the MoH." usage="input" required="false" of-type="TwoOptions" default-value="0" />
<property name="testMode" display-name-key="Test Mode" description-key="Allows you to set the control into test mode which will ensure that the sample QR code from https://nzcp.covid19.health.nz/#valid-worked-example will validate." usage="input" required="true" of-type="TwoOptions" default-value="0" />
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# NZ COVID Pass PCF Component
This PCF component utilizes [nzcp-js](https://github.com/vaxxnz/nzcp-js) to provide NZ Covid Pass Validation within a Canvas Power App.

## Installation

Make sure you have enabled PCF components for Canvas apps in your environment. For instructions on that [Click Here](https://docs.microsoft.com/en-us/powerapps/developer/component-framework/component-framework-for-canvas-apps)

Install the managed solution provided in the Release are of this repo.

## Control Properties
| Name | Mode | Type | Description | Default |
|---|---|---|---| --- |
|QR Codekd|Input| SingleLine.Text | The contents of the QR Code||
|Offline Mode|Input| Boolean | If offline mode is set to true the component will attempt to validate the COVID-19 Pass using a prefetched DID document, otherwise it will attempt to resolve the DID document from the MoH.|false|
|Test Mode|Input|Boolean|Allows you to set the control into test mode which will ensure that the sample QR code from https://nzcp.covid19.health.nz/#valid-worked-example will validate.|false|
|Success|Output|Boolean|Provides the outcome of the COVID Pass validation|false|
|Family Name|Output|SingleLine.Text|Pass holders family name||
|Given Name|Output|SingleLine.Text|Pass holders given name||
|Date of Birth|Output|SingleLine.Text|Pass holders date of birth||
|Violation Message|Output|SingleLine.Text|Friendly Error Message||
|Violation Section|Output|SingleLine.Text|Section of official specs under violation||
|Violation Link|Output|SingleLine.Text|Link to specifications breached||
|Violation Description|Output|SingleLine.Text|Simplified error message||

## Sample App
A sample app is included under the Sample folder of this project which you can import into your environment once you have deployed the PCF solution.
Binary file added Sample/NZ COVID Pass Scanner.msapp
Binary file not shown.
17 changes: 3 additions & 14 deletions Solution/NZCOVIDPass/NZCOVIDPass.cdsproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props')" />

<PropertyGroup>
<ProjectGuid>b4b8c0c9-a35f-487e-ba05-821b39279e57</ProjectGuid>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
Expand All @@ -15,18 +13,13 @@
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<SolutionRootPath>src</SolutionRootPath>
</PropertyGroup>

<!-- Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
<PropertyGroup>
<SolutionPackageType>Managed</SolutionPackageType>
<SolutionPackageType>Both</SolutionPackageType>
</PropertyGroup>
-->

<ItemGroup>
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
Expand All @@ -35,19 +28,15 @@
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
<Content Include="$(SolutionPackageZipFilePath)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\nzcp-pcf.pcfproj" />
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets')" />

</Project>
</Project>
2 changes: 1 addition & 1 deletion Solution/NZCOVIDPass/src/Other/Solution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LocalizedName description="NZCOVIDPass" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.0.3</Version>
<Version>1.0.5</Version>
<!-- Solution Package Type: Unmanaged(0)/Managed(1)/Both(2)-->
<Managed>2</Managed>
<Publisher>
Expand Down
70 changes: 70 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Build the NZ COVID Pass project utilizing npm and MSBuild
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
name: $(BuildVersionMajor).$(BuildVersionMinor).$(BuildVersionPatch).$(BuildVersionRevision)

trigger: none
# branches:
# include:
# - master
# paths:
# exclude:
# - *.md
# - *.yml

pr: none

variables:
#BUILD VERSION INFORMATION
BuildVersionMajor: 1
BuildVersionMinor: 1
BuildVersionPatch: 0
#sets a counter for the version number changing the Major or Minor version will reset this counter
#back to it's seed value
BuildVersionRevision: $[counter(format('{0}.{1}.{2}', variables['BuildVersionMajor'], variables['BuildVersionMinor'],variables['BuildVersionPatch']), 1)]

pool:
vmImage: 'windows-latest'

#COLOR PICKER

steps:
#Run npm install to get all required resources for the projectl
- task: Npm@1
inputs:
command: 'install'
workingDir: './'

#PowerApps controls can be build using MSBuild and do not require the PCF CLI to be downloaded.
#The build command will utilize NuGet to go out and get all the resource packages it needs.
- task: MSBuild@1
inputs:
solution: '**/*.cdsproj'
msbuildArguments: '/t:build /p:Configuration=Release /restore'

#Copy the solution files to the build artifacts directory.
- task: CopyFiles@2
inputs:
SourceFolder: './Solution/NZCOVIDPass/bin/Release/'
Contents: '*.zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

#Publish the build artifacts.
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'

#GitHub Release
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables['Release'], true))
inputs:
gitHubConnection: 'github.com_rwilson504'
repositoryName: 'rwilson504/nzcp-pcf'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: '$(Build.BuildNumber)'
title: '$(Build.BuildNumber)'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'

0 comments on commit dfb478f

Please sign in to comment.