Superset Iframe i got token but i dont have / embedding UI / - apache-superset

How I do superset chart on the iframe of HTML.
supersetEmbeddedSdk.embedDashboard({
id: "", / i dont have embedding UI /
supersetDomain: "http://************",
mountPoint: document.getElementById("superSet"),
fetchGuestToken: () => "token",
});

Related

Show mobile version of powerbi page in powerapps portals

We are trying to get a PowerBi report embedded in a Powerapps portal to show the mobile view of the report.
As described here, I’m testing with a report which only have mobile enabled pages.
This is the code I use to request the mobile version, as documented here.
let report = (await powerbi.get($('.portal-pbi-embedded')[0]))
let page = (await report.getPages()).find(i=>i.isActive);
console.log(await page.hasLayout(window['powerbi-client'].models.LayoutType.MobilePortrait))
// true
console.log(await report.updateSettings({layoutType: window['powerbi-client'].models.LayoutType.MobilePortrait}))
// {statusCode: 202, headers: {…}, body: undefined}
It appears that PowerBi can see that there is a mobile layout for the active page, and the updateSettings commands executes without errors, but nothing happens.
I also tried embedding the report again, where I request the mobile layout upfront, this gives the same behaviour (only showing the desktop version).
I recognized that the powerbi client version that powewrapps portals uses is a bit old (version 2.6.5). Even though that we are running the latest version of the portal that are available to us (9.3.2205.12).
Question 1: How do we show the mobile version of the report in the portal?
Question 2: Is there a way to update the powerbi client in the portal?
First Question
you should note the following (from docs):
after the report initial load, changing to report mobile layout is
supported only if mobile layout (portrait/landscape) has been set into
the initial embedding configuration object. Otherwise, you must first
call powerbi.reset(HTMLElement) to remove the iframe. Then, you have
to call powerbi.embed(...) using the same container with the mobile
layout setting defined on the embedded configuration object.
So basically, you are facing two options:
First Option - In your Configuration, use the following concept to control your visuals:
let models = window['powerbi-client'].models;
let embedConfig = {
type: 'report',
id: reportId,
embedUrl: 'https://app.powerbi.com/reportEmbed',
tokenType: models.TokenType.Embed,
accessToken: 'H4...rf',
settings: {
layoutType: models.LayoutType.Custom
customLayout: {
pageSize: {
type: models.PageSizeType.Custom,
width: 1600,
height: 1200
},
displayOption: models.DisplayOption.ActualSize,
pagesLayout: {
"ReportSection1" : {
defaultLayout: {
displayState: {
mode: models.VisualContainerDisplayMode.Hidden
}
},
visualsLayout: {
"VisualContainer1": {
x: 1,
y: 1,
z: 1,
width: 400,
height: 300,
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
"VisualContainer2": {
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
}
}
}
}
}
};
...
// Embed the report and display it within the div container.
let report = powerbi.embed(embedContainer, embedConfig);
The second option - use the reset method:
powerbi.reset(HTMLElement)
powerbi.embed(...)
Second Question
I'm not sure that I understood your question correctly, but if I did - take a look here (https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/update-settings)

using ApexChart for rails7 raising error Uncaught ReferenceError: ApexCharts is not defined

I'm new one in rails and trying to add Apexchart js to my project in rails7.
So i did
document.addEventListener('turbo:load', function(){
var options = {
chart: {
type: 'line'
},
series: [{
name: 'sales',
data: [30,40,35,50,49,60,70,91,125]
}],
xaxis: {
categories: [1991,1992,1993,1994,1995,1996,1997, 1998,1999]
}
}
var chart = new ApexCharts(document.querySelector('.user-apex-chart'), options);
if (chart) {
chart.render();
}
})
before I run
npm install apexcharts --save
I have Esbuild and turbo on
and add to application.js this:
import ApexCharts from 'apexcharts'
in package.json it has apex
"dependencies": {
"#hotwired/turbo-rails": "^7.1.1",
"#popperjs/core": "^2.11.5",
"apexcharts": "^3.35.3",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.8.1",
"esbuild": "^0.14.38",
"sass": "^1.51.0",
"tom-select": "^2.0.0"
},
no erorrs when I started the server..
but seems it doesn't see Apex.
What I did wrong?
the test code following below is working:
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
This is likely caused because your application.js script tag has defer="defer" and the library by default renders script tags that expect ApexCharts to exist.
Explanation of defer
The library supports passing defer: true to the options argument and then it will wrap create chart code inside an event listener.
<%= line_chart series, {defer: true} %>
I don't know if the event listener will work with turbo yet though.

How overcome with '#' , coming in URL through DeepLinking in Ionic 2?

I am trying to implement navigation in Ionic 2. I have tried with DeepLinking and i got the result, but '#' sign is comming in URL.
When '#' sign will come in URL then Google Analytic will not recognize the website, that's why i have tried to implement navigation in different ways like Angular 2 Routing, that supports both (HTML5 or hash URL style), but unable to implement in Ionic 2.
Ex- http://localhost:8100/#/registration - This one working fine but i want without '#'.
Like http://localhost:8100/registration
Thanks for help
I put in a PR for #ionic/app-scripts 3.2.5 to remedy this:
https://github.com/ionic-team/ionic-app-scripts/pull/1545
In the meantime you can edit some project and dependency files to enable it:
src/app/app.module.ts:
IonicModule.forRoot(MyApp,
{
locationStrategy: 'path'
},
{
links: [
{ component: RegistrationPage, name: 'registration', segment: 'registration' },
{ component: LoginPage, name: 'login', segment: 'login' },
{ component: HomePage, name: 'home', segment: '' }
]
})
src/index.html:
<head>
...
<base href="/" />
...
</head>
node_modules/#ionic/app-scripts/dist/dev-server/http-server.js:
function createHttpServer(config) {
var app = express();
app.set('serveConfig', config);
app.get('/', serveIndex);
app.use('/', express.static(config.wwwDir));
app.use("/" + serve_config_1.LOGGER_DIR, express.static(path.join(__dirname, '..', '..', 'bin'), { maxAge: 31536000 }));
// Lab routes
app.use(serve_config_1.IONIC_LAB_URL + '/static', express.static(path.join(__dirname, '..', '..', 'lab', 'static')));
app.get(serve_config_1.IONIC_LAB_URL, lab_1.LabAppView);
app.get(serve_config_1.IONIC_LAB_URL + '/api/v1/cordova', lab_1.ApiCordovaProject);
app.get(serve_config_1.IONIC_LAB_URL + '/api/v1/app-config', lab_1.ApiPackageJson);
app.get('/cordova.js', servePlatformResource, serveMockCordovaJS);
app.get('/cordova_plugins.js', servePlatformResource);
app.get('/plugins/*', servePlatformResource);
if (config.useProxy) {
setupProxies(app);
}
app.all('/*', serveIndex);
return app;
}
The line app.all('/*', serveIndex); is what will redirect any 404 file or directory not found errors to index.html. The locationStrategy: 'path' setting can then work normally with deeplinks and redirects under these circumstances.
Try to use pathLocationStrategy instead of HashLocationStrategy.
Add this in app.module.ts
import { LocationStrategy,
PathLocationStrategy } from '#angular/common';
...
#NgModule({
...
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy
},
...
Or other way is
IonicModule.forRoot(MyApp, {
locationStrategy: 'path'
})
And make sure to have a valid base href.
So here is the list of things which I did. Hope this helps.
We need to remove # in path of every url because Google Analytics rejects the urls with # in them. In App Module , add {locationStrategy: 'path'} to your App Module as follows :
IonicModule.forRoot(MyApp, {
locationStrategy: 'path'
})
2 .Now # is removed from the url. But when you refresh or directly access the url, this wont work because this is expected behaviour for any SPA. When you refresh the page , server tried to find the page at the location mentioned. As stated by #Parth Ghiya above For eg: if you hit localhost/abc , then server tries to find abc/index.html which actually doesn't exist.So to resolve this , you have wrote configurations on my server i.e to point every request to index.html . I am using node express server to deploy the app. Use the following code to route every request to index.html -
var express = require('express');
var path = require('path')
var app = express();
app.use(express.static(path.resolve(__dirname, "www")));
app.use('/*', function(req, res){
res.sendFile(__dirname+ '/www' + '/index.html');
});
app.set('port', process.env.PORT || 3000);
app.listen(app.get('port'), function() {
console.log("listening to Port", app.get("port"));
});

Html4 browsers does not support history.pushState and history.replaceState methods of History API from HTML5

I am working on an ember application (using ember-1.0.pre.js). And I'm trying to provide cross browser compatibility on IE8.
The issue is with url generate after every transition, it seems incorrect/falsy to user. Let say I hit the url like the_ domain_name/sell/new which initially land me to on sell page of our application. and then i tries to transit a new state called "Purchase" which will land me on purchase page of our application. The new state transition generates a URL the_ domain_name/sell/new#/offers/purchase?&suid=1365149991779013736531657156165 in IE8 addressbar instead of the domain_name/offers/purchase.
Note: the_domain_name = http://www.example.com
The generated url includes two incorrect things,
The initial prefix "/sell/new#".
The parameter "?&_suid=1365149991779013736531657156165" in query string of url.
I tried to figure out the issue and found that HTML4 browsers does not supports pushState and replaceState methods from History API from HTML5. How can i provide the support on IE8 Can anyone help me on this?
I suggest History.js as polyfill for browsers not support History API: https://github.com/browserstate/history.js
It is working in:
HTML5 Browsers:
Firefox 4+
Chrome 8+
Opera 11.5
Safari 5.0+
Safari iOS 4.3+
HTML4 Browsers:
IE 6, 7, 8, 9
Firefox 3
Opera 10, 11.0
Safari 4
Safari iOS 4.2, 4.1, 4.0, 3.2
Add jquery.history.js & Register a history.js location handler into you Ember App.
Here are the parts I modified from original Ember.HistoryLocation ( Full code )
(function() {
var get = Ember.get, set = Ember.set;
var popstateFired = false;
Ember.HistoryJsLocation = Ember.Object.extend({
initState: function() {
this.replaceState(this.formatURL(this.getURL()));
set(this, 'history', window.History);
},
getState: function() {
return get(this, 'history').getState().state;
},
pushState: function(path) {
History.pushState({ path: path }, null, path);
},
replaceState: function(path) {
History.replaceState({ path: path }, null, path);
}
});
Ember.Location.registerImplementation('historyJs', Ember.HistoryJsLocation);
})();
Then use this polyfill in your App:
App.Router.reopen({
location: 'historyJs'
});

Consuming SAP soap web service using jQueryAjax in html5 webpages iPad

I have made application for SAP on iPad in xcode framework. Using web view method I am able to open my application webpages in iPad. html5 pages are store on my pc.
My question is how to consume SAP SOAP web-service through html5 webpages. What steps should I make first? I have access of SAP ES workplace. I dont have any idea about this as this is my first project. Can some one provide me the proper Video tutorial or specific links to read.
Most of link are for REST ful web services. Thanks in Advance.
And my web service url is
"http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF5300E043F279F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800" which opens in wsdl format.
And "MaterialBasicDataByIDQueryResponse_In" this is my function name
I highly recommend REST! It's a lot more light weight
I user jQuery in this example
In your html page
<script id="soap-template" type="application/soap-template"> <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns0:getSOAP xmlns:ns0="http://localhost:8080/soap"> <search>${id}</search></ns0:getSOAP ></soap:Body></soap:Envelope></script>
JS:
var soapBody = $("#soap-template").html().replace(
new RegExp( "\\$\\{[^}]+\\}", "i" ),
search
);
soapBody = $.trim( soapBody );
$.ajax({
type: "post",
url: "http://localhost:8080/soap",
contentType: "text/xml",
data: soapBody,
dataType: "xml",
processData: false,
beforeSend: function( xhr ){
// Pass the target URL onto the proxy.
xhr.setRequestHeader(
"SOAPTarget",
"http://localhost:8080/soap"
);
// Pass the action onto the proxy.
xhr.setRequestHeader(
"SOAPAction",
"http://localhost:8080/soap/getSOAP"
);
},
success: function( response ){
// Get a jQuery-ized version of the response.
var xml = $( response );
//handle your result
},
error: function(){
alert("error");
console.log( "ERROR", arguments );
}
});