rockq-org / austack-core

API, Console, Test of austack
32 stars 8 forks source link

Data management Toolbar in User Entry #167

Closed hailiang-wang closed 9 years ago

hailiang-wang commented 9 years ago

Description

在数据列表上添加工具条

image

示例

image

(1) 批量删除数据 (2) 查看示例代码 (3) 上传excel文件,导入数据

Solution

批量删除数据

View API Details in #91

DELETE /api/repos/:repo_name/:uid

CodeSnippets for RESt API

Popup a dialog that display ready-to-use code snippets for Dave

Get JWT Token

npm install superagent

  var request = require('superagent');
  request.post(apiBaseURL + '/auth/application')
    .set('Content-Type', 'application/json')
    .set('Accept', 'application/json')
    .send({
      clientId: clientId,
      clientSecret: clientSecret
    })
    .end(function (err, res) {
      if (err) {
        return d.reject(err);
      }
      var applicationJwt = res.body.token;
      var token = res.body.token; # set Authorization to  'Bearer ' + token 
    });

Get an object as json


<script>
  var request = require('superagent');
  request.post({
      url: 'http://api.austack.com/api/repos/repo_dave1',
      headers: {accept: 'application/json', Authorization: 'Bearer ' + token  }
   }).success(function(data) {
      console.dir(data);
   });
</script>

Create an object


<script>
  var request = require('superagent');
   request.post({
      url: 'http://api.austack.com/api/repos/repo_dave1',
      type: 'POST',
      data: {foo: 'bar'},
      headers: {accept: 'application/json', Authorization: 'Bearer ' + token }
   }).done(function(data) {
      console.dir(data);
   });
</script>

apiBaseURL 是动态获取的

  • 上传数据(Pending)

    仅支持 excel

上传数据在浏览器上做不友好,原因有下面几点

所以,这里最好做成 cli 命令,类似于 gulp 等, Dave执行

npm install austack-cli -g
austack-cli login username password
austack-cli upload xxxx

这个任务在下一个版本实现,不考虑在prototype支持,同时,cli将支持数据下载等其他功能

lymanlai commented 9 years ago

screen shot 2015-08-03 at 4 34 34 pm

lymanlai commented 9 years ago

screen shot 2015-08-03 at 4 41 47 pm

lymanlai commented 9 years ago

screen shot 2015-08-04 at 4 21 41 pm screen shot 2015-08-04 at 4 21 51 pm

lymanlai commented 9 years ago

@Samurais I need to know the list here, as I list there is not correct, I am afraid. and the list at the head of this issuse:

screen shot 2015-08-05 at 8 09 12 am

hailiang-wang commented 9 years ago

@lymanlai For the APIs, I think your offering is good enough, but I suggest the sequence like below:

  1. 获取jwt
  2. 获取用户列表
  3. 创建新用户
  4. 获取用户详情
  5. 更新用户
  6. 删除用户

Thanks.