Skip to content

Commit 68ec515

Browse files
committed
Merge branch 'release/4.1.0'
2 parents 56a7f5a + 7f290d0 commit 68ec515

30 files changed

Lines changed: 713 additions & 91 deletions

OnTopic.Editor.AspNetCore.Host/OnTopic.Editor.AspNetCore.Host.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
<UserSecretsId>aff0d52c-eab2-4c07-88b2-5af34649f874</UserSecretsId>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="OnTopic" Version="4.0.0" />
11-
<PackageReference Include="OnTopic.ViewModels" Version="4.0.0" />
12-
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.0.0" />
13-
<PackageReference Include="OnTopic.Data.Caching" Version="4.0.0" />
14-
<PackageReference Include="OnTopic.Data.Sql" Version="4.0.0" />
15-
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.2.0" />
16-
<PackageReference Include="Newtonsoft.Json" version="12.0.2" />
10+
<PackageReference Include="OnTopic" Version="4.1.0" />
11+
<PackageReference Include="OnTopic.ViewModels" Version="4.1.0" />
12+
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.1.0" />
13+
<PackageReference Include="OnTopic.Data.Caching" Version="4.1.0" />
14+
<PackageReference Include="OnTopic.Data.Sql" Version="4.1.0" />
1715
</ItemGroup>
1816

1917
<ItemGroup>

