├── .dockerignore ├── .editorconfig ├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── NOTICE ├── README.md ├── assets ├── images │ └── copyright-vs-license.png └── template.html ├── browser ├── app.tsx ├── components │ ├── App.tsx │ ├── Landing.tsx │ ├── NotFound.tsx │ ├── projects │ │ ├── ProjectRouter.tsx │ │ ├── acl │ │ │ ├── GroupSelect.tsx │ │ │ └── ProjectAclEditor.tsx │ │ ├── admin │ │ │ ├── PackageVerification.tsx │ │ │ └── PackageVerificationQueue.tsx │ │ ├── browse │ │ │ ├── ProjectList.tsx │ │ │ ├── ProjectListItem.tsx │ │ │ └── Projects.tsx │ │ ├── editor │ │ │ ├── DetatchButton.tsx │ │ │ ├── PackageEditor.tsx │ │ │ ├── PackageFields.tsx │ │ │ ├── ProjectOnboardingForm.tsx │ │ │ ├── ProjectPackage.tsx │ │ │ ├── ProjectView.tsx │ │ │ ├── UsageFields.tsx │ │ │ ├── questions │ │ │ │ ├── QuestionWidget.tsx │ │ │ │ ├── RadioWidget.tsx │ │ │ │ ├── SelectWidget.tsx │ │ │ │ ├── TextWidget.tsx │ │ │ │ └── index.ts │ │ │ └── refs │ │ │ │ ├── AddRelatedProjectModal.tsx │ │ │ │ └── ProjectRefInfo.tsx │ │ ├── packages │ │ │ ├── PackageCard.tsx │ │ │ ├── PackageCardUsage.tsx │ │ │ └── PackageVerificationMark.tsx │ │ ├── refs │ │ │ └── CloneProject.tsx │ │ └── render │ │ │ ├── AttributionDocBuilder.tsx │ │ │ ├── AttributionDocWarning.tsx │ │ │ ├── TextAnnotator.tsx │ │ │ └── TextLine.tsx │ └── util │ │ ├── EditableText.tsx │ │ ├── FreeformSelect.tsx │ │ ├── Modal.tsx │ │ └── ToggleLink.tsx ├── ext.ts ├── extensions │ ├── DemoFooter.ext.tsx │ └── README.md ├── history.ts ├── modules │ ├── common.ts │ ├── licenses.ts │ ├── packages.ts │ └── projects.ts ├── reducers.ts ├── store.ts ├── tsconfig.json └── util │ ├── ExtensionPoint.tsx │ ├── debounce.ts │ ├── download.ts │ ├── index.ts │ └── viewport.ts ├── config ├── default.js └── dev.js ├── docker-compose.dev.yml ├── docker-compose.selenium.yml ├── docker-compose.yml ├── docs ├── for-admins.md ├── for-users.md ├── openapi.yaml └── schema.sql ├── package-lock.json ├── package.json ├── server ├── api │ ├── routes-v1.ts │ ├── routes.ts │ └── v1 │ │ ├── licenses │ │ ├── index.ts │ │ └── interfaces.ts │ │ ├── packages │ │ ├── auth.ts │ │ ├── index.ts │ │ └── interfaces.ts │ │ └── projects │ │ ├── attribution.ts │ │ ├── auth.spec.ts │ │ ├── auth.ts │ │ ├── index.spec.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ └── validators.ts ├── app.ts ├── auth │ ├── base.ts │ ├── impl │ │ └── nullauth.ts │ ├── index.ts │ ├── util.spec.ts │ └── util.ts ├── config.ts ├── custom.ts ├── db │ ├── attribution_documents.ts │ ├── index.ts │ ├── packages.ts │ ├── projects.ts │ └── projects_audit.ts ├── errors │ └── index.ts ├── licenses │ ├── index.ts │ ├── interfaces.ts │ ├── known.spec.ts │ ├── known │ │ ├── Apache-2.0.ts │ │ ├── MIT.ts │ │ ├── MyCustomLicense.ts │ │ └── README.md │ ├── tags.spec.ts │ └── tags │ │ ├── README.md │ │ ├── all.ts │ │ ├── fixed-text.ts │ │ ├── linkage.ts │ │ ├── modified.ts │ │ ├── notice.ts │ │ ├── popular.ts │ │ ├── spdx.ts │ │ ├── unknown.ts │ │ ├── user-supplied.ts │ │ └── validation-demo.ts ├── localserver.ts └── util │ ├── credentials.spec.ts │ ├── credentials.ts │ ├── idgen.ts │ └── middleware.ts ├── spec ├── helpers │ └── output.js ├── selenium │ ├── driver.ts │ ├── landing.spec.ts │ ├── projects-auth.spec.ts │ └── projects.spec.ts └── support │ └── jasmine.json ├── styles ├── bootstrap-overrides.scss ├── site.scss └── style.scss ├── tsconfig.json ├── tslint.json └── webpack.config.js /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | trim_trailing_whitespace = true 7 | 8 | [*.{css,js,jsx,ts,tsx,json,html}] 9 | indent_style = space 10 | indent_size = 2 11 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | 6 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: node_js 3 | services: docker 4 | node_js: 5 | - "12" 6 | 7 | before_install: 8 | - sudo apt-get update 9 | - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce 10 | 11 | script: 12 | - npm test 13 | - npm run test-ui 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html), as much as 6 | a website reasonably can. Backwards incompatible changes (requiring a major version bump) will be 7 | described here, and may involve database changes, significant workflow changes, or changes that 8 | require manual edits to pluggable interfaces. 9 | 10 | ## Unreleased 11 | 12 | ### Added 13 | - Added extension points to customize the look and behavior of client-side components. See 14 | the README in `browser/extensions` for info. 15 | - A global ACL is now available and can be set in your configuration as `globalACL`. Entries added 16 | to this list will implicitly apply to all projects. This will eventually replace the current 17 | admin functionality. 18 | - An API is available to fetch rendered/stored documents for projects. 19 | 20 | ### Changed 21 | - Now uses tiny-attribution-generator to build documents. 22 | 23 | ## 0.9.0 - 2017-12-11 24 | 25 | ### Added 26 | - Auth backends can now specify how a user should be authenticated, via Passport. They should 27 | provide an `initialize` method that is called during app start-up. This can be used to register 28 | Passport strategies, login URLs, or any other session activities. 29 | - SPDX license texts are now shipped with the attribution builder. 30 | - License tags can now specify presentation options to influence how they appear in the package 31 | editor. They can be sorted first, annotated with text (both in menu and below), and control 32 | whether users are asked for the full license text. 33 | - License tags can also specify "questions" to ask a user when adding a package. This is useful 34 | to gather context-sensitive info. For example, you could only ask for "dynamic/static linking" 35 | if relevant for a given license. 36 | - Added a user interface for editing project access lists. This can be accessed by clicking on 37 | the owner on the top right side of the projcet editor. 38 | - It is now possible to edit a package and usage information in a project. New package revisions 39 | will be created as necessary, and previous entries will be correctly cleaned up. 40 | 41 | ### Removed 42 | - JWT sessions are no longer in use. See the above addition about auth backends for an alternative. 43 | - The build process no longer requires Gulp. 44 | 45 | ### Changed 46 | - Project ACLs are now sanely validated, with levels of "owner", "editor", and "viewer". A viewer 47 | can only view a project. An editor can change project details, except for the ACL. An owner can 48 | change everything about a project. 49 | - Users on a project contact list implicitly have "viewer" permissions unless otherwire specified. 50 | - The format of `/api/licenses` changed. Instead of a list, it returns a {licenses, tags} 51 | structure. The license list is included in the `license` key. 52 | 53 | ### Fixed 54 | - Some lingering Bootstrap CSS issues were cleaned up. 55 | - The `validateUsage` function (used in tags) was incorrectly documented. 56 | - `extractRequestUser` is now consistently used, making custom auth backends more reliable. 57 | 58 | ### Security 59 | - Users who weren't configured to access package validation systems could still do so, due to 60 | a dangling `Promise`. Additional type checks and lints have been enabled to prevent this in the 61 | future. 62 | 63 | ## 0.8.0 - 2017-08-04 64 | 65 | - Initial release. -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Bugs 2 | 3 | Bug reports and feature suggestions are welcome. When filing a bug, try to include as much information as you can. Details like these are incredibly useful: 4 | 5 | * A reproducible test case or series of steps 6 | * The date/commit of the code you're running 7 | * Any modifications you've made relevant to the bug 8 | * Anything unusual about your environment or deployment 9 | 10 | # Pull Requests 11 | 12 | Pull requests are welcome! 13 | 14 | You should open an issue to discuss your pull request, unless it's a trivial change. It's best to ensure that your proposed change would be accepted so that you don't waste your own time. 15 | 16 | Pull requests should generally be opened against **master**. 17 | 18 | ## Tests 19 | 20 | Please ensure that your change still passes unit tests, and ideally integration/UI tests. It's OK if you're still working on tests at the time that you submit, but be prepared to be asked about them. 21 | 22 | ## Code Style 23 | 24 | Generally, match the style of the surrounding code. We ship an EditorConfig file for indentation and TSLint configuration for TypeScript code. Please ensure your changes don't wildly deviate from those rules. You can run `npm run lint` to identify and automatically fix most style issues. 25 | 26 | ## Code of Conduct 27 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 28 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 29 | opensource-codeofconduct@amazon.com with any additional questions or comments. 30 | 31 | 32 | ## Security issue notifications 33 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 34 | 35 | 36 | ## Licensing 37 | 38 | See the [LICENSE](https://github.com/amzn/oss-attribution-builder/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 39 | 40 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. 41 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 as build 2 | WORKDIR /build 3 | 4 | COPY ./package.json ./package-lock.json ./ 5 | RUN NPM_CONFIG_LOGLEVEL=warn npm install 6 | 7 | COPY ./ ./ 8 | RUN NODE_ENV=production npm run build 9 | 10 | 11 | FROM node:12 12 | ENV NODE_ENV production 13 | CMD ["node", "./server/localserver.js"] 14 | WORKDIR /opt/app 15 | 16 | COPY ./package.json ./package-lock.json ./ 17 | RUN NPM_CONFIG_LOGLEVEL=warn npm install --production 18 | COPY --from=build /build/build/ ./ 19 | 20 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | OSS Attribution Builder 2 | Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OSS Attribution Builder 2 | [![Build Status](https://travis-ci.com/amzn/oss-attribution-builder.svg?branch=master)](https://travis-ci.org/amzn/oss-attribution-builder) 3 | 4 | OSS Attribution Builder is a website that helps teams create attribution documents for software products. An attribution document is a text file, web page, or screen in just about every software application that lists the software components used and their licenses. They're often in the About screens, and are sometimes labeled "Open Source Notices", "Credits", or other similar jargon. 5 | 6 | [Screenshot](https://raw.github.com/amzn/oss-attribution-builder/screenshots/attribution-builder-project-example.png) 7 | 8 | ## Quickstart 9 | 10 | 1. Install [Docker](https://www.docker.com/) 11 | 2. Clone this repository 12 | 3. Run `docker-compose up` 13 | 4. Visit http://localhost:8000/ 14 | * The demo uses HTTP basic auth. Enter any username and password. Use `admin` to test out admin functionality. 15 | 16 | ## Using the Website 17 | 18 | See documentation: 19 | 20 | * [For users](docs/for-users.md) 21 | * [For administrators](docs/for-admins.md) 22 | 23 | ## Caveats 24 | 25 | The attribution builder was originally an Amazon-internal tool. Some portions had to be removed to make this a sensible open source project. As such, there are some warts: 26 | 27 | * Projects have contact lists, but at the moment the UI only supports one contact (the legal contact). 28 | 29 | These will all be fixed in time, but be aware that some things might be weird for a while. 30 | 31 | ## Custom deployment 32 | 33 | If you're ready to integrate the attribution builder into your own environment, there are some things to set up: 34 | 35 | ### Configuration 36 | 37 | Open up [config/default.js](config/default.js) and poke around. This configuration launches when you run `docker-compose` or otherwise launch the application. 38 | 39 | ### Licenses 40 | 41 | The attribution builder has support for two types of license definitions: 42 | 43 | * SPDX identifiers 44 | * "Known" license texts and tags 45 | 46 | SPDX identifiers are just used for pre-filling the license selector, but do not (currently) have texts. The more useful type of license is a "known" license, where **you** (the administrator) supply the text of the license and any tags you'd like to apply. 47 | 48 | For information on adding your own "known" licenses, see [the license README](server/licenses/known/README.md). There are two existing licenses in the same directory you can look at for examples. 49 | 50 | #### Tags 51 | 52 | Tags allow you to add arbitrary validation rules to a license. They can be useful for: 53 | 54 | * Verifying a license is being used in the right way (e.g., LGPL and how a package was linked) 55 | * Annotating a particular license as needing follow up, if your business has special processes 56 | * Providing guidance on attribution for licenses with many variants 57 | * Modifying the how a license is displayed in an attribution document 58 | 59 | For information on what tags can do and how to create your own, see [the tags README](server/licenses/tags/README.md). 60 | 61 | ### Extensions 62 | 63 | The attribution builder offers some form of extensions that allow you to alter client-side site behavior and appearance, without needing to patch internals. This can make upgrades easier. 64 | 65 | See [the extensions README](browser/extensions/README.md) for details. 66 | 67 | ### Authentication module 68 | 69 | The attribution builder supports being able to restrict access to certain people or groups using project ACLs. These can also be used for administration and to "verify" packages (details on that in a later section). The default implementation `nullauth` is not very useful for most environments; you will want to write your own when launching more broadly. 70 | 71 | See [the base auth interface](server/auth/base.ts) for implementation details. 72 | 73 | ### Running 74 | 75 | To start up the server, you should run `build/server/localserver.js` after building with `npm run build`. There are some environment variables you'll probably want to set when running: 76 | 77 | * `NODE_ENV` should most likely be set to `production` 78 | * `CONFIG_NAME` should be set to the basename (no extension) of your configuration file you created above. The default is "default". 79 | 80 | The server runs in HTTP only. You probably want to put a thin HTTPS web server or proxy in front of it. 81 | 82 | ## Contributing 83 | 84 | See [CONTRIBUTING](CONTRIBUTING.md) for information. 85 | 86 | ### Development 87 | 88 | `npm install` and then `npm run dev` will get you off the ground for local development. This will start a Docker container for PostgreSQL, but will use a local copy of tsc, webpack, node, etc so you can iterate quickly. 89 | 90 | Once things have started up, you can open http://0.0.0.0:2425/webpack-dev-server/. This will automatically reload on browser changes, and the backend will also automatically restart on server-side changes. 91 | 92 | Handy environment variables: 93 | 94 | * `NODE_ENV`: when unset or `development`, you'll get full source maps & debug logs 95 | * `DEBUG_SQL`: when set (to anything), this will show SQL queries on the terminal as they execute 96 | 97 | #### Testing 98 | 99 | `npm test` will run unit tests. These are primarily server focused. 100 | 101 | `npm run test-ui` will run Selenium tests. You can set the environment variable `SELENIUM_DRIVER` if you want a custom driver -- by default, it'll try to use Chrome, and if that's not available it'll fall back to PhantomJS. 102 | 103 | When debugging UI tests, it may be easier to change `standalone-chrome` to `standalone-chrome-debug` in `docker-compose.selenium.yml`, and then connect to the container via VNC (port 5900, password "secret"). Run the container and your tests separately: 104 | 105 | * `docker-compose -f docker-compose.selenium.yml up --build` 106 | * `tsc && jasmine --stop-on-failure=true 'build/selenium/*.spec.js'` 107 | 108 | Tests failing for seemingly no reason? `driver.sleep` not working? Make sure your Jasmine timeout on your test is high enough. 109 | -------------------------------------------------------------------------------- /assets/images/copyright-vs-license.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amzn/oss-attribution-builder/c8bc98e1d278a588324a02c8909cca2819f282d6/assets/images/copyright-vs-license.png -------------------------------------------------------------------------------- /assets/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Attribution Builder 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /browser/app.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'bootstrap'; 5 | import 'core-js/shim'; 6 | 7 | import * as React from 'react'; 8 | import { render } from 'react-dom'; 9 | import { Provider } from 'react-redux'; 10 | import { Route, Router } from 'react-router-dom'; 11 | 12 | import App from './components/App'; 13 | import history from './history'; 14 | import store from './store'; 15 | 16 | // routes listed here should point to redux-enabled containers 17 | window.addEventListener('DOMContentLoaded', () => { 18 | // see components/App.tsx for the rest of the routes 19 | render( 20 | 21 | 22 | 23 | 24 | , 25 | document.getElementById('content') 26 | ); 27 | }); 28 | 29 | // @ts-ignore 30 | // load up extensions (webpack hook) 31 | const extCtx = require.context('./extensions', false, /.ext.[jt]sx?$/); 32 | extCtx.keys().forEach(extCtx); 33 | -------------------------------------------------------------------------------- /browser/components/App.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import * as React from 'react'; 5 | import { connect } from 'react-redux'; 6 | import { NavLink, Route, Switch } from 'react-router-dom'; 7 | 8 | import { 9 | fetchSiteInfo, 10 | setAdminMode, 11 | setGeneralError, 12 | } from '../modules/common'; 13 | import ExtensionPoint from '../util/ExtensionPoint'; 14 | import Landing from './Landing'; 15 | import NotFound from './NotFound'; 16 | import PackageVerification from './projects/admin/PackageVerification'; 17 | import PackageVerificationQueue from './projects/admin/PackageVerificationQueue'; 18 | import Projects from './projects/browse/Projects'; 19 | import ProjectOnboardingForm from './projects/editor/ProjectOnboardingForm'; 20 | import ProjectRouter from './projects/ProjectRouter'; 21 | import Modal from './util/Modal'; 22 | import ToggleLink from './util/ToggleLink'; 23 | 24 | interface Props { 25 | dispatch: (action: any) => any; 26 | generalError: any; 27 | canAdmin: boolean; 28 | admin: boolean; 29 | } 30 | 31 | class App extends React.Component { 32 | componentWillMount() { 33 | const { dispatch } = this.props; 34 | dispatch(fetchSiteInfo()); 35 | } 36 | 37 | dismissError = (actionName) => { 38 | const { dispatch } = this.props; 39 | dispatch(setGeneralError(undefined)); 40 | }; 41 | 42 | mapError(err) { 43 | let title = ''; 44 | let explain = ''; 45 | 46 | switch (err.code) { 47 | case 403: 48 | title = 'You might not have access to this resource'; 49 | explain = 50 | 'If you think you need access to this item, contact the site administrator.'; 51 | break; 52 | 53 | default: 54 | title = 'Something went wrong'; 55 | explain = 'Please try that again.'; 56 | break; 57 | } 58 | 59 | return ( 60 | 61 | {(buttonAction) => ( 62 | <> 63 |
64 |

