tangledgroup/tangled-llama-p-128k-base-v0.1
Text Generation
•
Updated
•
4
•
2
text
stringlengths 2
1.05M
|
---|
/*
* Copyright 2019 Lightbend Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const should = require("chai").should();
const Long = require("long");
const PNCounter = require("../../src/crdts/pncounter");
const protobufHelper = require("../../src/protobuf-helper");
const CrdtDelta = protobufHelper.moduleRoot.cloudstate.crdt.CrdtDelta;
function roundTripDelta(delta) {
return CrdtDelta.decode(CrdtDelta.encode(delta).finish());
}
describe("PNCounter", () => {
it("should have a value of zero when instantiated", () => {
const counter = new PNCounter();
counter.value.should.equal(0);
should.equal(counter.getAndResetDelta(), null);
});
it("should reflect a delta update", () => {
const counter = new PNCounter();
counter.applyDelta(roundTripDelta({
pncounter: {
change: 10
}
}));
counter.value.should.equal(10);
// Try incrementing it again
counter.applyDelta(roundTripDelta({
pncounter: {
change: -3
}
}));
counter.value.should.equal(7);
});
it("should generate deltas", () => {
const counter = new PNCounter();
counter.increment(10);
counter.value.should.equal(10);
roundTripDelta(counter.getAndResetDelta()).pncounter.change.toNumber().should.equal(10);
should.equal(counter.getAndResetDelta(), null);
counter.decrement(3);
counter.value.should.equal(7);
counter.decrement(4);
counter.value.should.equal(3);
roundTripDelta(counter.getAndResetDelta()).pncounter.change.toNumber().should.equal(-7);
should.equal(counter.getAndResetDelta(), null);
});
it("should support long values", () => {
const impossibleDouble = Long.ZERO.add(Number.MAX_SAFE_INTEGER).add(1);
const counter = new PNCounter();
counter.increment(Number.MAX_SAFE_INTEGER);
counter.increment(1);
counter.longValue.should.eql(impossibleDouble);
roundTripDelta(counter.getAndResetDelta()).pncounter.change.should.eql(impossibleDouble);
});
it("should support incrementing by long values", () => {
const impossibleDouble = Long.ZERO.add(Number.MAX_SAFE_INTEGER).add(1);
const counter = new PNCounter();
counter.increment(impossibleDouble);
counter.longValue.should.eql(impossibleDouble);
roundTripDelta(counter.getAndResetDelta()).pncounter.change.should.eql(impossibleDouble);
});
it("should support empty initial deltas (for ORMap added)", () => {
const counter = new PNCounter();
counter.value.should.equal(0);
should.equal(counter.getAndResetDelta(), null);
roundTripDelta(counter.getAndResetDelta(/* initial = */ true)).pncounter.change.toNumber().should.equal(0);
});
});
|
import express from 'express'
// const PatientController = require('../controllers/patient-controller');
// import {PatientController} from '../controllers/patient-controller';
import {getItems,
getItemById,
createItem,
updateItem,
deleteItem} from '../controllers/patient-controller.js';
export const router = express.Router();
router.get('/items', getItems);
router.get('/item/:id', getItemById);
router.post('/item', createItem);
router.put('/item/:id', updateItem);
router.delete('/item/:id', deleteItem);
// module.exports = router;
|
var webPasses = require('../lib/http-proxy/passes/web-incoming'),
httpProxy = require('../lib/http-proxy'),
expect = require('expect.js'),
http = require('http');
describe('lib/http-proxy/passes/web.js', function() {
describe('#deleteLength', function() {
it('should change `content-length`', function() {
var stubRequest = {
method: 'DELETE',
headers: {}
};
webPasses.deleteLength(stubRequest, {}, {});
expect(stubRequest.headers['content-length']).to.eql('0');
})
});
describe('#timeout', function() {
it('should set timeout on the socket', function() {
var done = false, stubRequest = {
socket: {
setTimeout: function(value) { done = value; }
}
}
webPasses.timeout(stubRequest, {}, { timeout: 5000});
expect(done).to.eql(5000);
});
});
describe('#XHeaders', function () {
var stubRequest = {
connection: {
remoteAddress: '192.168.1.2',
remotePort: '8080'
},
headers: {
host: '192.168.1.2:8080'
}
}
it('set the correct x-forwarded-* headers', function () {
webPasses.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
});
});
});
describe('#createProxyServer.web() using own http server', function () {
it('should proxy the request using the web proxy handler', function (done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
});
function requestHandler(req, res) {
proxy.web(req, res);
}
var proxyServer = http.createServer(requestHandler);
var source = http.createServer(function(req, res) {
source.close();
proxyServer.close();
expect(req.method).to.eql('GET');
expect(req.headers.host.split(':')[1]).to.eql('8081');
done();
});
proxyServer.listen('8081');
source.listen('8080');
http.request('http://127.0.0.1:8081', function() {}).end();
});
it('should detect a proxyReq event and modify headers', function (done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080',
});
proxy.on('proxyReq', function(proxyReq, req, res, options) {
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
});
function requestHandler(req, res) {
proxy.web(req, res);
}
var proxyServer = http.createServer(requestHandler);
var source = http.createServer(function(req, res) {
source.close();
proxyServer.close();
expect(req.headers['x-special-proxy-header']).to.eql('foobar');
done();
});
proxyServer.listen('8081');
source.listen('8080');
http.request('http://127.0.0.1:8081', function() {}).end();
});
it('should proxy the request and handle error via callback', function(done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
});
var proxyServer = http.createServer(requestHandler);
function requestHandler(req, res) {
proxy.web(req, res, function (err) {
proxyServer.close();
expect(err).to.be.an(Error);
expect(err.code).to.be('ECONNREFUSED');
done();
});
}
proxyServer.listen('8082');
http.request({
hostname: '127.0.0.1',
port: '8082',
method: 'GET',
}, function() {}).end();
});
it('should proxy the request and handle error via event listener', function(done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
});
var proxyServer = http.createServer(requestHandler);
function requestHandler(req, res) {
proxy.once('error', function (err, errReq, errRes) {
proxyServer.close();
expect(err).to.be.an(Error);
expect(errReq).to.be.equal(req);
expect(errRes).to.be.equal(res);
expect(err.code).to.be('ECONNREFUSED');
done();
});
proxy.web(req, res);
}
proxyServer.listen('8083');
http.request({
hostname: '127.0.0.1',
port: '8083',
method: 'GET',
}, function() {}).end();
});
it('should proxy the request and handle timeout error (proxyTimeout)', function(done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:45000',
proxyTimeout: 100
});
require('net').createServer().listen(45000);
var proxyServer = http.createServer(requestHandler);
var started = new Date().getTime();
function requestHandler(req, res) {
proxy.once('error', function (err, errReq, errRes) {
proxyServer.close();
expect(err).to.be.an(Error);
expect(errReq).to.be.equal(req);
expect(errRes).to.be.equal(res);
expect(new Date().getTime() - started).to.be.greaterThan(99);
expect(err.code).to.be('ECONNRESET');
done();
});
proxy.web(req, res);
}
proxyServer.listen('8084');
http.request({
hostname: '127.0.0.1',
port: '8084',
method: 'GET',
}, function() {}).end();
});
it('should proxy the request and handle timeout error', function(done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:45001',
timeout: 100
});
require('net').createServer().listen(45001);
var proxyServer = http.createServer(requestHandler);
var cnt = 0;
var doneOne = function() {
cnt += 1;
if(cnt === 2) done();
}
var started = new Date().getTime();
function requestHandler(req, res) {
proxy.once('error', function (err, errReq, errRes) {
proxyServer.close();
expect(err).to.be.an(Error);
expect(errReq).to.be.equal(req);
expect(errRes).to.be.equal(res);
expect(err.code).to.be('ECONNRESET');
doneOne();
});
proxy.web(req, res);
}
proxyServer.listen('8085');
var req = http.request({
hostname: '127.0.0.1',
port: '8085',
method: 'GET',
}, function() {});
req.on('error', function(err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('ECONNRESET');
expect(new Date().getTime() - started).to.be.greaterThan(99);
doneOne();
});
req.end();
});
it('should proxy the request and provide a proxyRes event with the request and response parameters', function(done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
});
function requestHandler(req, res) {
proxy.once('proxyRes', function (proxyRes, pReq, pRes) {
source.close();
proxyServer.close();
expect(pReq).to.be.equal(req);
expect(pRes).to.be.equal(res);
done();
});
proxy.web(req, res);
}
var proxyServer = http.createServer(requestHandler);
var source = http.createServer(function(req, res) {
res.end('Response');
});
proxyServer.listen('8086');
source.listen('8080');
http.request('http://127.0.0.1:8086', function() {}).end();
});
it('should proxy the request and handle changeOrigin option', function (done) {
var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080',
changeOrigin: true
});
function requestHandler(req, res) {
proxy.web(req, res);
}
var proxyServer = http.createServer(requestHandler);
var source = http.createServer(function(req, res) {
source.close();
proxyServer.close();
expect(req.method).to.eql('GET');
expect(req.headers.host.split(':')[1]).to.eql('8080');
done();
});
proxyServer.listen('8081');
source.listen('8080');
http.request('http://127.0.0.1:8081', function() {}).end();
});
}); |
'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
app: 'app',
dist: 'dist',
test: 'test',
sass: {
dist: {
options: {
style: 'expanded', // expanded or nested or compact or compressed
loadPath: '<%= app %>/bower_components/foundation/scss',
compass: true,
quiet: true
},
files: {
'<%= app %>/css/app.css': '<%= app %>/scss/app.scss'
}
}
},
postcss: {
options: {
processors: [
require('autoprefixer')({browsers: 'last 2 versions'})
]
},
dist: {
src: '<%= app %>/css/app.css'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= app %>/js/**/*.js'
]
},
karma: {
unit: {
configFile: '<%= test %>/karma.conf.js'
}
},
clean: {
dist: {
src: ['<%= dist %>/*']
},
},
copy: {
dist: {
files: [{
expand: true,
cwd:'<%= app %>/',
src: ['fonts/**', '**/*.html', '!**/*.scss', '!bower_components/**'],
dest: '<%= dist %>/'
}]
},
},
imagemin: {
target: {
files: [{
expand: true,
cwd: '<%= app %>/images/',
src: ['**/*.{jpg,gif,svg,jpeg,png}'],
dest: '<%= dist %>/images/'
}]
}
},
uglify: {
options: {
preserveComments: 'some',
mangle: false
}
},
useminPrepare: {
html: ['<%= app %>/index.html'],
options: {
dest: '<%= dist %>'
}
},
usemin: {
html: ['<%= dist %>/**/*.html', '!<%= app %>/bower_components/**'],
css: ['<%= dist %>/css/**/*.css'],
options: {
dirs: ['<%= dist %>']
}
},
watch: {
grunt: {
files: ['Gruntfile.js'],
tasks: ['sass', 'postcss']
},
sass: {
files: '<%= app %>/scss/**/*.scss',
tasks: ['sass', 'postcss']
},
livereload: {
files: ['<%= app %>/**/*.html', '!<%= app %>/bower_components/**', '<%= app %>/js/**/*.js', '<%= app %>/css/**/*.css', '<%= app %>/images/**/*.{jpg,gif,svg,jpeg,png}'],
options: {
livereload: true
}
}
},
connect: {
app: {
options: {
port: 9000,
base: '<%= app %>/',
open: true,
livereload: true,
hostname: '127.0.0.1'
}
},
dist: {
options: {
port: 9001,
base: '<%= dist %>/',
open: true,
keepalive: true,
livereload: false,
hostname: '127.0.0.1'
}
}
},
wiredep: {
target: {
src: [
'<%= app %>/**/*.html'
],
exclude: [
'modernizr',
'jquery-placeholder',
'foundation'
]
}
}
});
grunt.registerTask('compile-sass', ['sass', 'postcss']);
grunt.registerTask('bower-install', ['wiredep']);
grunt.registerTask('default', ['compile-sass', 'bower-install', 'connect:app', 'watch']);
grunt.registerTask('validate-js', ['jshint']);
grunt.registerTask('server-dist', ['connect:dist']);
grunt.registerTask('publish', ['compile-sass', 'clean:dist', 'validate-js', 'useminPrepare', 'copy:dist', 'newer:imagemin', 'concat', 'cssmin', 'uglify', 'usemin']);
grunt.loadNpmTasks('grunt-karma');
};
|
/* See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Esri Inc. licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(["dojo/_base/declare",
"dojo/_base/lang",
"dojo/_base/array",
"dojo/topic",
"app/context/app-topics",
"app/common/Templated",
"dojo/text!./templates/App.html",
"dojo/i18n!../nls/resources",
"app/etc/util",
"app/main/SearchPanel",
"app/main/MapPanel",
"app/main/AboutPanel",
"app/content/MetadataEditor",
"app/content/UploadMetadata"],
function(declare, lang, array, topic, appTopics, Templated, template, i18n, util, SearchPanel, MapPanel, AboutPanel,
MetadataEditor, UploadMetadata) {
var oThisClass = declare([Templated], {
i18n: i18n,
templateString: template,
postCreate: function() {
this.inherited(arguments);
var self = this;
this.updateUI();
var ignoreMapPanelActivated = false;
$("a[href='#searchPanel']").on("shown.bs.tab",lang.hitch(this, function(e) {
this.setHash('searchPanel')
}));
$("a[href='#mapPanel']").on("shown.bs.tab",lang.hitch(this, function(e) {
this.setHash('mapPanel')
if (!ignoreMapPanelActivated && !self.mapPanel.mapWasInitialized) {
self.mapPanel.ensureMap();
}
}));
$("a[href='#aboutPanel']").on("shown.bs.tab",lang.hitch(this, function(e) {
this.setHash('aboutPanel')
}));
topic.subscribe(appTopics.AddToMapClicked,lang.hitch(this, function(params){
if (self.mapPanel.mapWasInitialized) {
$("a[href='#mapPanel']").tab("show");
self.mapPanel.addToMap(params);
} else {
var urlParams = {resource: params.type+":"+this.normalizeUrl(params.url)};
ignoreMapPanelActivated = true;
$("a[href='#mapPanel']").tab("show");
self.mapPanel.ensureMap(urlParams);
ignoreMapPanelActivated = false;
}
}));
topic.subscribe(appTopics.SignedIn,function(params){
self.updateUI();
});
$("#idAppDropdown").on("show.bs.dropdown",function() {
self.updateUI();
});
if (location.hash==null || location.hash.length==0) {
this.setHash('searchPanel')
} else if ( $("a[href='"+location.hash+"']").length > 0) {
$("a[href='"+location.hash+"']").tab("show");
}
},
/* =================================================================================== */
setHash: function(hash) {
var el = document.getElementById(hash);
var id = el.id;
el.removeAttribute('id');
location.hash = hash;
el.setAttribute('id',id);
},
createMetadataClicked: function() {
var editor = new MetadataEditor();
editor.show();
},
signInClicked: function() {
AppContext.appUser.showSignIn();
},
signOutClicked: function() {
AppContext.appUser.signOut();
},
uploadClicked: function() {
if (AppContext.appUser.isPublisher()) (new UploadMetadata()).show();
},
editFacetClicked: function() {
console.warn("TODO provide edit facet functionality in App.js")
},
/* =================================================================================== */
getCreateAccountUrl: function() {
if (AppContext.geoportal && AppContext.geoportal.createAccountUrl) {
return util.checkMixedContent(AppContext.geoportal.createAccountUrl);
}
return null;
},
updateUI: function() {
var updateHref = function(node,link,href) {
if (typeof href === "string" && href.length > 0) {
link.href = href;
node.style.display = "";
} else {
link.href = "#";
node.style.display = "none";
}
};
var v;
if (AppContext.appUser.isSignedIn()) {
v = i18n.nav.welcomePattern.replace("{name}",AppContext.appUser.getUsername());
util.setNodeText(this.usernameNode,v);
this.userOptionsNode.style.display = "";
this.signInNode.style.display = "none";
this.signOutNode.style.display = "";
this.adminOptionsBtnNode.style.display = "";
updateHref(this.createAccountNode,this.createAccountLink,null);
updateHref(this.myProfileNode,this.myProfileLink,AppContext.appUser.getMyProfileUrl());
} else {
this.usernameNode.innerHTML = "";
this.userOptionsNode.style.display = "none";
this.createAccountNode.style.display = "none";
this.signInNode.style.display = "";
this.signOutNode.style.display = "none";
this.adminOptionsBtnNode.style.display = "none";
updateHref(this.createAccountNode,this.createAccountLink,this.getCreateAccountUrl());
updateHref(this.myProfileNode,this.myProfileLink,null);
}
var isAdmin = AppContext.appUser.isAdmin();
var isPublisher = AppContext.appUser.isPublisher();
$("li[data-role='admin']").each(function(i,nd) {
if (isAdmin) nd.style.display = "";
else nd.style.display = "none";
});
$("li[data-role='publisher']").each(function(i,nd) {
if (isPublisher) nd.style.display = "";
else nd.style.display = "none";
});
if (!FileReader) this.uploadNode.style.display = "none";
},
normalizeUrl: function(url) {
var services = ["mapserver", "imageserver", "featureserver", "streamserver", "vectortileserver"];
var selSrv = array.filter(services, function(srv) { return url.toLowerCase().indexOf(srv)>=0; });
if (selSrv && selSrv.length>0) {
var srv = selSrv[0];
url = url.substr(0, url.toLowerCase().indexOf(srv) + srv.length);
}
return url;
},
_onHome: function() {
this.searchPanelLink.click()
location.hash = "searchPanel"
}
});
return oThisClass;
});
|
const AWS = require('aws-sdk');
require('amazon-cognito-js');
const { onConflict, onDatasetDeleted, onDatasetsMerged } = require('./sync-handlers');
const cognitoSyncManager = () => new AWS.CognitoSyncManager({ DataStore: AWS.CognitoSyncManager.StoreInMemory });
const getCognitoCredentials = (accessToken) => {
// Initialize the Amazon Cognito credentials provider
AWS.config.region = process.env.COGNITO_AWS_REGION;
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: process.env.COGNITO_IDENTITY_POOL_ID,
Logins: { 'www.amazon.com': accessToken },
});
return AWS.config.credentials.getPromise();
};
const openOrCreateDataset = datasetName => new Promise((resolve, reject) => {
cognitoSyncManager().openOrCreateDataset(datasetName, (error, dataset) => {
if (error) {
console.error(`Failed to open dataset: ${datasetName}`, error);
return reject(error);
}
console.log('Opened dataset:', datasetName);
return resolve(dataset);
});
});
const saveItemsToDataset = (dataset, items) => new Promise((resolve, reject) => {
dataset.putAll(items, (error) => {
if (error) {
console.error(`Failed to save items to dataset: ${items}`, error);
return reject(error);
}
console.log('Saved items to dataset:', items);
return resolve(dataset);
});
});
const saveItemToDataset = (dataset, itemId, item) => new Promise((resolve, reject) => {
dataset.put(itemId, item, (error, record) => {
if (error) {
console.error(`Failed to save item to dataset: ${item}`, error);
return reject(error);
}
console.log('Saved item to dataset:', record);
return resolve(dataset);
});
});
const removeItemsFromDataset = (dataset, itemIds) => {
// Save null values for the specified item IDs, causing them to be removed upon synchronization.
const removedItems = itemIds.reduce((records, itemId) => ({ ...records, [itemId]: null }), {});
return saveItemsToDataset(dataset, removedItems);
};
const removeItemFromDataset = (dataset, itemId) => new Promise((resolve, reject) => {
dataset.remove(itemId, (error, record) => {
if (error) {
console.error(`Failed to remove item from dataset: ${itemId}`, error);
return reject(error);
}
console.log('Removed item from dataset:', record);
return resolve(dataset);
});
});
const synchronizeDataset = dataset => new Promise((resolve, reject) => {
dataset.synchronize({
onSuccess(syncedDataset, updatedRecords) {
console.log('Synchronized dataset to remote store:', `${updatedRecords.length} records updated`);
resolve(syncedDataset);
},
onFailure(error) {
console.error('Failed to synchronize dataset to remote store:', error);
reject(error);
},
onConflict,
onDatasetDeleted,
onDatasetsMerged,
});
});
module.exports = {
getCognitoCredentials,
openOrCreateDataset,
saveItemsToDataset,
saveItemToDataset,
removeItemsFromDataset,
removeItemFromDataset,
synchronizeDataset,
};
|
Template[getTemplate('postUpvote')].helpers({
upvoted: function(){
var user = Meteor.user();
if(!user) return false;
return _.include(this.upvoters, user._id);
},
oneBasedRank: function(){
if(typeof this.rank !== 'undefined')
return this.rank + 1;
}
});
Template[getTemplate('postUpvote')].events({
'click .upvote-link': function(e, instance){
var post = this;
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
throwError(i18n.t("Please log in first"));
}
Meteor.call('upvotePost', post, function(error, result){
trackEvent("post upvoted", {'_id': post._id});
});
}
}); |
var m = require('mithril');
module.exports = m.trust('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="24" height="24" viewBox="0 0 24.00 24.00" enable-background="new 0 0 24.00 24.00" xml:space="preserve"><path fill="#000000" fill-opacity="1" stroke-width="1.33333" stroke-linejoin="miter" d="M 3,4C 1.89001,3.9966 1,4.89 1,6L 1,17L 3,17C 3,18.6568 4.34315,20 6,20C 7.65685,20 9,18.6568 9,17L 15,17C 15,18.6568 16.3431,20 18,20C 19.6569,20 21,18.6568 21,17L 23,17L 23,14C 23,12.89 22.11,12 21,12L 19,12L 19,9.5L 23,9.5L 23,6C 23,4.89 22.1097,3.975 21,4L 3,4 Z M 2.5,5.5L 6.5,5.5L 6.5,8L 2.5,8L 2.5,5.5 Z M 8,5.5L 12,5.5L 12,8L 8,8L 8,5.5 Z M 13.5,5.5L 17.5,5.5L 17.5,8L 13.5,8L 13.5,5.5 Z M 19,5.5L 21.5,5.5L 21.5,8L 19,8L 19,5.5 Z M 13.5,9.5L 17.5,9.5L 17.5,12L 13.5,12L 13.5,9.5 Z M 2.5,9.5L 6.5,9.5L 6.5,12L 2.5,12L 2.5,9.5 Z M 8,9.5L 12,9.5L 12,12L 8,12L 8,9.5 Z M 6,15.5C 6.82843,15.5 7.5,16.1716 7.5,17C 7.5,17.8284 6.82843,18.5 6,18.5C 5.17157,18.5 4.5,17.8284 4.5,17C 4.5,16.1716 5.17157,15.5 6,15.5 Z M 18,15.5C 18.8284,15.5 19.5,16.1716 19.5,17C 19.5,17.8284 18.8284,18.5 18,18.5C 17.1716,18.5 16.5,17.8284 16.5,17C 16.5,16.1716 17.1716,15.5 18,15.5 Z "/></svg>');
|
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import 'plugins/security/views/management/change_password_form/change_password_form';
import 'plugins/security/views/management/password_form/password_form';
import 'plugins/security/views/management/users';
import 'plugins/security/views/management/roles';
import 'plugins/security/views/management/edit_user';
import 'plugins/security/views/management/edit_role/index';
import 'plugins/security/views/management/management.less';
import routes from 'ui/routes';
import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
import '../../services/shield_user';
import { ROLES_PATH, USERS_PATH } from './management_urls';
import { management } from 'ui/management';
routes.defaults(/\/management/, {
resolve: {
securityManagementSection: function (ShieldUser, Private) {
const xpackInfo = Private(XPackInfoProvider);
const showSecurityLinks = xpackInfo.get('features.security.showLinks');
function deregisterSecurity() {
management.deregister('security');
}
function ensureSecurityRegistered() {
const registerSecurity = () => management.register('security', {
display: 'Security',
order: 10
});
const getSecurity = () => management.getSection('security');
const security = (management.hasItem('security')) ? getSecurity() : registerSecurity();
if (!security.hasItem('users')) {
security.register('users', {
name: 'securityUsersLink',
order: 10,
display: 'Users',
url: `#${USERS_PATH}`,
});
}
if (!security.hasItem('roles')) {
security.register('roles', {
name: 'securityRolesLink',
order: 20,
display: 'Roles',
url: `#${ROLES_PATH}`,
});
}
}
deregisterSecurity();
if (!showSecurityLinks) return;
// getCurrent will reject if there is no authenticated user, so we prevent them from seeing the security
// management screens
//
// $promise is used here because the result is an ngResource, not a promise itself
return ShieldUser.getCurrent().$promise
.then(ensureSecurityRegistered)
.catch(deregisterSecurity);
}
}
});
|
"/*! DataTables 1.10.16\n * ©2008-2017 SpryMedia Ltd - datatables.net/license\n */\n\n/**\n * @s(...TRUNCATED) |
No dataset card yet