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

auraErrorMessage: Enhance styling and placement, Hide in Prod #4

Open
ndrewr opened this issue Jan 10, 2020 · 0 comments
Open

auraErrorMessage: Enhance styling and placement, Hide in Prod #4

ndrewr opened this issue Jan 10, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@ndrewr
Copy link
Contributor

ndrewr commented Jan 10, 2020

FunnelSource already does this (see pages/FunnelAction2.page)

On app startup after component mount, we can check the org type and conditionally apply a class to either a) hide the element entirely in Prod orgs or b) prominently display the error message at top instead of hidden at bottom in dev orgs.

Could this be injected for any starting sfdx project?

Basic logic (note this is for a Visualforce page and utilizes a controller method to check org type):

STYLES
        .floatingError {
            position: fixed;
            top: 0;
            left: 0;
            z-index: 9998;
            height: 10vw;
            width: 35vw;
            margin: 0 auto;
            padding: 1rem;
            background: red;
            color: white;
        }
        .floatingError:after {
            content: "(Double click to dismiss)";
            position: absolute;
            bottom: .25rem;
            right: .25rem;
            z-index: -1;
        }
        div#auraErrorMessage:empty {
            display: none;
        }

SCRIPT
                    // Hide the error element if Prod or if there was a network issue
                    // Restyle vanilla error message element; https://salesforce.stackexchange.com/q/199930/68974
                    Visualforce.remoting.Manager.invokeAction(
                        '{!$RemoteAction.FunnelForecastCon.isProductionOrg}',
                        function(result, event) {
                            var auraErrorMessageElement = document.getElementById('auraErrorMessage');
                            auraErrorMessageElement.ondblclick = function() {
                                this.innerHTML = '';
                            };
                            auraErrorMessageElement.className = (result || !event.status)
                                ? 'slds-hide'
                                : 'floatingError';
                        }
                    );
@ndrewr ndrewr added the enhancement New feature or request label Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant