Add Edit operation on Grocerycrud - grocery-crud

I've got a out-of-the-box installation of grocerycrud. The samples worked just fine. However, when I tested it with my own table with tinyint columns, it just don't work. The following is my schema:
role_id int(11) Auto Increment role varchar(55)
can_add tinyint(1) [0] can_edit tinyint(1) [0]
can_delete tinyint(1) [0]
With this table, the tinyints are rendered as radio buttons. However, this causes the following errors as shown in chrome-dev console:
jquery.uniform.min.js:1 Uncaught TypeError: Cannot read property 'msie' of undefined(anonymous function) # jquery.uniform.min.js:1(anonymous function) #
jquery.uniform.min.js:1
jquery.uniform.config.js:2 Uncaught TypeError: $(...).uniform is not a function

Same problem here, the trick was update jquery.uniform.min.js to version 2.2, now it works again.

Related

Is there any way to identify the error returned by a SQL Server stored procedure in NodeJS

Scenario: executing a stored procedure to insert row into a table
Output: normal, should insert record as set in SQL statement
Failure case: if unique key is violated, it should not update and throw error
All the above steps are working when manually executed in Azure Studio. The same when integrated with NodeJS by using ASYNC call, it works only for the +ve test case; which is a for fresh new record inserted and when the duplicate is inserted, the recordset.length is seen as undefined
This undefined is visible in 6.3.1 and not in the earlier version of 6.2.3
Now in 6.3.1, I could find only an option of using returnValue. Does anyone know other features available to get notified of the error. Below is the output
If it's successful, I get the result as
{
recordsets: [],
recordset: undefined,
output: {},
rowsAffected: [],
returnValue: 0
}
You can try to put your INSERT/UPDATE inside a TRY-CATCH block, then return a specific integer ir a RAISE ERROR. Also, put It on a transaction to rollback on the CATCH block.

Postgres syntax error for reference

I am trying to create a table with the following query using the pg npm module (v7):
CREATE TABLE subscriptions(
id SERIAL PRIMARY KEY,
stripe_id VARCHAR(40) UNIQUE NOT NULL,
user INTEGER REFERENCES users,
plan VARCHAR(40) NOT NULL,
active BOOLEAN NOT NULL,
start DATE NOT NULL,
end DATE DEFAULT NULL
);
This seems to match the docs but it is throwing an error:
error: syntax error at or near "user"
The users table has a serial primary key for id, anyone know why this isn't working?
Edit: here's the docs for reference - https://www.postgresql.org/docs/9.4/static/ddl-constraints.html#DDL-CONSTRAINTS-FK
I'm using postgresql version 9.4.
user is a reserved keyword in postgresql. You may use any other column name in its place
Refer the postgresql documentation for the complete list of keywords - Key Words List
According to it, end is also reserved. So the last line of your code will generate an error

TypeError: Unable to get property 'replace' of undefined or null reference

I add a item in custom list after the display shortly following errors:
TypeError: Unable to get property 'replace' of undefined or null reference
TypeError: Unable to get property 'replace' of undefined or null referenceSys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null. Parameter name: element
I have the same problem.
Here is link to tmp workaround:
Edit list view and change field "Item Text (linked to item with edit menu)" to
"Item Text (linked to item)". Error disappears after that.
Update:
I confirm that install last update (2016-01) solved the problem.

Strong loop studio with SQL Server

I am trying to use strong loop studio to build an api for a SQL Server database. Almost all the functions are working but if I want to find after id like this localhost:3000/api/tableName/1 where 1 is the id, I get a syntax error.
Incorrect syntax near the keyword 'null'
Using SQL Server Profiler I got the query that is executed and I got this:
SELECT
[id], [name], [description], [application],
FROM
(SELECT
[id], [name], [description], [application], ROW_NUMBER() OVER (null) AS RowNum
FROM [dbo].[tableName]) AS S
WHERE
S.RowNum > 0 AND S.RowNum <= 1
What could be the problem? Can I override this method in some way and rewrite the query?
Actually i tried this on multiple tables and I get the same error.
That null comes from the order by clause in the SQL that StrongLoop creates. If it doesn't get an order, it seems to just use null.
https://github.com/strongloop/loopback-connector-mssql/blob/master/lib/mssql.js#L667
You can fix this by using an order in the default scope in your model.
http://docs.strongloop.com/display/public/LB/Model+definition+JSON+file#ModeldefinitionJSONfile-Defaultscope
"scope": {
"order": "id"
},

find('order-button', :disabled => false) raises ArgumentError: invalid keys

on the website that I am testing, the following happens:
you click a button
an ajax-call is executed, all input fields are temporarily disabled
once the data is retrieved, the fields are filled in and no longer disabled
To wait for this to happen (no sleep or other stupid solutions), I was thinking about something like this:
find('order-button', :disabled => false).click
But I get the following Exception: ArgumentError: invalid keys :disabled, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait
How do I get this to work? I am using the latest version of Capybara (2.1.0)
Any input in this is highly appreciated :)
:disabled option is supported only by following selector types:
:field
:link_or_button
:button
:fillable_field
:radio_button
:checkbox
:select
:file_field
It can be used as:
find(:field, 'field_id', disabled: false)
This option is not supported by :css that you seem to use.
With :css you are expected to use css's attributes which is much shorter:
find('#field_id:not([disabled])')

Resources