OnTopic.Editor.AspNetCore.Host/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace OnTopicTest {
1616
/// The <see cref="Program"/> class—and it's <see cref="Program.Main(String[])"/> method—represent the entry point into the
1717
/// ASP.NET Core web application.
1818
/// </summary>
19-
public class Program {
19+
public static class Program {
2020

2121
/*==========================================================================================================================
2222
| METHOD: MAIN
@@ -37,7 +37,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
3737
.CreateDefaultBuilder(args)
3838
.ConfigureWebHostDefaults(webBuilder => {
3939
webBuilder.UseStartup<Startup>();
40-
});
40+
});
4141

4242
} //Class
4343
} //Namespace

OnTopic.Editor.AspNetCore.Host/SampleActivator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class SampleActivator : IControllerActivator, IViewComponentActivator {
3737
private readonly ITopicRepository _topicRepository;
3838
private readonly IWebHostEnvironment _webHostEnvironment;
3939
private readonly StandardEditorComposer _standardEditorComposer;
40-
private readonly Topic _rootTopic;
4140

4241
/*==========================================================================================================================
4342
| CONSTRUCTOR
@@ -70,7 +69,7 @@ public SampleActivator(string connectionString, IWebHostEnvironment webHostEnvir
7069
_topicRepository = cachedTopicRepository;
7170
_typeLookupService = new EditorViewModelLookupService();
7271
_topicMappingService = new TopicMappingService(_topicRepository, _typeLookupService);
73-
_rootTopic = _topicRepository.Load();
72+
_ = _topicRepository.Load();
7473

7574
/*------------------------------------------------------------------------------------------------------------------------
7675
| Establish standard editor composer
@@ -120,7 +119,7 @@ public object Create(ViewComponentContext context) {
120119
/*------------------------------------------------------------------------------------------------------------------------
121120
| Configure and return appropriate view component
122121
\-----------------------------------------------------------------------------------------------------------------------*/
123-
if (_standardEditorComposer.IsEditorComponent(type)) {
122+
if (StandardEditorComposer.IsEditorComponent(type)) {
124123
return _standardEditorComposer.ActivateEditorComponent(type, _topicRepository);
125124
}
126125

OnTopic.Editor.AspNetCore.Host/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void ConfigureServices(IServiceCollection services) {
110110
/// Provides configuration the application. This method is called by the runtime to bootstrap the application
111111
/// configuration, including the HTTP pipeline.
112112
/// </summary>
113-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
113+
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
114114

115115
/*------------------------------------------------------------------------------------------------------------------------
116116
| Configure: Error Pages

OnTopic.Editor.AspNetCore.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
ProjectSection(SolutionItems) = preProject
1414
.gitignore = .gitignore
1515
GitVersion.yml = GitVersion.yml
16+
README.md = README.md
1617
EndProjectSection
1718
EndProject
1819
Global

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Editor/Components/ContentTypeList/Default.cshtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ else {
3737
<div class="ChildTopic">
3838
@if (Model.EnableModal == true) {
3939
<a onclick="initEditorModal('@Model.AttributeKey', '@Model.TopicList.LastOrDefault().Text', '@Model.TopicList.LastOrDefault().Value', @Model.OnModalClose); return false;" class="btn btn-info btn-sm">
40-
Add @Model.TopicList.LastOrDefault().Text
40+
<span class="fa fa-plus"></span>
41+
@Model.TopicList.LastOrDefault().Text
4142
</a>
4243
}
4344
else {
4445
<a href="@Model.TopicList.LastOrDefault().Value" class="btn btn-info btn-sm">
45-
Add @Model.TopicList.LastOrDefault().Text
46+
<span class="fa fa-plus"></span>
47+
@Model.TopicList.LastOrDefault().Text
4648
</a>
4749
}
4850
</div>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@model ExportViewModel
2+
3+
@{
4+
ViewBag.Title = "Export Topic";
5+
}
6+
7+
<form method="post">
8+
9+
<div id="Toolbar" class="toolbar">
10+
<!-- Action Buttons -->
11+
<div class="action buttons">
12+
<button type="submit" class="btn btn-primary btn-sm">Export</button>
13+
</div>
14+
</div>
15+
16+
<div id="FormArea" class="row form area">
17+
18+
<div class="col-lg-9 col-sm-12">
19+
20+
<h2>Export Options</h2>
21+
22+
<section class="attribute">
23+
<input type="checkbox" asp-for="ExportOptions.IncludeChildTopics" />
24+
<label asp-for="ExportOptions.IncludeChildTopics">Include Child Topics?</label>
25+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Recursively includes all child topics—including nested topics—in the export."></i>
26+
</section>
27+
28+
<section class="attribute">
29+
<input type="checkbox" asp-for="ExportOptions.IncludeNestedTopics" />
30+
<label asp-for="ExportOptions.IncludeNestedTopics">Include Nested Topics?</label>
31+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Includes nested topics that are part of the current topic to be included in the export."></i>
32+
</section>
33+
34+
<section class="attribute">
35+
<input type="checkbox" asp-for="ExportOptions.IncludeExternalReferences" />
36+
<label asp-for="ExportOptions.IncludeExternalReferences">Include External References?</label>
37+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Includes relationships even if the topic they are referencing falls outside the scope of the export."></i>
38+
</section>
39+
40+
</div>
41+
42+
@if (!Model.IsModal) {
43+
<div class="col-lg-3 callouts">
44+
<div class="callout topic-info">
45+
46+
<h3 class="h5">Topic Information</h3>
47+
<dl>
48+
<dt><i class="fa fa-cogs"></i> Content Type</dt>
49+
<dd><a href="/Configuration/ContentTypes/@Model.Topic.ContentType">@Model.Topic.ContentType</a></dd>
50+
<dt><i class="fa fa-database"></i> Topic ID</dt>
51+
<dd><a href="/Topic/@Model.Topic.Id/">@Model.Topic.Id</a></dd>
52+
<dt><i class="fa fa-eye"></i> Current</dt>
53+
<dd><a href="@Model.Topic.WebPath">View Page</a></dd>
54+
</dl>
55+
56+
</div>
57+
</div>
58+
}
59+
60+
</div>
61+
62+
</form>
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
@model ImportViewModel
2+
3+
@{
4+
ViewBag.Title = "Import Topic";
5+
}
6+
7+
<form method="post" enctype="multipart/form-data">
8+
9+
<div id="Toolbar" class="toolbar">
10+
<!-- Action Buttons -->
11+
<div class="action buttons">
12+
<button type="submit" class="btn btn-primary btn-sm">Import</button>
13+
</div>
14+
<ul id="DisplayGroupNavTabs" class="nav nav-tabs" role="tablist">
15+
<li class="nav-item">
16+
<a id="Tab_Options" class="nav-link active" href="#Group_Options" data-toggle="tab" role="tab" aria-controls="#Group_Options" aria-expanded="true">Options</a>
17+
</li>
18+
<li class="nav-item">
19+
<a id="Tab_LastModified" class="nav-link" href="#Group_LastModified" data-toggle="tab" role="tab" aria-controls="#Group_LastModified" aria-expanded="true">Attribution</a>
20+
</li>
21+
<li class="nav-item">
22+
<a id="Tab_Advanced" class="nav-link" href="#Group_Advanced" data-toggle="tab" role="tab" aria-controls="#Group_Advanced" aria-expanded="true">Advanced</a>
23+
</li>
24+
</ul>
25+
</div>
26+
27+
<div id="FormArea" class="row form area">
28+
29+
<div class="col-md-12">
30+
@if (Model.IsImported) {
31+
<div class="alert alert-primary" role="alert">
32+
The JSON file has been successfully imported and merged into the target database.
33+
</div>
34+
}
35+
<div asp-validation-summary="All"></div>
36+
</div>
37+
38+
<div class="col-lg-9 col-sm-12">
39+
<div id="DisplayGroupTabsContent" class="tab-content tab-validate">
40+
41+
<div id="Group_Options" class="tab-pane fade show active" role="tabpanel" aria-labelledby="Tab_Options">
42+
<section id="Section_Options">
43+
44+
<h2>Import Options</h2>
45+
46+
<h3>
47+
Source
48+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="The JSON file containing a previous export from a topic graph."></i>
49+
</h3>
50+
<section class="attribute">
51+
<input name="JsonFile" type="file" accept=".json" required />
52+
</section>
53+
54+
<h3>Strategy</h3>
55+
<section class="attribute">
56+
<label>
57+
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Add" /> Add
58+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Adds missing attributes; leaves existing attributes alone."></i>
59+
</label>
60+
<br />
61+
<label>
62+
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Merge" /> Merge
63+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Adds missing attributes; replaces existing attributes if the imported value is newer."></i>
64+
</label>
65+
<br />
66+
<label>
67+
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Overwrite" /> Overwrite
68+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Overwrites all attributes. Leaves unmatched attributes as is."></i>
69+
</label>
70+
<br />
71+
<label>
72+
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Replace" /> Replace
73+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Overwrites all attributes. Deletes unmatched attributes, relationships, and topics."></i>
74+
</label>
75+
</section>
76+
77+
</section>
78+
</div>
79+
80+
<div id="Group_LastModified" class="tab-pane fade" role="tabpanel" aria-labelledby="Tab_LastModified">
81+
<section id="Section_LastModified">
82+
83+
<h2>Attribution</h2>
84+
<p>
85+
Offers granular control over how the byline ("Last Modified By") and dateline ("Last Modified") are updated as part of the import process.
86+
</p>
87+
88+
<h3>Byline</h3>
89+
<section class="attribute">
90+
<label>
91+
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.Inherit" /> Use Import Strategy
92+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will treat the byline just like any other attribute, merging it according to the import strategy."></i>
93+
</label>
94+
<br />
95+
<label>
96+
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.TargetValue" /> Previous Value
97+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will always retain the existing byline, if present."></i>
98+
</label>
99+
<br />
100+
<label>
101+
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.Current" /> Current User (@(Context.User.Identity.Name?? "System"))
102+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Updates the byline to the current user, just like it would when manually updating a topic via the editor."></i>
103+
</label>
104+
<br />
105+
<label>
106+
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.System" /> System
107+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Updates the byline to 'System', which indicates that this was part of a system update and shouldn't be assigned to a specific contributor."></i>
108+
</label>
109+
</section>
110+
111+
<h3>Dateline</h3>
112+
<section class="attribute">
113+
<label>
114+
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.Inherit" /> Use Import Strategy
115+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will treat the dateline just like any other attribute, merging it according to the import strategy."></i>
116+
</label>
117+
<br />
118+
<label>
119+
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.TargetValue" /> Previous Value
120+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will always retain the existing last modified date, if present."></i>
121+
</label>
122+
<br />
123+
<label>
124+
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.Current" /> Current Time (@DateTime.Now.ToString("g"))
125+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Updates the dateline to the current time, just like it would when manually updating a topic via the editor."></i>
126+
</label>
127+
<br />
128+
</section>
129+
130+
</section>
131+
</div>
132+
133+
<div id="Group_Advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="Tab_Advanced">
134+
<section id="Section_Advanced">
135+
136+
<h2>Advanced Options</h2>
137+
The following options are usually determined by the merge strategy, but can optionally be set individually if you require fine-tuned control during an import.
138+
139+
<h3>Overwrite…?</h3>
140+
<section class="attribute">
141+
<label>
142+
<input type="checkbox" asp-for="ImportOptions.OverwriteContentType" /> Content Type
143+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Overwrites the content type if imported content type differs from the existing content type. Implicit if the merge strategy is set to overwrite or replace."></i>
144+
</label>
145+
</section>
146+
147+
<h3>Delete Unmatched…?</h3>
148+
<section class="attribute">
149+
<label>
150+
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedAttributes)" value="true" /> Attributes
151+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Deletes existing attributes if they aren't included in the import. Implicit if the merge strategy is set to replace."></i>
152+
</label>
153+
<br />
154+
<label>
155+
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedRelationships)" value="true" /> Relationships
156+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Deletes existing relationships if they aren't included in the import. Implicit if the merge strategy is set to replace."></i>
157+
</label>
158+
<br />
159+
<label>
160+
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedNestedTopics)" value="true" /> Nested Topics
161+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Deletes existing nested topics if they aren't included in the import. Implicit if the merge strategy is set to replace."></i>
162+
</label>
163+
<br />
164+
<label>
165+
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedChildren)" value="true" /> Children
166+
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Deletes existing children—including nested topics—if they aren't included in the import. Implicit if the merge strategy is set to replace."></i>
167+
</label>
168+
</section>
169+
170+
</section>
171+
</div>
172+
173+
</div>
174+
</div>
175+
176+
@if (!Model.IsModal) {
177+
<div class="col-lg-3 callouts">
178+
<div class="callout topic-info">
179+
180+
<h3 class="h5">Topic Information</h3>
181+
<dl>
182+
<dt><i class="fa fa-cogs"></i> Content Type</dt>
183+
<dd><a href="/Configuration/ContentTypes/@Model.Topic.ContentType">@Model.Topic.ContentType</a></dd>
184+
<dt><i class="fa fa-database"></i> Topic ID</dt>
185+
<dd><a href="/Topic/@Model.Topic.Id/">@Model.Topic.Id</a></dd>
186+
<dt><i class="fa fa-eye"></i> Current</dt>
187+
<dd><a href="@Model.Topic.WebPath">View Page</a></dd>
188+
</dl>
189+
190+
</div>
191+
</div>
192+
}
193+
194+
</div>
195+
</form>

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Shared/_Layout.cshtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
values =@Model.ContentTypeDescriptor.PermittedContentTypes>
6868
</vc:content-type-list>
6969
</text>
70+
<a href="@Url.Action("Import", "Editor")" class="btn btn-ancillary btn-sm">
71+
<span class="fa fa-arrow-up"></span>
72+
Import
73+
</a>
7074
</div>
7175
</nav>
7276
}

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Shared/_Toolbar.cshtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@
3434
}
3535
<!-- /Cancel -->
3636

37+
<!-- Export -->
38+
@if (!Model.IsModal) {
39+
<a href="@Url.Action("Export", "Editor", new { path=Model.Topic.WebPath })" class="btn btn-ancillary btn-sm">
40+
<span class="fa fa-arrow-down"></span>
41+
Export
42+
</a>
43+
}
44+
<!-- /Export -->
45+
3746
<!-- Delete -->
3847
@if (!Model.IsNew && !Model.ContentTypeDescriptor.DisableDelete) {
3948
<a

0 commit comments

Comments
 (0)