Skip to content

Commit

Permalink
Merge pull request #52 from Luthetus/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Luthetus authored Sep 4, 2023
2 parents 36a51ca + 0ae6241 commit 72ce3b8
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ public void QueueBackgroundWorkItem(
public async Task<IBackgroundTask?> DequeueAsync(
CancellationToken cancellationToken)
{
IBackgroundTask? backgroundTask;

try
{
await _workItemsQueueSemaphoreSlim.WaitAsync(cancellationToken);

_backgroundTasks.TryDequeue(out backgroundTask);
}
finally
{
_workItemsQueueSemaphoreSlim.Release();
}
await _workItemsQueueSemaphoreSlim.WaitAsync(cancellationToken);
_ = _backgroundTasks.TryDequeue(out var backgroundTask);

return backgroundTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ protected async override Task ExecuteAsync(

while (!cancellationToken.IsCancellationRequested)
{
var backgroundTask = await BackgroundTaskService
.DequeueAsync(cancellationToken);
var backgroundTask = await BackgroundTaskService.DequeueAsync(cancellationToken);

if (backgroundTask is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ public void QueueBackgroundWorkItem(
public async Task<IBackgroundTask?> DequeueAsync(
CancellationToken cancellationToken)
{
IBackgroundTask? backgroundTask;

try
{
await _workItemsQueueSemaphoreSlim.WaitAsync(cancellationToken);

_backgroundTasks.TryDequeue(out backgroundTask);
}
finally
{
_workItemsQueueSemaphoreSlim.Release();
}
await _workItemsQueueSemaphoreSlim.WaitAsync(cancellationToken);
_ = _backgroundTasks.TryDequeue(out var backgroundTask);

return backgroundTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial record PanelsCollection
public record RegisterPanelRecordAction(PanelRecord PanelRecord);
public record DisposePanelRecordAction(PanelRecordKey PanelRecordKey);

public record RegisterPanelTabAction(PanelRecordKey PanelRecordKey, PanelTab PanelTab);
public record RegisterPanelTabAction(PanelRecordKey PanelRecordKey, PanelTab PanelTab, bool InsertAtIndexZero);
public record DisposePanelTabAction(PanelRecordKey PanelRecordKey, PanelTabKey PanelTabKey);

public record SetActivePanelTabAction(PanelRecordKey PanelRecordKey, PanelTabKey PanelTabKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,19 @@ public static PanelsCollection ReduceRegisterPanelTabAction(
if (targetedPanelRecord is null)
return previousPanelsCollection;

var nextPanelTabs = targetedPanelRecord.PanelTabs.Add(
registerPanelTabAction.PanelTab);
var nextPanelTabs = targetedPanelRecord.PanelTabs;

if (registerPanelTabAction.InsertAtIndexZero)
{
nextPanelTabs = targetedPanelRecord.PanelTabs.Insert(
0,
registerPanelTabAction.PanelTab);
}
else
{
nextPanelTabs = targetedPanelRecord.PanelTabs.Add(
registerPanelTabAction.PanelTab);
}

var nextPanelRecord = targetedPanelRecord with
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="luth_ide_background-services">
<div class="luth_ide_section-title">
Background Tasks
</div>

<div class="luth_ide_section-body">
<BackgroundServiceDisplay BackgroundTaskQueue="LuthetusCommonBackgroundTaskService" />
<BackgroundServiceDisplay BackgroundTaskQueue="LuthetusIdeFileSystemBackgroundTaskService" />
<BackgroundServiceDisplay BackgroundTaskQueue="LuthetusIdeTerminalBackgroundTaskService" />
<BackgroundServiceDisplay BackgroundTaskQueue="LuthetusTextEditorCompilerServiceBackgroundTaskService" />
<BackgroundServiceDisplay BackgroundTaskQueue="LuthetusTextEditorTextEditorBackgroundTaskService" />
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Luthetus.Ide.RazorLib.BackgroundServiceCase;

public partial class BackgroundServicesPanelDisplay : ComponentBase
public partial class BackgroundServicesDisplay : ComponentBase
{
[Inject]
private ILuthetusCommonBackgroundTaskService LuthetusCommonBackgroundTaskService { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.luth_ide_background-services {
height: 100%;
}

This file was deleted.

31 changes: 21 additions & 10 deletions Source/Lib/Luthetus.Ide.RazorLib/LuthetusIdeInitializer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ protected override void OnInitialized()
{
if (LuthetusHostingInformation.LuthetusHostingKind != LuthetusHostingKind.ServerSide)
{
_ = Task.Run(async () => await LuthetusIdeFileSystemBackgroundTaskServiceWorker.StartAsync(CancellationToken.None));
_ = Task.Run(async () => await LuthetusIdeTerminalBackgroundTaskServiceWorker.StartAsync(CancellationToken.None));
_ = Task.Run(async () => await LuthetusIdeFileSystemBackgroundTaskServiceWorker
.StartAsync(CancellationToken.None)
.ConfigureAwait(false));

_ = Task.Run(async () => await LuthetusIdeTerminalBackgroundTaskServiceWorker
.StartAsync(CancellationToken.None)
.ConfigureAwait(false));
}

if (LuthetusTextEditorOptions.CustomThemeRecords is not null)
Expand Down Expand Up @@ -107,7 +112,8 @@ private void InitializeLeftPanelTabs()

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
leftPanel.PanelRecordKey,
solutionExplorerPanelTab));
solutionExplorerPanelTab,
false));

var folderExplorerPanelTab = new PanelTab(
PanelTabKey.NewPanelTabKey(),
Expand All @@ -119,7 +125,8 @@ private void InitializeLeftPanelTabs()

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
leftPanel.PanelRecordKey,
folderExplorerPanelTab));
folderExplorerPanelTab,
false));

Dispatcher.Dispatch(new PanelsCollection.SetActivePanelTabAction(
leftPanel.PanelRecordKey,
Expand All @@ -134,25 +141,27 @@ private void InitializeRightPanelTabs()
PanelTabKey.NewPanelTabKey(),
rightPanel.ElementDimensions,
new(),
typeof(NotificationHistoryDisplay),
typeof(NotificationsDisplay),
typeof(IconFolder),
"Notifications");

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
rightPanel.PanelRecordKey,
notificationsPanelTab));
notificationsPanelTab,
false));

var backgroundServicesPanelTab = new PanelTab(
PanelTabKey.NewPanelTabKey(),
rightPanel.ElementDimensions,
new(),
typeof(BackgroundServicesPanelDisplay),
typeof(BackgroundServicesDisplay),
typeof(IconFolder),
"Background Tasks");

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
rightPanel.PanelRecordKey,
backgroundServicesPanelTab));
backgroundServicesPanelTab,
false));
}

