Skip to content

Commit

Permalink
fix(Dashboard): fixed document request (& misc style)
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
  • Loading branch information
JBBianchi committed Jun 29, 2024
1 parent 9b4db3c commit ce407b4
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
}
else
{
<PreferredLanguageSelector PreferedLanguageChange="Store.ToggleTextBasedEditorLanguageAsync" />
<div class="d-flex justify-content-end mb-2">
<PreferredLanguageSelector PreferedLanguageChange="Store.ToggleTextBasedEditorLanguageAsync" />
</div>
<StandaloneCodeEditor @ref="Store.TextEditor"
ConstructionOptions="Store.StandaloneEditorConstructionOptions"
OnDidInit="Store.OnTextBasedEditorInitAsync"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public async Task LoadReferencedDocumentAsync()
if (loaded || string.IsNullOrWhiteSpace(reference)) return;
try
{
var document = await this.ApiClient.WorkflowData.GetAsync(reference);
var document = await this.ApiClient.Documents.GetAsync(reference);
string documentText = this.JsonSerializer.SerializeToText(document.Content);
this.Reduce(state => state with
{
Expand Down Expand Up @@ -254,10 +254,7 @@ public async Task SetTextBasedEditorLanguageAsync()
{
var resourceUri = $"inmemory://{reference.ToLower()}";
this._textModel = await Global.GetModel(this.JSRuntime, resourceUri);
if (this._textModel == null)
{
this._textModel = await Global.CreateModel(this.JSRuntime, "", language, resourceUri);
}
this._textModel ??= await Global.CreateModel(this.JSRuntime, "", language, resourceUri);
}
if (this._textModel != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
@inject IMonacoEditorHelper MonacoEditorHelper
@implements IDisposable

<div class="width d-flex justify-content-end mb-2">
<div class="btn-group btn-group-xsm" role="group" aria-label="Toggle editor language">
<Button class="@(!isJsonSelected ? "btn-outline-primary" : "btn-outline-mute")" Outline="true" Active="!isJsonSelected" @onclick="_ => ToggleLanguage()">YAML</Button>
<Button class="@(isJsonSelected ? "btn-outline-primary" : "btn-outline-mute")" Outline="true" Active="isJsonSelected" @onclick="_ => ToggleLanguage()">JSON</Button>
</div>

<div class="btn-group btn-group-xsm @ClassNames" role="group" aria-label="Toggle editor language">
<Button class="@(!isJsonSelected ? "btn-outline-primary" : "btn-outline-mute")" Outline="true" Active="!isJsonSelected" @onclick="_ => ToggleLanguage()">YAML</Button>
<Button class="@(isJsonSelected ? "btn-outline-primary" : "btn-outline-mute")" Outline="true" Active="isJsonSelected" @onclick="_ => ToggleLanguage()">JSON</Button>
</div>


@code {

protected string? ClassNames => Class;
[Parameter] public string? Class { get; set; }
[Parameter] public EventCallback<string> PreferedLanguageChange { get; set; }

protected bool isJsonSelected { get; set; }
Expand Down
289 changes: 0 additions & 289 deletions src/dashboard/Synapse.Dashboard/Components/ReferenceDetails/Store.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

<div class="container-fluid d-flex flex-grow flex-column">
<div class="row flex-grow">
<PreferredLanguageSelector PreferedLanguageChange="ToggleTextBasedEditorLanguageAsync" />
<div class="d-flex justify-content-end mb-2">
<PreferredLanguageSelector PreferedLanguageChange="ToggleTextBasedEditorLanguageAsync" />
</div>
<StandaloneCodeEditor @ref="textBasedEditor"
ConstructionOptions="MonacoEditorHelper.GetStandaloneEditorConstructionOptions(this.textEditorValue, false, this.MonacoEditorHelper.PreferredLanguage)"
OnDidInit="OnTextBasedEditorInit"
Expand Down
Loading

0 comments on commit ce407b4

Please sign in to comment.