Skip to content

Commit

Permalink
Merge branch 'develop' into alanwest/otel-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwest committed Jun 16, 2021
2 parents cc995e4 + 190b195 commit 32dd4c5
Show file tree
Hide file tree
Showing 115 changed files with 2,260 additions and 515 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-translations-and-deserialize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
TRANSLATION_VENDOR_SECRET: ${{ secrets.TRANSLATION_VENDOR_SECRET }}
BOT_NAME: nr-opensource-bot
BOT_EMAIL: opensource+bot@newrelic.com
CI: true

jobs:
fetch-content:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@github-docs/frontmatter": "^1.3.1",
"@mdx-js/mdx": "^2.0.0-next.8",
"@mdx-js/react": "^2.0.0-next.8",
"@newrelic/gatsby-theme-newrelic": "^2.4.2",
"@newrelic/gatsby-theme-newrelic": "^2.4.4",
"@splitsoftware/splitio-react": "^1.2.4",
"babel-jest": "^26.3.0",
"common-tags": "^1.8.0",
Expand Down
48 changes: 48 additions & 0 deletions scripts/actions/__tests__/fetch-and-deserialize.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import fetchAndDeserialize from '../fetch-and-deserialize';
const fse = require('fs-extra');
const vfile = require('vfile');
const { writeSync } = require('to-vfile');

jest.mock('fs-extra');
jest.mock('to-vfile');

describe('writeFilesSync', () => {
const testFiles = [
vfile({
contents: 'fake_content',
path: 'src/i18n/content/jp/docs/fake_path_1/fake_file_1.mdx',
extname: '.mdx',
}),
vfile({
contents: 'fake_content',
path: 'src/i18n/content/jp/docs/fake_path_1/fake_file_2.mdx',
extname: '.mdx',
}),
vfile({
contents: 'fake_content',
path: 'src/i18n/content/jp/docs/fake_path_2/fake_file_3.mdx',
extname: '.mdx',
}),
];

fse.existsSync.mockClear();
fse.existsSync.mockReturnValue(true);
fetchAndDeserialize.writeFilesSync(testFiles);

it('should call writeSync for each file', () => {
expect(writeSync).toHaveBeenCalledTimes(testFiles.length);
});

it('should call copySync for each unique directory path', () => {
expect(fse.copySync).toHaveBeenCalledTimes(2);
});

it('should not copy directories that dont have images', () => {
fse.existsSync.mockClear();
fse.existsSync.mockReturnValue(false);
fse.copySync.mockClear();
fetchAndDeserialize.writeFilesSync(testFiles);

expect(fse.copySync).toHaveBeenCalledTimes(0);
});
});
2 changes: 1 addition & 1 deletion scripts/actions/check-job-progress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const loadFromDB = require('./utils/load-from-db');

const { getAccessToken, vendorRequest } = require('./utils/vendor-request');
const fetchAndDeserialize = require('./fetch-and-deserialize');
const { fetchAndDeserialize } = require('./fetch-and-deserialize');

const PROJECT_ID = process.env.TRANSLATION_VENDOR_PROJECT;

Expand Down
4 changes: 3 additions & 1 deletion scripts/actions/deserialize-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ const stripTranslateFrontmatter = () => {
const frontmatterObj = yaml.load(tree.children[0].value);
delete frontmatterObj.translate;
delete frontmatterObj.redirects;
const frontmatterStr = yaml.dump(frontmatterObj).trim();
const frontmatterStr = yaml
.dump(frontmatterObj, { lineWidth: -1 })
.trim();
tree.children[0].value = frontmatterStr;
return tree;
}
Expand Down
47 changes: 43 additions & 4 deletions scripts/actions/fetch-and-deserialize.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const AdmZip = require('adm-zip');
const vfile = require('vfile');
const { writeSync } = require('to-vfile');
const path = require('path');
const fse = require('fs-extra');

const fetch = require('node-fetch');