private void InitializeBottomPanelTabs()
Expand All @@ -169,7 +178,8 @@ private void InitializeBottomPanelTabs()

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
bottomPanel.PanelRecordKey,
terminalPanelTab));
terminalPanelTab,
false));

var nuGetPanelTab = new PanelTab(
PanelTabKey.NewPanelTabKey(),
Expand All @@ -181,7 +191,8 @@ private void InitializeBottomPanelTabs()

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
bottomPanel.PanelRecordKey,
nuGetPanelTab));
nuGetPanelTab,
false));

Dispatcher.Dispatch(new PanelsCollection.SetActivePanelTabAction(
bottomPanel.PanelRecordKey,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="luth_ide_folder-notifications">
<div class="luth_ide_section-title">
Notifications
</div>

<div class="luth_ide_section-body">
#TODO: Body
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Luthetus.Ide.RazorLib.Notification;

public partial class NotificationHistoryDisplay : ComponentBase
public partial class NotificationsDisplay : ComponentBase
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.luth_ide_folder-notifications {
height: 100%;
}
6 changes: 4 additions & 2 deletions Source/Lib/Luthetus.Ide.RazorLib/Panel/PanelDisplay.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ private Task TopDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
panelRecord.PanelRecordKey,
panelDragEventArgs.Value.TagDragTarget));
panelDragEventArgs.Value.TagDragTarget,
true));
}

