centric-server

所属分类:快速开发平台
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2023-01-06 02:19:34
上 传 者sh-1993
说明:  可编程自动化服务器
(A programmable automation server)

文件列表:
.eslintrc.js (593, 2020-07-16)
.nvmrc (2, 2020-07-16)
LICENSE (10255, 2020-07-16)
api/ (0, 2020-07-16)
api/controllers/ (0, 2020-07-16)
api/controllers/loginController.js (1554, 2020-07-16)
api/controllers/triggerController.js (1181, 2020-07-16)
api/policies/ (0, 2020-07-16)
api/policies/isLocal.js (250, 2020-07-16)
api/policies/isLoggedIn.js (276, 2020-07-16)
api/policies/isLoggedInOrLocal.js (350, 2020-07-16)
bin/ (0, 2020-07-16)
bin/centric (1045, 2020-07-16)
client/ (0, 2020-07-16)
client/app.html (131, 2020-07-16)
client/layouts/ (0, 2020-07-16)
client/layouts/default.vue (5511, 2020-07-16)
client/layouts/login.vue (350, 2020-07-16)
client/layouts/print.vue (697, 2020-07-16)
client/middleware/ (0, 2020-07-16)
client/middleware/noLogin.js (99, 2020-07-16)
client/pages/ (0, 2020-07-16)
client/pages/entries/ (0, 2020-07-16)
client/pages/entries/_entry_key/ (0, 2020-07-16)
client/pages/entries/_entry_key/view.vue (2413, 2020-07-16)
client/pages/entries/index.vue (3788, 2020-07-16)
client/pages/history.vue (5699, 2020-07-16)
client/pages/login.vue (1502, 2020-07-16)
client/pages/operations/ (0, 2020-07-16)
client/pages/operations/_operation_key/ (0, 2020-07-16)
client/pages/operations/_operation_key/view.vue (8200, 2020-07-16)
client/pages/operations/index.vue (6735, 2020-07-16)
client/pages/tasks/ (0, 2020-07-16)
client/pages/tasks/_task_key/ (0, 2020-07-16)
client/pages/tasks/_task_key/schedules/ (0, 2020-07-16)
client/pages/tasks/_task_key/schedules/_schedule_key/ (0, 2020-07-16)
client/pages/tasks/_task_key/schedules/_schedule_key/edit.vue (2529, 2020-07-16)
client/pages/tasks/_task_key/schedules/create.vue (2200, 2020-07-16)
... ...

# Centric Server ### A programmable automation server [![license](https://img.shields.io/npm/l/centric.svg)](https://github.com/internalfx/centric-server/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/centric.svg)](https://www.npmjs.com/package/centric) ## Installation ### Install centric ``` $ npm install -g centric ``` #### Option 1 - Use centic scaffold centric scaffold will create a basic centric project with examples that you can modify to suit your needs. - Run the below command in the folder you want to create the project. ``` $ centric scaffold ``` - After that, start the server using the command: ``` $ centric start ``` And your done! #### Option 2 - Create the files yourself Folder Structure for a centric project. ``` . ├── services # Service Files ├── tasks # Task Files ├── config.js # Configuration file ``` ## Services The services folder contains all your projects service files. A service file has the following signature. ```javascript module.exports = async function ({ config }) { // Service Logic goes here... const testLogging = function () { console.log('this is a test') } return { testLogging } } ``` Services are useful for any logic you wish to share between tasks (like a database connection). ## Creating a new task Create a new file in the tasks folder that matches the following signature. > The name of the task in the centric web interface is equivalent to the name of the task file name. ```javascript module.exports = { description: 'task description', // Viewable in the web UI locks: null, defaultData: function () { // Return the default data for the task. // This will be the default "taskData" in the run method. return {} }, run: async function ({ config, services, opData, saveOpData, taskData, saveTaskData, logInfo, logWarning, logError, isCancelled }) { // Run method is called when the task is executed. // Logic for the task goes here. } } ``` The run method provides following listed parameters: | Argument | Description | | --- | --- | | config | configuration exported from config.js | | services | object containing all exported values from all service files | | opData | Current running task's operation-data. | | saveOpData | Method to be called to save the curremt operation data. | | taskData | Task data of the current running task. | | saveTaskData | Method to be called to save the current running task data. | | logInfo | logInfo is method to log the info entry showing information log of the operation. | | logWarning | logWarning is method to log the warnings entry showing warnings of the operation. | | logError | logError is method to log the errors entry showing errors of the operation. | | isCancelled | Method to check whether the task is active for running or has been cancelled. | The screen-shot below shows the list of tasks under the tasks folder. ![Tasks](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_tasks.png) ### Schedule a task Go to the tasks list page and click over the task item for which need to schedule a task and follow the following steps: 1. Enable the task 2. Click the Create Schedule button ![Tasks-Schedule](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_taskSchedule1.png) 3. Create Schdule form page will be displayed. #### Add new schedule: | Field | Description | | --- | --- | | Name | Name of the schedule | | cronTime | Time interval to determine how often to run the task | | enabled? | Enable or disable this schedule | | data | Set the tasks operation data when started with this schedule | 4. Click the Save button. ![Tasks-Schedule](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_taskSchedule2.png) ## Creating a new user Select Users menu from home page, users list page looks like ![Users](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_users.png) To create new user click over "CREATE USER" button and add the detail of the user to be created. ## Task History The task processed are listed in the history menu under sidemenu list. ![History](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_history.png) - It provides the list of task operations processed with following details. - Operation Number. - Task name of respective operation. - Status of the operation (i.e) Completed, Terminated, Active, Failed, Cancelled. - Run date of the operation. - Entry count: The number of logs written while the processing of the task operation. - Last entry message and data. ## Dashboard The dashboard page provides the list of currently running task detail. ![Dashboard](https://raw.githubusercontent.com/internalfx/centric-server/master/resources/screenshot_dashboard.png)

近期下载者

相关文件


收藏者