' + JSON.stringify(orig, null, 4);
}
function parseTryCatchStackTrace(err) {
var lines = err.stack.split('\n'),
stack;
stack = lines[1].split(':').reverse().splice(0, 2);
return {
column: stack[0],
line: stack[1]
};
}
window.onerror = function(msg, filename, lineno, colno, err) {
var error = {
err: err,
stack: {
message: msg,
line: lineno,
column: colno,
filename: filename
},
mode: 'onerror'
};
parseStackTrace(error);
};","var fizz_source_map = new sourceMap.SourceMapConsumer(fizzbuzz_map);
var test_source_map = new sourceMap.SourceMapConsumer(test_map);
var catch_source_map = new sourceMap.SourceMapConsumer(catch_map);
var body = document.body;
function parseStackTrace(err) {
var info;
var source_map;
if(err.mode === 'trycatch') {
info = parseTryCatchStackTrace(err);
source_map = catch_source_map;
} else {
info = err.stack;
source_map = test_source_map;
if(/fizzbuzz/.test(info.filename)) {
source_map = fizz_source_map;
}
}
var orig = source_map.originalPositionFor({
line: info.line,
column: info.column
});
orig.mode = err.mode;
body.innerHTML += '' + JSON.stringify(orig, null, 4);
}
function parseTryCatchStackTrace(err) {
var lines = err.stack.split('\n'),
stack;
stack = lines[1].split(':').reverse().splice(0, 2);
return {
column: 0,
line: stack[1]
};
}
window.onerror = function(msg, filename, lineno, colno, err) {
var error = {
err: err,
stack: {
message: msg,
line: lineno,
column: colno,
filename: filename
},
mode: 'onerror'
};
parseStackTrace(error);
};"
Update mm control for new style,"wax = wax || {};
wax.mm = wax.mm || {};
wax.mm.interaction = function() {
var dirty = false, _grid;
function grid() {
var zoomLayer = map.getLayerAt(0)
.levels[Math.round(map.getZoom())];
if (!dirty && _grid !== undefined && _grid.length) {
return _grid;
} else {
_grid = (function(t) {
var o = [];
for (var key in t) {
if (t[key].parentNode === zoomLayer) {
var offset = wax.u.offset(t[key]);
o.push([
offset.top,
offset.left,
t[key]
]);
}
}
return o;
})(map.getLayerAt(0).tiles);
return _grid;
}
}
function attach(x) {
if (!arguments.length) return map;
map = x;
function setdirty() { dirty = true; }
var clearingEvents = ['zoomed', 'panned', 'centered',
'extentset', 'resized', 'drawn'];
for (var i = 0; i < clearingEvents.length; i++) {
map.addCallback(clearingEvents[i], setdirty);
}
}
return wax.interaction()
.attach(attach)
.parent(function() {
return map.parent;
})
.grid(grid);
};
","wax = wax || {};
wax.mm = wax.mm || {};
wax.mm.interaction = function() {
var dirty = false, _grid;
function grid() {
var zoomLayer = map.getLayerAt(0)
.levels[Math.round(map.getZoom())];
if (!dirty && _grid !== undefined && _grid.length) {
return _grid;
} else {
_grid = (function(t) {
var o = [];
for (var key in t) {
if (t[key].parentNode === zoomLayer) {
var offset = wax.u.offset(t[key]);
o.push([
offset.top,
offset.left,
t[key]
]);
}
}
return o;
})(map.getLayerAt(0).tiles);
return _grid;
}
}
function attach(x) {
if (!arguments.length) return map;
map = x;
function setdirty() { dirty = true; }
var clearingEvents = ['zoomed', 'panned', 'centered',
'extentset', 'resized', 'drawn'];
for (var i = 0; i < clearingEvents.length; i++) {
map.addCallback(clearingEvents[i], setdirty);
}
}
return wax.interaction()
.attach(attach)
.grid(grid);
};
"
Set correct filesystem mount point / namespace if plugin is called,"app = $app;
$this->namespace = $namespace === 'default' ? 'files' : $namespace;
}
public function setFilesystem(FilesystemInterface $filesystem)
{
$this->filesystem = $filesystem;
if ($this->filesystem instanceof MountPointAwareInterface) {
$this->namespace = $this->filesystem->getMountPoint();
}
}
public function getDefault()
{
return false;
}
public function handle()
{
$args = func_get_args();
$method = 'get' . $this->adapterType() . ucfirst($this->getMethod());
if (method_exists($this, $method)) {
return call_user_func_array([$this, $method], $args);
}
return $this->getDefault();
}
protected function adapterType()
{
if ($this->filesystem instanceof Filesystem) {
$reflect = new \ReflectionClass($this->filesystem->getAdapter());
return $reflect->getShortName();
}
return 'Unknown';
}
}
","app = $app;
$this->namespace = $namespace === 'default' ? 'files' : $namespace;
}
public function setFilesystem(FilesystemInterface $filesystem)
{
$this->filesystem = $filesystem;
}
public function getDefault()
{
return false;
}
public function handle()
{
$args = func_get_args();
$method = 'get' . $this->adapterType() . ucfirst($this->getMethod());
if (method_exists($this, $method)) {
return call_user_func_array([$this, $method], $args);
}
return $this->getDefault();
}
protected function adapterType()
{
if ($this->filesystem instanceof Filesystem) {
$reflect = new \ReflectionClass($this->filesystem->getAdapter());
return $reflect->getShortName();
}
return 'Unknown';
}
}
"
Change variable names to reduce confusion,"from exceptions import AssertionError
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.test.client import Client
from cyder.core.ctnr.models import Ctnr
class CyTestMixin(object):
""""""
Mixin for all tests.
""""""
def _pre_setup(self):
super(TestCase, self)._pre_setup()
# Add ctnrs to session.
session = self.client.session
session['ctnr'] = Ctnr.objects.get(id=2)
session['ctnrs'] = list(Ctnr.objects.all())
session.save()
def assertObjectsConflict(self, obj_create_list):
pairs = [(a,b)
for a in obj_create_list
for b in obj_create_list
if a != b]
for first, second in pairs:
x = first()
try:
second()
except ValidationError:
pass
else:
raise AssertionError(
""'{}' and '{}' do not conflict"".format(first.name,
second.name))
x.delete()
def assertObjectsDontConflict(self, obj_create_list):
pairs = [(a,b)
for a in obj_create_list
for b in obj_create_list
if a != b]
for first, second in pairs:
x = first()
y = second()
y.delete()
x.delete()
class TestCase(TestCase, CyTestMixin):
""""""
Base class for all tests.
""""""
client_class = Client
fixtures = ['core/users']
","from exceptions import AssertionError
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.test.client import Client
from cyder.core.ctnr.models import Ctnr
class CyTestMixin(object):
""""""
Mixin for all tests.
""""""
def _pre_setup(self):
super(TestCase, self)._pre_setup()
# Add ctnrs to session.
session = self.client.session
session['ctnr'] = Ctnr.objects.get(id=2)
session['ctnrs'] = list(Ctnr.objects.all())
session.save()
def assertObjectsConflict(self, obj_create_list):
pairs = [(x,y)
for x in obj_create_list
for y in obj_create_list
if x != y]
for first, second in pairs:
x = first()
try:
second()
except ValidationError:
pass
else:
raise AssertionError(
""'{}' and '{}' do not conflict"".format(first.name,
second.name))
x.delete()
def assertObjectsDontConflict(self, obj_create_list):
pairs = [(x,y)
for x in obj_create_list
for y in obj_create_list
if x != y]
for first, second in pairs:
x = first()
y = second()
y.delete()
x.delete()
class TestCase(TestCase, CyTestMixin):
""""""
Base class for all tests.
""""""
client_class = Client
fixtures = ['core/users']
"
Make blog posts table more responsive,"import {personEntityName} from ""./person""
export const blogPostEntityName = ""blogPosts"";
export default (nga) => {
const personEntity = nga.entity(personEntityName);
const entity = nga.entity(blogPostEntityName);
entity.listView().fields([
nga.field(""title"")
.isDetailLink(true),
nga.field(""author"", ""reference"")
.targetEntity(personEntity)
.targetField(nga.field(""name"")),
nga.field(""readers"", ""reference_many"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
.cssClasses(""hidden-xs hidden-sm"")
]);
entity.creationView().fields([
nga.field(""title"")
.validation({required: true}),
nga.field(""content"", ""wysiwyg""),
nga.field(""author"", ""reference"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
.sortField(""name"")
.sortDir(""DESC"")
.validation({required: true})
.remoteComplete(true, {
refreshDelay: 200,
searchQuery(search){
return {search}
}
}),
nga.field(""readers"", ""reference_many"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
.sortField(""name"")
.sortDir(""DESC"")
.remoteComplete(true, {
refreshDelay: 200,
searchQuery(name){
return {name}
}
})
]);
entity.editionView().fields(entity.creationView().fields());
return entity;
}","import {personEntityName} from ""./person""
export const blogPostEntityName = ""blogPosts"";
export default (nga) => {
const personEntity = nga.entity(personEntityName);
const entity = nga.entity(blogPostEntityName);
entity.listView().fields([
nga.field(""title"")
.isDetailLink(true),
nga.field(""author"", ""reference"")
.targetEntity(personEntity)
.targetField(nga.field(""name"")),
nga.field(""readers"", ""reference_many"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
]);
entity.creationView().fields([
nga.field(""title"")
.validation({required: true}),
nga.field(""content"", ""wysiwyg""),
nga.field(""author"", ""reference"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
.sortField(""name"")
.sortDir(""DESC"")
.validation({required: true})
.remoteComplete(true, {
refreshDelay: 200,
searchQuery(search){
return {search}
}
}),
nga.field(""readers"", ""reference_many"")
.targetEntity(personEntity)
.targetField(nga.field(""name""))
.sortField(""name"")
.sortDir(""DESC"")
.remoteComplete(true, {
refreshDelay: 200,
searchQuery(name){
return {name}
}
})
]);
entity.editionView().fields(entity.creationView().fields());
return entity;
}"
"Set sails.js migration property to 'alter'
We want Sails.js to try to perform migration automatically","/**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
// connection: 'localDiskDb',
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
* *
***************************************************************************/
migrate: 'alter'
};
","/**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
// connection: 'localDiskDb',
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
* *
***************************************************************************/
// migrate: 'alter'
};
"
Drop old MySQL versions support that doesn't support json columns,"increments('id');
$table->string('slug');
$table->json('name');
$table->json('description')->nullable();
$table->mediumInteger('sort_order')->unsigned()->default(0);
$table->string('group')->nullable();
$table->string('type');
$table->boolean('is_required')->default(false);
$table->boolean('is_collection')->default(false);
$table->text('default')->nullable();
$table->timestamps();
// Indexes
$table->unique('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attributes'));
}
}
","increments('id');
$table->string('slug');
$table->{$this->jsonable()}('name');
$table->{$this->jsonable()}('description')->nullable();
$table->mediumInteger('sort_order')->unsigned()->default(0);
$table->string('group')->nullable();
$table->string('type');
$table->boolean('is_required')->default(false);
$table->boolean('is_collection')->default(false);
$table->text('default')->nullable();
$table->timestamps();
// Indexes
$table->unique('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attributes'));
}
/**
* Get jsonable column data type.
*
* @return string
*/
protected function jsonable(): string
{
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
}
}
"
Create recorder file if not exist,"from Measurement import Measurement
class Recorder(object):
def __init__(self, recorderType):
self.recorderType = recorderType
def record(self, measure: Measurement):
None
class PrintRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.format = config['format']
def record(self, measure: Measurement):
line = self.format.format(
device_id=measure.device_id,
celsius=measure.get_celsius(),
fahrenheit=measure.get_fahrenheit(),
timestamp=measure.timestamp)
print(line, end='\n')
class FileRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.format = config['format']
self.container = config['container']
self.extension = config['extension']
def record(self, measure: Measurement):
log_entry = self.format.format(
device_id=measure.device_id,
celsius=measure.get_celsius(),
fahrenheit=measure.get_fahrenheit(),
timestamp=measure.timestamp)
file_path = self.container + measure.device_id.split('/')[-1] + self.extension
f = open(file_path, 'w+')
f.writelines([log_entry])","from Measurement import Measurement
class Recorder(object):
def __init__(self, recorderType):
self.recorderType = recorderType
def record(self, measure: Measurement):
None
class PrintRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.format = config['format']
def record(self, measure: Measurement):
line = self.format.format(
device_id=measure.device_id,
celsius=measure.get_celsius(),
fahrenheit=measure.get_fahrenheit(),
timestamp=measure.timestamp)
print(line, end='\n')
class FileRecorder(Recorder):
def __init__(self, config):
Recorder.__init__(self, 'file')
self.format = config['format']
self.container = config['container']
self.extension = config['extension']
def record(self, measure: Measurement):
log_entry = self.format.format(
device_id=measure.device_id,
celsius=measure.get_celsius(),
fahrenheit=measure.get_fahrenheit(),
timestamp=measure.timestamp)
file_path = self.container + measure.device_id.split('/')[-1] + self.extension
f = open(file_path, 'w')
f.writelines([log_entry])"
Add publish command to gruntfile,"/*global exports:true, require:true */
module.exports = exports = function(grunt) {
'use strict';
grunt.initConfig({
casper: {
},
coffee: {
compile: {
files: {
'dist/wai.js': 'src/*.coffee'
}
}
},
coffeelint: {
options: {
},
source: ['src/*.coffee']
},
shell: {
publishDocs: {
options: {
stdout: true
},
command: 'rake publish ALLOW_DIRTY=true'
}
},
uglify: {
wai: {
files: {
'dist/wai.min.js': ['dist/wai.js']
}
}
},
watch: {
build: {
files: ['src/*.coffee'],
tasks: ['build']
},
grunt: {
files: [
'Gruntfile.js'
]
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['build', 'watch']);
grunt.registerTask('build', ['coffee', 'uglify']);
grunt.registerTask('publish', ['shell']);
// grunt.registerTask('server', function() {
// grunt.log.writeln('Starting web server at test/server.coffee');
// require('./test/server.coffee').listen(8181);
// });
grunt.registerTask('test', ['build', 'coffeelint']);
};
","/*global exports:true, require:true */
module.exports = exports = function(grunt) {
'use strict';
grunt.initConfig({
casper: {
},
coffee: {
compile: {
files: {
'dist/wai.js': 'src/*.coffee'
}
}
},
coffeelint: {
options: {
},
source: ['src/*.coffee']
},
shell: {
listFolders: {
options: {
stdout: true
},
command: 'rake publish ALLOW_DIRTY=true'
}
},
uglify: {
wai: {
files: {
'dist/wai.min.js': ['dist/wai.js']
}
}
},
watch: {
build: {
files: ['src/*.coffee'],
tasks: ['build']
},
grunt: {
files: [
'Gruntfile.js'
]
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['build', 'watch']);
grunt.registerTask('build', ['coffee', 'uglify']);
// grunt.registerTask('publish', ['shell']);
// grunt.registerTask('server', function() {
// grunt.log.writeln('Starting web server at test/server.coffee');
// require('./test/server.coffee').listen(8181);
// });
grunt.registerTask('test', ['build', 'coffeelint']);
};
"
Add tests around ObjectType Meta,"from collections import OrderedDict
from unittest import TestCase
from graphql.type.definition import GraphQLField, GraphQLObjectType
from graphql.type.scalars import GraphQLString
from polygraph.types.definitions import PolygraphNonNull
from polygraph.types.fields import String, Int
from polygraph.types.object_type import ObjectType
from polygraph.types.tests.helpers import graphql_objects_equal
class ObjectTypeTest(TestCase):
def test_simple_object_type(self):
class HelloWorldObject(ObjectType):
""""""
This is a test object
""""""
first = String(description=""First violin"", nullable=True)
second = String(description=""Second fiddle"", nullable=False)
third = String(deprecation_reason=""Third is dead"")
hello_world = HelloWorldObject()
expected = GraphQLObjectType(
name=""HelloWorldObject"",
description=""This is a test object"",
fields=OrderedDict({
""first"": GraphQLField(GraphQLString, None, None, None, ""First violin""),
""second"": GraphQLField(
PolygraphNonNull(GraphQLString), None, None, None, ""Second fiddle""),
""third"": GraphQLField(
PolygraphNonNull(GraphQLString), None, None, ""Third is dead"", None),
})
)
actual = hello_world.build_definition()
self.assertTrue(graphql_objects_equal(expected, actual))
def test_object_type_meta(self):
class MetaObject(ObjectType):
""""""
This docstring is _not_ the description
""""""
count = Int()
class Meta:
name = ""Meta""
description = ""Actual meta description is here""
meta = MetaObject()
self.assertEqual(meta.description, ""Actual meta description is here"")
self.assertEqual(meta.name, ""Meta"")
","from collections import OrderedDict
from unittest import TestCase
from graphql.type.definition import GraphQLField, GraphQLObjectType
from graphql.type.scalars import GraphQLString
from polygraph.types.definitions import PolygraphNonNull
from polygraph.types.fields import String
from polygraph.types.object_type import ObjectType
from polygraph.types.tests.helpers import graphql_objects_equal
class HelloWorldObject(ObjectType):
""""""
This is a test object
""""""
first = String(description=""First violin"", nullable=True)
second = String(description=""Second fiddle"", nullable=False)
third = String(deprecation_reason=""Third is dead"")
class ObjectTypeTest(TestCase):
def test_simple_object_type(self):
hello_world = HelloWorldObject()
expected = GraphQLObjectType(
name=""HelloWorldObject"",
description=""This is a test object"",
fields=OrderedDict({
""first"": GraphQLField(GraphQLString, None, None, None, ""First violin""),
""second"": GraphQLField(
PolygraphNonNull(GraphQLString), None, None, None, ""Second fiddle""),
""third"": GraphQLField(
PolygraphNonNull(GraphQLString), None, None, ""Third is dead"", None),
})
)
actual = hello_world.build_definition()
self.assertTrue(graphql_objects_equal(expected, actual))
"
Allow us to limit the amount of returned results,"a = $a;
}
public function asJsonResponse()
{
$data = [];
$total = $amount_displayed = 0;
if ($this->model) {
$model_name = $this->model;
if ($this->columns) {
}
$sql = $model_name::query()->select($this->columns ?: '*');
$total = ($sql->count());
$models = $sql->take($this->a->input('length'))->get();
$data = $models->toArray();
$total = $total;
$amount_displayed = count($models);
}
$data = ([
'aaData'=>$data,
'iTotalRecords'=>$total,
'iTotalDisplayRecords'=>$amount_displayed
]);
return new JsonResponse($data, 200);
}
public function forEloquentModel($model)
{
$this->model = $model;
return $this;
}
public function pluckColumns($argument1)
{
$this->columns[] = $argument1;
return $this;
}
}
","a = $a;
}
public function asJsonResponse()
{
$data = [];
$total = $amount_displayed = 0;
if ($this->model) {
$model_name = $this->model;
if ($this->columns) {
}
$models = $model_name::select($this->columns?:'*')->get();
$data = $models->toArray();
$total = count($models);
$amount_displayed = count($models);
}
$data = ([
'aaData'=>$data,
'iTotalRecords'=>$total,
'iTotalDisplayRecords'=>$amount_displayed
]);
return new JsonResponse($data, 200);
}
public function forEloquentModel($model)
{
$this->model = $model;
return $this;
}
public function pluckColumns($argument1)
{
$this->columns[] = $argument1;
return $this;
}
}
"
Add function to list donors and total donations.,"# Charles Robison
# 2016.10.16
# Mailroom Lab
#!/usr/bin/env python
donors = {
'Smith':[100, 125, 100],
'Galloway':[50],
'Williams':[22, 43, 40, 3.25],
'Cruz':[101],
'Maples':[1.50, 225]
}
donations = {}
for k, v in donors.items():
donations[k] = sum(v)
def print_report():
print(""This will print a report"")
for i in donations:
print(i, donations[i])
def send_thanks():
print(""This will write a thank you note"")
# here is where triple quoted strings can be helpful
msg = """"""
What would you like to do?
To send a thank you: type ""s""
To print a report: type ""p""
To exit: type ""x""
""""""
def main():
""""""
run the main interactive loop
""""""
response = ''
# keep asking until the users responds with an 'x'
while True: # make sure there is a break if you have infinite loop!
print(msg)
response = input(""==> "").strip() # strip() in case there are any spaces
if response == 'p':
print_report()
elif response == 's':
send_thanks()
elif response == 'x':
break
else:
print('please type ""s"", ""p"", or ""x""')
if __name__ == ""__main__"":
main()","# Charles Robison
# 2016.10.16
# Mailroom Lab
#!/usr/bin/env python
donors = {
'Smith':[100, 125, 100],
'Galloway':[50],
'Williams':[22, 43, 40, 3.25],
'Cruz':[101],
'Maples':[1.50, 225]
}
def print_report():
print(""This will print a report"")
for i in donors.values():
print(sum(i))
def send_thanks():
print(""This will write a thank you note"")
# here is where triple quoted strings can be helpful
msg = """"""
What would you like to do?
To send a thank you: type ""s""
To print a report: type ""p""
To exit: type ""x""
""""""
def main():
""""""
run the main interactive loop
""""""
response = ''
# keep asking until the users responds with an 'x'
while True: # make sure there is a break if you have infinite loop!
print(msg)
response = input(""==> "").strip() # strip() in case there are any spaces
if response == 'p':
print_report()
elif response == 's':
send_thanks()
elif response == 'x':
break
else:
print('please type ""s"", ""p"", or ""x""')
if __name__ == ""__main__"":
main()"
Add system status to /status endpoint,"
*/
class GeneralController extends AbstractApiController
{
/**
* Ping endpoint allows API consumers to check the version.
*
* @return \Illuminate\Http\JsonResponse
*/
public function ping()
{
return $this->item('Pong!');
}
/**
* Endpoint to show the Cachet version.
*
* @return \Illuminate\Http\JsonResponse
*/
public function version()
{
$latest = app(Releases::class)->latest();
return $this->setMetaData([
'on_latest' => version_compare(CACHET_VERSION, $latest['tag_name']) === 1,
'latest' => $latest,
])->item(CACHET_VERSION);
}
/**
* Get the system status message.
*
* @return \Illuminate\Http\JsonResponse
*/
public function status()
{
$system = app()->make(System::class)->getStatus();
return $this->item([
'status' => $system['system_status'],
'message' => $system['system_message']
]);
}
}
","
*/
class GeneralController extends AbstractApiController
{
/**
* Ping endpoint allows API consumers to check the version.
*
* @return \Illuminate\Http\JsonResponse
*/
public function ping()
{
return $this->item('Pong!');
}
/**
* Endpoint to show the Cachet version.
*
* @return \Illuminate\Http\JsonResponse
*/
public function version()
{
$latest = app(Releases::class)->latest();
return $this->setMetaData([
'on_latest' => version_compare(CACHET_VERSION, $latest['tag_name']) === 1,
'latest' => $latest,
])->item(CACHET_VERSION);
}
/**
* Get the system status message.
*
* @return \Illuminate\Http\JsonResponse
*/
public function status()
{
$system = app()->make(System::class)->getStatus();
return $this->item($system['system_message']);
}
}
"
Update WebsocketHandler and WebsocketSession behavior,"package io.scalecube.gateway.websocket;
import io.scalecube.gateway.clientsdk.ClientMessage;
import io.scalecube.gateway.clientsdk.ClientSettings;
import io.scalecube.gateway.clientsdk.codec.WebsocketGatewayMessageCodec;
import io.scalecube.gateway.clientsdk.websocket.WebsocketClientTransport;
import io.scalecube.services.codec.DataCodec;
import java.time.Duration;
import reactor.core.publisher.Mono;
import reactor.ipc.netty.resources.LoopResources;
public class WebsocketClientTransportTest {
public static void main(String[] args) throws InterruptedException {
String contentType = ""application/json"";
ClientSettings settings =
ClientSettings.builder().contentType(contentType).host(""localhost"").port(7070).build();
LoopResources loopResources = LoopResources.create(""worker"");
WebsocketClientTransport transport =
new WebsocketClientTransport(
settings,
new WebsocketGatewayMessageCodec(DataCodec.getInstance(contentType)),
loopResources);
ClientMessage request =
ClientMessage.builder().qualifier(""/greeting/one"").header(""sid"", ""1"").build();
Mono.delay(Duration.ofSeconds(3))
.doOnTerminate(
() -> {
System.err.println(""closing ..."");
transport.close().subscribe();
})
.subscribe();
transport.requestResponse(request).subscribe(System.out::println, System.err::println);
Thread.currentThread().join();
}
}
","package io.scalecube.gateway.websocket;
import io.scalecube.gateway.clientsdk.ClientMessage;
import io.scalecube.gateway.clientsdk.ClientSettings;
import io.scalecube.gateway.clientsdk.codec.WebsocketGatewayMessageCodec;
import io.scalecube.gateway.clientsdk.websocket.WebsocketClientTransport;
import io.scalecube.services.codec.DataCodec;
import java.time.Duration;
import reactor.core.publisher.Mono;
import reactor.ipc.netty.resources.LoopResources;
public class WebsocketClientTransportTest {
public static void main(String[] args) {
String contentType = ""application/json"";
ClientSettings settings =
ClientSettings.builder().contentType(contentType).host(""localhost"").port(7070).build();
LoopResources loopResources = LoopResources.create(""worker"");
WebsocketClientTransport transport =
new WebsocketClientTransport(
settings,
new WebsocketGatewayMessageCodec(DataCodec.getInstance(contentType)),
loopResources);
ClientMessage request = ClientMessage.builder().qualifier(""/greeting/one"").build();
Mono.delay(Duration.ofSeconds(10))
.doOnTerminate(
() -> {
System.err.println(""closing ..."");
transport.close().subscribe();
})
.subscribe();
ClientMessage block = transport.requestResponse(request).block();
System.out.println(block);
}
}
"
Format duration in downloaded list,"/**
* View for viewing downloaded videos.
*/
export default class DownloadedList {
/**
* Default constructor for setting the values
*
* @param {HTMLElement} element - The HTML element to bind/adopt
* @param {Array