return Task.CompletedTask;
Expand All @@ -168,7 +169,8 @@ private Task BottomDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
panelRecord.PanelRecordKey,
panelDragEventArgs.Value.TagDragTarget));
panelDragEventArgs.Value.TagDragTarget,
false));
}

return Task.CompletedTask;
Expand Down
11 changes: 10 additions & 1 deletion Source/Lib/Luthetus.Ide.RazorLib/Panel/PanelTabDisplay.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
@PanelTab.DisplayName
</span>

@*
<!--
Commenting out this code. The idea was to track the index of the panel tab
which was being hovered over. Then one can insert the panel tab they are
dragging either before or after that index.
(2023-09-03)
-->
@if (PanelsCollectionWrap.Value.PanelDragEventArgs is not null)
{
<div class="luth_ide_panel-tab-dropzone luth_ide_panel-tab-dropzone-top"
Expand All @@ -20,7 +29,7 @@
@onmouseup:stopPropagation="true"
@onmouseup="BottomDropzoneOnMouseUp">
</div>
}
} *@
</button>

@if (PanelTab.IsBeingDragged)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private Task TopDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
PanelRecord.PanelRecordKey,
panelDragEventArgs.Value.TagDragTarget));
panelDragEventArgs.Value.TagDragTarget,
false));
}

return Task.CompletedTask;
Expand All @@ -145,7 +146,8 @@ private Task BottomDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)

Dispatcher.Dispatch(new PanelsCollection.RegisterPanelTabAction(
PanelRecord.PanelRecordKey,
panelDragEventArgs.Value.TagDragTarget));
panelDragEventArgs.Value.TagDragTarget,
false));
}

return Task.CompletedTask;
Expand Down
8 changes: 4 additions & 4 deletions Source/Lib/Luthetus.Ide.RazorLib/Shared/IdeMainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
ClassCssString="@($"luth_ide_main-layout {UnselectableClassCss} {AppOptionsService.ThemeCssClassString}")"
StyleCssString="@($"{AppOptionsService.FontSizeCssStyleString} {AppOptionsService.FontFamilyCssStyleString}")">

<ShouldRenderBoundary>
<LuthetusCommonInitializer/>
<LuthetusTextEditorInitializer/>
<LuthetusIdeInitializer/>
<LuthetusCommonInitializer />
<LuthetusTextEditorInitializer />
<LuthetusIdeInitializer />

<ShouldRenderBoundary>
<IdeHeader/>

<StateHasChangedBoundary @ref="_bodyAndFooterStateHasChangedBoundaryComponent">
Expand Down
14 changes: 8 additions & 6 deletions Source/Lib/Luthetus.Ide.RazorLib/wwwroot/luthetusIde.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ input[type="checkbox"]{
}

.luth_ide_footer {
background-color: var(--luth_ide_footer-background-color);
background-color: var(--luth_ide_body-background-color);
}

.luth_ide_section-title {
Expand Down Expand Up @@ -310,6 +310,7 @@ button.luth_ide_input-file-address-hierarchy-entry {

.luth_ide_panel-tabs {
position: relative;
background-color: var(--luth_ide_footer-background-color);
}

.luth_ide_panel-tab {
Expand All @@ -326,20 +327,21 @@ button.luth_ide_input-file-address-hierarchy-entry {
position: absolute;
left: 0;
z-index: 100;
background-color: var(--luth_primary-hover-background-color);
opacity: 0.6;
}

.luth_ide_panel-tab-dropzone:hover {
background-color: orange;
}
.luth_ide_panel-tab-dropzone:hover {
background-color: var(--luth_button-hover-background-color);
box-shadow: 0 0 2px var(--luth_primary-overlay-box-shadow-color);
}

.luth_ide_panel-tab-dropzone-top {
top: 0;
background-color: aqua;
}

.luth_ide_panel-tab-dropzone-bottom {
top: 50%;
background-color: mediumpurple;
}

.luth_ide_panel-tab-drag-display {
Expand Down

0 comments on commit 72ce3b8

Please sign in to comment.