Dashboard: include link to repo for the current commit
This commit is contained in:
parent
523820fda6
commit
8f78336a4b
|
@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Birthdays: move today's birthdays out of notifications into right sidebar.
|
- Birthdays: move today's birthdays out of notifications into right sidebar.
|
||||||
- Performance: improve scrolling/navigation between feeds by using a virtual window library.
|
- Performance: improve scrolling/navigation between feeds by using a virtual window library.
|
||||||
- Admin: admin UI into 3-column layout.
|
- Admin: admin UI into 3-column layout.
|
||||||
|
- Admin: include external link to frontend repo for the running commit.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Theme: Halloween theme.
|
- Theme: Halloween theme.
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email-list';
|
import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email-list';
|
||||||
import List, { ListItem } from 'soapbox/components/list';
|
import List, { ListItem } from 'soapbox/components/list';
|
||||||
import { CardTitle, IconButton, Stack } from 'soapbox/components/ui';
|
import { CardTitle, Icon, IconButton, Stack } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useOwnAccount, useFeatures, useInstance } from 'soapbox/hooks';
|
import { useAppDispatch, useOwnAccount, useFeatures, useInstance } from 'soapbox/hooks';
|
||||||
import sourceCode from 'soapbox/utils/code';
|
import sourceCode from 'soapbox/utils/code';
|
||||||
import { download } from 'soapbox/utils/download';
|
import { download } from 'soapbox/utils/download';
|
||||||
|
@ -113,7 +113,18 @@ const Dashboard: React.FC = () => {
|
||||||
|
|
||||||
<List>
|
<List>
|
||||||
<ListItem label={<FormattedMessage id='admin.software.frontend' defaultMessage='Frontend' />}>
|
<ListItem label={<FormattedMessage id='admin.software.frontend' defaultMessage='Frontend' />}>
|
||||||
<span>{sourceCode.displayName} {sourceCode.version}</span>
|
<a
|
||||||
|
href={sourceCode.ref ? `${sourceCode.url}/tree/${sourceCode.ref}` : sourceCode.url}
|
||||||
|
className='flex space-x-1 items-center truncate'
|
||||||
|
target='_blank'
|
||||||
|
>
|
||||||
|
<span>{sourceCode.displayName} {sourceCode.version}</span>
|
||||||
|
|
||||||
|
<Icon
|
||||||
|
className='w-4 h-4'
|
||||||
|
src={require('@tabler/icons/external-link.svg')}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem label={<FormattedMessage id='admin.software.backend' defaultMessage='Backend' />}>
|
<ListItem label={<FormattedMessage id='admin.software.backend' defaultMessage='Backend' />}>
|
||||||
|
|
|
@ -3,6 +3,8 @@ const { execSync } = require('child_process');
|
||||||
|
|
||||||
const pkg = require('../../../package.json');
|
const pkg = require('../../../package.json');
|
||||||
|
|
||||||
|
const { CI_COMMIT_TAG, CI_COMMIT_REF_NAME, CI_COMMIT_SHA } = process.env;
|
||||||
|
|
||||||
const shortRepoName = url => new URL(url).pathname.substring(1);
|
const shortRepoName = url => new URL(url).pathname.substring(1);
|
||||||
const trimHash = hash => hash.substring(0, 7);
|
const trimHash = hash => hash.substring(0, 7);
|
||||||
|
|
||||||
|
@ -10,14 +12,12 @@ const tryGit = cmd => {
|
||||||
try {
|
try {
|
||||||
return String(execSync(cmd));
|
return String(execSync(cmd));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = pkg => {
|
const version = pkg => {
|
||||||
// Try to discern from GitLab CI first
|
// Try to discern from GitLab CI first
|
||||||
const { CI_COMMIT_TAG, CI_COMMIT_REF_NAME, CI_COMMIT_SHA } = process.env;
|
|
||||||
|
|
||||||
if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') {
|
if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') {
|
||||||
return pkg.version;
|
return pkg.version;
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,5 @@ module.exports = {
|
||||||
repository: shortRepoName(pkg.repository.url),
|
repository: shortRepoName(pkg.repository.url),
|
||||||
version: version(pkg),
|
version: version(pkg),
|
||||||
homepage: pkg.homepage,
|
homepage: pkg.homepage,
|
||||||
|
ref: CI_COMMIT_TAG || CI_COMMIT_SHA || tryGit('git rev-parse HEAD'),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue