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

Dashboard widget is showing up after removing DashboardWidget stereotype #14596

Closed
agriffard opened this issue Oct 28, 2023 · 7 comments · Fixed by #14603
Closed

Dashboard widget is showing up after removing DashboardWidget stereotype #14596

agriffard opened this issue Oct 28, 2023 · 7 comments · Fixed by #14603
Milestone

Comments

@agriffard
Copy link
Member

To test the admin theme's Bootstrap 5.3.2 PR, I created a Content type with all parts in order to show them all in Edit.

A very weird side effect is that the Dashboard displays the ListPart in its widgets.

image

There is also a Duplicated Dashboard title.

@MikeAlhayek
Copy link
Member

@agriffard if you're AdminWidget has ListPart attached to it, why do you expect it not to show up? Can you please share the recipe you are using to create these content types and maybe the Dashboard content items?

@MikeAlhayek
Copy link
Member

MikeAlhayek commented Oct 29, 2023

Also, I do not see a duplicate title. Here is the content type I created

{
  "steps": [
    {
      "name": "ContentDefinition",
      "ContentTypes": [
        {
          "Name": "AdminWidgetWithListPart",
          "DisplayName": "AdminWidgetWithListPart",
          "Settings": {
            "ContentTypeSettings": {
              "Creatable": true,
              "Listable": true,
              "Draftable": true,
              "Versionable": true,
              "Stereotype": "DashboardWidget",
              "Securable": true
            },
            "FullTextAspectSettings": {}
          },
          "ContentTypePartDefinitionRecords": [
            {
              "PartName": "AdminWidgetWithListPart",
              "Name": "AdminWidgetWithListPart",
              "Settings": {
                "ContentTypePartSettings": {
                  "Position": "1"
                }
              }
            },
            {
              "PartName": "ListPart",
              "Name": "ListPart",
              "Settings": {
                "ContentTypePartSettings": {
                  "Position": "2"
                },
                "ListPartSettings": {
                  "PageSize": 10,
                  "ContainedContentTypes": [
                    "Article"
                  ]
                }
              }
            },
            {
              "PartName": "TitlePart",
              "Name": "TitlePart",
              "Settings": {
                "ContentTypePartSettings": {
                  "Position": "0"
                }
              }
            },
            {
              "PartName": "DashboardPart",
              "Name": "DashboardPart",
              "Settings": {
                "ContentTypePartSettings": {
                  "Position": "3"
                }
              }
            }
          ]
        }
      ],
      "ContentParts": []
    }
  ]
}

It works as expected

image

image

And after styling my own AdminWidgetWithListPart Here is what I get (note the spacing change.) FYI I did that by adding a view called DashboardWidget-AdminWidgetWithListPart.DetailAdmin.cshtml with this

<div class="card h-100 @string.Join(' ', Model.Classes.ToArray())">
    @if (Model.Header != null || Model.Leading != null || Model.ActionsMenu != null)
    {
        <div class="card-header">
            @await DisplayAsync(Model.Leading)
            @await DisplayAsync(Model.Header)
            @if (Model.ActionsMenu != null)
            {
                <div class="btn-group float-end" title="@T["Actions"]">
                    <button type="button" class="btn btn-sm " data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <i class="fa-solid fa-ellipsis-v" aria-hidden="true"></i>
                    </button>
                    <div class="actions-menu dropdown-menu">
                        @await DisplayAsync(Model.ActionsMenu)
                    </div>
                </div>
            }
        </div>
    }
    <div class="dashboard-body-container card-body p-2 h-100">
        @if (Model.Tags != null || Model.Meta != null)
        {
            <div class="dashboard-meta">
                @await DisplayAsync(Model.Meta)
                @await DisplayAsync(Model.Tags)
            </div>
        }
        @await DisplayAsync(Model.Content)
    </div>
    @if (Model.Footer != null)
    {
        <div class="card-footer">
            @await DisplayAsync(Model.Footer)
        </div>
    }
</div>

image

@agriffard
Copy link
Member Author

I didn't use a recipe, just added all the parts.

I don't expect to see it because I didn't add the DashboardWidget stereotype on the AcontentType type.
At first, I added the Dashboard Part so this is may be what messed up the Dashboard, even after removing it.

@agriffard
Copy link
Member Author

agriffard commented Oct 29, 2023

Here is what I have in the Document, linked to the Dashboard:

