sachinbhutani / flow-db-admin Goto Github PK
View Code? Open in Web Editor NEWMeteor Database Admin package for use with Flow Router
Home Page: https://atmospherejs.com/sach/flow-db-admin
Meteor Database Admin package for use with Flow Router
Home Page: https://atmospherejs.com/sach/flow-db-admin
I have a schema like so:
lesson.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Name"
},
description: {
type: String,
label: "Description"
},
rank: {
type: Number,
label: "Rank"
},
phase_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
label: "Phase ID",
index: 1,
autoform: {
options: function() {
_.map(phase.find().fetch(), function(phase) {
return {
label: phase.name,
value: phase._id
}
});
}
}
},
...
Note the phase_id > autoform > options definition. I'd like to pull in the phases, and map an id and name to the phase_id field. This isn't working.
jquery.dataTables drop an error if using collection helper like
tableColumns: [
{label: 'Challenges', name: 'challenges()', template: 'challengesFormat'},
{label: 'ID', name: '_id'}
]
It doesn't break an app, but sorting won't work for this column.
I have a multi facility system and want the current user to only see a subset of fields (effectively want to use my own publications , where to specify this in collections) , how is this doable ?
As of 2017 there have been several changes to depending packages of this one.
collection2 is now deprecated and replaced by collection2-core
laded:simple-schema is deprecated and replaced by a npm package (simpl-schema)
autoform is major version 6
If recent apps want to use this package, it is crucial to provide this update.
Note: I will create a PR, when I made transition complete.
I have successfully added additional fields to the 'edit' view of the users collection. My problem is whenever I 'update' these fields they disappear and I can no longer see them. So if I have to update something, I have to refill all fields. Is there a way to populate the fields with current data? Also, could you guide me on how to add these additional fields to the initial view of the collection? It seems pretty simple in other collections but not in Meteor.users. I have attached the Schema I am using for reference. If you need anything else please let me know. Thanks for your help and thanks for making this for FR ๐
FYI - I am new to actual production stuff and this project is intended to show how easily we can upgrade from our current intranet at the office. They are still running FrontPage(2003)...
Schema = {};
Schema.UserProfile = new SimpleSchema({
firstName: {
type: String,
regEx: /^[A-Za-z0-9 ]/,
optional: true
},
lastName: {
type: String,
regEx: /^[A-Za-z0-9 ]/,
optional: true
},
birthday: {
type: Date,
optional: true
},
position: {
type: String,
optional: true
},
phone: {
type: String,
regEx: /^\(?[0-9]{3}(\-|\)) ?[0-9]{3}-[0-9]{4}$/,
optional: true
}
});
Schema.User = new SimpleSchema({
emails: {
type: Array,
optional: true
},
"emails.$": {
type: Object
},
"emails.$.address": {
type: String,
regEx: SimpleSchema.RegEx.Email
},
"emails.$.verified": {
type: Boolean
},
createdAt: {
type: Date
},
profile: {
type: Schema.UserProfile,
optional: true
},
services: {
type: Object,
optional: true,
blackbox: true
},
roles: {
type: Object,
optional: true,
blackbox: true
}
});
Meteor.users.attachSchema(Schema.User);
I created an empty meteor project just to test this. Have a fixture that creates "admin" and "editor" roles, a dedicated [email protected] account for driving the /admin UI, and several dummy accounts with no roles. I then used the /admin view to add the "admin" and "editor" roles, which works just fine and creates the following user record.
{
"_id" : "5fm3DnEv7fPuK7MSv",
"createdAt" : ISODate("2015-10-18T03:06:36.793Z"),
"services" : {
"password" : {
"bcrypt" : "$2a$10$7N96hW7wnJdDPMdeDM2Xo..pJ.5/IqgI6wUDC11SPhAH598SB65U2"
}
},
"username" : "[email protected]",
"emails" : [
{
"address" : "[email protected]",
"verified" : false
}
],
"roles" : {
"global_roles" : [
"editor",
"admin"
]
}
}
In contrast, trying to remove the role just added results in a failure. Note this happens for both the admin role and other roles I created for testing. The following is output the browser js console:
There is no route for the path: /admin/Users/Router._notfoundRoute @ router.js:347(anonymous function) @ router.js:5352.Route.middleware @ client.browserify.js:566nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:398nextExit @ client.browserify.js:3862.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:3872.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:387Triggers.runTriggers @ triggers.js:89Router.route.route.exitHandle @ router.js:1162.Route.middleware @ client.browserify.js:566nextExit @ client.browserify.js:3872.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:3872.page.dispatch @ client.browserify.js:4022.page.show @ client.browserify.js:293Router.initialize..each.self._page.(anonymous function) @ router.js:382onclick @ client.browserify.js:693
events.coffee:16 removing user
meteor.js:862 Error invoking Method 'adminRemoveUserToRole': Internal server error [500]
And the following exception in the server console:
I20151017-23:19:28.841(-4)? Exception while invoking method 'adminRemoveUserToRole' Error: Roles error: Can't mix grouped and non-grouped roles for same user
I20151017-23:19:28.841(-4)? at Object..extend.removeUsersFromRoles (packages/alanning_roles/roles_common.js:247:1)
I20151017-23:19:28.842(-4)? at [object Object].Meteor.methods.adminRemoveUserToRole (packages/sach_flow-db-admin/lib/server/methods.coffee:102:10)
I20151017-23:19:28.842(-4)? at maybeAuditArgumentChecks (livedata_server.js:1692:12)
I20151017-23:19:28.842(-4)? at livedata_server.js:708:19
I20151017-23:19:28.842(-4)? at [object Object]..extend.withValue (packages/meteor/packages/meteor.js:1013:1)
I20151017-23:19:28.842(-4)? at livedata_server.js:706:40
I20151017-23:19:28.842(-4)? at [object Object]._.extend.withValue (packages/meteor/packages/meteor.js:1013:1)
I20151017-23:19:28.842(-4)? at livedata_server.js:704:46
I20151017-23:19:28.842(-4)? at tryCallTwo (/Users/beynon/.meteor/packages/promise/.0.5.0.15f7kag++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)
I20151017-23:19:28.842(-4)? at doResolve (/Users/beynon/.meteor/packages/promise/.0.5.0.15f7kag++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:171:13)
Hello,
In my project, I would like to use your package and redirect to login page is user is not admin. It seems to me there is a bug, in AdminDashboard.coffee, line 16, Iron Router is still in use when it should be Flow Router. Can you confirm ?
Thanks a lot,
Hello, I've just tried this in order to have and admin panel for 1.2 and everything seems to be working besides the view of Meteor.users collection. This is what I get(i get the correct number of users in the dashboard but then...)
Error: value is undefined
AdminTables.Users<.columns<.render@http://localhost:8080/packages/sach_flow-db-admin.js?ed89fd8442b134f468ab64c0c8aafb9693650eb8:469:9
_fnGetObjectDataFn/<@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:1332:12
_fnColumnOptions/oCol.fnGetData@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:818:5
_fnGetCellData@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:1225:24
_fnColumnTypes@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:990:1
_fnSort@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:4666:3
_fnReDraw@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:2220:4
_fnSortListener@http://localhost:8080/packages/aldeed_tabular.js?402599831726fb93f98209c4ae93cf5b40a63e89:4896:3
_fnSortAttachListener/<@http://localhost:80[โฆ]
My users schema is quite complex with different autoform plugins, but i have tried to simplify and use another simpleschema
userSchema: new SimpleSchema({
username: {
type: String
}
})
but even by using that mode i get the same error as before
i have installed flow-db-admin with all its dependencies and i have configured flow router and accounts-passwords package and i added this to the client main.js :
AdminConfig = { name: 'My App' adminEmails: ['MY_EMAIL'] collections: { } };
and when i log in with my email and go to the '/admin' it shows me : you have to be admin to view this page and in the console it shows me this :
Exception from Tracker recompute function: meteor.js:942 Error: No such template: AdminLTE at blaze.js:3212 at Blaze.View.<anonymous> (spacebars.js:68) at blaze.js:1934 at Function.Template._withTemplateInstanceFunc (blaze.js:3744) at blaze.js:1932 at Object.Blaze._withCurrentView (blaze.js:2271) at viewAutorun (blaze.js:1931) at Tracker.Computation._compute (tracker.js:339) at new Tracker.Computation (tracker.js:229) at Object.Tracker.autorun (tracker.js:613)
The autoform doesn't seem to work with the simpl-schema as the labels don't show and the validation doesn't work.
I'm logged in and when I try to access localhost:3000/admin
, I get
Error invoking Method 'adminCheckAdmin': Internal server error [500]
in the console. And the admin page says You need to be an admin to view this page
, even though I'm signed into an admin account already.
Server logs
I20151104-13:25:28.747(8)? Exception while invoking method 'adminCheckAdmin' ReferenceError: Match is not defined
I20151104-13:25:28.748(8)? at [object Object].Meteor.methods.adminCheckAdmin (packages/sach_flow-db-admin/lib/server/methods.coffee:76:21)
I20151104-13:25:28.749(8)? at maybeAuditArgumentChecks (livedata_server.js:1698:12)
I20151104-13:25:28.749(8)? at livedata_server.js:708:19
I20151104-13:25:28.749(8)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151104-13:25:28.749(8)? at livedata_server.js:706:40
I20151104-13:25:28.749(8)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151104-13:25:28.749(8)? at livedata_server.js:704:46
I20151104-13:25:28.750(8)? at tryCallTwo (/Users/hl/.meteor/packages/promise/.0.5.1.1vhv18x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)
I20151104-13:25:28.750(8)? at doResolve (/Users/hl/.meteor/packages/promise/.0.5.1.1vhv18x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:171:13)
I20151104-13:25:28.750(8)? at new Promise (/Users/hl/.meteor/packages/promise/.0.5.1.1vhv18x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:65:3)
My configure file is:
https://gist.github.com/thinksource/038e208c94892f826f0f
I already installed the preinstall packages from README.md
The error is when I visit localhost:3000/dashboard:
C:\Users\sheng\AppData\Local\.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:245
throw(ex);
^
Error: userSchema is not in the [object global]
at lookup (packages/sach_flow-db-admin/lib/both/utils.coffee:22:14)
at adminCollectionObject (packages/sach_flow-db-admin/lib/both/utils.coffee:5:3)
at packages/sach_flow-db-admin/lib/both/startup.coffee:103:16
at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
at adminCreateTables (packages/sach_flow-db-admin/lib/both/startup.coffee:77:4)
at __coffeescriptShare (packages/sach_flow-db-admin/lib/both/startup.coffee:133:2)
at G:\work\adtest2\.meteor\local\build\programs\server\boot.js:249:5
Exited with code: 8
Your application is crashing. Waiting for file change.
userSchema seems do not declared.
Is there a way to import AdminConfig so that I can use this with Meteor 1.3?
How can I use this package for only user admin?
Even if I create the AdminConfig
global object, I still get the following message at /admin
:
You need to define an AdminConfig object to use the admin dashboard.
A basic config to manage the 'Posts' and 'Comments' collection would look like this:
AdminConfig = {
adminEmails: [' [email protected]'],
collections:
{
Posts: {},
Comments: {}
}
}
My code (it is getting called, I tried a console.log
just to make sure):
AdminConfig = {
name: 'App',
adminEmails: ['[email protected]']
}
My current project is using the semantic ui framework. My question is will adding the bootstrap framework throw things off or is there a way to isolate bootstrap to only work with this Admin? Is this even possible?
Hi all,
I think this is a very simple issue, but I'm not sure how to go about fixing it. I am logged in as an admin user, and when I go to /admin, the "You need to be an admin to view this page" block appears very briefly (followed by an even faster 'Loading...' line) before the dashboard shows up.
I know this is a callback issue, but I don't know how or where to fix this. Could someone please point me in the right direction? Thank you!
I'm following the instruction in order to have a custom template for my edit page. Part of my AdminConfig is as follow:
News:
tableColumns: [
{label: 'ID', name: '_id'}
{label: 'Title', name: 'title'}
]
templates:
new:
name: 'newNews'
edit:
name: 'editNews'
data:
news: Meteor.isClient && Session.get('admin_doc')
and here's my editNews
template:
+autoForm collection="News" type="update" doc=news id="news-update"
+afQuickField(name ="title")
+afQuickField(name ="content")
+afQuickField(name ="image")
button(type="submit", class="btn btn-primary") Update
First of all, using doc=news
does not prepopulate my form. I had to find a work around and use a helper function to get the doc. In addition, when user clicks the delete button in the list of documents, the alert component in the edit page is not displayed.
Hi! I tried to use summernote rich editor with yours admin panel.
I used this code to add summernote-textarea class to special fields.
autoform: {
class: "summernote-textarea",
afFieldInput: {
type: 'textarea'
}
}
And used this code to run summernote on that fields.
Template.AdminDashboardNew.rendered = function() {
console.log($("input").length); //returns number > 0
initEditor();
};
Template.AdminDashboardEdit.rendered = function() {
console.log($("input").length); //returns 0
initEditor();
};
function initEditor() {
$('.summernote-textarea').summernote({
height: "160px",
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'strikethrough', 'clear']],
['fontParams', ['fontname', 'fontsize','color']],
['paragraps', ['ul', 'ol', 'paragraph']],
['table', ['hr', 'table']],
['insert', ['link', 'picture', 'video']],
['view', ['codeview', 'fullscreen']],
['misc', ['undo','redo']]
]
});
};
This code works with AdminDashboardNew template, but when I tried to do the same with AdminDashboardEdit template, I received the next problem:
console.log($("input").length); //returns 0
It means that Template.AdminDashboardEdit.rendered does not executed when it actually rendered.
setTimeout(() => {},0) does not helps too.
Do you have any idea what is wrong with this template and how i could solve my issue ?
Thank you in advance!
I am having some weird issues while using the Meteor.users collection. All other collections are working as expected.
I have made a separate package for my user related functionality which contains the user schema and the adminConfig file is in another package which depends on the user package.
a) In the adminConfig object if I put the "userSchema = null" as mentioned in the docs I get a "TypeError: Cannot read property 'showEditColumn' of null" error
b) If a put a new simpleSchema() for the userSchema I get a "Error: userSchema is not in the [object global]" error
c) If I don't put any user related info in the adminConfig but do add a schema somewhere in the code the users table is populated correctly. The add and delete also works fine but when I try to view/edit the the user the autoform although shows up with the correct schema I added but with no data populated. I am able to update the form by adding some data to the blank fields and they get saved correctly but I am not able to update the roles for the user. It does not throw any error on the server or in the browser console.
Is there something more I need to do for the Meteor.users to function which is not currently documented in the readme section?
Hi,
First of all I am grateful for this beautiful package. The help documentation is sufficient for many basic functions.
But in my case I need to access the helper of a collection and the data of another collection.
For example:
Lists.helpers({ todos() { return Todos.find({ listId: this._id }, { sort: { createdAt: -1 } }); }, });
In the help document:
extraFields fields to be subscribed but not displayed in the table. Can be used if collection helper depends on the field which is not in the table.
But I don't figure out, how I subscribe Todos in client .
I would be glad if you help.
yours sincerely.
flow-db-admin looks very interesting but several try on installation all end up with
"TypeError: Cannot read property 'constructor' of undefined
W20190809-12:17:25.436(2)? (STDERR) at exposeSubscription (packages\meteorhacks_meteorx.js:69:41)
W20190809-12:17:25.437(2)? (STDERR) at exposeLivedata (packages\meteorhacks_meteorx.js:39:5)
W20190809-12:17:25.437(2)? (STDERR) at packages\meteorhacks_meteorx.js:130:1
W20190809-12:17:25.439(2)? (STDERR) at packages\meteorhacks_meteorx.js:135:4
W20190809-12:17:25.439(2)? (STDERR) at packages\meteorhacks_meteorx.js:139:4
W20190809-12:17:25.586(2)? (STDERR) at packages\meteorhacks_meteorx.js:147:3
W20190809-12:17:25.587(2)? (STDERR) at C:\METEOR\sandbox\admin1.meteor\local\build\programs\server\boot.js:419:36
W20190809-12:17:25.587(2)? (STDERR) at Array.forEach ()
W20190809-12:17:25.588(2)? (STDERR) at C:\METEOR\sandbox\admin1.meteor\local\build\programs\server\boot.js:228:19
W20190809-12:17:25.588(2)? (STDERR) at C:\METEOR\sandbox\admin1.meteor\local\build\programs\server\boot.js:479:5"
I'm tying to install in a quite untouched new project, so no third party interruptions.
Any suggestions ???
On the list pages, the table based list views get broken when upgrading to Meteor 1.2.
The left menu correctly uses the route to view the list of users as "/admin/view/Users". In contrast, the breadcrumbs view at the top of the pane shows "/admin/Users" that doesn't have a route and produces the following error in the client js console:
There is no route for the path: /admin/Users/Router._notfoundRoute @ router.js:347(anonymous function) @ router.js:5352.Route.middleware @ client.browserify.js:566nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:3982.Route.middleware @ client.browserify.js:567nextEnter @ client.browserify.js:398nextExit @ client.browserify.js:3862.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:3872.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:387Triggers.runTriggers @ triggers.js:89Router.route.route.exitHandle @ router.js:1162.Route.middleware @ client.browserify.js:566nextExit @ client.browserify.js:3872.Route.middleware @ client.browserify.js:567nextExit @ client.browserify.js:3872.page.dispatch @ client.browserify.js:4022.page.show @ client.browserify.js:293Router.initialize..each.self._page.(anonymous function) @ router.js:382onclick @ client.browserify.js:693
Hello, when i'm trying to install the 1.2.0 version of flow-db-admin by doing:
meteor add [email protected]
i got an error :
=> Errors while parsing arguments:
While adding package sach:[email protected]:
error: no such version sach:[email protected]
How can i install this version ?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.