How to use four_button.js plugin in Datatables 1.10 - datatables

I'm start to use Datatables 1.10 versiĆ³n but i have problems to use this option "sPaginationType" : 'four_button' when initializing my datatables
In the version 1.9.4 , I used previously works correctly
My datatables version
https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js
My four_button version
https://cdn.datatables.net/plug-ins/1.10.17/pagination/four_button.js
table = $('#tabla-informes').DataTable({
"sDom" : "",
"sPaginationType" : 'four_button',
"aoColumns" : aoColumns,
"aoColumnDefs" : [ {"bVisible" : false, "aTargets" : [ 0 ]} ],
"bServerSide" : true,
"sAjaxSource" : "/informacion/ajaxLista",
"fnServerParams": function ( aoData ) {
}) ....
Browser crash
https://imgur.com/YnNlXoj
Thanks, all

Related

Context not set in time after fetching it from the basesites request after Upgrading to 2.1

we have our Spartacus project set up to fetch the context from the basesites request. A sample response can be seen here:
{
"baseSites" : [ {
"defaultLanguage" : {
"isocode" : "sl"
},
"geoRecommended" : false,
"showTeaser" : true,
"stores" : [ {
"currencies" : [ {
"isocode" : "EUR"
} ],
"defaultCurrency" : {
"isocode" : "EUR"
},
"defaultLanguage" : {
"isocode" : "sl"
},
"languages" : [ {
"isocode" : "sl"
} ],
} ],
"uid" : "ung-site-si",
"urlEncodingAttributes" : [ "languageCountry" ],
"urlPatterns" : [ "(?i)^https?://localhost(:[\\d]+)?/rest/.*$", "(?i)^https?://[^/]+/(sl-SI)/?.*$" ]
}, ...
]
We have two basesites set up at the moment. The urlPatterns are used to find the correct baseSite. Then the context(baseSite, language, currency) is set in our custom occ-loaded-config-converter. So we are not using any static context or fetching it from the URL, but getting the context from the response of the basesites request.
The site-context-interceptor then subscribes to e.g. this.languageService.getActive() and then sets the correct context (language, currency) for the backend requests:
/rest/v2/ung-site-rs/cms/pages?fields=DEFAULT&pageType=ContentPage&pageLabelOrId=/shoppster-akcija&lang=sr&curr=RSD
Before the Spartacus Upgrade to 2.0 this worked fine. Right after the context was set from the basesites request, the subscription in the site-context-interceptor was triggered an the right context sent with the subsequent backend requests. Now after upgrading to 2.1, the context is not set on time anymore. So the first few backend requests are sent with the wrong context (default USD, en) and then at some point in time, the subscriptions are triggered an the correct context is set.
This may be related to this change:
https://sap.github.io/spartacus-docs/technical-changes-version-2/#context-change-action-not-dispatched-on-the-initial-setting-of-the-value
Is it now not possible anymore to use the basesites request to set the context?
As discussed in comments: bumping to the latest patch version 2.1.4 has fixed the issue.

Why TSLint problems are not shown in IntelliJ Idea?

I'm using IntelliJ Idea (Ultimate) and I'm trying to setup TSLint. What I have done so far:
created a new project
installed TS & TSLint npm i tslint typescript -D
enabled TSLint in Languages and Frameworks | TypeScript | TSLint | Enable (like suggested here)
added additional (rather random) tslint.json (see below)
applied it via right click | Apply TSLint Code Style Rules
created some ugly .ts file (see below)
but still none of the problems are highlighted. When I run tslint ugly.ts in console it shows many problems. TS problems are highlighted:
I've also checked highlighting settings:
And here's how TSLint settings look now (Enable checked, Automatic search is set):
Any ideas what could be wrong?
ugly.ts:
/* tslint:enable */
// npm i tslint typescript -D
function a (): void {
var b = 1;
if(b){var c=2; var d=5;}
var a =4
a+b
var s1 = 'haha'
, s2 ="ololo"
,s3 = `wow`
return ;;
}
function b(){return 9}
tslint.json:
{
"extends": ["tslint:recommended"],
"linterOptions": {
"exclude": [
"node_modules/**/*"
]
},
"rules": {
"quotemark": {
"single": true,
"severity": "error"
}, //"jsx-double"
"interface-name": false,
"whitespace": [ true, "check-module" ],
"max-classes-per-file": [ false ],
"member-access": false,
"object-literal-sort-keys": false,
"member-ordering": false,
"semicolon": [ true, "always", "ignore-bound-class-methods" ],
"variable-name": [ true, "check-format", "allow-leading-underscore", "allow-pascal-case" ],
"no-console": false,
"indent": [ true, "spaces", 2 ],
"no-empty-interface": false
}
}

ELK - X-Pack Custom realm

I've developed a custom realm for my ELK cluster.
This module works well on a on node elasticsearch but when I install it on my production cluster, nothing works.
Elasticsearch starting logs :
- nothing special, everything seems to work and xpack module is loaded (generates a log in stdout)
Elasticsearch cluster diagnostic (custom seems to be disabled and not available) :
{
"security" : {
"available" : true,
"enabled" : true,
"realms" : {
"file" : {
"available" : true,
"enabled" : false
},
"ldap" : {
"available" : true,
"enabled" : false
},
"native" : {
"name" : [
"realm2"
],
"available" : true,
"size" : [
2
],
"enabled" : true,
"order" : [
1
]
},
"custom" : {
"available" : false,
"enabled" : false
},
...
}
Elasticsearch configuration :
cluster.name: "production-cluster-1"
network.host: 0.0.0.0
bootstrap.memory_lock: true
xpack.security.enabled: true
xpack.security.audit.enabled: true
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.watcher.enabled: false
xpack.ml.enabled: false
discovery.zen.ping.unicast.hosts: "-------------------"
network.publish_host: "----"
discovery.zen.minimum_master_nodes: 3
xpack.security:
authc:
realms:
realm1:
type: custom
order: 0
realm2:
type: native
order: 1
The native authentication works fine.
How can I troubleshoot this correctly ? :)
Thanks
Let's start by turning up the logging:
curl -u<user> -XPUT '<host>:<http-port>/_cluster/settings?pretty' -H 'Content-Type: application/json' -d'
{
"transient": {
"logger.org.elasticsearch.xpack.security.authc": "DEBUG"
}
}
'
That will give you any authentication logs on debug. I think the right package for the native realm should be logger.org.elasticsearch.xpack.security.authc.esnative in case you want to limit it down just to that.

JSlint ignoring globals set inside .jshintrc file - used in intellij

I am trying to use jshint and jslint.I am using custom .jshintrc file and add few of my global variables and functions into globals inside .jshintrc as below.
{
// Environments
"browser" : true, // Web Browser (window, document, etc)
"browserify" : false, // Browserify (node.js code in the browser)
"couch" : false, // CouchDB
"devel" : true, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jasmine" : false, // Jasmine
"jquery" : true, // jQuery
"mocha" : true, // Mocha
"mootools" : false, // MooTools
"node" : true, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"phantom" : false, // PhantomJS
"prototypejs" : false, // Prototype and Scriptaculous
"qunit" : false, // QUnit
"rhino" : false, // Rhino
"shelljs" : false, // ShellJS
"typed" : false, // Globals for typed array constructions
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface
"globals": {
"swal": true,
"testvar1":true,
"testfunction1":true,
"testfunction2":true,
"testvar2":true,
"console":true,
"$":true
}
}
I am getting following errors
JSLint:Undeclared console
JSLint:Undeclared $
When I add /*gloabls console */ in same file it is working fine.How to fix this issue.
Thanks

Angular 2, Karma and PhantomJS

I am learning how to set up Karma with Angular 2 and running into issues.
I followed what Julie did in her seed project and applied it to my project.
All works well in Chrome, but when I want to use PhantomJS I get an error. This also happens in PhantomJS2...
This is the error:
[karma]: Karma v0.13.22 server started at http://localhost:9877/
[launcher]: Starting browser PhantomJS2
[PhantomJS 2.0.0 (Mac OS X 0.0.0)]: Connected on socket /#1yDrSei5NUX4_WYaAAAA with id 93476222
Missing error handler on `socket`.
TypeError: (msg || "").replace is not a function
at node_modules/karma/lib/reporter.js:45:23
karma.config.js
module.exports = function (config) {
config.set({
basePath : '',
frameworks : ['jasmine'],
files : [
// paths loaded by Karma
{pattern : 'node_modules/systemjs/dist/system-polyfills.js', included : true, watched : true},
{pattern : 'node_modules/systemjs/dist/system.src.js', included : true, watched : true},
{pattern : 'node_modules/es6-shim/es6-shim.js', included : true, watched : true},
{pattern : 'node_modules/angular2/bundles/angular2-polyfills.js', included : true, watched : true},
{pattern : 'node_modules/rxjs/bundles/Rx.js', included : true, watched : true},
{pattern : 'node_modules/angular2/bundles/angular2.js', included : true, watched : true},
{pattern : 'node_modules/angular2/bundles/testing.dev.js', included : true, watched : true},
{pattern : 'karma-test-shim.js', included : true, watched : true},
{pattern : 'app/**/*.js', included : false, watched : true},
{pattern : 'app/**/*.html', included : false, watched : true},
{pattern : 'app/**/*.css', included : false, watched : true},
{pattern : 'test/**/*.ts', included : false, watched : false},
{pattern : 'test/**/*.js', included : false, watched : true},
{pattern : 'test/**/*.js.map', included : false, watched : false}
],
proxies : {
"/app/" : "/base/src/app/"
},
reporters : ['progress'],
port : 9876,
colors : true,
logLevel : config.LOG_INFO,
autoWatch : false,
browsers : ['PhantomJS2'],
singleRun : true
})}
Anyone know what I am doing wrong?
Thanks in advance
ensure this line in your karma.conf.js
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false}, // PhantomJS2 (and possibly others) might require it
this github project works with phantom:
https://github.com/danday74/angular2-coverage/blob/master/karma.conf.js
clone it and have a play