65 | There was a problem: 66 |
67 | {err.message} 68 |

69 |

{explain}

70 |
71 |
72 | 78 |
79 | 80 | )} 81 |
82 | ); 83 | } 84 | 85 | toggleAdmin = () => { 86 | const { dispatch, admin } = this.props; 87 | dispatch(setAdminMode(!admin)); 88 | }; 89 | 90 | render() { 91 | const { generalError, canAdmin, admin } = this.props; 92 | return ( 93 | <> 94 | 95 | 96 | 133 | 134 | {generalError != undefined && this.mapError(generalError)} 135 | 136 |
137 |
138 |
139 | 140 | 141 | 142 | 147 | 148 | 153 | 157 | 158 | 159 |
160 |
161 | 162 |
163 |
164 | {canAdmin && ( 165 |
166 | 167 | Admin 168 | 169 |
170 | )} 171 | 172 |
173 |
174 |
175 | 176 | 177 | 178 | ); 179 | } 180 | } 181 | 182 | export default connect((state: any) => ({ 183 | generalError: state.common.generalError, 184 | canAdmin: 185 | state.common.info.permissions && state.common.info.permissions.admin, 186 | admin: state.common.admin, 187 | }))(App); 188 | -------------------------------------------------------------------------------- /browser/components/Landing.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import * as React from 'react'; 5 | import { connect } from 'react-redux'; 6 | import { Link } from 'react-router-dom'; 7 | 8 | import { fetchSiteInfo } from '../modules/common'; 9 | import ExtensionPoint from '../util/ExtensionPoint'; 10 | 11 | interface Props { 12 | dispatch: any; 13 | admin?: boolean; 14 | displayName?: string; 15 | } 16 | 17 | class Landing extends React.Component { 18 | componentWillMount() { 19 | const { dispatch } = this.props; 20 | // this is a little dumb... but in order to display the current user, 21 | // we need to authenticate. 22 | dispatch(fetchSiteInfo()); 23 | } 24 | 25 | render() { 26 | const { admin, displayName } = this.props; 27 | 28 | return ( 29 | <> 30 |
31 |

{displayName ? `Hello, ${displayName}` : 'Hello'}

32 | 33 |

34 | This tool helps you build an attribution document to use in a 35 | distributed product. 36 |

37 |

38 | We organize attribution documents by project. You can create a new 39 | project or browse your projects below. We'll ask you for some 40 | basic details about your product, such as who your legal contact 41 | is and when you plan to distribute or launch. Then you'll build a 42 | list of all of the open source packages you use and their 43 | licenses. These packages and their licenses will form your 44 | attribution document. 45 |

46 |
47 |

48 | 49 | New Project 50 | {' '} 51 | 52 | My Projects 53 | {' '} 54 | {admin ? ( 55 | 56 | All Projects 57 | 58 | ) : ( 59 | '' 60 | )} 61 |

62 |
63 | 64 | 65 | ); 66 | } 67 | } 68 | 69 | export default connect((state: any) => ({ 70 | displayName: state.common.info.displayName, 71 | admin: state.common.admin, 72 | }))(Landing as any); 73 | -------------------------------------------------------------------------------- /browser/components/NotFound.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import * as React from 'react'; 5 | import { match } from 'react-router'; 6 | 7 | import ExtensionPoint from '../util/ExtensionPoint'; 8 | 9 | interface Props { 10 | match: match; 11 | } 12 | 13 | const Landing: React.SFC = (props) => { 14 | return ( 15 |
16 |
Not Found
17 |
18 | 19 |

Page not found

20 |

21 | The resource you were looking for doesn't exist here. Check your 22 | location for typos and try again. 23 |

24 |
25 |
26 |
27 | ); 28 | }; 29 | export default Landing; 30 | -------------------------------------------------------------------------------- /browser/components/projects/ProjectRouter.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import * as React from 'react'; 5 | import { connect } from 'react-redux'; 6 | import { Route, Switch } from 'react-router'; 7 | import { Link } from 'react-router-dom'; 8 | 9 | import { WebProject } from '../../../server/api/v1/projects/interfaces'; 10 | import * as ProjectActions from '../../modules/projects'; 11 | import ProjectAclEditor from './acl/ProjectAclEditor'; 12 | import ProjectView from './editor/ProjectView'; 13 | import CloneProject from './refs/CloneProject'; 14 | import AttributionDocBuilder from './render/AttributionDocBuilder'; 15 | 16 | interface Props { 17 | dispatch: (action: any) => any; 18 | match: any; 19 | project: WebProject; 20 | } 21 | 22 | class ProjectRouter extends React.Component { 23 | componentWillMount() { 24 | const { 25 | dispatch, 26 | match: { params }, 27 | } = this.props; 28 | dispatch(ProjectActions.fetchProjectDetail(params.projectId)); 29 | } 30 | 31 | componentWillUpdate(nextProps) { 32 | const { 33 | dispatch, 34 | match: { params }, 35 | } = this.props; 36 | if (params.projectId === nextProps.match.params.projectId) { 37 | return; 38 | } 39 | 40 | dispatch( 41 | ProjectActions.fetchProjectDetail(nextProps.match.params.projectId) 42 | ); 43 | } 44 | 45 | render() { 46 | const { 47 | project, 48 | match: { 49 | params: { projectId }, 50 | }, 51 | } = this.props; 52 | 53 | if (project == undefined || projectId !== project.projectId) { 54 | return
Loading project information...
; 55 | } 56 | 57 | return ( 58 |
59 | 82 | 83 | 88 | 89 | 93 | 94 | 95 |
96 | ); 97 | } 98 | } 99 | 100 | export default connect((state: any) => ({ 101 | project: state.projects.active, 102 | }))(ProjectRouter); 103 | -------------------------------------------------------------------------------- /browser/components/projects/acl/GroupSelect.tsx: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import * as React from 'react'; 5 | import Select, { Option } from 'react-select'; 6 | 7 | interface Props { 8 | name: string; 9 | value: string; 10 | groups: string[]; 11 | onChange: (value: string | undefined) => void; 12 | } 13 | 14 | export default function GroupSelect(props: Props) { 15 | return ( 16 | {' '} 57 | {text} 58 | 59 | 60 | ); 61 | }; 62 | 63 | submitForm = (e: any) => { 64 | const { 65 | dispatch, 66 | match: { 67 | params: { packageId }, 68 | }, 69 | } = this.props; 70 | e.preventDefault(); 71 | dispatch( 72 | PackageActions.verifyPackage( 73 | packageId, 74 | this.allChecked, 75 | this.state.comments 76 | ) 77 | ); 78 | }; 79 | 80 | validate = () => { 81 | this.allChecked = ['website', 'license', 'copyright'] 82 | .map((x) => this.state[`verify_${x}`]) 83 | .reduce((a, b) => a && b, true); 84 | 85 | return this.allChecked || this.state.comments.trim().length > 0; 86 | }; 87 | 88 | render() { 89 | const { 90 | match: { 91 | params: { packageId }, 92 | }, 93 | } = this.props; 94 | 95 | const valid = this.validate(); 96 | 97 | return ( 98 |
99 |
100 | 104 |
105 | 106 |
107 |
108 | {this.renderVerifyOption('license', 'License name/text is correct')} 109 | {this.renderVerifyOption( 110 | 'copyright', 111 | 'Copyright statement is correct' 112 | )} 113 | {this.renderVerifyOption('website', 'Website is correct')} 114 |
115 | 116 |