-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from rwilson504/BrowserInfo
Browser info
- Loading branch information
Showing
26 changed files
with
6,659 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# generated directory | ||
**/generated | ||
|
||
# output directory | ||
/out | ||
|
||
# msbuild output directories | ||
/bin | ||
/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
RUNTIME INFO | ||
================ | ||
|
||
This component will allow you to get additional information about the browser and device running your Canvas App is running in. | ||
|
||
![RuntimeInfo](./images/RuntimeInfo.png) | ||
|
||
## Installation/Usage | ||
|
||
* 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) | ||
|
||
* In the Power Apps Editor ribbon navigate to **Insert -> Custom -> Import Components** | ||
![Import Component](./images/ImportComponent.png) | ||
|
||
* On the Import Component screen select the **Code** tab and Import the **RAW! Runtime Info** | ||
![Import Component](./images/ImportComponentFromCode.png) | ||
|
||
* Open the **Code components** area in the Insert panel and add the **RAW! Runtime Info** component to the form. The control itself will just be a blank space on the form. It is suggested you rename the Component you dropped on the form to make it easier to access. | ||
|
||
![Rename Component](./images/EditComponentName.png) | ||
|
||
![Rename Component](./images/EditComponentNameUpdateName.png) | ||
|
||
* This component does not need any properties to be set. Instead it has a output properties which provide you with the details of the browser/device your Canvas app is running in. For additional details on the values which can be returned with these properties check out the [UAParser.js](https://github.com/faisalman/ua-parser-js) website which this component is build off of. | ||
* Browser | ||
* BrowserVersion | ||
* Engine | ||
* EngineVersion | ||
* DeviceModel | ||
* DeviceType | ||
* DeviceVendor | ||
* OperatingSystem | ||
* OperatingSystemVersion | ||
* CPUArchitecture | ||
* UserAgent | ||
|
||
* Once the control is on the for you can utilize the output parameters withing controls, functions, variables, etc. | ||
![Component Outputs](./images/UtilizePropertyInTextField.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?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> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> | ||
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.props')"/> | ||
|
||
<PropertyGroup> | ||
<Name>RuntimeInfo</Name> | ||
<ProjectGuid>031f9111-8394-4483-8db8-8cffac36460d</ProjectGuid> | ||
<OutputPath>$(MSBuildThisFileDirectory)out\controls</OutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> | ||
<!--Remove TargetFramework when this is available in 16.1--> | ||
<TargetFramework>net462</TargetFramework> | ||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.PowerApps.MSBuild.Pcf" Version="1.*"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**"/> | ||
<ExcludeDirectories Include="$(OutputPath)\**"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.pcfproj"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.pcfproj.user"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln"/> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\node_modules\**"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)"/> | ||
</ItemGroup> | ||
|
||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" /> | ||
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Pcf.targets')"/> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest> | ||
<control namespace="RAW" constructor="RuntimeInfo" version="0.0.7" display-name-key="RAW! Runtime Info" description-key="Allows you to get some of the runtime information for the current running app." control-type="standard"> | ||
<!-- property node identifies a specific, configurable piece of data that the control expects from CDS --> | ||
<property name="UserAgent" display-name-key="UserAgent" description-key="Provides the User Agent string" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="Browser" display-name-key="Browser" description-key="Browser Name" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="BrowserVersion" display-name-key="BrowserVersion" description-key="Browser Version" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="OperatingSystem" display-name-key="OperatingSystem" description-key="Operating System" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="OperatingSystemVersion" display-name-key="OperatingSystemVersion" description-key="Operating System Version" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="DeviceModel" display-name-key="DeviceModel" description-key="Device Model" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="DeviceType" display-name-key="DeviceModel" description-key="Device Model" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="DeviceVendor" display-name-key="DeviceVendor" description-key="Device Vendor" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="Engine" display-name-key="Engine" description-key="Engine Name" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="EngineVersion" display-name-key="EngineVersion" description-key="Engine Version" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<property name="CPUArchitecture" display-name-key="CPUArchitecture" description-key="CPU Architecture" usage="output" of-type="SingleLine.Text" required="false" /> | ||
<resources> | ||
<code path="index.ts" order="1" /> | ||
</resources> | ||
</control> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'browser-info'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {IInputs, IOutputs} from "./generated/ManifestTypes"; | ||
import {UAParser} from 'ua-parser-js'; | ||
export class RuntimeInfo implements ComponentFramework.StandardControl<IInputs, IOutputs> { | ||
|
||
private _uaResults: IUAParser.IResult; | ||
private _notifyOutputChanged: () => void; | ||
|
||
constructor() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Used to initialize the control instance. Controls can kick off remote server calls and other initialization actions here. | ||
* Data-set values are not initialized here, use updateView. | ||
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to property names defined in the manifest, as well as utility functions. | ||
* @param notifyOutputChanged A callback method to alert the framework that the control has new outputs ready to be retrieved asynchronously. | ||
* @param state A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling 'setControlState' in the Mode interface. | ||
* @param container If a control is marked control-type='standard', it will receive an empty div element within which it can render its content. | ||
*/ | ||
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement) | ||
{ | ||
this._notifyOutputChanged = notifyOutputChanged; | ||
} | ||
|
||
|
||
/** | ||
* Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc. | ||
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions | ||
*/ | ||
public updateView(context: ComponentFramework.Context<IInputs>): void | ||
{ | ||
let ua = new UAParser(); | ||
this._uaResults = ua.getResult(); | ||
|
||
this._notifyOutputChanged(); | ||
} | ||
|
||
/** | ||
* It is called by the framework prior to a control receiving new data. | ||
* @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output” | ||
*/ | ||
public getOutputs(): IOutputs | ||
{ | ||
return { | ||
UserAgent: this._uaResults.ua || '', | ||
Browser: this._uaResults.browser.name || '', | ||
BrowserVersion: this._uaResults.browser.version || '', | ||
Engine: this._uaResults.engine.name || '', | ||
EngineVersion: this._uaResults.engine.version || '', | ||
OperatingSystem: this._uaResults.os.name || '', | ||
OperatingSystemVersion: this._uaResults.os.version || '', | ||
DeviceModel: this._uaResults.device.model || '', | ||
DeviceType: this._uaResults.device.type || '', | ||
DeviceVendor: this._uaResults.device.vendor || '', | ||
CPUArchitecture: this._uaResults.cpu.architecture || '' | ||
}; | ||
} | ||
|
||
/** | ||
* Called when the control is to be removed from the DOM tree. Controls should use this call for cleanup. | ||
* i.e. cancelling any pending remote calls, removing listeners, etc. | ||
*/ | ||
public destroy(): void | ||
{ | ||
// Add code to cleanup control if necessary | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# msbuild output directories | ||
/bin | ||
/obj |
49 changes: 49 additions & 0 deletions
49
RuntimeInfo/Solution/RuntimeInfoComponent/RuntimeInfoComponent.cdsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?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> | ||
</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>d33d6ff1-df82-46ee-acaa-637acc509723</ProjectGuid> | ||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> | ||
<!--Remove TargetFramework when this is available in 16.1--> | ||
<TargetFramework>net462</TargetFramework> | ||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> | ||
<SolutionRootPath>src</SolutionRootPath> | ||
</PropertyGroup> | ||
|
||
|
||
<PropertyGroup> | ||
<SolutionPackageType>Both</SolutionPackageType> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" /> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" /> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**" /> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj" /> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" /> | ||
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\RuntimeInfo.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> |
18 changes: 18 additions & 0 deletions
18
RuntimeInfo/Solution/RuntimeInfoComponent/src/Other/Customizations.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<Entities /> | ||
<Roles /> | ||
<Workflows /> | ||
<FieldSecurityProfiles /> | ||
<Templates /> | ||
<EntityMaps /> | ||
<EntityRelationships /> | ||
<OrganizationSettings /> | ||
<optionsets /> | ||
<CustomControls /> | ||
<SolutionPluginAssemblies /> | ||
<EntityDataProviders /> | ||
<Languages> | ||
<Language>1033</Language> | ||
</Languages> | ||
</ImportExportXml> |
2 changes: 2 additions & 0 deletions
2
RuntimeInfo/Solution/RuntimeInfoComponent/src/Other/Relationships.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EntityRelationships xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> |
Oops, something went wrong.