$('#type-filter-select')[0]).sumo.unSelectAll();
+ searchBox.val('');
+ updateListedReviews();
+ });
+
+ var prevLanguageValue = languageSelect.val();
+ languageSelect.on('sumo:closed', function (e) {
+ var val = $(this).val() as string;
if (val == "C++" || val == "C#") {
- val = val.replace("C++", "Cpp").replace("C#", "Csharp");
- }
- var helpName = "#help-" + val;
- $(helpName).click();
- if (val == 'Cadl' || prevLanguageValue == 'Cadl') {
- const fileSelectors = $(".package-selector");
- for (var i = 0; i < fileSelectors.length; i++) {
- $(fileSelectors[i]).toggleClass("hidden-row");
- }
- }
- prevLanguageValue = val;
- });
-});
+ val = val.replace("C++", "Cpp").replace("C#", "Csharp");
+ }
+ $("#uploadModel").find(".card-body > div").addClass("d-none");
+ var helpName = "#" + val.toLowerCase() + "-help";
+ $(helpName).removeClass("d-none");
+ if (val == 'Cadl' || prevLanguageValue == 'Cadl') {
+ const fileSelectors = $(".package-selector");
+ for (var i = 0; i < fileSelectors.length; i++) {
+ $(fileSelectors[i]).toggleClass("d-none");
+ }
+ }
+ prevLanguageValue = val;
+ });
+
+ // Open / Close right Offcanvas Menu
+ $("#index-right-offcanvas-toggle").on('click', function () {
+ updatePageSettings(function () {
+ rightOffCanvasNavToggle("index-main-container");
+ });
+ });
+});
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/review.ts b/src/dotnet/APIView/APIViewWeb/Client/src/pages/review.ts
similarity index 91%
rename from src/dotnet/APIView/APIViewWeb/Client/src/review.ts
rename to src/dotnet/APIView/APIViewWeb/Client/src/pages/review.ts
index d29246c48b4..f3600faf446 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/src/review.ts
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/pages/review.ts
@@ -1,13 +1,14 @@
import Split from "split.js";
-import { updatePageSettings } from "./helpers";
+import { updatePageSettings } from "../shared/helpers";
+import { rightOffCanvasNavToggle } from "../shared/off-canvas";
$(() => {
const SEL_DOC_CLASS = ".documentation";
const SHOW_DOC_CHECK_COMPONENT = "#show-documentation-component";
- const SHOW_DOC_CHECKBOX = ".show-doc-checkbox";
- const SHOW_DOC_HREF = ".show-document";
+ const SHOW_DOC_CHECKBOX = ".show-documentation-checkbox";
+ const SHOW_DOC_HREF = ".show-documentation-switch";
const SHOW_DIFFONLY_CHECKBOX = ".show-diffonly-checkbox";
- const SHOW_DIFFONLY_HREF = ".show-diffonly";
+ const SHOW_DIFFONLY_HREF = ".show-diffonly-switch";
const TOGGLE_DOCUMENTATION = ".line-toggle-documentation-button";
const SEL_HIDDEN_CLASS = ".hidden-api-toggleable";
const SHOW_HIDDEN_CHECK_COMPONENT = "#show-hidden-api-component";
@@ -219,7 +220,7 @@ $(() => {
if (sectionKeyB)
uri = uri + '§ionKeyB=' + sectionKeyB;
- const loadingMarkUp = "Loading... | ";
+ const loadingMarkUp = "Loading... | ";
const failedToLoadMarkUp = "Failed to load section. Refresh page and try again.
";
if (sectionContent.children(".spinner-border").length == 0) {
sectionContent.children("td").after(loadingMarkUp);
@@ -278,6 +279,12 @@ $(() => {
}
}
+ // Enable SumoSelect
+ $(document).ready(function () {
+ ($("#revision-select")).SumoSelect({ search: true, searchText: 'Search Revisions...' });
+ ($("#diff-select")).SumoSelect({ search: true, searchText: 'Search Revisons for Diff...' });
+ });
+
/* ADD FUNCTIONS TO LEFT NAVIGATION
--------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* Enable expand/collapse of navigation groups */
@@ -411,7 +418,7 @@ $(() => {
/* DROPDOWN FILTER FOR REVIEW, REVISIONS AND DIFF (UPDATES REVIEW PAGE ON CHANGE)
--------------------------------------------------------------------------------------------------------------------------------------------------------*/
- $('#revisions-bootstraps-select, #review-bootstraps-select, #diff-bootstraps-select').each(function(index, value) {
+ $('#revision-select, #diff-select').each(function(index, value) {
$(this).on('change', function() {
var url = $(this).find(":selected").val();
if (url)
@@ -459,8 +466,34 @@ $(() => {
--------------------------------------------------------------------------------------------------------------------------------------------------------*/
addToggleEventHandlers();
- /* ENABLE TOOLTIP AND POPOVER
+ /* RIGHT OFFCANVAS OPERATIONS
--------------------------------------------------------------------------------------------------------------------------------------------------------*/
- ($('[data-toggle="tooltip"]')).tooltip();
- ($('[data-toggle="popover"]')).popover();
+ // Open / Close right Offcanvas Menu
+ $("#review-right-offcanvas-toggle").on('click', function () {
+ updatePageSettings(function () {
+ rightOffCanvasNavToggle("review-main-container");
+ });
+ });
+
+ // Toggle Subscribe Switch
+ $("#reviewSubscribeSwitch").on('change', function () {
+ $("#reviewSubscribeForm").submit();
+ });
+ // Toggle Close Switch
+ $("#reviewCloseSwitch").on('change', function () {
+ $("#reviewCloseForm").submit();
+ });
+
+ // Manage Expand / Collapse State of options
+ [$("#approveCollapse"), $("#requestReviewersCollapse"), $("#reviewOptionsCollapse"), $("#pageSettingsCollapse")].forEach(function (value, index) {
+ const id = value.attr("id");
+ value.on('hidden.bs.collapse', function () {
+ console.log(id);
+ document.cookie = `${id}=hidden; max-age=${7 * 24 * 60 * 60}`;
+ });
+ value.on('shown.bs.collapse', function () {
+ console.log(id);
+ document.cookie = `${id}=shown; max-age=${7 * 24 * 60 * 60}`;
+ });
+ });
});
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/revisions.ts b/src/dotnet/APIView/APIViewWeb/Client/src/pages/revisions.ts
similarity index 72%
rename from src/dotnet/APIView/APIViewWeb/Client/src/revisions.ts
rename to src/dotnet/APIView/APIViewWeb/Client/src/pages/revisions.ts
index dab5970e368..14e5bb2dd3f 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/src/revisions.ts
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/pages/revisions.ts
@@ -1,4 +1,6 @@
$(() => {
+ const revisionlanguageSelect = $('#revision-language-select');
+
$(document).on("click", ".revision-rename-icon", e => {
toggleNameField($(e.target));
});
@@ -17,11 +19,16 @@ $(() => {
renameIcon.siblings(".revision-name-input").toggle();
}
- const languageSelect = $('#revision-language-select');
- languageSelect.on('change', function (e) {
+ revisionlanguageSelect.on('change', function (e) {
const fileSelectors = $(".package-file-selector");
for (var i = 0; i < fileSelectors.length; i++) {
$(fileSelectors[i]).toggleClass("hidden-row");
}
});
+
+ $("#uploadModel").on("show.bs.modal", function () {
+ (revisionlanguageSelect).SumoSelect({
+ placeholder: 'Language'
+ });
+ });
});
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/user-profile.ts b/src/dotnet/APIView/APIViewWeb/Client/src/pages/user-profile.ts
similarity index 79%
rename from src/dotnet/APIView/APIViewWeb/Client/src/user-profile.ts
rename to src/dotnet/APIView/APIViewWeb/Client/src/pages/user-profile.ts
index aca849b4cb4..de75e347d2e 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/src/user-profile.ts
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/pages/user-profile.ts
@@ -1,7 +1,11 @@
-import { updatePageSettings } from "./helpers";
+import { updatePageSettings } from "../shared/helpers";
$(() => {
- const themeSelector = $( '#theme-selector' );
+ const themeSelector = $('#theme-selector');
+ const approvableLangSelect = $('#approvable-language-select');
+
+ (themeSelector).SumoSelect();
+ (approvableLangSelect).SumoSelect({selectAll: true});
$(document).on("submit", "form[data-post-update='userProfile']", e => {
const form = $(e.target);
@@ -34,4 +38,4 @@ $(() => {
body.addClass(newTheme);
});
});
-});
\ No newline at end of file
+});
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/comments.ts b/src/dotnet/APIView/APIViewWeb/Client/src/shared/comments.ts
similarity index 96%
rename from src/dotnet/APIView/APIViewWeb/Client/src/comments.ts
rename to src/dotnet/APIView/APIViewWeb/Client/src/shared/comments.ts
index e2903869124..d50bbf1924c 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/src/comments.ts
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/shared/comments.ts
@@ -1,3 +1,5 @@
+import { updatePageSettings } from "../shared/helpers";
+
$(() => {
const INVISIBLE = "invisible";
const SEL_CODE_DIAG = ".code-diagnostics";
@@ -49,13 +51,19 @@ $(() => {
});
$(document).on("click", "#show-comments-checkbox", e => {
- ensureMessageIconInDOM();
- toggleAllCommentsVisibility(e.target.checked);
+ updatePageSettings(function () {
+ const checked = $("#show-comments-checkbox").prop("checked");
+ ensureMessageIconInDOM();
+ toggleAllCommentsVisibility(checked);
+ });
});
$(document).on("click", "#show-system-comments-checkbox", e => {
- ensureMessageIconInDOM();
- toggleAllDiagnosticsVisibility(e.target.checked);
+ updatePageSettings(function () {
+ const checked = $("#show-system-comments-checkbox").prop("checked");
+ ensureMessageIconInDOM();
+ toggleAllDiagnosticsVisibility(checked);
+ });
});
$(document).on("click", SEL_COMMENT_ICON, e => {
@@ -633,14 +641,14 @@ $(() => {
var previousCommentThreadAnchor = "comment-thread-" + (index - 1);
if (index == 0) {
- commentNavigationButtons.append(``)
+ commentNavigationButtons.append(``)
}
else if (index == displayedCommentRows.length - 1) {
- commentNavigationButtons.append(``)
+ commentNavigationButtons.append(``)
}
else {
- commentNavigationButtons.append(``)
- commentNavigationButtons.append(``)
+ commentNavigationButtons.append(``)
+ commentNavigationButtons.append(``)
}
});
}
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/file-input.ts b/src/dotnet/APIView/APIViewWeb/Client/src/shared/file-input.ts
similarity index 100%
rename from src/dotnet/APIView/APIViewWeb/Client/src/file-input.ts
rename to src/dotnet/APIView/APIViewWeb/Client/src/shared/file-input.ts
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/shared/helpers.ts b/src/dotnet/APIView/APIViewWeb/Client/src/shared/helpers.ts
new file mode 100644
index 00000000000..7cc67545818
--- /dev/null
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/shared/helpers.ts
@@ -0,0 +1,32 @@
+// Updated Page Setting by Updating UserPreference
+export function updatePageSettings(callBack) {
+ var hideLineNumbers = $("#hide-line-numbers").prop("checked");
+ if (hideLineNumbers != undefined) { hideLineNumbers = !hideLineNumbers; }
+
+ var hideLeftNavigation = $("#hide-left-navigation").prop("checked");
+ if (hideLeftNavigation != undefined) { hideLeftNavigation = !hideLeftNavigation; }
+
+ var showHiddenApis = $("#show-hidden-api-checkbox").prop("checked");
+ var showComments = $("#show-comments-checkbox").prop("checked");
+ var showSystemComments = $("#show-system-comments-checkbox").prop("checked");
+
+ var hideReviewPageOptions = $("#review-right-offcanvas-toggle").prop("checked");
+ if (hideReviewPageOptions != undefined) { hideReviewPageOptions = !hideReviewPageOptions; }
+
+ var hideIndexPageOptions = $("#index-right-offcanvas-toggle").prop("checked");
+ if (hideIndexPageOptions != undefined) { hideIndexPageOptions = !hideIndexPageOptions; }
+
+ var uri = location.origin + `/userprofile/updatereviewpagesettings?` +
+ `hideLineNumbers=${hideLineNumbers}&` +
+ `hideLeftNavigation=${hideLeftNavigation}&` +
+ `showHiddenApis=${showHiddenApis}&` +
+ `hideReviewPageOptions=${hideReviewPageOptions}&` +
+ `hideIndexPageOptions=${hideIndexPageOptions}&` +
+ `showComments=${showComments}&` +
+ `showSystemComments=${showSystemComments}`;
+
+ $.ajax({
+ type: "PUT",
+ url: uri
+ }).done(callBack());
+}
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/shared/layout.ts b/src/dotnet/APIView/APIViewWeb/Client/src/shared/layout.ts
new file mode 100644
index 00000000000..9b0f548edb1
--- /dev/null
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/shared/layout.ts
@@ -0,0 +1,8 @@
+// Enable tooltip and Popovers
+declare const bootstrap: any;
+
+const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
+const tooltipList = ([...tooltipTriggerList]).map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
+
+const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
+const popoverList = ([...popoverTriggerList]).map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
diff --git a/src/dotnet/APIView/APIViewWeb/Client/src/shared/off-canvas.ts b/src/dotnet/APIView/APIViewWeb/Client/src/shared/off-canvas.ts
new file mode 100644
index 00000000000..d8f208b7f3a
--- /dev/null
+++ b/src/dotnet/APIView/APIViewWeb/Client/src/shared/off-canvas.ts
@@ -0,0 +1,11 @@
+// Functions to Control right OffCanvas Menu
+export function rightOffCanvasNavToggle(mainContainser: String) {
+ if ($(".right-offcanvas").css("width") == '0px') {
+ $(`#${mainContainser}`).addClass("move-main-content-container-left");
+ $("#right-offcanvas-menu").addClass("show-offcanvas");
+ }
+ else {
+ $("#right-offcanvas-menu").removeClass("show-offcanvas");
+ $(`#${mainContainser}`).removeClass("move-main-content-container-left");
+ }
+}
diff --git a/src/dotnet/APIView/APIViewWeb/Client/tsconfig.json b/src/dotnet/APIView/APIViewWeb/Client/tsconfig.json
index c1a76b12743..c6faa1bcede 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/tsconfig.json
+++ b/src/dotnet/APIView/APIViewWeb/Client/tsconfig.json
@@ -14,9 +14,7 @@
"noImplicitAny": false,
"types": [
"webpack-env",
- "jquery",
- "jqueryui",
- "node"
+ "jquery"
],
"paths": {
"@/*": [
diff --git a/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js b/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js
index 7b21a5f81e8..fe346158635 100644
--- a/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js
+++ b/src/dotnet/APIView/APIViewWeb/Client/webpack.config.js
@@ -1,31 +1,13 @@
const path = require('path');
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const { DuplicatesPlugin } = require("inspectpack/plugin");
module.exports = {
mode: "production",
- entry: {
- comments: './src/comments.ts',
- revisions: './src/revisions.ts',
- fileInput: './src/file-input.ts',
- review: './src/review.ts',
- reviews: './src/reviews.ts',
- userProfile: './src/user-profile.ts',
- site: './css/site.scss',
- c: './css/c.scss',
- cplusplus: './css/cplusplus.scss',
- csharp: './css/csharp.scss',
- go: './css/go.scss',
- java: './css/java.scss',
- javascript: './css/javascript.scss',
- json: './css/json.scss',
- kotlin: './css/kotlin.scss',
- python: './css/python.scss',
- swagger: './css/swagger.scss',
- swift: './css/swift.scss',
- xml: './css/xml.scss',
- usagesample: './css/usageSample.scss'
- },
+ entry: [
+ './src/main.ts',
+ './css/main.scss'
+ ],
devtool: 'source-map',
module: {
rules: [
@@ -58,14 +40,18 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin({
- filename: '[name].css'
+ filename: 'main.css'
}),
+ new DuplicatesPlugin({
+ emitErrors: false,
+ verbose: false
+ })
],
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
},
output: {
- filename: '[name].js',
+ filename: 'main.js',
path: path.resolve(__dirname, '../wwwroot'),
},
}
diff --git a/src/dotnet/APIView/APIViewWeb/Controllers/UserProfileController.cs b/src/dotnet/APIView/APIViewWeb/Controllers/UserProfileController.cs
index 3b056126755..e4465762d6f 100644
--- a/src/dotnet/APIView/APIViewWeb/Controllers/UserProfileController.cs
+++ b/src/dotnet/APIView/APIViewWeb/Controllers/UserProfileController.cs
@@ -19,13 +19,19 @@ public UserProfileController(IUserProfileManager userProfileManager, UserPrefere
}
[HttpPut]
- public ActionResult UpdateReviewPageSettings(bool? hideLineNumbers = null, bool? hideLeftNavigation = null, bool? showHiddenApis = null)
+ public ActionResult UpdateReviewPageSettings(bool? hideLineNumbers = null, bool? hideLeftNavigation = null,
+ bool? showHiddenApis = null, bool? hideReviewPageOptions = null, bool? hideIndexPageOptions = null,
+ bool? showComments = null, bool? showSystemComments = null)
{
_userPreferenceCache.UpdateUserPreference(new UserPreferenceModel()
{
HideLeftNavigation = hideLeftNavigation,
HideLineNumbers = hideLineNumbers,
- ShowHiddenApis = showHiddenApis
+ ShowHiddenApis = showHiddenApis,
+ HideReviewPageOptions = hideReviewPageOptions,
+ HideIndexPageOptions = hideIndexPageOptions,
+ ShowComments = showComments,
+ ShowSystemComments = showSystemComments
}, User);
return Ok();
}
diff --git a/src/dotnet/APIView/APIViewWeb/Helpers/AutoMapperProfiles.cs b/src/dotnet/APIView/APIViewWeb/Helpers/AutoMapperProfiles.cs
index ed85101249c..3de53a6ea05 100644
--- a/src/dotnet/APIView/APIViewWeb/Helpers/AutoMapperProfiles.cs
+++ b/src/dotnet/APIView/APIViewWeb/Helpers/AutoMapperProfiles.cs
@@ -1,4 +1,4 @@
-using APIViewWeb.Models;
+using APIViewWeb.Models;
using AutoMapper;
using Microsoft.CodeAnalysis.Diagnostics;
@@ -17,7 +17,11 @@ public AutoMapperProfiles()
.ForMember(dest => dest.HideLineNumbers, opt => opt.MapFrom((src, dest) => src._hideLineNumbers != null ? src._hideLineNumbers : dest._hideLineNumbers))
.ForMember(dest => dest.HideLeftNavigation, opt => opt.MapFrom((src, dest) => src._hideLeftNavigation != null ? src._hideLeftNavigation : dest._hideLeftNavigation))
.ForMember(dest => dest.Theme, opt => opt.MapFrom((src, dest) => src._theme != null ? src._theme : dest._theme))
- .ForMember(dest => dest.ShowHiddenApis, opt => opt.MapFrom((src, dest) => src._showHiddenApis != null ? src._showHiddenApis : dest._showHiddenApis));
+ .ForMember(dest => dest.ShowHiddenApis, opt => opt.MapFrom((src, dest) => src._showHiddenApis != null ? src._showHiddenApis : dest._showHiddenApis))
+ .ForMember(dest => dest.HideReviewPageOptions, opt => opt.MapFrom((src, dest) => src._hideReviewPageOptions != null ? src._hideReviewPageOptions : dest._hideReviewPageOptions))
+ .ForMember(dest => dest.HideIndexPageOptions, opt => opt.MapFrom((src, dest) => src._hideIndexPageOptions != null ? src._hideIndexPageOptions : dest._hideIndexPageOptions))
+ .ForMember(dest => dest.ShowComments, opt => opt.MapFrom((src, dest) => src._showComments != null ? src._showComments : dest._showComments))
+ .ForMember(dest => dest.ShowSystemComments, opt => opt.MapFrom((src, dest) => src._showSystemComments != null ? src._showSystemComments : dest._showSystemComments));
}
}
diff --git a/src/dotnet/APIView/APIViewWeb/Models/UserPreferenceModel.cs b/src/dotnet/APIView/APIViewWeb/Models/UserPreferenceModel.cs
index 7623a0c7dec..80b3f5a2079 100644
--- a/src/dotnet/APIView/APIViewWeb/Models/UserPreferenceModel.cs
+++ b/src/dotnet/APIView/APIViewWeb/Models/UserPreferenceModel.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using CsvHelper.Configuration.Attributes;
using Newtonsoft.Json;
@@ -14,6 +14,10 @@ public class UserPreferenceModel
internal bool? _hideLineNumbers;
internal bool? _hideLeftNavigation;
internal bool? _showHiddenApis;
+ internal bool? _hideReviewPageOptions;
+ internal bool? _hideIndexPageOptions;
+ internal bool? _showComments;
+ internal bool? _showSystemComments;
internal string _theme;
public string UserName { get; set; }
@@ -72,5 +76,33 @@ public bool? ShowHiddenApis {
get => _showHiddenApis ?? false;
set => _showHiddenApis = value;
}
+
+ [Name("HideReviewPageOptions")]
+ public bool? HideReviewPageOptions
+ {
+ get => _hideReviewPageOptions ?? false;
+ set => _hideReviewPageOptions = value;
+ }
+
+ [Name("HideIndexPageOptions")]
+ public bool? HideIndexPageOptions
+ {
+ get => _hideIndexPageOptions ?? false;
+ set => _hideIndexPageOptions = value;
+ }
+
+ [Name("ShowComments")]
+ public bool? ShowComments
+ {
+ get => _showComments ?? true;
+ set => _showComments = value;
+ }
+
+ [Name("ShowSystemComments")]
+ public bool? ShowSystemComments
+ {
+ get => _showSystemComments ?? true;
+ set => _showSystemComments = value;
+ }
}
}
diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Conversation.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Conversation.cshtml
index 2b3d2f646ca..4d82a2d6234 100644
--- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Conversation.cshtml
+++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Conversation.cshtml
@@ -3,101 +3,109 @@
@using APIViewWeb.Helpers
@using APIViewWeb.Models
@{
- Layout = "ReviewLayout";
+ Layout = "Shared/_Layout";
ViewData["Title"] = "Conversation";
TempData["UserPreference"] = PageModelHelpers.GetUserPreference(Model._preferenceCache, User);
}
-