Removing Widgets from Dashboards

EmpowerID provides an overrides structure that can be used to customize the theme as well as the visibility of elements and widgets displayed in the Web interface. This allows you to customize pages and change the default look and feel of the site to match your corporate brand or that of a partner who uses the site. To do so, you place the appropriate CSS files, images and scripts and .cshtm files within the specified folders of the overrides directory. EmpowerID then "picks up" your files from the overrides directory, replacing the application's default files with your customized files. This topic demonstrates this by customizing the Home dashboard, removing the My Last 10 Login Failures widget from the dashboard. Removing the widget involves overriding the cshtml file that binds the widget to the dashboard. In EmpowerID, this cshtm file is the index.cshtml file, which is located in the C:\Program Files\TheDotNetFactory\EmpowerID\Web Sites\EmpowerID.Web.PortableAreas.Common\Views\Dashboards directory.

The overrides directory must match the path of the original file being overridden for EmpowerID to pick up your changes. For changes to .cshtml files, the overrides directory needs to be placed within the Web Sites folder. Once created, the path to the new directory should be  C:\Program Files\TheDotNetFactory\EmpowerID\Web Sites\EmpowerID.Web.Overrides\Areas\Common. Depending on the particular cshtml file being overridden, you then add the appropriate folders to match the source directory of the file. For Dashboard widgets, these folders are Views\Dashboards. So to override dashboards the complete path is C:\Program Files\TheDotNetFactory\EmpowerID\Web Sites\EmpowerID.Web.Overrides\Areas\Common\Views\Dashboards

To remove the My Last 10 Login Failures widget from the Home dashboard

  1. From your EmpowerID Web server, navigate to \Program Files\TheDotNetFactory\EmpowerID\Web Sites and open a command window.

  2. If the appropriate overrides directory does not exist, create it by running the below command.

    mkdir EmpowerID.Web.Overrides\Areas\Common\View\Dashboards

     

  3. From the Web Sites folder, navigate to EmpowerID.Web.PortableAreas.Common\Views\Dashboards and copy Index.cshtml.

     

  4. Paste Index.cshtml in the EmpowerID.Web.Overrides\Areas\Common\Views\Dashboards folder.

     

  5. From the overrides directory, open Index.cshtml with any text editor. 

  6. In Index.cshtml, search for mylast10loginfailures.

  7. Comment out the code, including the div tag above it (approximately lines 57 through 70).

    Index.cshtml should look like the below image once you have commented out the code.





  8. Save your changes and close the file.

  9. Reload the home dashboard.

    You should see that the "My Last 10 Login Failures" widget no longer appears on the page.