Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v9: Created new system information section in help panel #11230

Merged
merged 30 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
61de77f
Implemented debug dashboard with hardcoded data
Sep 27, 2021
4ea1f46
Implemented variable data instead of hardcoded
Sep 30, 2021
95568b2
Updated to display framework
Sep 30, 2021
c4e14d1
Updated to display default language
Sep 30, 2021
22ca290
Added Unit Tests
Sep 30, 2021
d42b51d
Created Cypress test and renamed folder
Zeegaan Oct 1, 2021
ef8a705
Update help.controller.js
Zeegaan Oct 1, 2021
17e53e4
Fixed Folder structure
Oct 4, 2021
45badbd
Apply suggestions from code review
Zeegaan Oct 4, 2021
e4e1d7f
Fixed folders
Oct 4, 2021
9c39cc4
Updated based on review
Oct 4, 2021
9214db8
fixed cypress test
Oct 4, 2021
9242994
Don't search in array
Oct 4, 2021
9a04150
Try and make input block more specific
Oct 4, 2021
8330dec
Make system information run locally on linux
nikolajlauridsen Oct 4, 2021
1deab9a
Fixed flaky test
Oct 5, 2021
8a6d028
Fixed flaky test v2
Oct 5, 2021
44f14c9
Added more stability to test
Zeegaan Oct 5, 2021
e3ff40b
Tried to fix stability
Oct 5, 2021
fa6f96d
stability wait
Oct 5, 2021
c05d6b7
Move timeout
Oct 5, 2021
0d90a78
Try and fix acceptance tests
Oct 5, 2021
be66e2e
Updated cypress test to use newly created helper method
Oct 6, 2021
0be6121
Updated test to actually cleanup
Oct 6, 2021
4446de9
Merge branch 'v9/dev' into v9/feature/debug-dashboard
Oct 7, 2021
861be72
Updated systeminformation to use more helper methods
Oct 7, 2021
1a25f72
Updated test for the last time i swear
Oct 7, 2021
09a35ef
Fixed breaking change
Oct 7, 2021
70831bb
Update src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
Zeegaan Oct 7, 2021
ae39256
Specify constructor for DI
Oct 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private void AddCoreServices()
Services.AddUnique<UriUtility>();

Services.AddUnique<IDashboardService, DashboardService>();
Services.AddUnique<IUserDataService, UserDataService>();

// will be injected in controllers when needed to invoke rest endpoints on Our
Services.AddUnique<IInstallationService, InstallationService>();
Expand Down
19 changes: 19 additions & 0 deletions src/Umbraco.Core/Models/UserData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Runtime.Serialization;

namespace Umbraco.Cms.Core.Models
{
[DataContract]
public class UserData
{
[DataMember(Name = "name")]
public string Name { get; }
[DataMember(Name = "data")]
public string Data { get; }

public UserData(string name, string data)
{
Name = name;
Data = data;
}
}
}
10 changes: 10 additions & 0 deletions src/Umbraco.Core/Services/IUserDataService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;

namespace Umbraco.Cms.Core.Services
{
public interface IUserDataService
{
IEnumerable<UserData> GetUserData();
}
}
48 changes: 48 additions & 0 deletions src/Umbraco.Core/Services/UserDataService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Models;
using Umbraco.Extensions;

namespace Umbraco.Cms.Core.Services
{
public class UserDataService : IUserDataService
{
private readonly IUmbracoVersion _version;
private readonly ILocalizationService _localizationService;

public UserDataService(IUmbracoVersion version, ILocalizationService localizationService)
{
_version = version;
_localizationService = localizationService;
}

public IEnumerable<UserData> GetUserData() =>
new List<UserData>
{
new("Server OS", RuntimeInformation.OSDescription),
new("Server Framework", RuntimeInformation.FrameworkDescription),
new("Default Language", _localizationService.GetDefaultLanguageIsoCode()),
new("Umbraco Version", _version.SemanticVersion.ToSemanticStringWithoutBuild()),
new("Current Culture", Thread.CurrentThread.CurrentCulture.ToString()),
new("Current UI Culture", Thread.CurrentThread.CurrentUICulture.ToString()),
new("Current Webserver", GetCurrentWebServer())
};

private string GetCurrentWebServer() => IsRunningInProcessIIS() ? "IIS" : "Kestrel";

public bool IsRunningInProcessIIS()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return false;
}

string processName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName);
return (processName.Contains("w3wp") || processName.Contains("iisexpress"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/// <reference types="Cypress" />

function openSystemInformation(){
//We have to wait for page to load, if the site is slow
cy.get('[data-element="global-help"]').should('be.visible').click();
cy.get('.umb-help-list-item').last().should('be.visible').click();
cy.get('.umb-drawer-content').scrollTo('bottom', {ensureScrollable : false});
}

context('System Information', () => {

beforeEach(() => {
//arrange
cy.umbracoLogin(Cypress.env('username'), Cypress.env('password'));
cy.umbracoSetCurrentUserLanguage('en-US');
});
afterEach(() => {
cy.umbracoSetCurrentUserLanguage('en-US');
});

it('Check System Info Displays', () => {
openSystemInformation();
cy.get('.table').find('tr').should('have.length', 10);
cy.contains('Current Culture').parent().should('contain', 'en-US');
cy.contains('Current UI Culture').parent().should('contain', 'en-US');
});

it('Checks language displays correctly after switching', () => {

//Navigate to edit user and change language
cy.umbracoGlobalUser().click();
cy.get('[alias="editUser"]').click();
cy.get('[name="culture"]').select('string:da-DK', { force: true});
cy.umbracoButtonByLabelKey('buttons_save').click({force: true});
//Refresh site to display new language
cy.reload();
cy.get('.umb-tour-step', { timeout: 60000 }).should('be.visible'); // We now due to the api calls this will be shown, but slow computers can take a while
cy.get('.umb-tour-step__close').click();
openSystemInformation();
//Assert
cy.contains('Current Culture').parent().should('contain', 'da-DK');
cy.contains('Current UI Culture').parent().should('contain', 'da-DK');
cy.get('.umb-button__content').last().click();
//Clean
cy.umbracoSetCurrentUserLanguage('en-US');
});
});
Loading