{"ContentItemId":"483tcgpp5zwy9vmzcqb4crj8wq","ContentItemVersionId":"41e765wmef6exvw5zwqd621wdd","ContentType":"AContentType","DisplayText":"AContentType1","Latest":true,"Published":true,"ModifiedUtc":"2023-10-28T22:02:49.8089631Z","PublishedUtc":"2023-10-28T22:02:49.9910231Z","CreatedUtc":"2023-09-20T21:45:48.8713018Z","Owner":"4mvjsrd1pddrt7epj9x7khjd5x","Author":"admin","AContentType":{"Boolean":{"Value":false},"ContentPicker":{"ContentItemIds":[]},"Date":{"Value":"2023-09-20T00:00:00Z"},"DateTime":{"Value":"2023-09-20T21:46:00Z"},"Geo":{"Latitude":null,"Longitude":null},"Html":{"Html":"<h2>Test</h2>"},"Link":{"Url":null,"Text":null},"Markdown":{"Markdown":"dfg"},"Media":{"Paths":[],"MediaTexts":[]},"MultiText":{"Values":[]},"Numeric":{"Value":50.12},"Taxonomy":{"TaxonomyContentItemId":"4bswhecexa7y33gmbqv1db5gcq","TermContentItemIds":[]},"Text":{"Text":null},"Time":{"Value":"23:49:00"},"UserPicker":{"UserIds":[],"UserNames":[]},"Youtube":{"EmbeddedAddress":null,"RawAddress":null}},"AliasPart":{"Alias":"title"},"ArchiveLaterPart":{"ScheduledArchiveUtc":null},"AuditTrailPart":{"Comment":null,"ShowComment":false},"AutoroutePart":{"Path":"title","SetHomepage":false,"Disabled":false,"RouteContainedItems":false,"Absolute":false},"BagPart":{"ContentItems":[]},"CommonPart":{},"ContentMenuItemPart":{"Name":"Title","SelectedContentItem":{"ContentItemIds":["4nenazk9g12c5w42cjtkv12pdc"]}},"DashboardPart":{"Position":0.0,"Width":2.0,"Height":2.0},"FacebookPluginPart":{"Liquid":null},"FlowPart":{"Widgets":[]},"FormPart":{"Action":null,"Method":"POST","WorkflowTypeId":null,"EncType":"application/x-www-form-urlencoded","EnableAntiForgeryToken":true},"FormElementLabelPart":{"Option":0,"Label":null},"FormElementValidationPart":{"Option":0},"HtmlMenuItemPart":{"Url":null,"Html":""},"HtmlBodyPart":{"Html":""},"LinkMenuItemPart":{"Name":"Title","Url":null},"LiquidPart":{"Liquid":null},"ListPart":{"DisableRssFeed":false,"FeedProxyUrl":null,"FeedItemsCount":20},"MarkdownBodyPart":{"Markdown":null},"PreviewPart":{},"PublishLaterPart":{"ScheduledPublishUtc":null},"SeoMetaPart":{"PageTitle":null,"Render":true,"MetaDescription":null,"MetaKeywords":null,"Canonical":null,"MetaRobots":null,"CustomMetaTags":[],"DefaultSocialImage":{"Paths":[],"MediaTexts":[]},"OpenGraphImage":{"Paths":[],"MediaTexts":[]},"OpenGraphType":null,"OpenGraphTitle":null,"OpenGraphDescription":null,"TwitterImage":{"Paths":[],"MediaTexts":[]},"TwitterTitle":null,"TwitterDescription":null,"TwitterCard":null,"TwitterCreator":null,"TwitterSite":null,"GoogleSchema":null},"SitemapPart":{"OverrideSitemapConfig":false,"ChangeFrequency":0,"Priority":5,"Exclude":false},"TitlePart":{"Title":"AContentType1"},"WidgetsListPart":{"Widgets":{}}}

Note that the following json is still there, even if I remove the DashboardPart and resave the content item:
"DashboardPart":{"Position":0.0,"Width":2.0,"Height":2.0}

@MikeAlhayek
Copy link
Member

I didn't use a recipe, just added all the parts.
Yes but you can export your recipe and share it if needed.

I don't expect to see it because I didn't add the DashboardWidget stereotype on the AcontentType type.
At first, I added the Dashboard Part so this is may be what messed up the Dashboard, even after removing it.

The DashboardWidget stereotype is mainly used for proper views and allow us to list it into the "Add Widget" drop down button. When you attach DashboardPart, this will cause the content item to be indexed in DashboardPartIndex and will list it on the menu to add.

So removing DashboardWidget stereotype will prevent you from adding new widgets, but will not prevent displaying previously created widgets incorrectly. Maybe this is the problem you were seeing

@agriffard
Copy link
Member Author

Ok thank you for the explanations, I am closing it.

@MikeAlhayek
Copy link
Member

@agriffard I am re-opeing this issue. Note what I mentioned in my last comment

So removing DashboardWidget stereotype will prevent you from adding new widgets, but will not prevent displaying previously created widgets incorrectly. Maybe this is the problem you were seeing

I think this is not a good behavior and we should address it. When a content item of a type DashboardWidget, is previously added we should not show because this will break the dashboard. I'll submit a PR to fix this.

@MikeAlhayek MikeAlhayek reopened this Oct 29, 2023
@MikeAlhayek MikeAlhayek changed the title Dashboard: Displaying ListPart Dashboard widget is showing up after removing DashboardWidget stereotype Oct 29, 2023
@sebastienros sebastienros added this to the 1.x milestone Nov 2, 2023
@MikeAlhayek MikeAlhayek modified the milestones: 1.x, 1.8 Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants