mock_data.js 6.2 KB
Newer Older
1
const RESPONSE_MAP = {
2
  GET: {
C
Clement Ho 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    '/gitlab-org/gitlab-shell/issues/5.json': {
      id: 45,
      iid: 5,
      author_id: 23,
      description: 'Nulla ullam commodi delectus adipisci quis sit.',
      lock_version: null,
      milestone_id: 21,
      position: 0,
      state: 'closed',
      title: 'Vel et nulla voluptatibus corporis dolor iste saepe laborum.',
      updated_by_id: 1,
      created_at: '2017-02-02T21: 49: 49.664Z',
      updated_at: '2017-05-03T22: 26: 03.760Z',
      time_estimate: 0,
      total_time_spent: 0,
      human_time_estimate: null,
      human_total_time_spent: null,
      branch_name: null,
      confidential: false,
      assignees: [
        {
          name: 'User 0',
          username: 'user0',
          id: 22,
          state: 'active',
28 29
          avatar_url:
            'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
C
Clement Ho 已提交
30 31 32 33 34 35 36
          web_url: 'http: //localhost:3001/user0',
        },
        {
          name: 'Marguerite Bartell',
          username: 'tajuana',
          id: 18,
          state: 'active',
37 38
          avatar_url:
            'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
C
Clement Ho 已提交
39 40 41 42 43 44 45
          web_url: 'http: //localhost:3001/tajuana',
        },
        {
          name: 'Laureen Ritchie',
          username: 'michaele.will',
          id: 16,
          state: 'active',
46 47
          avatar_url:
            'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
C
Clement Ho 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
          web_url: 'http: //localhost:3001/michaele.will',
        },
      ],
      due_date: null,
      moved_to_id: null,
      project_id: 4,
      weight: null,
      milestone: {
        id: 21,
        iid: 1,
        project_id: 4,
        title: 'v0.0',
        description: 'Molestiae commodi laboriosam odio sunt eaque reprehenderit.',
        state: 'active',
        created_at: '2017-02-02T21: 49: 30.530Z',
        updated_at: '2017-02-02T21: 49: 30.530Z',
        due_date: null,
        start_date: null,
      },
      labels: [],
    },
69
    '/gitlab-org/gitlab-shell/issues/5.json?serializer=sidebar_extras': {
70 71 72 73 74 75
      assignees: [
        {
          name: 'User 0',
          username: 'user0',
          id: 22,
          state: 'active',
76 77
          avatar_url:
            'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
78
          web_url: 'http://localhost:3001/user0',
79 80 81 82 83 84
        },
        {
          name: 'Marguerite Bartell',
          username: 'tajuana',
          id: 18,
          state: 'active',
85 86
          avatar_url:
            'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
87
          web_url: 'http://localhost:3001/tajuana',
88 89 90 91 92 93
        },
        {
          name: 'Laureen Ritchie',
          username: 'michaele.will',
          id: 16,
          state: 'active',
94 95
          avatar_url:
            'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
96
          web_url: 'http://localhost:3001/michaele.will',
97 98 99 100 101 102 103 104 105 106
        },
      ],
      human_time_estimate: null,
      human_total_time_spent: null,
      participants: [
        {
          name: 'User 0',
          username: 'user0',
          id: 22,
          state: 'active',
107 108
          avatar_url:
            'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
109
          web_url: 'http://localhost:3001/user0',
110 111 112 113 114 115
        },
        {
          name: 'Marguerite Bartell',
          username: 'tajuana',
          id: 18,
          state: 'active',
116 117
          avatar_url:
            'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
118
          web_url: 'http://localhost:3001/tajuana',
119 120 121 122 123 124
        },
        {
          name: 'Laureen Ritchie',
          username: 'michaele.will',
          id: 16,
          state: 'active',
125 126
          avatar_url:
            'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
127
          web_url: 'http://localhost:3001/michaele.will',
128 129 130 131 132 133
        },
      ],
      subscribed: true,
      time_estimate: 0,
      total_time_spent: 0,
    },
134 135
    '/autocomplete/projects?project_id=15': [
      {
136 137 138 139 140
        id: 0,
        name_with_namespace: 'No project',
      },
      {
        id: 20,
141
        name_with_namespace: '<img src=x onerror=alert(document.domain)> foo / bar',
142 143
      },
    ],
C
Clement Ho 已提交
144
  },
145
  PUT: {
C
Clement Ho 已提交
146 147 148 149
    '/gitlab-org/gitlab-shell/issues/5.json': {
      data: {},
    },
  },
150
  POST: {
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
    '/gitlab-org/gitlab-shell/issues/5/move': {
      id: 123,
      iid: 5,
      author_id: 1,
      description: 'some description',
      lock_version: 5,
      milestone_id: null,
      state: 'opened',
      title: 'some title',
      updated_by_id: 1,
      created_at: '2017-06-27T19:54:42.437Z',
      updated_at: '2017-08-18T03:39:49.222Z',
      time_estimate: 0,
      total_time_spent: 0,
      human_time_estimate: null,
      human_total_time_spent: null,
      branch_name: null,
      confidential: false,
      assignees: [],
      due_date: null,
      moved_to_id: null,
      project_id: 7,
      milestone: null,
      labels: [],
      web_url: '/root/some-project/issues/5',
    },
E
Eric Eastwood 已提交
177
    '/gitlab-org/gitlab-shell/issues/5/toggle_subscription': {},
178
  },
C
Clement Ho 已提交
179 180
};

181 182
const mockData = {
  responseMap: RESPONSE_MAP,
C
Clement Ho 已提交
183
  mediator: {
184
    endpoint: '/gitlab-org/gitlab-shell/issues/5.json?serializer=sidebar_extras',
E
Eric Eastwood 已提交
185
    toggleSubscriptionEndpoint: '/gitlab-org/gitlab-shell/issues/5/toggle_subscription',
186 187
    moveIssueEndpoint: '/gitlab-org/gitlab-shell/issues/5/move',
    projectsAutocompleteEndpoint: '/autocomplete/projects?project_id=15',
C
Clement Ho 已提交
188 189 190 191 192
    editable: true,
    currentUser: {
      id: 1,
      name: 'Administrator',
      username: 'root',
193 194
      avatar_url:
        'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
C
Clement Ho 已提交
195 196
    },
    rootPath: '/',
197
    fullPath: '/gitlab-org/gitlab-shell',
C
Clement Ho 已提交
198 199 200 201 202 203 204 205
  },
  time: {
    time_estimate: 3600,
    total_time_spent: 0,
    human_time_estimate: '1h',
    human_total_time_spent: null,
  },
  user: {
206
    avatar: 'https://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
C
Clement Ho 已提交
207 208 209 210
    id: 1,
    name: 'Administrator',
    username: 'root',
  },
211
};
C
Clement Ho 已提交
212

213
export default mockData;