Expand All @@ -13,6 +15,42 @@ const localesMap = {

const projectId = process.env.TRANSLATION_VENDOR_PROJECT;

/**
* Method which writes translated content to the 'src/content/i18n' path, and copies images for translated files.
* @param {vfile.VFile[]} vfiles
*/
const writeFilesSync = (vfiles) => {
const copiedDirectories = {};

vfiles.forEach((file) => {
writeSync(file, 'utf-8');

const imageDirectory = `${path.dirname(
file.path.substring(file.path.indexOf('/docs/'))
)}/images`;

/*
Check to see:
1. have we already copied this image directory for a different file (with the same parent path)?
2. does the image directory exist?
*/
if (
!(imageDirectory in copiedDirectories) &&
fse.existsSync(`src/content/${imageDirectory}`)
) {
// sync 'src/content/docs/.../images' to 'src/i18n/content/.../docs/.../images'
fse.copySync(
`src/content/${imageDirectory}`,
`${path.dirname(file.path)}/images`,
{
overwrite: true,
}
);
copiedDirectories[imageDirectory] = true;
}
});
};

const fetchTranslatedFilesZip = async (fileUris, locale, accessToken) => {
const fileUriStr = fileUris.reduce((str, uri) => {
return str.concat(`&fileUris[]=${encodeURIComponent(uri)}`);
Expand Down Expand Up @@ -69,10 +107,11 @@ const fetchAndDeserialize = (accessToken) => async ({ locale, fileUris }) => {
);

createDirectories(files);

files.forEach((file) => writeSync(file, 'utf-8'));
writeFilesSync(files);
};

fetchAndDeserialize();
if (process.env.CI) {
fetchAndDeserialize();
}

module.exports = fetchAndDeserialize;
module.exports = { writeFilesSync, fetchAndDeserialize };
2 changes: 1 addition & 1 deletion scripts/actions/release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
message=commit.commit.message.splitlines()[0],
url=commit.html_url
)
except AssertionError:
except AttributeError:
pass

# Set result as an Env for use in Workflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ For accounts with [New Relic One pricing](/docs/accounts/accounts-billing/new-re

A user's [user type](/docs/accounts/accounts-billing/new-relic-one-user-management/new-relic-one-user-model-understand-user-structure/#user-type) is meant to be long-term setting determined by a user's expected New Relic duties and responsibilities. Because user type is a billing factor, we have restrictions around how often a full user can be downgraded to a basic user: **a full user can downgrade to a basic user a maximum of two times in a rolling 12-month period.** If a full user has been changed to a basic user two times in that 12-month period, that user won't be able to return to being a basic user until the start of the next 12-month period. To learn reasons for assigning one user type or another, see [Tips on assigning user type](/docs/accounts/accounts-billing/new-relic-one-user-management/new-relic-one-user-model-understand-user-structure/#decide-user-type).

Other user-related billing details:
More user-related billing details:
* You can see your full user count [in the UI](/docs/accounts/accounts-billing/general-account-settings/introduction-account-settings/#pricing).
* The count of full users is prorated based on the start of a New Relic subscription, or based on when a user is created as a full user or converted to a full user.
* The count of full users is prorated based on the start of a New Relic subscription, or based on when a user is created as a full user or converted to a full user.
* For organizations on our original account/user model that have a [master/sub-account structure](/docs/accounts/original-accounts-billing/original-users-roles/mastersub-account-structure), the count of billable users in the UI may differ from the list of users you see. For more on this, see [User count discrepancy](/docs/accounts/original-accounts-billing/original-users-roles/users-roles-original-user-model#full-user-count).
* A user can have a maximum of either three concurrent active sessions, or three unique IP addresses in use at any given time.
* The [Standard edition](https://newrelic.com/pricing) of the New Relic One pricing plan includes one free full user.
* Users with duplicate email addresses are only counted once.
* For organizations on our [original user model](/docs/accounts/original-accounts-billing/original-users-roles/users-roles-original-user-model/#user-type), a user may be set as a basic user in one account, and as a full user in another account. In such cases, the full user status takes precedence and that user is considered a full user.
* For organizations that have multiple accounts, the billable users are counted on the main account responsible for payment. This can mean that if you’re viewing or querying your user count when in a sub-account, you may not see the complete user count for that organization.

For how to query usage data, see [Query and alert on usage](/docs/accounts/accounts-billing/new-relic-one-pricing-users/usage-queries-alerts).

Expand Down

0 comments on commit 32dd4c5

Please sign in to comment.