Skip to content

Commit

Permalink
Merge pull request #850 from bcgov/test
Browse files Browse the repository at this point in the history
Create Latest Release
  • Loading branch information
ikethecoder authored Jul 13, 2023
2 parents bd661fd + 9301fd1 commit af1fc8c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 14 deletions.
3 changes: 3 additions & 0 deletions feeds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
## Configuration

```
export LOG_FEEDS=ON
export DESTINATION_URL=https://aps-portal-feature-sprint13-poc.apps.silver.devops.gov.bc.ca
export WORKING_PATH=`pwd`/_tmp
export KONG_ADMIN_URL=https://adminapi-264e6f-dev.apps.silver.devops.gov.bc.ca
export CKAN_URL=https://catalog.data.gov.bc.ca
export PROM_URL=https://prom-264e6f-dev.apps.silver.devops.gov.bc.ca
npm run start
```

#### GatewayService
Expand Down
16 changes: 4 additions & 12 deletions feeds/ckan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,15 @@ async function sync({ url, workingPath, destinationUrl }) {
const xfer = transfers(workingPath, url, exceptions);

await xfer.copy('/api/action/group_list?limit=100&offset=0', 'group-keys');
await xfer.copy(
'/api/action/package_list?limit=100&offset=0',
'package-keys'
await xfer.copySearch(
'/api/action/package_search?fq=groups:(bc-government-api-registry)',
'packages/'
);

await xfer.concurrentWork(
getCkanDataProducer(xfer, 'group-keys', '/api/action/group_show', 'groups/')
);
await xfer.concurrentWork(
getCkanDataProducer(
xfer,
'package-keys',
'/api/action/package_show',
'packages/'
),
10
);

console.log('Exceptions? ' + (exceptions.length == 0 ? 'NO' : 'YES!'));
console.log(JSON.stringify(exceptions, null, 4));

Expand Down
2 changes: 2 additions & 0 deletions feeds/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ if (process.env.SCHEDULE == 'true') {
runTimedJob('prometheus', 120, { numDays: 1 });
runTimedJob('prometheus', 24 * 60 + 5, { numDays: 5 });
runTimedJob('kong', 1 * 60, {});
runTimedJob('ckan', (24 * 60) + 30, {});
runTimedJob('ckan_org', 24 * 60, {});
}

const server = app.listen(port, () => {
Expand Down
26 changes: 26 additions & 0 deletions feeds/utils/transfers.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,32 @@ function transfers(workingPath, baseUrl, exceptions) {
});
},

copySearch: async function (_url, filename, index = 0) {
log.debug('[copySearch] %s%s', baseUrl, _url);
return fetch(baseUrl + _url)
.then(checkStatus)
.then((data) => data.json())
.then((json) => {
for (const item of json.result.results) {
const out =
workingPath + '/' + filename + item.name + '-' + index + '.json';
fs.writeFileSync(
out,
JSON.stringify({ result: item }, null, 4),
null
);
}
})
.catch((err) => {
log.error('[copySearch] %s, %s', filename, err);
exceptions.push({
relativeUrl: url,
filename: filename,
error: '' + err,
});
});
},

read: function (filename) {
const infile = workingPath + '/' + filename + '.json';
return JSON.parse(fs.readFileSync(infile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
environments {
id
name
active
flow
credentialIssuer {
name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const GrantAccessDialog: React.FC<GrantAccessDialogProps> = ({
{product &&
data?.allProductsByNamespace
.find((p) => p.id === product)
?.environments.map((e) => (
?.environments.filter((e) => e.active).map((e) => (
<option key={e.id} value={e.id}>
{e.name}
</option>
Expand Down Expand Up @@ -272,6 +272,7 @@ const query = gql`
environments {
id
name
active
flow
credentialIssuer {
name
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/pages/devportal/api-directory/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default ApiPage;

const detailItems: DetailItem[] = [
{
title: 'License',
title: 'Licence',
key: 'license_title',
},
{
Expand Down

0 comments on commit af1fc8c

Please sign in to comment.