Skip to content

Commit

Permalink
Merge branch 'release/4.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyCaney committed Mar 28, 2020
2 parents 56a7f5a + 7f290d0 commit 68ec515
Show file tree
Hide file tree
Showing 30 changed files with 713 additions and 91 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
<PackageReference Include="OnTopic" Version="4.0.0" />
<PackageReference Include="OnTopic.ViewModels" Version="4.0.0" />
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.0.0" />
<PackageReference Include="OnTopic.Data.Caching" Version="4.0.0" />
<PackageReference Include="OnTopic.Data.Sql" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" version="12.0.2" />
<PackageReference Include="OnTopic" Version="4.1.0" />
<PackageReference Include="OnTopic.ViewModels" Version="4.1.0" />
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.1.0" />
<PackageReference Include="OnTopic.Data.Caching" Version="4.1.0" />
<PackageReference Include="OnTopic.Data.Sql" Version="4.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions OnTopic.Editor.AspNetCore.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace OnTopicTest {
/// The <see cref="Program"/> class—and it's <see cref="Program.Main(String[])"/> method—represent the entry point into the
/// ASP.NET Core web application.
/// </summary>
public class Program {
public static class Program {

/*==========================================================================================================================
| METHOD: MAIN
Expand All @@ -37,7 +37,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => {
webBuilder.UseStartup<Startup>();
});
});

} //Class
} //Namespace
5 changes: 2 additions & 3 deletions OnTopic.Editor.AspNetCore.Host/SampleActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class SampleActivator : IControllerActivator, IViewComponentActivator {
private readonly ITopicRepository _topicRepository;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly StandardEditorComposer _standardEditorComposer;
private readonly Topic _rootTopic;

/*==========================================================================================================================
| CONSTRUCTOR
Expand Down Expand Up @@ -70,7 +69,7 @@ public SampleActivator(string connectionString, IWebHostEnvironment webHostEnvir
_topicRepository = cachedTopicRepository;
_typeLookupService = new EditorViewModelLookupService();
_topicMappingService = new TopicMappingService(_topicRepository, _typeLookupService);
_rootTopic = _topicRepository.Load();
_ = _topicRepository.Load();

/*------------------------------------------------------------------------------------------------------------------------
| Establish standard editor composer
Expand Down Expand Up @@ -120,7 +119,7 @@ public object Create(ViewComponentContext context) {
/*------------------------------------------------------------------------------------------------------------------------
| Configure and return appropriate view component
\-----------------------------------------------------------------------------------------------------------------------*/
if (_standardEditorComposer.IsEditorComponent(type)) {
if (StandardEditorComposer.IsEditorComponent(type)) {
return _standardEditorComposer.ActivateEditorComponent(type, _topicRepository);
}

Expand Down
2 changes: 1 addition & 1 deletion OnTopic.Editor.AspNetCore.Host/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void ConfigureServices(IServiceCollection services) {
/// Provides configuration the application. This method is called by the runtime to bootstrap the application
/// configuration, including the HTTP pipeline.
/// </summary>
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env) {

/*------------------------------------------------------------------------------------------------------------------------
| Configure: Error Pages
Expand Down
1 change: 1 addition & 0 deletions OnTopic.Editor.AspNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
GitVersion.yml = GitVersion.yml
README.md = README.md
EndProjectSection
EndProject
Global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ else {
<div class="ChildTopic">
@if (Model.EnableModal == true) {
<a onclick="initEditorModal('@Model.AttributeKey', '@Model.TopicList.LastOrDefault().Text', '@Model.TopicList.LastOrDefault().Value', @Model.OnModalClose); return false;" class="btn btn-info btn-sm">
Add @Model.TopicList.LastOrDefault().Text
<span class="fa fa-plus"></span>
@Model.TopicList.LastOrDefault().Text
</a>
}
else {
<a href="@Model.TopicList.LastOrDefault().Value" class="btn btn-info btn-sm">
Add @Model.TopicList.LastOrDefault().Text
<span class="fa fa-plus"></span>
@Model.TopicList.LastOrDefault().Text
</a>
}
</div>
Expand Down
62 changes: 62 additions & 0 deletions OnTopic.Editor.AspNetCore/Areas/Editor/Views/Editor/Export.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@model ExportViewModel

@{
ViewBag.Title = "Export Topic";
}

<form method="post">

<div id="Toolbar" class="toolbar">
<!-- Action Buttons -->
<div class="action buttons">
<button type="submit" class="btn btn-primary btn-sm">Export</button>
</div>
</div>

<div id="FormArea" class="row form area">

<div class="col-lg-9 col-sm-12">

<h2>Export Options</h2>

<section class="attribute">
<input type="checkbox" asp-for="ExportOptions.IncludeChildTopics" />
<label asp-for="ExportOptions.IncludeChildTopics">Include Child Topics?</label>
<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>
</section>

<section class="attribute">
<input type="checkbox" asp-for="ExportOptions.IncludeNestedTopics" />
<label asp-for="ExportOptions.IncludeNestedTopics">Include Nested Topics?</label>
<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>
</section>

<section class="attribute">
<input type="checkbox" asp-for="ExportOptions.IncludeExternalReferences" />
<label asp-for="ExportOptions.IncludeExternalReferences">Include External References?</label>
<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>
</section>

</div>

@if (!Model.IsModal) {
<div class="col-lg-3 callouts">
<div class="callout topic-info">

<h3 class="h5">Topic Information</h3>
<dl>
<dt><i class="fa fa-cogs"></i> Content Type</dt>
<dd><a href="/Configuration/ContentTypes/@Model.Topic.ContentType">@Model.Topic.ContentType</a></dd>
<dt><i class="fa fa-database"></i> Topic ID</dt>
<dd><a href="/Topic/@Model.Topic.Id/">@Model.Topic.Id</a></dd>
<dt><i class="fa fa-eye"></i> Current</dt>
<dd><a href="@Model.Topic.WebPath">View Page</a></dd>
</dl>

</div>
</div>
}

</div>

</form>
195 changes: 195 additions & 0 deletions OnTopic.Editor.AspNetCore/Areas/Editor/Views/Editor/Import.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
@model ImportViewModel

@{
ViewBag.Title = "Import Topic";
}

<form method="post" enctype="multipart/form-data">

<div id="Toolbar" class="toolbar">
<!-- Action Buttons -->
<div class="action buttons">
<button type="submit" class="btn btn-primary btn-sm">Import</button>
</div>
<ul id="DisplayGroupNavTabs" class="nav nav-tabs" role="tablist">
<li class="nav-item">
<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>
</li>
<li class="nav-item">
<a id="Tab_LastModified" class="nav-link" href="#Group_LastModified" data-toggle="tab" role="tab" aria-controls="#Group_LastModified" aria-expanded="true">Attribution</a>
</li>
<li class="nav-item">
<a id="Tab_Advanced" class="nav-link" href="#Group_Advanced" data-toggle="tab" role="tab" aria-controls="#Group_Advanced" aria-expanded="true">Advanced</a>
</li>
</ul>
</div>

<div id="FormArea" class="row form area">

<div class="col-md-12">
@if (Model.IsImported) {
<div class="alert alert-primary" role="alert">
The JSON file has been successfully imported and merged into the target database.
</div>
}
<div asp-validation-summary="All"></div>
</div>

<div class="col-lg-9 col-sm-12">
<div id="DisplayGroupTabsContent" class="tab-content tab-validate">

<div id="Group_Options" class="tab-pane fade show active" role="tabpanel" aria-labelledby="Tab_Options">
<section id="Section_Options">

<h2>Import Options</h2>

<h3>
Source
<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>
</h3>
<section class="attribute">
<input name="JsonFile" type="file" accept=".json" required />
</section>

<h3>Strategy</h3>
<section class="attribute">
<label>
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Add" /> Add
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Adds missing attributes; leaves existing attributes alone."></i>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Merge" /> Merge
<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>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Overwrite" /> Overwrite
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Overwrites all attributes. Leaves unmatched attributes as is."></i>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.Strategy" value="@ImportStrategy.Replace" /> Replace
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Overwrites all attributes. Deletes unmatched attributes, relationships, and topics."></i>
</label>
</section>

</section>
</div>

<div id="Group_LastModified" class="tab-pane fade" role="tabpanel" aria-labelledby="Tab_LastModified">
<section id="Section_LastModified">

<h2>Attribution</h2>
<p>
Offers granular control over how the byline ("Last Modified By") and dateline ("Last Modified") are updated as part of the import process.
</p>

<h3>Byline</h3>
<section class="attribute">
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.Inherit" /> Use Import Strategy
<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>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.TargetValue" /> Previous Value
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will always retain the existing byline, if present."></i>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.Current" /> Current User (@(Context.User.Identity.Name?? "System"))
<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>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedByStrategy" value="@LastModifiedImportStrategy.System" /> System
<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>
</label>
</section>

<h3>Dateline</h3>
<section class="attribute">
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.Inherit" /> Use Import Strategy
<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>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.TargetValue" /> Previous Value
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Will always retain the existing last modified date, if present."></i>
</label>
<br />
<label>
<input type="radio" asp-for="ImportOptions.LastModifiedStrategy" value="@LastModifiedImportStrategy.Current" /> Current Time (@DateTime.Now.ToString("g"))
<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>
</label>
<br />
</section>

</section>
</div>

<div id="Group_Advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="Tab_Advanced">
<section id="Section_Advanced">

<h2>Advanced Options</h2>
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.

<h3>Overwrite…?</h3>
<section class="attribute">
<label>
<input type="checkbox" asp-for="ImportOptions.OverwriteContentType" /> Content Type
<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>
</label>
</section>

<h3>Delete Unmatched…?</h3>
<section class="attribute">
<label>
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedAttributes)" value="true" /> Attributes
<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>
</label>
<br />
<label>
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedRelationships)" value="true" /> Relationships
<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>
</label>
<br />
<label>
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedNestedTopics)" value="true" /> Nested Topics
<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>
</label>
<br />
<label>
<input type="checkbox" name="@nameof(ImportOptions).@nameof(ImportOptions.DeleteUnmatchedChildren)" value="true" /> Children
<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>
</label>
</section>

</section>
</div>

</div>
</div>

@if (!Model.IsModal) {
<div class="col-lg-3 callouts">
<div class="callout topic-info">

<h3 class="h5">Topic Information</h3>
<dl>
<dt><i class="fa fa-cogs"></i> Content Type</dt>
<dd><a href="/Configuration/ContentTypes/@Model.Topic.ContentType">@Model.Topic.ContentType</a></dd>
<dt><i class="fa fa-database"></i> Topic ID</dt>
<dd><a href="/Topic/@Model.Topic.Id/">@Model.Topic.Id</a></dd>
<dt><i class="fa fa-eye"></i> Current</dt>
<dd><a href="@Model.Topic.WebPath">View Page</a></dd>
</dl>

</div>
</div>
}

</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
values =@Model.ContentTypeDescriptor.PermittedContentTypes>
</vc:content-type-list>
</text>
<a href="@Url.Action("Import", "Editor")" class="btn btn-ancillary btn-sm">
<span class="fa fa-arrow-up"></span>
Import
</a>
</div>
</nav>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
}
<!-- /Cancel -->

<!-- Export -->
@if (!Model.IsModal) {
<a href="@Url.Action("Export", "Editor", new { path=Model.Topic.WebPath })" class="btn btn-ancillary btn-sm">
<span class="fa fa-arrow-down"></span>
Export
</a>
}
<!-- /Export -->

<!-- Delete -->
@if (!Model.IsNew && !Model.ContentTypeDescriptor.DisableDelete) {
<a
Expand Down
Loading

0 comments on commit 68ec515

Please sign in to comment.