示例#1
0
        /// <summary>
        /// Loads the group list.
        /// </summary>
        private void LoadGroupList()
        {
            var accessToken = PowerBiUtilities.GetAccessToken(ddlSettingPowerBiAccount.SelectedValue.AsGuid());
            var groups      = PowerBiUtilities.GetGroups(accessToken);

            ddlSettingPowerBiGroup.Items.Clear();
            ddlSettingPowerBiGroup.Items.Add(new ListItem());
            foreach (var group in groups)
            {
                ddlSettingPowerBiGroup.Items.Add(new ListItem(group.Name, group.Id));
            }
        }
示例#2
0
        /// <summary>
        /// Loads the report list.
        /// </summary>
        private void LoadReportList()
        {
            var accessToken = PowerBiUtilities.GetAccessToken(ddlSettingPowerBiAccount.SelectedValue.AsGuid());
            var reports     = PowerBiUtilities.GetReports(accessToken, ddlSettingPowerBiGroup.SelectedValue);

            ddlSettingPowerBiReportUrl.Items.Clear();
            ddlSettingPowerBiReportUrl.Items.Add(new ListItem());
            foreach (var report in reports)
            {
                ddlSettingPowerBiReportUrl.Items.Add(new ListItem(report.name, report.embedUrl));
            }
        }
示例#3
0
        /// <summary>
        /// Shows the view.
        /// </summary>
        private void ShowView()
        {
            pnlEditModal.Visible = false;
            pnlView.Visible      = true;

            fullsizer.Visible = GetAttributeValue("ShowFullsizeBtn").AsBoolean();

            string reportUrl     = GetAttributeValue("ReportUrl");
            bool   showRightPane = GetAttributeValue("ShowRightPane").AsBoolean();
            bool   showNavPane   = GetAttributeValue("ShowNavPane").AsBoolean();

            nbError.Text = string.Empty;

            if (reportUrl.IsNullOrWhiteSpace())
            {
                pnlView.Visible             = false;
                nbError.NotificationBoxType = NotificationBoxType.Warning;
                nbError.Text = "No report has been configured.";
                return;
            }

            hfReportEmbedUrl.Value = reportUrl +
                                     (showRightPane ? "" : "&filterPaneEnabled=false") +
                                     (showNavPane ? "" : "&navContentPaneEnabled=false");

            if (!string.IsNullOrWhiteSpace(GetAttributeValue("PowerBiAccount")))
            {
                // ensure that the account still exists as a defined value
                var accountValue = DefinedValueCache.Get(GetAttributeValue("PowerBiAccount"));

                if (accountValue != null)
                {
                    hfAccessToken.Value = PowerBiUtilities.GetAccessToken(accountValue.Guid);

                    if (string.IsNullOrWhiteSpace(hfAccessToken.Value))
                    {
                        pnlView.Visible  = false;
                        pnlLogin.Visible = true;
                    }
                }
                else
                {
                    pnlView.Visible             = false;
                    nbError.NotificationBoxType = NotificationBoxType.Warning;
                    nbError.Text = "The account configured for this block no longer exists.";
                    return;
                }
            }
        }
示例#4
0
        /// <summary>
        /// Shows the view.
        /// </summary>
        private void ShowView()
        {
            pnlEditModal.Visible = false;
            pnlView.Visible      = true;

            nbError.Text           = string.Empty;
            hfReportEmbedUrl.Value = GetAttributeValue("ReportUrl");

            if (hfReportEmbedUrl.Value.IsNullOrWhiteSpace())
            {
                pnlView.Visible             = false;
                nbError.NotificationBoxType = NotificationBoxType.Warning;
                nbError.Text = "No report has been configured.";
                return;
            }

            if (!string.IsNullOrWhiteSpace(GetAttributeValue("PowerBiAccount")))
            {
                // ensure that the account still exists as a defined value
                var accountValue = DefinedValueCache.Read(GetAttributeValue("PowerBiAccount"));

                if (accountValue != null)
                {
                    hfAccessToken.Value = PowerBiUtilities.GetAccessToken(accountValue.Guid);

                    if (string.IsNullOrWhiteSpace(hfAccessToken.Value))
                    {
                        pnlView.Visible  = false;
                        pnlLogin.Visible = true;
                    }
                }
                else
                {
                    pnlView.Visible             = false;
                    nbError.NotificationBoxType = NotificationBoxType.Warning;
                    nbError.Text = "The account configured for this block no longer exists.";
                    return;
                }
            }
        }