Skip to content

Commit 9264d98

Browse files
Adding Ad Hoc Data Source solution (GQI) (SkylineCommunications#22)
* Adding gitignore * Update version + small cleanup of csproj * Add ad hoc data source solution * Update working/templates/gqi-ad-hoc-data-source-solution/CompanionFiles/Skyline DataMiner/AboutThisFolder.md Co-authored-by: Jan Staelens <jan.staelens@skyline.be> * CR remarks $NAMESPACE$ (also class name) will now be PascalCase instead. Change has been propagated to the other templates as well. Added existing aka link for more general information about creating data sources. Fix indentation (tabs to spaces) * CR remark Removed Dlls folder as this is not possible for GQI stuff for now * Missing a "." in the new xml comments. Added a few words and a "." so it doesn't start with style warnings. * CR remarks from mail Added default values for the name (Also done for connector, automation & user defined api) Namespace has been changed to filter out some invalid chars, but nothing extra. Will be properly tackled in another task. Swapped 2 methods around (OnStopUpdates & OnDestroy) Updated some tooltips * CR remarks from mail --------- Co-authored-by: Jan Staelens <jan.staelens@skyline.be>
1 parent 62a4be4 commit 9264d98

File tree

21 files changed

+1426
-69
lines changed

21 files changed

+1426
-69
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/bin/*
2+
**/obj/*

working/templatepack.csproj

+15-25
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
<PropertyGroup>
44
<PackageType>template</PackageType>
5-
<PackageVersion>1.0.13</PackageVersion>
5+
<PackageVersion>1.0.14</PackageVersion>
66
<PackageId>Skyline.DataMiner.VisualStudioTemplates</PackageId>
77
<Title>DataMiner DotNet Templates</Title>
88
<Authors>SkylineCommunications</Authors>
99
<Description>This package contains DataMiner dotnet templates for use in Visual Studio and the dotnet CLI.</Description>
1010
<PackageTags>dotnet-new;templates;DataMiner</PackageTags>
11-
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
12-
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
13-
<PackageIcon>Icon.png</PackageIcon>
14-
<PackageReadmeFile>README.md</PackageReadmeFile>
15-
11+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
12+
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
13+
<PackageIcon>Icon.png</PackageIcon>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
1615
<TargetFramework>netstandard2.0</TargetFramework>
1716
<IncludeContentInPack>true</IncludeContentInPack>
1817
<IncludeBuildOutput>false</IncludeBuildOutput>
@@ -21,24 +20,15 @@
2120
<NoDefaultExcludes>true</NoDefaultExcludes>
2221
</PropertyGroup>
2322

24-
<ItemGroup>
25-
<None Include="..\nuget\Icon.png">
26-
<Pack>True</Pack>
27-
<PackagePath>\</PackagePath>
28-
</None>
29-
<None Include="..\LICENSE.txt">
30-
<Pack>True</Pack>
31-
<PackagePath>\</PackagePath>
32-
</None>
33-
<None Include="..\README.md">
34-
<Pack>True</Pack>
35-
<PackagePath>\</PackagePath>
36-
</None>
37-
</ItemGroup>
38-
39-
<ItemGroup>
40-
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
41-
<Compile Remove="**\*" />
42-
</ItemGroup>
23+
<ItemGroup>
24+
<None Include="..\nuget\Icon.png" Pack="true" PackagePath="" />
25+
<None Include="..\LICENSE.txt" Pack="true" PackagePath="" />
26+
<None Include="..\README.md" Pack="true" PackagePath="" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
31+
<Compile Remove="**\*" />
32+
</ItemGroup>
4333

4434
</Project>

working/templates/automationsolution/.template_config/template.json

+20-22
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"author": "Skyline Communications",
44
"classifications": [ "DataMiner" ],
55
"tags": {
6-
"language": "C#",
7-
"type": "solution",
8-
"editorTreatAs":"solution"
6+
"language": "C#",
7+
"type": "solution",
8+
"editorTreatAs":"solution"
99
},
1010
"identity": "Skyline.DataMiner.AutomationScript.Solution.Template",
1111
"name": "DataMiner Automation Script Solution",
@@ -15,11 +15,11 @@
1515
"ScriptName": {
1616
"type": "parameter",
1717
"datatype": "string",
18-
"defaultValue": "",
18+
"defaultValue": "AutomationScript1",
1919
"replaces": "$SCRIPTNAME$",
20-
"FileRename": "$SCRIPTNAME$",
20+
"FileRename": "$SCRIPTNAME$",
2121
"description": "The name of the Automation script.",
22-
"isRequired": true
22+
"isRequired": true
2323
},
2424
"Author": {
2525
"type": "parameter",
@@ -35,22 +35,20 @@
3535
"parameters": {
3636
"format": "dd/MM/yyyy"
3737
}
38-
},
38+
},
3939
"Namespace": {
40-
"type": "generated",
41-
"generator": "regex",
42-
"dataType": "string",
43-
"replaces": "$NAMESPACE$",
44-
"parameters": {
45-
"source": "ScriptName",
46-
"steps": [
47-
{
48-
"regex": "[\\s+-]",
49-
"replacement": "_"
50-
}
51-
]
52-
}
53-
}
40+
"type": "derived",
41+
"valueSource": "ScriptName",
42+
"valueTransform": "invalidChars",
43+
"replaces": "$NAMESPACE$"
44+
}
45+
},
46+
"forms": {
47+
"invalidChars": {
48+
"identifier": "replace",
49+
"pattern": "([\\-_\\.\\ ])",
50+
"replacement": ""
51+
}
5452
},
5553
"guids": [
5654
"30ECB5E3-395D-4674-9EF8-8B07C6B1AD50",
@@ -64,7 +62,7 @@
6462
"2BF9AFEF-11BA-4037-827E-A7C4408DD5E0",
6563
"54EEBDD9-1D2F-41E5-9654-EB47544FF03D",
6664
"37D054BA-8A8F-489C-B707-D45D9F6AF17E",
67-
"F2683535-3B81-4454-9E99-120E5016BBCE"
65+
"F2683535-3B81-4454-9E99-120E5016BBCE"
6866
],
6967
"sources": [
7068
{

working/templates/connectorsolution/.template_config/template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"ConnectorName": {
1616
"type": "parameter",
1717
"datatype": "string",
18-
"defaultValue": "",
18+
"defaultValue": "Connector1",
1919
"replaces": "$CONNECTORNAME$",
2020
"description": "The name of the connector.",
2121
"isRequired": true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<DMSScript options="272" xmlns="http://www.skyline.be/automation">
3+
<Name>$SCRIPTNAME$</Name>
4+
<Description></Description>
5+
<Type>Automation</Type>
6+
<Author>$AUTHOR$</Author>
7+
<CheckSets>FALSE</CheckSets>
8+
<Folder></Folder>
9+
10+
<Protocols>
11+
</Protocols>
12+
13+
<Memory>
14+
</Memory>
15+
16+
<Parameters>
17+
</Parameters>
18+
19+
<Script>
20+
<Exe id="1" type="csharp">
21+
<Value><![CDATA[[Project:$SCRIPTNAME$_1]]]></Value>
22+
<!--<Param type="debug">true</Param>-->
23+
<Param type="preCompile">true</Param>
24+
<Param type="libraryName">$SCRIPTNAME$</Param>
25+
<Message></Message>
26+
</Exe>
27+
</Script>
28+
</DMSScript>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
namespace $NAMESPACE$_1
2+
{
3+
using System;
4+
using Skyline.DataMiner.Analytics.GenericInterface;
5+
6+
/// <summary>
7+
/// Represents a data source.
8+
/// See: https://aka.dataminer.services/gqi-external-data-source for a complete example.
9+
/// </summary>
10+
[GQIMetaData(Name = "$SCRIPTNAME$")]
11+
public sealed class $NAMESPACE$ : IGQIDataSource
12+
#if (IGQIOnInit)
13+
, IGQIOnInit
14+
#endif
15+
#if (IGQIInputArguments)
16+
, IGQIInputArguments
17+
#endif
18+
#if (IGQIOnPrepareFetch)
19+
, IGQIOnPrepareFetch
20+
#endif
21+
#if (IGQIUpdateable)
22+
, IGQIUpdateable
23+
#endif
24+
#if (IGQIOnDestroy)
25+
, IGQIOnDestroy
26+
#endif
27+
{
28+
#if (IGQIOnInit)
29+
public OnInitOutputArgs OnInit(OnInitInputArgs args)
30+
{
31+
// Initialize the data source
32+
// See: https://aka.dataminer.services/igqioninit-oninit
33+
return default;
34+
}
35+
36+
#endif
37+
#if (IGQIInputArguments)
38+
public GQIArgument[] GetInputArguments()
39+
{
40+
// Define data source input arguments
41+
// See: https://aka.dataminer.services/igqiinputarguments-getinputarguments
42+
return Array.Empty<GQIArgument>();
43+
}
44+
45+
public OnArgumentsProcessedOutputArgs OnArgumentsProcessed(OnArgumentsProcessedInputArgs args)
46+
{
47+
// Process input argument values
48+
// See: https://aka.dataminer.services/igqiinputarguments-onargumentsprocessed
49+
return default;
50+
}
51+
52+
#endif
53+
public GQIColumn[] GetColumns()
54+
{
55+
// Define data source columns
56+
// See: https://aka.dataminer.services/igqidatasource-getcolumns
57+
return Array.Empty<GQIColumn>();
58+
}
59+
#if (IGQIOnPrepareFetch)
60+
61+
public OnPrepareFetchOutputArgs OnPrepareFetch(OnPrepareFetchInputArgs args)
62+
{
63+
// Prepare data source for fetching
64+
// See: https://aka.dataminer.services/igqionpreparefetch-onpreparefetch
65+
return default;
66+
}
67+
#endif
68+
#if (IGQIUpdateable)
69+
70+
public void OnStartUpdates(IGQIUpdater updater)
71+
{
72+
// Enable the data source to send updates
73+
// See: https://aka.dataminer.services/igqiupdateable-onstartupdates
74+
}
75+
#endif
76+
77+
public GQIPage GetNextPage(GetNextPageInputArgs args)
78+
{
79+
// Define data source rows
80+
// See: https://aka.dataminer.services/igqidatasource-getnextpage
81+
return new GQIPage(Array.Empty<GQIRow>())
82+
{
83+
HasNextPage = false,
84+
};
85+
}
86+
#if (IGQIUpdateable)
87+
88+
public void OnStopUpdates()
89+
{
90+
// Stop sending updates
91+
// See: https://aka.dataminer.services/igqiupdateable-onstopupdates
92+
}
93+
#endif
94+
#if (IGQIOnDestroy)
95+
96+
public OnDestroyOutputArgs OnDestroy(OnDestroyInputArgs args)
97+
{
98+
// Clean up the data source
99+
// See: https://aka.dataminer.services/igqiondestroy-ondestroy
100+
return default;
101+
}
102+
#endif
103+
}
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net48</TargetFramework>
4+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
5+
</PropertyGroup>
6+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
7+
<DebugType>full</DebugType>
8+
<CodeAnalysisRuleSet>..\Internal\Code Analysis\qaction-debug.ruleset</CodeAnalysisRuleSet>
9+
</PropertyGroup>
10+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
11+
<DebugType>pdbonly</DebugType>
12+
<CodeAnalysisRuleSet>..\Internal\Code Analysis\qaction-release.ruleset</CodeAnalysisRuleSet>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<DefineConstants>$(DefineConstants);DCFv1;DBInfo;ALARM_SQUASHING</DefineConstants>
16+
</PropertyGroup>
17+
<ItemGroup>
18+
<!--#if (IGQIUpdateable)-->
19+
<PackageReference Include="Skyline.DataMiner.Dev.Automation" Version="10.4.4.2" />
20+
<!--#else-->
21+
<PackageReference Include="Skyline.DataMiner.Dev.Automation" Version="10.2.5.5" />
22+
<!--#endif-->
23+
</ItemGroup>
24+
<ProjectExtensions>
25+
<VisualStudio>
26+
<UserProperties DisLinkedXmlFile="..\$SCRIPTNAME$.xml" DisProjectType="automationScriptProject" DisLinkId="1" />
27+
</VisualStudio>
28+
</ProjectExtensions>
29+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json.schemastore.org/dotnetcli.host",
3+
"symbolInfo": {
4+
"ScriptName": {
5+
"longName": "ad-hoc-data-source-name",
6+
"shortName": "name"
7+
},
8+
"Author": {
9+
"longName": "author",
10+
"shortName": "auth"
11+
},
12+
"IGQIOnInit": {
13+
"shortName": "on-init"
14+
},
15+
"IGQIInputArguments": {
16+
"shortName": "input-arguments"
17+
},
18+
"IGQIOnPrepareFetch": {
19+
"shortName": "on-prepare-fetch"
20+
},
21+
"IGQIUpdateable": {
22+
"shortName": "updateable"
23+
},
24+
"IGQIOnDestroy": {
25+
"shortName": "on-destroy"
26+
}
27+
}
28+
}
Loading

0 commit comments

Comments
 (0)