Skip to content

Commit

Permalink
Add support for repository template, plugin_activity_visibility and p…
Browse files Browse the repository at this point in the history
…lugin_activity_timestamps (#119)
  • Loading branch information
lowlighter committed Feb 10, 2021
1 parent d784073 commit 2cef0d7
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000001",
Expand Down Expand Up @@ -58,6 +59,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000002",
Expand All @@ -81,6 +83,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000003",
Expand All @@ -103,6 +106,7 @@
],
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000004",
Expand Down Expand Up @@ -135,6 +139,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000005",
Expand All @@ -152,6 +157,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000006",
Expand Down Expand Up @@ -181,6 +187,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000007",
Expand All @@ -201,6 +208,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000008",
Expand All @@ -217,6 +225,7 @@
master_branch:"master",
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"100000000009",
Expand All @@ -229,6 +238,7 @@
},
payload:{action:"started"},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000010",
Expand All @@ -244,6 +254,7 @@
ref_type:faker.random.arrayElement(["tag", "branch"]),
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000011",
Expand All @@ -266,6 +277,7 @@
],
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000012",
Expand All @@ -291,6 +303,7 @@
},
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000013",
Expand All @@ -308,6 +321,7 @@
action:"added",
},
created_at:faker.date.recent(7),
public:true,
},
{
id:"10000000014",
Expand All @@ -320,6 +334,7 @@
},
payload:{},
created_at:faker.date.recent(7),
public:true,
},
],
})
Expand Down
8 changes: 8 additions & 0 deletions source/app/mocks/api/github/rest/activity/listRepoEvents.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
import listEventsForAuthenticatedUser from "./listEventsForAuthenticatedUser.mjs"

/**Mocked data */
export default function({faker}, target, that, [{username:login, page, per_page}]) {
console.debug("metrics/compute/mocks > mocking rest api result > rest.activity.listRepoEvents")
return listEventsForAuthenticatedUser(...arguments)
}
33 changes: 26 additions & 7 deletions source/app/web/statics/app.placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,15 @@
//Activity
...(set.plugins.enabled.activity ? ({
activity:{
timestamps:options["activity.timestamps"],
events:new Array(Number(options["activity.limit"])).fill(null).map(_ => [
{
type:"push",
repo:`${faker.random.word()}/${faker.random.word()}`,
size:1,
branch:"master",
commits: [ { sha:faker.git.shortSha(), message:faker.lorem.sentence()} ]
commits: [ { sha:faker.git.shortSha(), message:faker.lorem.sentence()} ],
timestamp:faker.date.recent(),
},
{
type:"comment",
Expand All @@ -528,6 +530,7 @@
mobile:null,
number:faker.git.shortSha(),
title:"",
timestamp:faker.date.recent(),
},
{
type:"comment",
Expand All @@ -538,6 +541,7 @@
mobile:null,
number:faker.random.number(100),
title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
},
{
type:"comment",
Expand All @@ -548,6 +552,7 @@
mobile:null,
number:faker.random.number(100),
title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
},
{
type:"issue",
Expand All @@ -556,6 +561,7 @@
user:set.user,
number:faker.random.number(100),
title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
},
{
type:"pr",
Expand All @@ -564,23 +570,27 @@
user:set.user,
number:faker.random.number(100),
title:faker.lorem.sentence(),
lines:{added:faker.random.number(1000), deleted:faker.random.number(1000)}, files:{changed:faker.random.number(10)}
lines:{added:faker.random.number(1000), deleted:faker.random.number(1000)}, files:{changed:faker.random.number(10)},
timestamp:faker.date.recent(),
},
{
type:"wiki",
repo:`${faker.random.word()}/${faker.random.word()}`,
pages:[faker.lorem.sentence(), faker.lorem.sentence()]
pages:[faker.lorem.sentence(), faker.lorem.sentence()],
timestamp:faker.date.recent(),
},
{
type:"fork",
repo:`${faker.random.word()}/${faker.random.word()}`,
timestamp:faker.date.recent(),
},
{
type:"review",
repo:`${faker.random.word()}/${faker.random.word()}`,
user:set.user,
number:faker.random.number(100),
title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
},
{
type:"release",
Expand All @@ -589,30 +599,36 @@
name:faker.random.words(4),
draft:faker.random.boolean(),
prerelease:faker.random.boolean(),
timestamp:faker.date.recent(),
},
{
type:"ref/create",
repo:`${faker.random.word()}/${faker.random.word()}`,
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"]),}
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"])},
timestamp:faker.date.recent(),
},
{
type:"ref/delete",
repo:`${faker.random.word()}/${faker.random.word()}`,
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"]),}
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"])},
timestamp:faker.date.recent(),
},
{
type:"member",
repo:`${faker.random.word()}/${faker.random.word()}`,
user:set.user
user:set.user,
timestamp:faker.date.recent(),
},
{
type:"public",
repo:`${faker.random.word()}/${faker.random.word()}`,
timestamp:faker.date.recent(),
},
{
type:"star",
repo:`${faker.random.word()}/${faker.random.word()}`,
action:"started"
action:"started",
timestamp:faker.date.recent(),
},
][Math.floor(Math.random()*15)])
}
Expand Down Expand Up @@ -647,6 +663,9 @@
return text
return `${text.substring(0, length)}…`
}
data.f.date = function (string, options) {
return new Intl.DateTimeFormat("en-GB", options).format(new Date(string))
}
//Render
return await ejs.render(image, data, {async:true, rmWhitespace:true})
}
Expand Down

0 comments on commit 2cef0d7

Please sign in to comment.