├── .nvmrc ├── .prettierignore ├── .nycrc ├── .vscode ├── extensions.json └── settings.json ├── src ├── images │ ├── logo.png │ ├── favicon.ico │ ├── tw-logo.png │ ├── radar_legend.png │ ├── banner-image-desktop.jpg │ ├── banner-image-mobile.jpg │ ├── tech-radar-landing-page-wide.png │ └── search-logo-2x.svg ├── stylesheets │ ├── _fonts.scss │ ├── _layout.scss │ ├── _mediaqueries.scss │ ├── _footer.scss │ ├── _error.scss │ ├── _loader.scss │ ├── _colors.scss │ ├── _herobanner.scss │ ├── _tip.scss │ ├── _landingpage.scss │ ├── _form.scss │ ├── _header.scss │ └── base.scss ├── site.js ├── models │ ├── ring.js │ ├── quadrant.js │ ├── blip.js │ └── radar.js ├── common.js ├── config.js ├── exceptions │ ├── unauthorizedError.js │ ├── malformedDataError.js │ └── sheetNotFoundError.js ├── util │ ├── queryParamProcessor.js │ ├── ringCalculator.js │ ├── exceptionMessages.js │ ├── contentValidator.js │ ├── autoComplete.js │ ├── inputSanitizer.js │ ├── sheet.js │ ├── googleAuth.js │ └── factory.js ├── gtm.js ├── error.html ├── index.html └── graphing │ └── radar.js ├── run_e2e_tests.sh ├── .prettierrc ├── spec ├── end_to_end_tests │ ├── pageObjects │ │ ├── base_page.js │ │ ├── byor_page.js │ │ └── radar_page.js │ ├── resources │ │ ├── sheet.csv │ │ ├── data.json │ │ └── localfiles │ │ │ └── radar.json │ ├── util │ │ └── hooks.js │ └── specs │ │ └── end_to_end_test.js ├── support │ └── jasmine.json ├── helpers │ └── jsdom.js ├── models │ ├── ring-spec.js │ ├── quadrant-spec.js │ ├── blip-spec.js │ └── radar-spec.js ├── util │ ├── ringCalculator-spec.js │ ├── queryParamProcessor-spec.js │ ├── contentValidator-spec.js │ ├── sheet-spec.js │ └── inputSanitizer-spec.js └── graphing │ └── ref-table-spec.js ├── .editorconfig ├── .eslintignore ├── .dockerignore ├── .gitignore ├── docker_push.sh ├── .eslintrc.json ├── default.template ├── CONTRIBUTORS.md ├── Dockerfile ├── webpack.prod.js ├── webpack.dev.js ├── cypress.json ├── .circleci ├── config.yml └── deployment-workflow.yml ├── .devcontainer └── devcontainer.json ├── package.json ├── webpack.common.js ├── README.md └── LICENSE.md /.nvmrc: -------------------------------------------------------------------------------- 1 | v18 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | LICENSE.md -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["spec/**/*spec.js", "src/**"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { "recommendations": ["esbenp.prettier-vscode", "EditorConfig.EditorConfig"] } 2 | -------------------------------------------------------------------------------- /src/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/logo.png -------------------------------------------------------------------------------- /src/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/favicon.ico -------------------------------------------------------------------------------- /src/images/tw-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/tw-logo.png -------------------------------------------------------------------------------- /src/images/radar_legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/radar_legend.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnSave": true 4 | } 5 | -------------------------------------------------------------------------------- /run_e2e_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TEST_URL=$1 4 | 5 | npm run dev & 6 | sleep 30 7 | TEST_URL=$TEST_URL npm run test:e2e 8 | -------------------------------------------------------------------------------- /src/images/banner-image-desktop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/banner-image-desktop.jpg -------------------------------------------------------------------------------- /src/images/banner-image-mobile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/banner-image-mobile.jpg -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "all", 6 | "printWidth": 120 7 | } 8 | -------------------------------------------------------------------------------- /src/stylesheets/_fonts.scss: -------------------------------------------------------------------------------- 1 | @import 'featuretoggles'; 2 | 3 | $baseFont: 17px; 4 | $baseWeight: 100; 5 | $baseFontFamily: 'Inter', sans-serif; 6 | -------------------------------------------------------------------------------- /src/images/tech-radar-landing-page-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orenmazor/build-your-own-radar/master/src/images/tech-radar-landing-page-wide.png -------------------------------------------------------------------------------- /spec/end_to_end_tests/pageObjects/base_page.js: -------------------------------------------------------------------------------- 1 | /* eslint no-useless-constructor: "off" */ 2 | 3 | class BasePage { 4 | constructor() {} 5 | } 6 | 7 | module.exports = new BasePage() 8 | -------------------------------------------------------------------------------- /spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": ["**/*[sS]pec.js"], 4 | "helpers": ["helpers/**/*.js"], 5 | "stopSpecOnExpectationFailure": false, 6 | "random": false 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true -------------------------------------------------------------------------------- /src/site.js: -------------------------------------------------------------------------------- 1 | require('./common') 2 | require('./images/logo.png') 3 | require('./images/radar_legend.png') 4 | require('./gtm.js') 5 | 6 | const GoogleSheetInput = require('./util/factory') 7 | 8 | GoogleSheetInput().build() 9 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | dist 4 | *.swa 5 | *.swp 6 | *.swo 7 | 8 | coverage/ 9 | 10 | .idea/ 11 | .DS_Store 12 | 13 | spec/end_to_end_tests/reports/ 14 | cypress/ 15 | 16 | .nyc_output 17 | 18 | .private.notes 19 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/resources/sheet.csv: -------------------------------------------------------------------------------- 1 | name,ring,quadrant,isNew,description 2 | Babel,adopt,tools,TRUE,test 3 | Apache Kafka,trial,languages & frameworks,FALSE,test 4 | Android-x86,assess,platforms,TRUE,test 5 | Cloud lift and shift,hold,techniques,FALSE,test -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | dist 12 | 13 | # misc 14 | .DS_Store 15 | 16 | npm-debug.log* -------------------------------------------------------------------------------- /src/models/ring.js: -------------------------------------------------------------------------------- 1 | const Ring = function (name, order) { 2 | var self = {} 3 | 4 | self.name = function () { 5 | return name 6 | } 7 | 8 | self.order = function () { 9 | return order 10 | } 11 | 12 | return self 13 | } 14 | 15 | module.exports = Ring 16 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/util/hooks.js: -------------------------------------------------------------------------------- 1 | // let basePage = require('../pageObjects/base_page') 2 | 3 | describe('Hooks', function () { 4 | before(function () { 5 | // basePage.login(); 6 | }) 7 | 8 | after(function () { 9 | // runs once after all tests in the block 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /src/stylesheets/_layout.scss: -------------------------------------------------------------------------------- 1 | @import 'mediaqueries'; 2 | @mixin default-layout-margin { 3 | margin: auto; 4 | width: 80%; 5 | } 6 | 7 | @mixin eight-column-layout-margin { 8 | margin: auto; 9 | max-width: 80%; 10 | @include media-query-large { 11 | max-width: 54%; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | dist 4 | *.swa 5 | *.swp 6 | *.swo 7 | 8 | coverage/ 9 | 10 | .idea/ 11 | .DS_Store 12 | 13 | spec/end_to_end_tests/reports/ 14 | src/stylesheets/_featuretoggles.scss 15 | cypress/ 16 | 17 | .nyc_output 18 | 19 | .private.notes 20 | 21 | .talismanrc 22 | -------------------------------------------------------------------------------- /src/common.js: -------------------------------------------------------------------------------- 1 | require('./stylesheets/base.scss') 2 | require('./images/tech-radar-landing-page-wide.png') 3 | require('./images/tw-logo.png') 4 | require('./images/favicon.ico') 5 | require('./images/search-logo-2x.svg') 6 | require('./images/banner-image-mobile.jpg') 7 | require('./images/banner-image-desktop.jpg') 8 | -------------------------------------------------------------------------------- /spec/helpers/jsdom.js: -------------------------------------------------------------------------------- 1 | const JSDOM = require('jsdom').JSDOM 2 | const dom = new JSDOM('') 3 | global.document = dom.window.document 4 | global.window = dom.window 5 | global.navigator = dom.window.navigator 6 | global.jQuery = global.$ = global.jquery = require('jquery') 7 | require('jquery-ui') 8 | -------------------------------------------------------------------------------- /src/config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | production: { 3 | featureToggles: { 4 | UIRefresh2022: false, 5 | }, 6 | }, 7 | development: { 8 | featureToggles: { 9 | UIRefresh2022: true, 10 | }, 11 | }, 12 | } 13 | module.exports = process.env.ENVIRONMENT ? config[process.env.ENVIRONMENT] : config 14 | -------------------------------------------------------------------------------- /docker_push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker login -u $DOCKER_USER -p $DOCKER_PASS 4 | 5 | export REPO=wwwthoughtworks/build-your-own-radar 6 | export TAG=${CIRCLE_SHA1:0:8} 7 | 8 | docker build -f Dockerfile -t $REPO:latest . 9 | docker tag $REPO:latest $REPO:$TAG 10 | 11 | docker push $REPO:latest 12 | docker push $REPO:$TAG -------------------------------------------------------------------------------- /spec/models/ring-spec.js: -------------------------------------------------------------------------------- 1 | const Ring = require('../../src/models/ring') 2 | 3 | describe('Ring', function () { 4 | it('has a name', function () { 5 | var ring = Ring('My Ring') 6 | 7 | expect(ring.name()).toEqual('My Ring') 8 | }) 9 | 10 | it('has a order', function () { 11 | var ring = new Ring('My Ring', 0) 12 | 13 | expect(ring.order()).toEqual(0) 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /src/exceptions/unauthorizedError.js: -------------------------------------------------------------------------------- 1 | const UnauthorizedError = function (message) { 2 | this.message = message 3 | } 4 | 5 | Object.setPrototypeOf(UnauthorizedError, Error) 6 | UnauthorizedError.prototype = Object.create(Error.prototype) 7 | UnauthorizedError.prototype.name = 'UnauthorizedError' 8 | UnauthorizedError.prototype.message = '' 9 | UnauthorizedError.prototype.constructor = UnauthorizedError 10 | 11 | module.exports = UnauthorizedError 12 | -------------------------------------------------------------------------------- /src/exceptions/malformedDataError.js: -------------------------------------------------------------------------------- 1 | const MalformedDataError = function (message) { 2 | this.message = message 3 | } 4 | 5 | Object.setPrototypeOf(MalformedDataError, Error) 6 | MalformedDataError.prototype = Object.create(Error.prototype) 7 | MalformedDataError.prototype.name = 'MalformedDataError' 8 | MalformedDataError.prototype.message = '' 9 | MalformedDataError.prototype.constructor = MalformedDataError 10 | 11 | module.exports = MalformedDataError 12 | -------------------------------------------------------------------------------- /src/exceptions/sheetNotFoundError.js: -------------------------------------------------------------------------------- 1 | const SheetNotFoundError = function (message) { 2 | this.message = message 3 | } 4 | 5 | Object.setPrototypeOf(SheetNotFoundError, Error) 6 | SheetNotFoundError.prototype = Object.create(Error.prototype) 7 | SheetNotFoundError.prototype.name = 'SheetNotFoundError' 8 | SheetNotFoundError.prototype.message = '' 9 | SheetNotFoundError.prototype.constructor = SheetNotFoundError 10 | 11 | module.exports = SheetNotFoundError 12 | -------------------------------------------------------------------------------- /src/util/queryParamProcessor.js: -------------------------------------------------------------------------------- 1 | const QueryParams = function (queryString) { 2 | var decode = function (s) { 3 | return decodeURIComponent(s.replace(/\+/g, ' ')) 4 | } 5 | 6 | var search = /([^&=]+)=?([^&]*)/g 7 | 8 | var queryParams = {} 9 | var match 10 | while ((match = search.exec(queryString))) { 11 | queryParams[decode(match[1])] = decode(match[2]) 12 | } 13 | 14 | return queryParams 15 | } 16 | 17 | module.exports = QueryParams 18 | -------------------------------------------------------------------------------- /src/gtm.js: -------------------------------------------------------------------------------- 1 | if (process.env.GTM_ID) { 2 | ;(function (w, d, s, l, i) { 3 | w[l] = w[l] || [] 4 | w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }) 5 | var f = d.getElementsByTagName(s)[0] 6 | var j = d.createElement(s) 7 | var dl = l !== 'dataLayer' ? '&l=' + l : '' 8 | j.async = true 9 | j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl 10 | f.parentNode.insertBefore(j, f) 11 | })(window, document, 'script', 'dataLayer', process.env.GTM_ID) 12 | } 13 | -------------------------------------------------------------------------------- /src/models/quadrant.js: -------------------------------------------------------------------------------- 1 | const Quadrant = function (name) { 2 | var self, blips 3 | 4 | self = {} 5 | blips = [] 6 | 7 | self.name = function () { 8 | return name 9 | } 10 | 11 | self.add = function (newBlips) { 12 | if (Array.isArray(newBlips)) { 13 | blips = blips.concat(newBlips) 14 | } else { 15 | blips.push(newBlips) 16 | } 17 | } 18 | 19 | self.blips = function () { 20 | return blips.slice(0) 21 | } 22 | 23 | return self 24 | } 25 | 26 | module.exports = Quadrant 27 | -------------------------------------------------------------------------------- /src/stylesheets/_mediaqueries.scss: -------------------------------------------------------------------------------- 1 | $screen-medium: 768px; 2 | $screen-large: 1200px; 3 | $screen-xlarge: 1440px; 4 | 5 | @mixin media-query-medium { 6 | @media screen and (min-width: $screen-medium) { 7 | //iPad - 768px and above 8 | @content; 9 | } 10 | } 11 | 12 | @mixin media-query-large { 13 | @media screen and (min-width: $screen-large) { 14 | //Desktop - 1200px and above 15 | @content; 16 | } 17 | } 18 | 19 | @mixin media-query-xlarge { 20 | @media screen and (min-width: $screen-xlarge) { 21 | //Desktop - 1440px and above 22 | @content; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/util/ringCalculator.js: -------------------------------------------------------------------------------- 1 | const RingCalculator = function (numberOfRings, maxRadius) { 2 | var sequence = [0, 6, 5, 3, 2, 1, 1, 1] 3 | 4 | var self = {} 5 | 6 | self.sum = function (length) { 7 | return sequence.slice(0, length + 1).reduce(function (previous, current) { 8 | return previous + current 9 | }, 0) 10 | } 11 | 12 | self.getRadius = function (ring) { 13 | var total = self.sum(numberOfRings) 14 | var sum = self.sum(ring) 15 | 16 | return (maxRadius * sum) / total 17 | } 18 | 19 | return self 20 | } 21 | 22 | module.exports = RingCalculator 23 | -------------------------------------------------------------------------------- /spec/util/ringCalculator-spec.js: -------------------------------------------------------------------------------- 1 | const RingCalculator = require('../../src/util/ringCalculator') 2 | 3 | describe('ringCalculator', function () { 4 | var ringLength, radarSize, ringCalculator 5 | beforeAll(function () { 6 | ringLength = 4 7 | radarSize = 500 8 | ringCalculator = new RingCalculator(ringLength, radarSize) 9 | }) 10 | 11 | it('sums up the sequences', function () { 12 | expect(ringCalculator.sum(ringLength)).toEqual(16) 13 | }) 14 | 15 | it('calculates the correct radius', function () { 16 | expect(ringCalculator.getRadius(ringLength)).toEqual(radarSize) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "es2021": true, 5 | "jasmine": true, 6 | "cypress/globals": true 7 | }, 8 | "extends": ["eslint:recommended", "prettier"], 9 | "parserOptions": { 10 | "ecmaVersion": "latest" 11 | }, 12 | "rules": { 13 | "cypress/no-assigning-return-values": "error", 14 | "cypress/no-unnecessary-waiting": "error", 15 | "cypress/assertion-before-screenshot": "warn", 16 | "cypress/no-force": "warn", 17 | "cypress/no-async-tests": "error", 18 | "cypress/no-pause": "error" 19 | }, 20 | "globals": {}, 21 | "plugins": ["jasmine", "cypress"] 22 | } 23 | -------------------------------------------------------------------------------- /src/stylesheets/_footer.scss: -------------------------------------------------------------------------------- 1 | @import 'layout'; 2 | @import 'fonts'; 3 | 4 | #footer { 5 | text-align: center; 6 | clear: both; 7 | 8 | .footer-content { 9 | width: 50%; 10 | margin: 0 auto; 11 | 12 | p { 13 | padding-top: 60px; 14 | font-size: $baseFont; 15 | font-weight: $baseWeight; 16 | text-align: left; 17 | } 18 | } 19 | } 20 | 21 | @if $UIRefresh2022 { 22 | footer { 23 | p { 24 | @include eight-column-layout-margin; 25 | font-size: 18px; 26 | font-family: $baseFontFamily; 27 | font-weight: normal; 28 | margin-top: 30px; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spec/util/queryParamProcessor-spec.js: -------------------------------------------------------------------------------- 1 | const QueryParams = require('../../src/util/queryParamProcessor') 2 | 3 | describe('QueryParams', function () { 4 | it('retrieves one parameter', function () { 5 | var params = QueryParams('param1=value1') 6 | 7 | expect(params.param1).toEqual('value1') 8 | }) 9 | 10 | it('retrieves zero parameter', function () { 11 | var params = QueryParams('') 12 | 13 | expect(params).toEqual({}) 14 | }) 15 | 16 | it('retrieves one parameter', function () { 17 | var params = QueryParams('param1=value1¶m2=value2') 18 | 19 | expect(params.param1).toEqual('value1') 20 | expect(params.param2).toEqual('value2') 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /default.template: -------------------------------------------------------------------------------- 1 | # server block for static file serving 2 | server { 3 | listen 80; 4 | location / { 5 | root /opt/build-your-own-radar; 6 | index index.html; 7 | } 8 | 9 | # custom error page for 404 errors 10 | error_page 404 /error.html; 11 | location = /error.html { 12 | root /opt/build-your-own-radar; 13 | } 14 | 15 | # nginx default error page for 50x errors 16 | error_page 500 502 503 504 /50x.html; 17 | location = /50x.html { 18 | root /usr/share/nginx/html; 19 | } 20 | 21 | location ~ /files/ { 22 | root /opt/build-your-own-radar; 23 | autoindex on; 24 | default_type text/plain; 25 | add_header 'Access-Control-Allow-Origin' '*'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/resources/data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Babel", 4 | "ring": "adopt", 5 | "quadrant": "tools", 6 | "isNew": "TRUE", 7 | "description": "test" 8 | }, 9 | { 10 | "name": "Apache Kafka", 11 | "ring": "trial", 12 | "quadrant": "languages & frameworks", 13 | "isNew": "FALSE", 14 | "description": "test" 15 | }, 16 | { 17 | "name": "Android-x86", 18 | "ring": "assess", 19 | "quadrant": "platforms", 20 | "isNew": "TRUE", 21 | "description": "test" 22 | }, 23 | { 24 | "name": "GrapCloud lift and shifthQL", 25 | "ring": "hold", 26 | "quadrant": "techniques", 27 | "isNew": "FALSE", 28 | "description": "test" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/resources/localfiles/radar.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Babel", 4 | "ring": "adopt", 5 | "quadrant": "tools", 6 | "isNew": "TRUE", 7 | "description": "test" 8 | }, 9 | { 10 | "name": "Apache Kafka", 11 | "ring": "trial", 12 | "quadrant": "languages & frameworks", 13 | "isNew": "FALSE", 14 | "description": "test" 15 | }, 16 | { 17 | "name": "Android-x86", 18 | "ring": "assess", 19 | "quadrant": "platforms", 20 | "isNew": "TRUE", 21 | "description": "test" 22 | }, 23 | { 24 | "name": "GrapCloud lift and shifthQL", 25 | "ring": "hold", 26 | "quadrant": "techniques", 27 | "isNew": "FALSE", 28 | "description": "test" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | #BYOR Contributors 2 | 3 | In no particular order 4 | 5 | - [BRUNNEL6](https://github.com/BRUNNEL6) 6 | 7 | - [lauraionescu](https://github.com/lauraionescu) 8 | 9 | - [thenano](https://github.com/thenano) 10 | 11 | - [trecenti](https://github.com/trecenti) 12 | 13 | - [hkurosawa](https://github.com/hkurosawa) 14 | 15 | - [kylec32](https://github.com/kylec32) 16 | 17 | - [aschonfeld](https://github.com/aschonfeld) 18 | 19 | - [andyw8](https://github.com/andyw8) 20 | 21 | - [br00k](https://github.com/br00k) 22 | 23 | - [camiloribeiro](https://github.com/camiloribeiro) 24 | 25 | - [shahadarsh](https://github.com/shahadarsh) 26 | 27 | - [filipesabella](https://github.com/filipesabella) 28 | 29 | - [jaiganeshg](https://github.com/jaiganeshg) 30 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.23.0 2 | 3 | RUN apt-get update && apt-get upgrade -y 4 | 5 | RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - 6 | RUN apt-get install -y nodejs 7 | 8 | RUN \ 9 | apt-get install -y \ 10 | libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 \ 11 | libxss1 libasound2 libxtst6 xauth xvfb g++ make 12 | 13 | WORKDIR /src/build-your-own-radar 14 | COPY package.json ./ 15 | RUN npm install 16 | 17 | COPY . ./ 18 | 19 | # Override parent node image's entrypoint script (/usr/local/bin/docker-entrypoint.sh), 20 | # which tries to run CMD as a node command 21 | ENTRYPOINT [] 22 | CMD ["./build_and_start_nginx.sh"] 23 | -------------------------------------------------------------------------------- /src/models/blip.js: -------------------------------------------------------------------------------- 1 | const IDEAL_BLIP_WIDTH = 22 2 | const Blip = function (name, ring, isNew, topic, description) { 3 | var self, number 4 | 5 | self = {} 6 | number = -1 7 | 8 | self.width = IDEAL_BLIP_WIDTH 9 | 10 | self.name = function () { 11 | return name 12 | } 13 | 14 | self.topic = function () { 15 | return topic || '' 16 | } 17 | 18 | self.description = function () { 19 | return description || '' 20 | } 21 | 22 | self.isNew = function () { 23 | return isNew 24 | } 25 | 26 | self.ring = function () { 27 | return ring 28 | } 29 | 30 | self.number = function () { 31 | return number 32 | } 33 | 34 | self.setNumber = function (newNumber) { 35 | number = newNumber 36 | } 37 | 38 | return self 39 | } 40 | 41 | module.exports = Blip 42 | -------------------------------------------------------------------------------- /src/util/exceptionMessages.js: -------------------------------------------------------------------------------- 1 | const ExceptionMessages = { 2 | TOO_MANY_QUADRANTS: 'There are more than 4 quadrant names listed in your data. Check the quadrant column for errors.', 3 | TOO_MANY_RINGS: 'More than 4 rings.', 4 | MISSING_HEADERS: 5 | 'Document is missing one or more required headers or they are misspelled. ' + 6 | 'Check that your document contains headers for "name", "ring", "quadrant", "isNew", "description".', 7 | MISSING_CONTENT: 'Document is missing content.', 8 | LESS_THAN_FOUR_QUADRANTS: 9 | 'There are less than 4 quadrant names listed in your data. Check the quadrant column for errors.', 10 | SHEET_NOT_FOUND: 'Oops! We can’t find the Google Sheet you’ve entered. Can you check the URL?', 11 | UNAUTHORIZED: 'UNAUTHORIZED', 12 | } 13 | 14 | module.exports = ExceptionMessages 15 | -------------------------------------------------------------------------------- /webpack.prod.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge') 2 | const common = require('./webpack.common.js') 3 | const path = require('path') 4 | const webpack = require('webpack') 5 | const main = ['./src/site.js'] 6 | const fs = require('fs') 7 | const config = require('./src/config')['production'] 8 | const featureTogglesList = Object.keys(config.featureToggles) 9 | const scssVariables = featureTogglesList.map((x) => `$${x}:${config.featureToggles[x]};`).join('\n') 10 | 11 | fs.writeFileSync(path.join(__dirname, './src/stylesheets/_featuretoggles.scss'), scssVariables) 12 | 13 | module.exports = merge(common, { 14 | mode: 'production', 15 | entry: { main }, 16 | performance: { 17 | hints: false, 18 | }, 19 | plugins: [ 20 | new webpack.NoEmitOnErrorsPlugin(), 21 | new webpack.DefinePlugin({ 22 | 'process.env.ENVIRONMENT': JSON.stringify('production'), 23 | }), 24 | ], 25 | }) 26 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/pageObjects/byor_page.js: -------------------------------------------------------------------------------- 1 | const config = require('../../../cypress.json') 2 | const environment = require('/src/config') 3 | 4 | class ByorPage { 5 | constructor() { 6 | this.text_box = "[name='sheetId']" 7 | this.submit = environment[Cypress.env('TEST_ENV') ? Cypress.env('TEST_ENV') : 'development'].featureToggles 8 | .UIRefresh2022 9 | ? 'input[type=submit]' 10 | : '.button' 11 | } 12 | 13 | provideExcelName() { 14 | cy.get(this.text_box).type(config.excel) 15 | } 16 | 17 | provideCsvName() { 18 | cy.get(this.text_box).type(config.csv) 19 | } 20 | 21 | provideJsonName() { 22 | cy.get(this.text_box).type(config.json) 23 | } 24 | 25 | clickSubmitButton() { 26 | cy.get(this.submit).click() 27 | } 28 | 29 | providePublicSheetUrl() { 30 | cy.get(this.text_box).type(config.publicGoogleSheet) 31 | } 32 | } 33 | 34 | module.exports = new ByorPage() 35 | -------------------------------------------------------------------------------- /src/stylesheets/_error.scss: -------------------------------------------------------------------------------- 1 | .error-container { 2 | text-align: center; 3 | padding-top: 50px; 4 | 5 | .error-container__message { 6 | width: 60%; 7 | display: inline-block; 8 | } 9 | 10 | .error-title { 11 | font-weight: 400; 12 | } 13 | 14 | .error-subtitle { 15 | margin-top: -10px; 16 | } 17 | 18 | .switch-account-button { 19 | margin: 0px 0px 35px 0px; 20 | } 21 | } 22 | 23 | .input-sheet { 24 | .page-not-found { 25 | font-size: 40px; 26 | font-weight: 900; 27 | margin-bottom: 20px; 28 | } 29 | 30 | .message p { 31 | font-size: 25px; 32 | } 33 | } 34 | 35 | .support { 36 | margin-top: 20px; 37 | 38 | p { 39 | font-weight: 500; 40 | font-size: 30px; 41 | margin-bottom: 1px; 42 | } 43 | } 44 | 45 | .support-link { 46 | font-size: 26px; 47 | padding: 20px; 48 | 49 | span { 50 | padding: 0 40px; 51 | display: table-cell; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /spec/models/quadrant-spec.js: -------------------------------------------------------------------------------- 1 | const Quadrant = require('../../src/models/quadrant') 2 | const Blip = require('../../src/models/blip') 3 | 4 | describe('Quadrant', function () { 5 | it('has a name', function () { 6 | var quadrant = new Quadrant('My Quadrant') 7 | 8 | expect(quadrant.name()).toEqual('My Quadrant') 9 | }) 10 | 11 | it('has no blips by default', function () { 12 | var quadrant = new Quadrant('My Quadrant') 13 | 14 | expect(quadrant.blips()).toEqual([]) 15 | }) 16 | 17 | it('can add a single blip', function () { 18 | var quadrant = new Quadrant('My Quadrant') 19 | 20 | quadrant.add(new Blip()) 21 | 22 | expect(quadrant.blips().length).toEqual(1) 23 | }) 24 | 25 | it('can add multiple blips', function () { 26 | var quadrant = new Quadrant('My Quadrant') 27 | 28 | quadrant.add([new Blip(), new Blip()]) 29 | 30 | expect(quadrant.blips().length).toEqual(2) 31 | }) 32 | }) 33 | -------------------------------------------------------------------------------- /src/stylesheets/_loader.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | .loading-spinner { 3 | &-blocks { 4 | width: 100%; 5 | height: 100%; 6 | display: flex; 7 | align-items: center; 8 | flex-direction: column; 9 | margin: 50px 0; 10 | overflow: hidden; 11 | 12 | &.hide { 13 | display: none; 14 | } 15 | } 16 | } 17 | 18 | .loader-wrapper { 19 | max-width: 60px; 20 | height: 60px; 21 | display: flex; 22 | flex-wrap: wrap; 23 | justify-content: space-between; 24 | align-content: space-between; 25 | margin: 2rem auto; 26 | } 27 | .loader-wrapper div { 28 | box-sizing: content-box; 29 | } 30 | 31 | .loader-wrapper div { 32 | width: 30px; 33 | height: 30px; 34 | background: $mist; 35 | animation: loader 1s linear infinite; 36 | } 37 | 38 | @keyframes loader { 39 | 0% { 40 | background: $wave; 41 | } 42 | 50% { 43 | background: $mist; 44 | } 45 | 100% { 46 | background: $mist; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge') 2 | const common = require('./webpack.common.js') 3 | const path = require('path') 4 | const webpack = require('webpack') 5 | const main = ['./src/site.js'] 6 | const fs = require('fs') 7 | const config = require('./src/config')['development'] 8 | const featureTogglesList = Object.keys(config.featureToggles) 9 | const scssVariables = featureTogglesList.map((x) => `$${x}:${config.featureToggles[x]};`).join('\n') 10 | 11 | fs.writeFileSync(path.join(__dirname, './src/stylesheets/_featuretoggles.scss'), scssVariables) 12 | 13 | // main.push('webpack-dev-server/client?http://0.0.0.0:8080') 14 | 15 | module.exports = merge(common, { 16 | mode: 'development', 17 | entry: { main: main }, 18 | performance: { 19 | hints: false, 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env.ENVIRONMENT': JSON.stringify('development'), 24 | }), 25 | ], 26 | devtool: 'source-map', 27 | }) 28 | -------------------------------------------------------------------------------- /spec/models/blip-spec.js: -------------------------------------------------------------------------------- 1 | const Blip = require('../../src/models/blip') 2 | const Ring = require('../../src/models/ring') 3 | 4 | describe('Blip', function () { 5 | var blip 6 | 7 | beforeEach(function () { 8 | blip = new Blip('My Blip', new Ring('My Ring')) 9 | }) 10 | 11 | it('has a name', function () { 12 | expect(blip.name()).toEqual('My Blip') 13 | }) 14 | 15 | it('has a ring', function () { 16 | expect(blip.ring().name()).toEqual('My Ring') 17 | }) 18 | 19 | it('has a default number', function () { 20 | expect(blip.number()).toEqual(-1) 21 | }) 22 | 23 | it('sets the number', function () { 24 | blip.setNumber(1) 25 | expect(blip.number()).toEqual(1) 26 | }) 27 | 28 | it('is new', function () { 29 | blip = new Blip('My Blip', new Ring('My Ring'), true) 30 | 31 | expect(blip.isNew()).toBe(true) 32 | }) 33 | 34 | it('is not new', function () { 35 | blip = new Blip('My Blip', new Ring('My Ring'), false) 36 | 37 | expect(blip.isNew()).toBe(false) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /src/stylesheets/_colors.scss: -------------------------------------------------------------------------------- 1 | $green: #86b782; 2 | $blue: #1ebccd; 3 | $orange: #f38a3e; 4 | $violet: #b32059; 5 | $pink: #ee0b77; 6 | 7 | $grey-darkest: #bababa; 8 | $grey-dark: #cacaca; 9 | $grey: #dadada; 10 | $grey-light: #eee; 11 | $grey-lightest: #fafafa; 12 | $grey-even-darker: #d7d7d7; 13 | 14 | $white: #fff; 15 | $black: #000; 16 | $grey-text: rgb(51, 51, 51); 17 | 18 | $grey-alpha-03: rgba(255, 255, 255, 0.3); 19 | 20 | //## Brand colors for use across theme. 21 | $black: #000000; //onyx 22 | $white: #ffffff; //white 23 | $wave: #163c4d; //wave 24 | $wave-light: #6b8591; //wave-light 25 | $flamingo: #e16a7c; //flamingo 26 | $mist: #edf1f3; //mist (ededed) 27 | $sapphire: #47a1ad; //$sapphire 28 | $jade: #6b9e78; //jade 29 | $turmeric: #cc850a; //turmeric 30 | $amethyst: #634f7d; //amethyst 31 | 32 | //Other colors 33 | $mist-s30: #71777d; 34 | 35 | $button-normal: $wave; //button color 36 | $button-disabled: #909090; //disabled state for links and buttons 37 | 38 | $link-normal: $black; //links color 39 | $link-hover: #9b293c; //links hover state color 40 | -------------------------------------------------------------------------------- /src/util/contentValidator.js: -------------------------------------------------------------------------------- 1 | const _ = { 2 | map: require('lodash/map'), 3 | uniqBy: require('lodash/uniqBy'), 4 | capitalize: require('lodash/capitalize'), 5 | each: require('lodash/each'), 6 | } 7 | 8 | const MalformedDataError = require('../../src/exceptions/malformedDataError') 9 | const ExceptionMessages = require('./exceptionMessages') 10 | 11 | const ContentValidator = function (columnNames) { 12 | var self = {} 13 | columnNames = columnNames.map(function (columnName) { 14 | return columnName.trim() 15 | }) 16 | 17 | self.verifyContent = function () { 18 | if (columnNames.length === 0) { 19 | throw new MalformedDataError(ExceptionMessages.MISSING_CONTENT) 20 | } 21 | } 22 | 23 | self.verifyHeaders = function () { 24 | _.each(['name', 'ring', 'quadrant', 'isNew', 'description'], function (field) { 25 | if (columnNames.indexOf(field) === -1) { 26 | throw new MalformedDataError(ExceptionMessages.MISSING_HEADERS) 27 | } 28 | }) 29 | } 30 | 31 | return self 32 | } 33 | 34 | module.exports = ContentValidator 35 | -------------------------------------------------------------------------------- /src/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 7 |
8 |

Build your own radar

9 |
10 |
11 |

PAGE NOT FOUND

12 |
13 |

14 | Oops! It seems like the page you were trying to find isn't around anymore
(or at least isn't here). 15 |

16 |
17 |
18 |

You might want to look at

19 |
20 | 24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "excel": "https://docs.google.com/spreadsheets/d/1Yozpcv58-etk1UNvxS0HxMqw7V5Amf4dgWBnekJcHcc/edit?usp=sharing", 3 | "csv": "https://raw.githubusercontent.com/thoughtworks/build-your-own-radar/master/spec/end_to_end_tests/resources/sheet.csv", 4 | "json": "https://raw.githubusercontent.com/thoughtworks/build-your-own-radar/master/spec/end_to_end_tests/resources/data.json", 5 | "publicGoogleSheet": "https://docs.google.com/spreadsheets/d/1GBX3-jzlGkiKpYHF9RvVtu6GxSrco5OYTBv9YsOTXVg", 6 | "integrationFolder": "spec/end_to_end_tests/specs", 7 | "chromeWebSecurity": false, 8 | "screenshotsFolder": "spec/end_to_end_tests/reports/screenshots", 9 | "videosFolder": "spec/end_to_end_tests/reports/videos", 10 | "reporter": "mochawesome", 11 | "reporterOptions": { 12 | "reportDir": "spec/end_to_end_tests/reports", 13 | "reportFilename": "results", 14 | "quiet": "true", 15 | "json": "false" 16 | }, 17 | "watchForFileChanges": false, 18 | "defaultCommandTimeout": 10000, 19 | "pageLoadTimeout": 60000, 20 | "supportFile": "spec/end_to_end_tests/util/hooks.js" 21 | } 22 | -------------------------------------------------------------------------------- /src/stylesheets/_herobanner.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | @import 'layout'; 3 | 4 | @if $UIRefresh2022 { 5 | .hero-banner { 6 | height: 300px; 7 | background-color: $amethyst; 8 | background-image: url('/images/banner-image-mobile.jpg'); 9 | background-size: contain; 10 | background-repeat: no-repeat; 11 | background-position: right; 12 | color: $white; 13 | display: flex; 14 | align-items: center; 15 | margin: 0; 16 | 17 | @include media-query-medium { 18 | background-image: url('/images/banner-image-desktop.jpg'); 19 | height: 200px; 20 | background-size: cover; 21 | } 22 | 23 | &__wrapper { 24 | @include default-layout-margin; 25 | } 26 | 27 | &__title-text { 28 | width: 57%; 29 | text-align: left; 30 | text-transform: none; 31 | letter-spacing: 0; 32 | 33 | @include media-query-large { 34 | font-size: 3rem; 35 | width: 50%; 36 | overflow: hidden; 37 | text-overflow: ellipsis; 38 | display: -webkit-box; 39 | -webkit-line-clamp: 3; 40 | -webkit-box-orient: vertical; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/pageObjects/radar_page.js: -------------------------------------------------------------------------------- 1 | class RadarPage { 2 | constructor() { 3 | this.blip = '.quadrant-group-second .blip-link' 4 | this.allBlips = '.blip-link' 5 | this.blip_selected = '.quadrant-table.selected .blip-list-item' 6 | this.blip_description = '.blip-item-description.expanded p' 7 | this.sheet2 = '.alternative' 8 | this.autocomplete = '.search-radar' 9 | this.search_value = 'Babel' 10 | this.search_item = '.ui-menu-item:first' 11 | } 12 | 13 | clickTheBlipFromInteractiveSection() { 14 | cy.get(this.blip).click() 15 | } 16 | 17 | clickTheBlip() { 18 | cy.get(this.blip_selected).click() 19 | } 20 | 21 | validateBlipDescription(text) { 22 | expect(cy.get(this.blip_description).contains(text)) 23 | } 24 | 25 | clickSheet2() { 26 | cy.get(this.sheet2).click() 27 | } 28 | 29 | searchTheBlip() { 30 | cy.get(this.autocomplete).type(this.search_value) 31 | cy.get(this.search_item).click() 32 | } 33 | 34 | validateBlipSearch() { 35 | expect(cy.get(this.blip_selected).contains(this.search_value)) 36 | } 37 | 38 | validateBlipCountForPublicGoogleSheet() { 39 | cy.get(this.allBlips).should('have.length', 103) 40 | } 41 | } 42 | 43 | module.exports = new RadarPage() 44 | -------------------------------------------------------------------------------- /src/stylesheets/_tip.scss: -------------------------------------------------------------------------------- 1 | .d3-tip { 2 | white-space: nowrap; 3 | line-height: 1; 4 | font-size: 12px; 5 | display: none; 6 | padding: 12px; 7 | background: rgba(0, 0, 0, 0.8); 8 | color: #fff; 9 | border-radius: 4px; 10 | border-color: #000; 11 | pointer-events: none; 12 | z-index: 2; 13 | } 14 | 15 | @media screen and (min-width: 800px) { 16 | .d3-tip { 17 | display: block; 18 | } 19 | } 20 | 21 | .d3-tip:after { 22 | box-sizing: border-box; 23 | display: none; 24 | font-size: 10px; 25 | width: 100%; 26 | line-height: 1; 27 | color: rgba(0, 0, 0, 0.8); 28 | position: absolute; 29 | pointer-events: none; 30 | } 31 | 32 | @media screen and (min-width: 800px) { 33 | .d3-tip:after { 34 | display: inline; 35 | } 36 | } 37 | 38 | .d3-tip.n { 39 | margin: -10px 0 0; 40 | } 41 | .d3-tip.n:after { 42 | content: '\25BC'; 43 | margin: -3px 0 0; 44 | top: 100%; 45 | left: 0; 46 | text-align: center; 47 | } 48 | 49 | .d3-tip.ne { 50 | margin: -10px 0 0 -45px; 51 | } 52 | .d3-tip.ne:after { 53 | content: '\25BC'; 54 | bottom: -8px; 55 | left: 18px; 56 | text-align: left; 57 | } 58 | 59 | .d3-tip.nw { 60 | margin: -10px 0 0 45px; 61 | } 62 | .d3-tip.nw:after { 63 | content: '\25BC'; 64 | bottom: -8px; 65 | right: 18px; 66 | text-align: right; 67 | } 68 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | setup: true 4 | 5 | orbs: 6 | continuation: circleci/continuation@0.2.0 7 | 8 | executors: 9 | base: 10 | docker: 11 | - image: cimg/node:18.12.1 12 | user: root 13 | 14 | commands: 15 | install-node-packages: 16 | description: Install node packages 17 | steps: 18 | - restore_cache: 19 | key: node-cache-v2-{{ checksum "package-lock.json" }} 20 | - run: 21 | name: Install node packages 22 | command: npm install 23 | - save_cache: 24 | paths: 25 | - ./node_modules 26 | key: node-cache-v2-{{ checksum "package-lock.json" }} 27 | 28 | jobs: 29 | tests: 30 | executor: base 31 | steps: 32 | - checkout 33 | - install-node-packages 34 | - run: 35 | name: Run linter and unit tests with coverage 36 | command: npm run quality 37 | check-for-pr: 38 | executor: base 39 | steps: 40 | - checkout 41 | - run: | 42 | if [[ $CIRCLE_PULL_REQUEST ]]; then 43 | circleci-agent step halt 44 | fi 45 | - continuation/continue: 46 | configuration_path: .circleci/deployment-workflow.yml 47 | 48 | workflows: 49 | main: 50 | jobs: 51 | - tests 52 | - check-for-pr: 53 | requires: 54 | - tests 55 | -------------------------------------------------------------------------------- /spec/end_to_end_tests/specs/end_to_end_test.js: -------------------------------------------------------------------------------- 1 | var byorPage = require('../pageObjects/byor_page') 2 | var radarPage = require('../pageObjects/radar_page') 3 | 4 | describe('Build radar with CSV', () => { 5 | it('Validate CSV file', () => { 6 | cy.visit(Cypress.env('host')) 7 | byorPage.provideCsvName() 8 | byorPage.clickSubmitButton() 9 | radarPage.clickTheBlipFromInteractiveSection() 10 | radarPage.clickTheBlip() 11 | radarPage.validateBlipDescription('test') 12 | }) 13 | 14 | it('Validate search', () => { 15 | cy.visit(Cypress.env('host')) 16 | byorPage.provideCsvName() 17 | byorPage.clickSubmitButton() 18 | radarPage.searchTheBlip() 19 | radarPage.validateBlipSearch() 20 | }) 21 | }) 22 | 23 | describe('Build radar with JSON', () => { 24 | it('Validate JSON file', () => { 25 | cy.visit(Cypress.env('host')) 26 | byorPage.provideJsonName() 27 | byorPage.clickSubmitButton() 28 | radarPage.clickTheBlipFromInteractiveSection() 29 | radarPage.clickTheBlip() 30 | radarPage.validateBlipDescription('test') 31 | }) 32 | }) 33 | 34 | describe('Build radar with public google sheet', () => { 35 | it('Validate public google sheet file', () => { 36 | cy.visit(Cypress.env('host')) 37 | byorPage.providePublicSheetUrl() 38 | byorPage.clickSubmitButton() 39 | radarPage.validateBlipCountForPublicGoogleSheet() 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/docker-existing-dockerfile 3 | { 4 | "name": "Existing Dockerfile", 5 | // Sets the run context to one level up instead of the .devcontainer folder. 6 | "context": "..", 7 | // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. 8 | "dockerFile": "../Dockerfile", 9 | // Set *default* container specific settings.json values on container create. 10 | "settings": {}, 11 | // Add the IDs of extensions you want installed when the container is created. 12 | "extensions": [] 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | // Uncomment the next line to run commands after the container is created - for example installing curl. 16 | // "postCreateCommand": "apt-get update && apt-get install -y curl", 17 | // Uncomment when using a ptrace-based debugger like C++, Go, and Rust 18 | // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], 19 | // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. 20 | // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], 21 | // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. 22 | // "remoteUser": "vscode" 23 | } 24 | -------------------------------------------------------------------------------- /src/util/autoComplete.js: -------------------------------------------------------------------------------- 1 | const $ = require('jquery') 2 | require('jquery-ui/ui/widgets/autocomplete') 3 | 4 | $.widget('custom.radarcomplete', $.ui.autocomplete, { 5 | _create: function () { 6 | this._super() 7 | this.widget().menu('option', 'items', '> :not(.ui-autocomplete-quadrant)') 8 | }, 9 | _renderMenu: function (ul, items) { 10 | let currentQuadrant = '' 11 | 12 | items.forEach((item) => { 13 | const quadrantName = item.quadrant.quadrant.name() 14 | if (quadrantName !== currentQuadrant) { 15 | ul.append(`
  • ${quadrantName}
  • `) 16 | currentQuadrant = quadrantName 17 | } 18 | const li = this._renderItemData(ul, item) 19 | if (quadrantName) { 20 | li.attr('aria-label', `${quadrantName}:${item.value}`) 21 | } 22 | }) 23 | }, 24 | }) 25 | 26 | const AutoComplete = (el, quadrants, cb) => { 27 | const blips = quadrants.reduce((acc, quadrant) => { 28 | return [...acc, ...quadrant.quadrant.blips().map((blip) => ({ blip, quadrant }))] 29 | }, []) 30 | 31 | $(el).radarcomplete({ 32 | source: (request, response) => { 33 | const matches = blips.filter(({ blip }) => { 34 | const searchable = `${blip.name()} ${blip.description()}`.toLowerCase() 35 | return request.term.split(' ').every((term) => searchable.includes(term.toLowerCase())) 36 | }) 37 | response(matches.map((item) => ({ ...item, value: item.blip.name() }))) 38 | }, 39 | select: cb.bind({}), 40 | }) 41 | } 42 | 43 | module.exports = AutoComplete 44 | -------------------------------------------------------------------------------- /src/stylesheets/_landingpage.scss: -------------------------------------------------------------------------------- 1 | @import 'layout'; 2 | @import 'colors'; 3 | @import 'fonts'; 4 | 5 | .helper-description { 6 | @include eight-column-layout-margin; 7 | padding-top: 32px; 8 | margin-top: 24px; 9 | 10 | p { 11 | font-weight: bold; 12 | margin: 0; 13 | } 14 | 15 | .loader-text { 16 | display: none; 17 | text-align: center; 18 | &__title { 19 | display: inline-block; 20 | font-size: 2.5rem; 21 | font-weight: bold; 22 | margin-bottom: 1rem; 23 | } 24 | } 25 | } 26 | 27 | .input-sheet-form { 28 | @include eight-column-layout-margin; 29 | display: flex; 30 | flex-direction: column; 31 | 32 | p { 33 | margin-top: 88px; 34 | text-align: center; 35 | } 36 | 37 | form { 38 | display: flex; 39 | flex-direction: column; 40 | justify-content: center; 41 | flex-wrap: nowrap; 42 | align-items: center; 43 | 44 | input[type='text'] { 45 | font-family: $baseFontFamily; 46 | background-color: $mist; 47 | border: 1px solid #d5d9db; 48 | letter-spacing: 0.06px; 49 | height: 48px; 50 | margin-bottom: 20px; 51 | color: $black; 52 | font-size: 18px; 53 | 54 | &::placeholder { 55 | color: #3c606f; 56 | } 57 | } 58 | 59 | input[type='submit'] { 60 | background-color: $button-normal; 61 | color: $white; 62 | font-size: 20px; 63 | font-family: $baseFontFamily; 64 | line-height: 24px; 65 | font-weight: bold; 66 | padding-left: 30px; 67 | padding-right: 30px; 68 | margin-bottom: 18px; 69 | border: none; 70 | cursor: pointer; 71 | &:focus { 72 | outline: auto; 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/images/search-logo-2x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | search@2x 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/stylesheets/_form.scss: -------------------------------------------------------------------------------- 1 | .input-sheet { 2 | margin: 60px auto; 3 | 4 | p { 5 | font-weight: 100; 6 | color: $black; 7 | font-size: 18px; 8 | } 9 | 10 | .input-sheet__logo { 11 | text-align: center; 12 | padding-bottom: 40px; 13 | a { 14 | border-bottom: none; 15 | 16 | img { 17 | width: 200px; 18 | } 19 | } 20 | } 21 | 22 | .radar-footer { 23 | padding-top: 200px; 24 | } 25 | 26 | .input-sheet__banner { 27 | background-image: url('/images/tech-radar-landing-page-wide.png'); 28 | background-repeat: no-repeat; 29 | background-color: $grey-light; 30 | background-size: cover; 31 | background-position: center; 32 | width: 100%; 33 | margin: 0 auto; 34 | text-align: center; 35 | min-height: 285px; 36 | display: table; 37 | 38 | div { 39 | display: table-cell; 40 | vertical-align: middle; 41 | } 42 | p, 43 | h1 { 44 | color: $white; 45 | } 46 | 47 | a { 48 | color: $white; 49 | border-bottom-color: $white; 50 | } 51 | } 52 | 53 | .input-sheet__form { 54 | width: 50%; 55 | margin: 0 auto; 56 | text-align: center; 57 | padding-top: 30px; 58 | 59 | button { 60 | font-family: inherit; 61 | border: none; 62 | background-color: transparent; 63 | margin: 0; 64 | padding: 0; 65 | } 66 | } 67 | 68 | input[type='text'] { 69 | border-bottom: 2px solid $grey-even-darker; 70 | display: block; 71 | font-size: 18px; 72 | margin-bottom: 30px; 73 | padding: 10px; 74 | transition: box-shadow 0.3s, border 0.3s; 75 | 76 | &:focus, 77 | &.focus { 78 | outline: none; 79 | border-bottom: 2px solid $grey-even-darker; 80 | box-shadow: none; 81 | } 82 | } 83 | 84 | form, 85 | input, 86 | a { 87 | font-family: inherit; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /spec/util/contentValidator-spec.js: -------------------------------------------------------------------------------- 1 | const ContentValidator = require('../../src/util/contentValidator') 2 | const MalformedDataError = require('../../src/exceptions/malformedDataError') 3 | const ExceptionMessages = require('../../src/util/exceptionMessages') 4 | 5 | describe('ContentValidator', function () { 6 | describe('verifyContent', function () { 7 | it('does not return anything if content is valid', function () { 8 | var columnNames = ['name', 'ring', 'quadrant', 'isNew', 'description'] 9 | var contentValidator = new ContentValidator(columnNames) 10 | 11 | expect(contentValidator.verifyContent()).not.toBeDefined() 12 | }) 13 | 14 | it('raises an error if content is empty', function () { 15 | var columnNames = [] 16 | var contentValidator = new ContentValidator(columnNames) 17 | 18 | expect(function () { 19 | contentValidator.verifyContent() 20 | }).toThrow(new MalformedDataError(ExceptionMessages.MISSING_CONTENT)) 21 | }) 22 | }) 23 | 24 | describe('verifyHeaders', function () { 25 | it('raises an error if one of the headers is empty', function () { 26 | var columnNames = ['ring', 'quadrant', 'isNew', 'description'] 27 | var contentValidator = new ContentValidator(columnNames) 28 | 29 | expect(function () { 30 | contentValidator.verifyHeaders() 31 | }).toThrow(new MalformedDataError(ExceptionMessages.MISSING_HEADERS)) 32 | }) 33 | 34 | it('does not return anything if the all required headers are present', function () { 35 | var columnNames = ['name', 'ring', 'quadrant', 'isNew', 'description'] 36 | var contentValidator = new ContentValidator(columnNames) 37 | 38 | expect(contentValidator.verifyHeaders()).not.toBeDefined() 39 | }) 40 | 41 | it('does not care about white spaces in the headers', function () { 42 | var columnNames = [' name', 'ring ', ' quadrant', 'isNew ', ' description '] 43 | var contentValidator = new ContentValidator(columnNames) 44 | 45 | expect(contentValidator.verifyHeaders()).not.toBeDefined() 46 | }) 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /src/util/inputSanitizer.js: -------------------------------------------------------------------------------- 1 | const sanitizeHtml = require('sanitize-html') 2 | const _ = { 3 | forOwn: require('lodash/forOwn'), 4 | } 5 | 6 | const InputSanitizer = function () { 7 | var relaxedOptions = { 8 | allowedTags: ['b', 'i', 'em', 'strong', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'ul', 'br', 'p', 'u'], 9 | allowedAttributes: { 10 | a: ['href'], 11 | }, 12 | } 13 | 14 | var restrictedOptions = { 15 | allowedTags: [], 16 | allowedAttributes: {}, 17 | textFilter: function (text) { 18 | return text.replace(/&/, '&') 19 | }, 20 | } 21 | 22 | function trimWhiteSpaces(blip) { 23 | var processedBlip = {} 24 | _.forOwn(blip, function (value, key) { 25 | processedBlip[key.trim()] = value.trim() 26 | }) 27 | return processedBlip 28 | } 29 | 30 | var self = {} 31 | self.sanitize = function (rawBlip) { 32 | var blip = trimWhiteSpaces(rawBlip) 33 | blip.description = sanitizeHtml(blip.description, relaxedOptions) 34 | blip.name = sanitizeHtml(blip.name, restrictedOptions) 35 | blip.isNew = sanitizeHtml(blip.isNew, restrictedOptions) 36 | blip.ring = sanitizeHtml(blip.ring, restrictedOptions) 37 | blip.quadrant = sanitizeHtml(blip.quadrant, restrictedOptions) 38 | 39 | return blip 40 | } 41 | 42 | self.sanitizeForProtectedSheet = function (rawBlip, header) { 43 | var blip = trimWhiteSpaces(rawBlip) 44 | 45 | const descriptionIndex = header.indexOf('description') 46 | const nameIndex = header.indexOf('name') 47 | const isNewIndex = header.indexOf('isNew') 48 | const quadrantIndex = header.indexOf('quadrant') 49 | const ringIndex = header.indexOf('ring') 50 | 51 | const description = descriptionIndex === -1 ? '' : blip[descriptionIndex] 52 | const name = nameIndex === -1 ? '' : blip[nameIndex] 53 | const isNew = isNewIndex === -1 ? '' : blip[isNewIndex] 54 | const ring = ringIndex === -1 ? '' : blip[ringIndex] 55 | const quadrant = quadrantIndex === -1 ? '' : blip[quadrantIndex] 56 | 57 | blip.description = sanitizeHtml(description, relaxedOptions) 58 | blip.name = sanitizeHtml(name, restrictedOptions) 59 | blip.isNew = sanitizeHtml(isNew, restrictedOptions) 60 | blip.ring = sanitizeHtml(ring, restrictedOptions) 61 | blip.quadrant = sanitizeHtml(quadrant, restrictedOptions) 62 | 63 | return blip 64 | } 65 | 66 | return self 67 | } 68 | 69 | module.exports = InputSanitizer 70 | -------------------------------------------------------------------------------- /src/models/radar.js: -------------------------------------------------------------------------------- 1 | const MalformedDataError = require('../exceptions/malformedDataError') 2 | const ExceptionMessages = require('../util/exceptionMessages') 3 | 4 | const _ = { 5 | map: require('lodash/map'), 6 | uniqBy: require('lodash/uniqBy'), 7 | sortBy: require('lodash/sortBy'), 8 | } 9 | 10 | const Radar = function () { 11 | var self, quadrants, blipNumber, addingQuadrant, alternatives, currentSheetName 12 | 13 | blipNumber = 0 14 | addingQuadrant = 0 15 | quadrants = [ 16 | { order: 'first', startAngle: 90 }, 17 | { order: 'second', startAngle: 0 }, 18 | { order: 'third', startAngle: -90 }, 19 | { order: 'fourth', startAngle: -180 }, 20 | ] 21 | alternatives = [] 22 | currentSheetName = '' 23 | self = {} 24 | 25 | function setNumbers(blips) { 26 | blips.forEach(function (blip) { 27 | blip.setNumber(++blipNumber) 28 | }) 29 | } 30 | 31 | self.addAlternative = function (sheetName) { 32 | alternatives.push(sheetName) 33 | } 34 | 35 | self.getAlternatives = function () { 36 | return alternatives 37 | } 38 | 39 | self.setCurrentSheet = function (sheetName) { 40 | currentSheetName = sheetName 41 | } 42 | 43 | self.getCurrentSheet = function () { 44 | return currentSheetName 45 | } 46 | 47 | self.addQuadrant = function (quadrant) { 48 | if (addingQuadrant >= 4) { 49 | throw new MalformedDataError(ExceptionMessages.TOO_MANY_QUADRANTS) 50 | } 51 | quadrants[addingQuadrant].quadrant = quadrant 52 | setNumbers(quadrant.blips()) 53 | addingQuadrant++ 54 | } 55 | 56 | function allQuadrants() { 57 | if (addingQuadrant < 4) { 58 | throw new MalformedDataError(ExceptionMessages.LESS_THAN_FOUR_QUADRANTS) 59 | } 60 | 61 | return _.map(quadrants, 'quadrant') 62 | } 63 | 64 | function allBlips() { 65 | return allQuadrants().reduce(function (blips, quadrant) { 66 | return blips.concat(quadrant.blips()) 67 | }, []) 68 | } 69 | 70 | self.rings = function () { 71 | return _.sortBy( 72 | _.map( 73 | _.uniqBy(allBlips(), function (blip) { 74 | return blip.ring().name() 75 | }), 76 | function (blip) { 77 | return blip.ring() 78 | }, 79 | ), 80 | function (ring) { 81 | return ring.order() 82 | }, 83 | ) 84 | } 85 | 86 | self.quadrants = function () { 87 | return quadrants 88 | } 89 | 90 | return self 91 | } 92 | 93 | module.exports = Radar 94 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "build-your-own-radar", 3 | "version": "0.3.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build:dev": "webpack --mode development --config webpack.dev.js", 8 | "build:prod": "webpack --mode production --config webpack.prod.js", 9 | "dev": "webpack-dev-server --mode development --config webpack.dev.js", 10 | "test": "jasmine", 11 | "test:e2e": "cypress run --env host=$TEST_URL", 12 | "lint-prettier:check": "eslint . && prettier --check .", 13 | "lint-prettier:fix": "eslint . --fix && prettier --write .", 14 | "start": "cypress open --env host=$TEST_URL,TEST_ENV=$TEST_ENV", 15 | "coverage": "nyc npm run test", 16 | "quality": "npm run lint-prettier:check && npm run coverage" 17 | }, 18 | "author": "Thoughtworks", 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/thoughtworks/build-your-own-radar" 22 | }, 23 | "keywords": [ 24 | "tech-radar" 25 | ], 26 | "license": "AGPL-3.0", 27 | "devDependencies": { 28 | "@babel/core": "^7.17.5", 29 | "@babel/preset-env": "^7.16.11", 30 | "babel-loader": "^8.2.3", 31 | "css-loader": "^6.7.1", 32 | "cssnano": "^5.1.1", 33 | "cypress": "^9.5.1", 34 | "dotenv": "^16.0.0", 35 | "eslint": "^8.10.0", 36 | "eslint-config-prettier": "^8.5.0", 37 | "eslint-plugin-cypress": "^2.12.1", 38 | "eslint-plugin-jasmine": "^4.1.3", 39 | "expose-loader": "^3.1.0", 40 | "html-webpack-plugin": "^5.5.0", 41 | "jasmine": "^4.0.2", 42 | "jsdom": "^19.0.0", 43 | "mini-css-extract-plugin": "^2.6.0", 44 | "mochawesome": "^7.1.2", 45 | "sass": "^1.53.0", 46 | "nyc": "^15.1.0", 47 | "postcss-loader": "^6.2.1", 48 | "postcss-preset-env": "^7.4.2", 49 | "prettier": "^2.5.1", 50 | "sass-loader": "^12.6.0", 51 | "style-loader": "^3.3.1", 52 | "webpack": "^5.70.0", 53 | "webpack-cli": "^4.9.2", 54 | "webpack-dev-server": "^4.7.4", 55 | "yargs": "^17.3.1" 56 | }, 57 | "dependencies": { 58 | "chance": "^1.1.8", 59 | "d3": "^7.3.0", 60 | "d3-tip": "^0.9.1", 61 | "jquery": "^3.6.0", 62 | "jquery-ui": "^1.13.1", 63 | "lodash": "^4.17.21", 64 | "sanitize-html": "^2.7.0" 65 | }, 66 | "standard": { 67 | "globals": [ 68 | "Cypress", 69 | "cy", 70 | "XMLHttpRequest" 71 | ], 72 | "env": [ 73 | "jasmine" 74 | ], 75 | "ignore": [ 76 | "radar-spec.js", 77 | "ref-table-spec.js" 78 | ] 79 | }, 80 | "engines": { 81 | "node": ">=14", 82 | "npm": "8" 83 | }, 84 | "private": true 85 | } 86 | -------------------------------------------------------------------------------- /src/util/sheet.js: -------------------------------------------------------------------------------- 1 | /* global gapi */ 2 | const SheetNotFoundError = require('../../src/exceptions/sheetNotFoundError') 3 | const UnauthorizedError = require('../../src/exceptions/unauthorizedError') 4 | const ExceptionMessages = require('./exceptionMessages') 5 | 6 | const Sheet = function (sheetReference) { 7 | var self = {} 8 | 9 | ;(function () { 10 | var matches = sheetReference.match('https:\\/\\/docs.google.com\\/spreadsheets\\/d\\/(.*?)($|\\/$|\\/.*|\\?.*)') 11 | self.id = matches !== null ? matches[1] : sheetReference 12 | })() 13 | 14 | self.validate = function (callback) { 15 | var apiKeyEnabled = process.env.API_KEY || false 16 | var feedURL = 'https://docs.google.com/spreadsheets/d/' + self.id 17 | 18 | // TODO: Move this out (as HTTPClient) 19 | var xhr = new XMLHttpRequest() 20 | xhr.open('GET', feedURL, true) 21 | xhr.onreadystatechange = function () { 22 | if (xhr.readyState === 4) { 23 | if (xhr.status === 200) { 24 | return callback(null, apiKeyEnabled) 25 | } else if (xhr.status === 404) { 26 | return callback(new SheetNotFoundError(ExceptionMessages.SHEET_NOT_FOUND, apiKeyEnabled)) 27 | } else { 28 | return callback(new UnauthorizedError(ExceptionMessages.UNAUTHORIZED, apiKeyEnabled)) 29 | } 30 | } 31 | } 32 | xhr.send(null) 33 | } 34 | 35 | self.getSheet = async function () { 36 | return gapi.client.sheets.spreadsheets.get({ spreadsheetId: self.id }) 37 | } 38 | 39 | self.isPublicSheet = async function () { 40 | let isPublic = false 41 | try { 42 | isPublic = (await self.getSheet()) ? true : false 43 | } catch (error) { 44 | isPublic = false 45 | } 46 | return isPublic 47 | } 48 | 49 | self.getData = function (range) { 50 | return gapi.client.sheets.spreadsheets.values.get({ 51 | spreadsheetId: self.id, 52 | range: range, 53 | }) 54 | } 55 | 56 | self.processSheetResponse = function (sheetName, createBlips, handleError) { 57 | self 58 | .getSheet() 59 | .then((response) => { 60 | processSheetData(sheetName, response, createBlips, handleError) 61 | }) 62 | .catch(handleError) 63 | } 64 | 65 | function processSheetData(sheetName, sheetResponse, createBlips, handleError) { 66 | const sheetNames = sheetResponse.result.sheets.map((s) => s.properties.title) 67 | sheetName = !sheetName ? sheetNames[0] : sheetName 68 | self 69 | .getData(sheetName + '!A1:E') 70 | .then((r) => createBlips(sheetResponse.result.properties.title, r.result.values, sheetNames)) 71 | .catch(handleError) 72 | } 73 | 74 | return self 75 | } 76 | 77 | module.exports = Sheet 78 | -------------------------------------------------------------------------------- /spec/util/sheet-spec.js: -------------------------------------------------------------------------------- 1 | const Sheet = require('../../src/util/sheet') 2 | 3 | describe('sheet', function () { 4 | var sheet 5 | var caller = { callback: function () {} } 6 | 7 | beforeAll(function () { 8 | spyOn(caller, 'callback') 9 | }) 10 | 11 | it('knows to find the sheet id from published URL', function () { 12 | sheet = new Sheet( 13 | 'https://docs.google.com/spreadsheets/' + 'd/1YXkrgV7Y6zShiPeyw4Y5_19QOfu5I6CyH5sGnbkEyiI/pubhtml', 14 | ) 15 | 16 | expect(sheet.id).toEqual('1YXkrgV7Y6zShiPeyw4Y5_19QOfu5I6CyH5sGnbkEyiI') 17 | }) 18 | 19 | it('knows to find the sheet id from publicly shared URL having query params', function () { 20 | sheet = new Sheet( 21 | 'https://docs.google.com/spreadsheets/' + 'd/1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U?abc=xyz', 22 | ) 23 | 24 | expect(sheet.id).toEqual('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 25 | }) 26 | 27 | it('knows to find the sheet id from publicly shared URL having extra path and query params', function () { 28 | sheet = new Sheet( 29 | 'https://docs.google.com/spreadsheets/' + 'd/1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U/edit?usp=sharing', 30 | ) 31 | 32 | expect(sheet.id).toEqual('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 33 | }) 34 | 35 | it('knows to find the sheet id from publicly shared URL having no extra path or query params', function () { 36 | sheet = new Sheet('https://docs.google.com/spreadsheets/' + 'd/1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 37 | 38 | expect(sheet.id).toEqual('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 39 | }) 40 | 41 | it('knows to find the sheet id from publicly shared URL with trailing slash', function () { 42 | sheet = new Sheet('https://docs.google.com/spreadsheets/' + 'd/1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U/') 43 | 44 | expect(sheet.id).toEqual('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 45 | }) 46 | 47 | it('can identify a plain sheet ID', function () { 48 | sheet = new Sheet('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 49 | 50 | expect(sheet.id).toEqual('1wLRmV2tVlS5PqjKFyiTA0HuoH8vp_h_DOmjciZAEG0U') 51 | }) 52 | 53 | xit('calls back with nothing if the sheet exists', function () { 54 | pending('need to be fix: XMLHttpRequest is not defined') 55 | 56 | sheet = new Sheet('http://example.com/a/b/c/d/?x=y') 57 | sheet.exists(caller.callback) 58 | 59 | expect(caller.callback).toHaveBeenCalledWith(undefined) 60 | }) 61 | 62 | xit('calls back with error if sheet the sheet does not exist', function () { 63 | pending('need to be fix: XMLHttpRequest is not defined') 64 | 65 | sheet = new Sheet('http://example.com/a/b/c/d/?x=y') 66 | sheet.exists(caller.callback) 67 | 68 | expect(caller.callback).toHaveBeenCalledWith('Some error') 69 | }) 70 | }) 71 | -------------------------------------------------------------------------------- /spec/graphing/ref-table-spec.js: -------------------------------------------------------------------------------- 1 | const Quadrant = require('../../src/models/quadrant.js') 2 | const Ring = require('../../src/models/ring.js') 3 | const Blip = require('../../src/models/blip.js') 4 | const Radar = require('../../src/models/radar.js') 5 | 6 | describe('graphingRadar', function () { 7 | var radar, toolsQuadrant, techniquesQuadrant, platformsQuadrant, languageFramework, element 8 | 9 | beforeEach(function () { 10 | toolsQuadrant = new Quadrant('Tools') 11 | techniquesQuadrant = new Quadrant('Techniques') 12 | platformsQuadrant = new Quadrant('Platforms') 13 | languageFramework = new Quadrant('Languages') 14 | 15 | radar = new Radar() 16 | radar.addQuadrant(toolsQuadrant) 17 | radar.addQuadrant(techniquesQuadrant) 18 | radar.addQuadrant(platformsQuadrant) 19 | radar.addQuadrant(languageFramework) 20 | 21 | element = { innerHTML: '' } 22 | spyOn(document, 'querySelector').and.returnValue(element) 23 | }) 24 | 25 | xdescribe('render', function () { 26 | it('groups blips by ring', function () { 27 | var adopt = new Ring('Adopt') 28 | var assess = new Ring('Assess') 29 | 30 | toolsQuadrant.add([ 31 | new Blip('foo', adopt, true, 'this is foo'), 32 | new Blip('bar', assess, true, 'this is bar'), 33 | new Blip('baz', adopt, true, 'this is baz'), 34 | ]) 35 | 36 | /*var table = new tr.graphing.RefTable(radar) 37 | table.init('#some-id').render()*/ 38 | 39 | expect(element.innerHTML).toEqual( 40 | '' + 41 | '' + 42 | '' + 43 | '' + 44 | '' + 45 | '' + 46 | '
    Adopt
    -1foothis is foo
    -1bazthis is baz
    Assess
    -1barthis is bar
    ', 47 | ) 48 | }) 49 | 50 | it('respects the assigned order of rings', function () { 51 | var adopt = new Ring('Adopt', 1) 52 | var assess = new Ring('Assess', 3) 53 | var hold = new Ring('Hold', 2) 54 | 55 | toolsQuadrant.add([ 56 | new Blip('foo', adopt, true, 'this is foo'), 57 | new Blip('bar', assess, true, 'this is bar'), 58 | new Blip('baz', hold, true, 'this is baz'), 59 | ]) 60 | 61 | /*var table = new tr.graphing.RefTable(radar) 62 | table.init('#some-id').render()*/ 63 | 64 | expect(element.innerHTML).toEqual( 65 | '' + 66 | '' + 67 | '' + 68 | '' + 69 | '' + 70 | '' + 71 | '' + 72 | '
    Adopt
    -1foothis is foo
    Hold
    -1bazthis is baz
    Assess
    -1barthis is bar
    ', 73 | ) 74 | }) 75 | }) 76 | }) 77 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 19 |
    20 |
    21 |

    Build Your Own Radar

    22 |
    23 |
    24 |
    25 |
    26 |

    27 | Once you've created your Radar you can use this service 28 | to generate an interactive version of your Technology Radar. Not sure how? 29 | Read this first. 30 |

    31 | 32 | Building your radar... 33 |

    Your Technology Radar will be available in just a few seconds

    34 |
    35 |
    36 |
    37 |
    38 |
    39 |
    40 |
    41 |
    42 |
    43 |

    44 | Enter the URL of your 45 | Google Sheet, CSV or JSON file 46 | below… 47 |

    48 |
    49 | 55 | 56 | Need help? 57 |
    58 |
    59 |
    60 |
    61 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /spec/util/inputSanitizer-spec.js: -------------------------------------------------------------------------------- 1 | const InputSanitizer = require('../../src/util/inputSanitizer') 2 | 3 | describe('InputSanitizer', function () { 4 | var sanitizer, rawBlip, blip 5 | 6 | beforeAll(function () { 7 | sanitizer = new InputSanitizer() 8 | var description = "Hello there

    heading

    " 9 | rawBlip = { 10 | name: "Hello there

    blip

    ", 11 | description: description, 12 | ring: 'Adopt', 13 | quadrant: 'techniques and tools', 14 | isNew: 'true
    ', 15 | } 16 | 17 | blip = sanitizer.sanitize(rawBlip) 18 | }) 19 | 20 | it('strips out script tags from blip descriptions', function () { 21 | expect(blip.description).toEqual('Hello there

    heading

    ') 22 | }) 23 | 24 | it('strips out all tags from blip name', function () { 25 | expect(blip.name).toEqual('Hello there blip') 26 | }) 27 | 28 | it('strips out all tags from blip status', function () { 29 | expect(blip.isNew).toEqual('true') 30 | }) 31 | 32 | it('strips out all tags from blip ring', function () { 33 | expect(blip.ring).toEqual('Adopt') 34 | }) 35 | 36 | it('strips out all tags from blip quadrant', function () { 37 | expect(blip.quadrant).toEqual('techniques and tools') 38 | }) 39 | 40 | it('trims white spaces in keys and values', function () { 41 | rawBlip = { 42 | ' name': ' Some name ', 43 | ' ring ': ' Some ring name ', 44 | } 45 | blip = sanitizer.sanitize(rawBlip) 46 | 47 | expect(blip.name).toEqual('Some name') 48 | expect(blip.ring).toEqual('Some ring name') 49 | }) 50 | }) 51 | 52 | describe('Input Santizer for Protected sheet', function () { 53 | var sanitizer, rawBlip, blip, header 54 | beforeAll(function () { 55 | sanitizer = new InputSanitizer() 56 | header = ['name', 'quadrant', 'ring', 'isNew', 'description'] 57 | 58 | rawBlip = [ 59 | "Hello there

    blip

    ", 60 | 'techniques & tools', 61 | "Adopt", 62 | 'true
    ', 63 | "Hello there

    heading

    ", 64 | ] 65 | 66 | blip = sanitizer.sanitizeForProtectedSheet(rawBlip, header) 67 | }) 68 | 69 | it('strips out script tags from blip descriptions', function () { 70 | expect(blip.description).toEqual('Hello there

    heading

    ') 71 | }) 72 | 73 | it('strips out all tags from blip name', function () { 74 | expect(blip.name).toEqual('Hello there blip') 75 | }) 76 | 77 | it('strips out all tags from blip status', function () { 78 | expect(blip.isNew).toEqual('true') 79 | }) 80 | 81 | it('strips out all tags from blip ring', function () { 82 | expect(blip.ring).toEqual('Adopt') 83 | }) 84 | 85 | it('strips out all tags from blip quadrant', function () { 86 | expect(blip.quadrant).toEqual('techniques & tools') 87 | }) 88 | 89 | it('trims white spaces in keys and values', function () { 90 | rawBlip = { 91 | ' name': ' Some name ', 92 | ' ring ': ' Some ring name ', 93 | } 94 | blip = sanitizer.sanitize(rawBlip) 95 | 96 | expect(blip.name).toEqual('Some name') 97 | expect(blip.ring).toEqual('Some ring name') 98 | }) 99 | }) 100 | -------------------------------------------------------------------------------- /webpack.common.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const webpack = require('webpack') 4 | const path = require('path') 5 | const buildPath = path.resolve(__dirname, 'dist') 6 | const args = require('yargs').argv 7 | 8 | const HtmlWebpackPlugin = require('html-webpack-plugin') 9 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 10 | const postcssPresetEnv = require('postcss-preset-env') 11 | const cssnano = require('cssnano') 12 | 13 | const env = args.envFile 14 | if (env) { 15 | // Load env file 16 | require('dotenv').config({ path: env }) 17 | } 18 | 19 | const common = ['./src/common.js'] 20 | 21 | const ASSET_PATH = process.env.ASSET_PATH || '/' 22 | 23 | const plugins = [ 24 | new MiniCssExtractPlugin({ filename: '[name].[contenthash].css' }), 25 | new HtmlWebpackPlugin({ 26 | template: './src/index.html', 27 | chunks: ['main'], 28 | inject: 'body', 29 | }), 30 | new HtmlWebpackPlugin({ 31 | template: './src/error.html', 32 | chunks: ['common'], 33 | inject: 'body', 34 | filename: 'error.html', 35 | }), 36 | new webpack.DefinePlugin({ 37 | 'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID), 38 | 'process.env.API_KEY': JSON.stringify(process.env.API_KEY), 39 | 'process.env.ENABLE_GOOGLE_AUTH': JSON.stringify(process.env.ENABLE_GOOGLE_AUTH), 40 | 'process.env.GTM_ID': JSON.stringify(process.env.GTM_ID), 41 | }), 42 | ] 43 | 44 | module.exports = { 45 | context: __dirname, 46 | entry: { 47 | common: common, 48 | }, 49 | 50 | output: { 51 | path: buildPath, 52 | publicPath: ASSET_PATH, 53 | filename: '[name].[contenthash].js', 54 | assetModuleFilename: 'images/[name][ext]', 55 | }, 56 | resolve: { 57 | extensions: ['.js', '.ts'], 58 | fallback: { 59 | fs: false, 60 | }, 61 | }, 62 | 63 | module: { 64 | rules: [ 65 | { 66 | test: /\.js$/, 67 | exclude: /node_modules/, 68 | use: [ 69 | { 70 | loader: 'babel-loader', 71 | options: { 72 | presets: ['@babel/preset-env'], 73 | }, 74 | }, 75 | ], 76 | }, 77 | { 78 | test: /\.scss$/, 79 | exclude: /node_modules/, 80 | use: [ 81 | 'style-loader', 82 | MiniCssExtractPlugin.loader, 83 | { 84 | loader: 'css-loader', 85 | options: { importLoaders: 1, modules: 'global', url: false }, 86 | }, 87 | { 88 | loader: 'postcss-loader', 89 | options: { 90 | postcssOptions: { 91 | plugins: [ 92 | postcssPresetEnv({ browsers: 'last 2 versions' }), 93 | cssnano({ 94 | preset: ['default', { discardComments: { removeAll: true } }], 95 | }), 96 | ], 97 | }, 98 | }, 99 | }, 100 | 'sass-loader', 101 | ], 102 | }, 103 | { 104 | test: /\.(eot|otf|ttf|woff|woff2)$/, 105 | type: 'asset/resource', 106 | }, 107 | { 108 | test: /\.(png|jpg|jpeg|gif|ico|svg)$/, 109 | exclude: /node_modules/, 110 | type: 'asset/resource', 111 | }, 112 | { 113 | test: require.resolve('jquery'), 114 | loader: 'expose-loader', 115 | options: { exposes: ['$', 'jQuery'] }, 116 | }, 117 | ], 118 | }, 119 | 120 | plugins: plugins, 121 | } 122 | -------------------------------------------------------------------------------- /.circleci/deployment-workflow.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | orbs: 4 | aws-cli: circleci/aws-cli@2.0.6 5 | 6 | executors: 7 | base: 8 | docker: 9 | - image: cimg/node:18.12.1 10 | user: root 11 | 12 | commands: 13 | install-node-packages: 14 | description: Install node packages 15 | steps: 16 | - restore_cache: 17 | key: node-cache-v2-{{ checksum "package-lock.json" }} 18 | - run: 19 | name: Install node packages 20 | command: npm install 21 | - save_cache: 22 | paths: 23 | - ./node_modules 24 | key: node-cache-v2-{{ checksum "package-lock.json" }} 25 | install-node-and-cypress-packages: 26 | description: Install node packages and Cypress dependencies 27 | steps: 28 | - restore_cache: 29 | key: node-cache-with-cypress-v1-{{ checksum "package-lock.json" }} 30 | - run: 31 | name: Install Cypress dependencies 32 | command: | 33 | apt-get update 34 | apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb 35 | - run: 36 | name: Install node packages 37 | command: npm install 38 | - save_cache: 39 | paths: 40 | - ./node_modules 41 | - ~/.cache/Cypress 42 | key: node-cache-with-cypress-v1-{{ checksum "package-lock.json" }} 43 | build-and-push: 44 | description: Build and push code to S3 bucket 45 | parameters: 46 | api_key: 47 | type: string 48 | default: '' 49 | client_id: 50 | type: string 51 | default: '' 52 | gtm_id: 53 | type: string 54 | default: '' 55 | bucket_name: 56 | type: string 57 | default: '' 58 | distribution_id: 59 | type: string 60 | default: '' 61 | mode: 62 | type: string 63 | default: '' 64 | steps: 65 | - run: 66 | name: Build code 67 | command: API_KEY=<< parameters.api_key >> CLIENT_ID=<< parameters.client_id >> GTM_ID=<< parameters.gtm_id >> npm run build:<> 68 | - aws-cli/setup 69 | - run: 70 | name: Sync build artifacts to S3 71 | command: aws s3 cp --recursive dist "s3://<< parameters.bucket_name >>/" 72 | - run: 73 | name: Create invalidation in CloudFront 74 | command: aws cloudfront create-invalidation --distribution-id << parameters.distribution_id >> --paths '/*' 75 | 76 | jobs: 77 | e2e-tests: 78 | executor: base 79 | steps: 80 | - checkout 81 | - install-node-and-cypress-packages 82 | - run: 83 | name: Run e2e test cases 84 | command: API_KEY=$LOCAL_API_KEY ./run_e2e_tests.sh $LOCAL_TEST_URL 85 | qa-deployment: 86 | executor: base 87 | steps: 88 | - checkout 89 | - install-node-packages 90 | - build-and-push: 91 | api_key: $QA_API_KEY 92 | client_id: $QA_CLIENT_ID 93 | gtm_id: $QA_GTM_ID 94 | bucket_name: $QA_BUCKET_NAME 95 | distribution_id: $QA_DISTRIBUTION_ID 96 | mode: dev 97 | prod-deployment: 98 | executor: base 99 | steps: 100 | - checkout 101 | - setup_remote_docker: 102 | version: 20.10.12 103 | docker_layer_caching: true 104 | - install-node-packages 105 | - build-and-push: 106 | api_key: $PROD_API_KEY 107 | client_id: $PROD_CLIENT_ID 108 | gtm_id: $PROD_GTM_ID 109 | bucket_name: $PROD_BUCKET_NAME 110 | distribution_id: $PROD_DISTRIBUTION_ID 111 | mode: prod 112 | - run: 113 | name: Build and push Docker image to DockerHub 114 | command: ./docker_push.sh 115 | 116 | workflows: 117 | build-and-deploy: 118 | jobs: 119 | - e2e-tests: 120 | filters: 121 | branches: 122 | only: master 123 | - approve-qa-deployment: 124 | type: approval 125 | requires: 126 | - e2e-tests 127 | - qa-deployment: 128 | requires: 129 | - approve-qa-deployment 130 | - approve-prod-deployment: 131 | type: approval 132 | requires: 133 | - qa-deployment 134 | - prod-deployment: 135 | requires: 136 | - approve-prod-deployment 137 | -------------------------------------------------------------------------------- /src/stylesheets/_header.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | @import 'featuretoggles'; 3 | @import 'mediaqueries'; 4 | 5 | header { 6 | text-align: center; 7 | } 8 | 9 | .radar-title, 10 | .buttons-group, 11 | #alternative-buttons { 12 | display: flex; 13 | flex-direction: row; 14 | justify-content: flex-start; 15 | align-items: center; 16 | align-content: space-between; 17 | } 18 | 19 | .radar-title { 20 | background-color: $grey-light; 21 | padding: 30px 0; 22 | 23 | display: table; 24 | margin: auto; 25 | width: 100%; 26 | 27 | .radar-title__text { 28 | display: table-cell; 29 | width: 70%; 30 | 31 | text-align: left; 32 | padding-left: 10%; 33 | 34 | h1 { 35 | font-size: 55px; 36 | font-weight: 900; 37 | letter-spacing: -0.04em; 38 | line-height: 0.8em; 39 | margin: 0; 40 | text-transform: uppercase; 41 | } 42 | } 43 | 44 | .radar-title__logo { 45 | flex: 0 0 30%; 46 | margin-left: auto; 47 | 48 | width: 30%; 49 | display: table-cell; 50 | vertical-align: middle; 51 | 52 | a { 53 | border-bottom: none; 54 | } 55 | 56 | img { 57 | vertical-align: middle; 58 | width: 34%; 59 | } 60 | } 61 | } 62 | 63 | .quadrant-btn--group, 64 | .multiple-sheet-button-group { 65 | text-align: left; 66 | padding-left: 10%; 67 | } 68 | 69 | .print-radar-btn, 70 | .search-box { 71 | margin-left: auto; 72 | margin-right: 10%; 73 | } 74 | 75 | .buttons-group { 76 | padding: 15px 0 25px; 77 | } 78 | 79 | .home-link { 80 | color: $pink; 81 | margin-bottom: 10px; 82 | line-height: normal; 83 | cursor: pointer; 84 | display: inline-block; 85 | font-size: $baseFont; 86 | text-align: left; 87 | width: 80%; 88 | } 89 | 90 | .button { 91 | font-size: $baseFont; 92 | text-transform: capitalize; 93 | margin-right: 20px; 94 | border-radius: 2px; 95 | padding: 10px 20px; 96 | cursor: pointer; 97 | transition: all 0.2s ease-out; 98 | 99 | background-color: $grey-light; 100 | color: $black; 101 | 102 | &.no-capitalize { 103 | text-transform: none; 104 | } 105 | 106 | &:hover, 107 | &.selected { 108 | transform: translate(0, -2px); 109 | opacity: 0.85; 110 | 111 | &.first { 112 | color: white; 113 | background-color: $green; 114 | } 115 | 116 | &.second { 117 | color: white; 118 | background-color: $blue; 119 | } 120 | 121 | &.third { 122 | color: white; 123 | background-color: $orange; 124 | } 125 | 126 | &.fourth { 127 | color: white; 128 | background-color: $violet; 129 | } 130 | } 131 | 132 | &.full-view { 133 | &.first { 134 | background-color: $green; 135 | color: $white; 136 | } 137 | 138 | &.second { 139 | background-color: $blue; 140 | color: $white; 141 | } 142 | 143 | &.third { 144 | background-color: $orange; 145 | color: $white; 146 | } 147 | 148 | &.fourth { 149 | background-color: $violet; 150 | color: $white; 151 | } 152 | } 153 | } 154 | 155 | #alternative-buttons { 156 | margin-bottom: 50px; 157 | 158 | .highlight { 159 | border-bottom: none; 160 | font-weight: bold; 161 | } 162 | 163 | p { 164 | font-size: 16px; 165 | font-weight: 700; 166 | margin-top: 0; 167 | margin-bottom: 10px; 168 | } 169 | 170 | .multiple-sheet-button { 171 | margin-right: 10px; 172 | } 173 | 174 | .search-radar { 175 | border: 1px solid #aaa; 176 | background-color: inherit; 177 | background-image: url('/images/search-logo-2x.svg'); 178 | background-repeat: no-repeat; 179 | background-position: 10px; 180 | } 181 | 182 | input { 183 | padding-left: 35px; 184 | width: 275px; 185 | } 186 | } 187 | 188 | .ui-autocomplete { 189 | width: 275px !important; 190 | 191 | .ui-autocomplete-quadrant { 192 | font-size: 14px; 193 | font-weight: 600; 194 | padding: 5px; 195 | } 196 | 197 | .ui-menu-item { 198 | white-space: normal; 199 | font-size: 14px; 200 | font-weight: 400; 201 | 202 | .ui-menu-item-wrapper { 203 | padding: 0 10px; 204 | } 205 | } 206 | } 207 | 208 | @if $UIRefresh2022 { 209 | header { 210 | height: 80px; 211 | display: flex; 212 | align-items: center; 213 | justify-content: center; 214 | 215 | a { 216 | display: block; 217 | border-bottom: none; 218 | 219 | img { 220 | height: 20px; 221 | width: auto; 222 | } 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /src/util/googleAuth.js: -------------------------------------------------------------------------------- 1 | /* global gapi */ 2 | const d3 = require('d3') 3 | 4 | // Client ID and API key from the Developer Console 5 | var CLIENT_ID = process.env.CLIENT_ID 6 | var API_KEY = process.env.API_KEY 7 | 8 | // Array of API discovery doc URLs for APIs used by the quickstart 9 | var DISCOVERY_DOCS = ['https://sheets.googleapis.com/$discovery/rest?version=v4'] 10 | 11 | // Authorization scopes required by the API multiple scopes can be 12 | // included, separated by spaces. 13 | var SCOPES = 'https://www.googleapis.com/auth/spreadsheets.readonly' 14 | 15 | const GoogleAuth = function () { 16 | const self = {} 17 | self.forceLogin = false 18 | self.isAuthorizedCallbacks = [] 19 | self.isLoggedIn = undefined 20 | self.userEmail = '' 21 | let tokenClient 22 | self.gapiInitiated = false 23 | self.gsiInitiated = false 24 | 25 | self.loadAuthAPI = function () { 26 | !self.gapiInitiated && 27 | self.content.append('script').attr('src', 'https://apis.google.com/js/api.js').on('load', self.handleClientLoad) 28 | } 29 | 30 | self.loadGSI = function () { 31 | !self.gsiInitiated && 32 | self.content 33 | .append('script') 34 | .attr('src', 'https://accounts.google.com/gsi/client') 35 | .on('load', function () { 36 | self.gsiLogin() 37 | }) 38 | } 39 | 40 | self.loadGoogle = function (forceLogin = false, callback) { 41 | self.loadedCallback = callback 42 | self.forceLogin = forceLogin 43 | self.content = d3.select('body') 44 | 45 | if (!self.forceLogin) { 46 | self.loadAuthAPI() 47 | } else { 48 | self.handleClientLoad() 49 | self.gsiLogin(forceLogin) 50 | } 51 | } 52 | 53 | function parseJwt(token) { 54 | var base64Url = token.split('.')[1] 55 | var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/') 56 | var jsonPayload = decodeURIComponent( 57 | window 58 | .atob(base64) 59 | .split('') 60 | .map(function (c) { 61 | return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) 62 | }) 63 | .join(''), 64 | ) 65 | 66 | return JSON.parse(jsonPayload) 67 | } 68 | 69 | self.gsiCallback = async function (credentialResponse) { 70 | let jwToken 71 | if (credentialResponse) { 72 | jwToken = parseJwt(credentialResponse.credential) 73 | } 74 | 75 | tokenClient = await window.google.accounts.oauth2.initTokenClient({ 76 | client_id: CLIENT_ID, 77 | scope: SCOPES, 78 | callback: '', 79 | prompt: self.forceLogin ? 'select_account' : '', 80 | hint: self.forceLogin ? '' : jwToken?.email, 81 | }) 82 | 83 | self.gsiInitiated = true 84 | self.prompt() 85 | } 86 | 87 | self.gsiLogin = async function (forceLogin = false) { 88 | self.forceLogin = forceLogin 89 | window.google.accounts.id.initialize({ 90 | client_id: CLIENT_ID, 91 | callback: self.gsiCallback, 92 | auto_select: self.forceLogin ? false : true, 93 | cancel_on_tap_outside: false, 94 | }) 95 | if (!self.forceLogin) { 96 | window.google.accounts.id.prompt() 97 | } else { 98 | self.gsiCallback() 99 | } 100 | } 101 | 102 | self.handleClientLoad = function () { 103 | gapi.load('client', self.initClient) 104 | } 105 | 106 | self.isAuthorized = function (callback) { 107 | self.isAuthorizedCallbacks.push(callback) 108 | if (self.isLoggedIn !== undefined) { 109 | callback(self.isLoggedIn) 110 | } 111 | } 112 | 113 | self.prompt = async function () { 114 | if (self.gsiInitiated && self.gapiInitiated) { 115 | const token = gapi.client.getToken() 116 | if (token && token.access_token && !self.forceLogin) { 117 | const options = { method: 'GET', headers: { authorization: `Bearer ${token.access_token}` } } 118 | const response = await fetch('https://www.googleapis.com/oauth2/v1/userinfo', options) 119 | const profile = await response.json() 120 | self.userEmail = profile.email 121 | self.loadedCallback() 122 | } else { 123 | tokenClient.callback = () => { 124 | self.forceLogin = false 125 | self.prompt() 126 | } 127 | tokenClient.requestAccessToken() 128 | } 129 | } 130 | } 131 | 132 | self.initClient = async function () { 133 | gapi.client 134 | .init({ 135 | apiKey: API_KEY, 136 | discoveryDocs: DISCOVERY_DOCS, 137 | scope: SCOPES, 138 | }) 139 | .then(() => { 140 | self.gapiInitiated = true 141 | self.loadedCallback() 142 | }) 143 | } 144 | 145 | self.getEmail = () => { 146 | return self.userEmail 147 | } 148 | 149 | return self 150 | } 151 | 152 | module.exports = new GoogleAuth() 153 | -------------------------------------------------------------------------------- /spec/models/radar-spec.js: -------------------------------------------------------------------------------- 1 | const Radar = require('../../src/models/radar') 2 | const Quadrant = require('../../src/models/quadrant') 3 | const Ring = require('../../src/models/ring') 4 | const Blip = require('../../src/models/blip') 5 | const MalformedDataError = require('../../src/exceptions/malformedDataError') 6 | const ExceptionMessages = require('../../src/util/exceptionMessages') 7 | 8 | describe('Radar', function () { 9 | it('has no quadrants by default', function () { 10 | var radar = new Radar() 11 | 12 | expect(radar.quadrants()[0].quadrant).not.toBeDefined() 13 | expect(radar.quadrants()[1].quadrant).not.toBeDefined() 14 | expect(radar.quadrants()[2].quadrant).not.toBeDefined() 15 | expect(radar.quadrants()[3].quadrant).not.toBeDefined() 16 | }) 17 | 18 | it('sets the first quadrant', function () { 19 | var quadrant, radar, blip 20 | 21 | blip = new Blip('A', new Ring('First')) 22 | quadrant = new Quadrant('First') 23 | quadrant.add([blip]) 24 | radar = new Radar() 25 | 26 | radar.addQuadrant(quadrant) 27 | 28 | expect(radar.quadrants()[0].quadrant).toEqual(quadrant) 29 | expect(radar.quadrants()[0].quadrant.blips()[0].number()).toEqual(1) 30 | }) 31 | 32 | it('sets the second quadrant', function () { 33 | var quadrant, radar, blip 34 | 35 | blip = new Blip('A', new Ring('First')) 36 | quadrant = new Quadrant('Second') 37 | quadrant.add([blip]) 38 | radar = new Radar() 39 | 40 | radar.addQuadrant(quadrant) 41 | 42 | expect(radar.quadrants()[0].quadrant).toEqual(quadrant) 43 | expect(radar.quadrants()[0].quadrant.blips()[0].number()).toEqual(1) 44 | }) 45 | 46 | it('sets the third quadrant', function () { 47 | var quadrant, radar, blip 48 | 49 | blip = new Blip('A', new Ring('First')) 50 | quadrant = new Quadrant('Third') 51 | quadrant.add([blip]) 52 | radar = new Radar() 53 | 54 | radar.addQuadrant(quadrant) 55 | 56 | expect(radar.quadrants()[0].quadrant).toEqual(quadrant) 57 | expect(radar.quadrants()[0].quadrant.blips()[0].number()).toEqual(1) 58 | }) 59 | 60 | it('sets the fourth quadrant', function () { 61 | var quadrant, radar, blip 62 | 63 | blip = new Blip('A', new Ring('First')) 64 | quadrant = new Quadrant('Fourth') 65 | quadrant.add([blip]) 66 | radar = new Radar() 67 | 68 | radar.addQuadrant(quadrant) 69 | 70 | expect(radar.quadrants()[0].quadrant).toEqual(quadrant) 71 | expect(radar.quadrants()[0].quadrant.blips()[0].number()).toEqual(1) 72 | }) 73 | 74 | it('throws an error if too many quadrants are added', function () { 75 | var quadrant, radar, blip 76 | 77 | blip = new Blip('A', new Ring('First')) 78 | quadrant = new Quadrant('First') 79 | quadrant.add([blip]) 80 | radar = new Radar() 81 | 82 | radar.addQuadrant(quadrant) 83 | radar.addQuadrant(new Quadrant('Second')) 84 | radar.addQuadrant(new Quadrant('Third')) 85 | radar.addQuadrant(new Quadrant('Fourth')) 86 | 87 | expect(function () { 88 | radar.addQuadrant(new Quadrant('Fifth')) 89 | }).toThrow(new MalformedDataError(ExceptionMessages.TOO_MANY_QUADRANTS)) 90 | }) 91 | 92 | it('throws an error if less than 4 quadrants are added', function () { 93 | var quadrant, radar, blip 94 | 95 | blip = new Blip('A', new Ring('First')) 96 | quadrant = new Quadrant('First') 97 | quadrant.add([blip]) 98 | radar = new Radar() 99 | 100 | radar.addQuadrant(quadrant) 101 | radar.addQuadrant(new Quadrant('Second')) 102 | radar.addQuadrant(new Quadrant('Third')) 103 | 104 | expect(function () { 105 | radar.rings() 106 | }).toThrow(new MalformedDataError(ExceptionMessages.LESS_THAN_FOUR_QUADRANTS)) 107 | }) 108 | 109 | describe('blip numbers', function () { 110 | var firstQuadrant, secondQuadrant, radar, firstRing 111 | 112 | beforeEach(function () { 113 | firstRing = new Ring('Adopt', 0) 114 | firstQuadrant = new Quadrant('First') 115 | secondQuadrant = new Quadrant('Second') 116 | firstQuadrant.add([new Blip('A', firstRing), new Blip('B', firstRing)]) 117 | secondQuadrant.add([new Blip('C', firstRing), new Blip('D', firstRing)]) 118 | radar = new Radar() 119 | }) 120 | 121 | it('sets blip numbers starting on the first quadrant', function () { 122 | radar.addQuadrant(firstQuadrant) 123 | 124 | expect(radar.quadrants()[0].quadrant.blips()[0].number()).toEqual(1) 125 | expect(radar.quadrants()[0].quadrant.blips()[1].number()).toEqual(2) 126 | }) 127 | 128 | it('continues the number from the previous quadrant set', function () { 129 | radar.addQuadrant(firstQuadrant) 130 | radar.addQuadrant(secondQuadrant) 131 | 132 | expect(radar.quadrants()[1].quadrant.blips()[0].number()).toEqual(3) 133 | expect(radar.quadrants()[1].quadrant.blips()[1].number()).toEqual(4) 134 | }) 135 | }) 136 | 137 | describe('alternatives', function () { 138 | it('returns a provided alternatives', function () { 139 | var radar = new Radar() 140 | 141 | var alternative1 = 'alternative1' 142 | var alternative2 = 'alternative2' 143 | 144 | radar.addAlternative(alternative1) 145 | radar.addAlternative(alternative2) 146 | 147 | expect(radar.getAlternatives()).toEqual([alternative1, alternative2]) 148 | }) 149 | }) 150 | 151 | describe('rings', function () { 152 | var quadrant, radar, firstRing, secondRing, otherQuadrant 153 | 154 | beforeEach(function () { 155 | firstRing = new Ring('Adopt', 0) 156 | secondRing = new Ring('Hold', 1) 157 | quadrant = new Quadrant('Fourth') 158 | otherQuadrant = new Quadrant('Other') 159 | radar = new Radar() 160 | }) 161 | 162 | it('returns an array for a given set of blips', function () { 163 | quadrant.add([new Blip('A', firstRing), new Blip('B', secondRing)]) 164 | 165 | radar.addQuadrant(quadrant) 166 | radar.addQuadrant(otherQuadrant) 167 | radar.addQuadrant(otherQuadrant) 168 | radar.addQuadrant(otherQuadrant) 169 | 170 | expect(radar.rings()).toEqual([firstRing, secondRing]) 171 | }) 172 | 173 | it('has unique rings', function () { 174 | quadrant.add([new Blip('A', firstRing), new Blip('B', firstRing), new Blip('C', secondRing)]) 175 | 176 | radar.addQuadrant(quadrant) 177 | radar.addQuadrant(otherQuadrant) 178 | radar.addQuadrant(otherQuadrant) 179 | radar.addQuadrant(otherQuadrant) 180 | 181 | expect(radar.rings()).toEqual([firstRing, secondRing]) 182 | }) 183 | 184 | it('has sorts by the ring order', function () { 185 | quadrant.add([new Blip('C', secondRing), new Blip('A', firstRing), new Blip('B', firstRing)]) 186 | 187 | radar.addQuadrant(quadrant) 188 | radar.addQuadrant(otherQuadrant) 189 | radar.addQuadrant(otherQuadrant) 190 | radar.addQuadrant(otherQuadrant) 191 | 192 | expect(radar.rings()).toEqual([firstRing, secondRing]) 193 | }) 194 | }) 195 | }) 196 | -------------------------------------------------------------------------------- /src/stylesheets/base.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | @import 'fonts'; 3 | @import 'tip'; 4 | @import 'form'; 5 | @import 'error'; 6 | @import 'header'; 7 | @import 'footer'; 8 | @import 'featuretoggles'; 9 | @import 'herobanner'; 10 | @import 'mediaqueries'; 11 | @import 'layout'; 12 | @import 'landingpage'; 13 | @import 'loader'; 14 | @import 'screen'; 15 | 16 | body { 17 | font: 18px 'Open Sans'; 18 | opacity: 0; 19 | @if $UIRefresh2022 { 20 | font-family: $baseFontFamily; 21 | opacity: 1; 22 | 23 | h1 { 24 | font-size: 2rem; 25 | font-family: 'Bitter', serif; 26 | text-transform: none; 27 | letter-spacing: normal; 28 | 29 | @include media-query-large { 30 | font-size: 3.5rem; 31 | } 32 | } 33 | 34 | p { 35 | font-size: 18px; 36 | font-family: $baseFontFamily; 37 | line-height: 27px; 38 | font-weight: 360; 39 | } 40 | 41 | a { 42 | color: $link-normal; 43 | border-color: $link-normal; 44 | 45 | &:hover { 46 | color: $link-hover; 47 | border-color: $link-hover; 48 | } 49 | } 50 | } 51 | 52 | -webkit-font-smoothing: antialiased; 53 | margin: 0; 54 | } 55 | 56 | @media print { 57 | body, 58 | article { 59 | width: 100%; 60 | margin: 0; 61 | padding: 0; 62 | } 63 | 64 | @page { 65 | margin: 2cm; 66 | } 67 | 68 | a:after { 69 | content: ' <' attr(href) '> '; 70 | font-size: 0.8em; 71 | font-weight: normal; 72 | } 73 | 74 | #radar-plot { 75 | display: none; 76 | } 77 | 78 | .quadrant-table { 79 | .quadrant-table__name { 80 | display: block; 81 | font-size: 36pt; 82 | padding: 0 10px; 83 | margin-bottom: 20px; 84 | } 85 | 86 | &.first .quadrant-table__name { 87 | color: $green; 88 | } 89 | 90 | &.second .quadrant-table__name { 91 | color: $blue; 92 | } 93 | 94 | &.third .quadrant-table__name { 95 | color: $orange; 96 | } 97 | 98 | &.fourth .quadrant-table__name { 99 | color: $violet; 100 | } 101 | } 102 | 103 | .quadrant-table { 104 | page-break-after: always; 105 | 106 | ul { 107 | list-style: none; 108 | padding: 0; 109 | margin: 0; 110 | } 111 | 112 | li { 113 | page-break-inside: avoid; 114 | } 115 | 116 | h3 { 117 | page-break-before: always; 118 | padding: 0 10px; 119 | text-transform: uppercase; 120 | font-size: 18pt; 121 | font-weight: bold; 122 | } 123 | 124 | h2 + h3 { 125 | page-break-before: avoid; 126 | } 127 | } 128 | 129 | .blip-list-item { 130 | font-weight: bold; 131 | } 132 | 133 | .blip-item-description { 134 | padding: 0 15px; 135 | } 136 | 137 | header { 138 | text-align: left; 139 | 140 | .radar-title .radar-title__text { 141 | font-size: 40px; 142 | width: 100%; 143 | padding: 10px; 144 | display: block; 145 | } 146 | 147 | .radar-title .radar-title__logo { 148 | display: block; 149 | width: auto; 150 | 151 | a { 152 | padding: 40px 10px 0; 153 | display: block; 154 | 155 | &::after { 156 | display: none; 157 | } 158 | } 159 | 160 | img { 161 | max-width: 150px; 162 | } 163 | } 164 | 165 | .buttons-group { 166 | display: none; 167 | } 168 | 169 | .home-link { 170 | display: none; 171 | 172 | &.selected { 173 | display: none; 174 | } 175 | } 176 | 177 | #alternative-buttons { 178 | display: none; 179 | } 180 | 181 | .print-radar { 182 | display: none; 183 | } 184 | } 185 | 186 | #footer { 187 | display: none; 188 | } 189 | 190 | .error-container { 191 | display: none; 192 | } 193 | } 194 | 195 | @media screen { 196 | #radar { 197 | width: 80%; 198 | margin: 0 auto; 199 | position: relative; 200 | 201 | svg#radar-plot { 202 | margin: 0 auto; 203 | transition: all 1s ease; 204 | position: absolute; 205 | left: 0; 206 | right: 0; 207 | 208 | .legend { 209 | visibility: hidden; 210 | transition: visibility 1s ease 1s; 211 | color: $black; 212 | } 213 | 214 | path { 215 | &.ring-arc-3 { 216 | stroke: none; 217 | fill: $grey-light; 218 | } 219 | 220 | &.ring-arc-2 { 221 | stroke: none; 222 | fill: $grey; 223 | } 224 | 225 | &.ring-arc-1 { 226 | stroke: none; 227 | fill: $grey-dark; 228 | } 229 | 230 | &.ring-arc-0 { 231 | stroke: none; 232 | fill: $grey-darkest; 233 | } 234 | } 235 | 236 | .blip-link { 237 | text-decoration: none; 238 | cursor: pointer; 239 | } 240 | 241 | .quadrant-group { 242 | cursor: pointer; 243 | } 244 | 245 | circle, 246 | polygon, 247 | path { 248 | &.first { 249 | fill: $green; 250 | stroke: none; 251 | } 252 | 253 | &.second { 254 | fill: $blue; 255 | stroke: none; 256 | } 257 | 258 | &.third { 259 | fill: $orange; 260 | stroke: none; 261 | } 262 | 263 | &.fourth { 264 | fill: $violet; 265 | stroke: none; 266 | } 267 | } 268 | 269 | line { 270 | stroke: white; 271 | } 272 | 273 | text { 274 | &.blip-text { 275 | font-size: 9px; 276 | font-style: italic; 277 | fill: $white; 278 | } 279 | 280 | &.line-text { 281 | font-weight: bold; 282 | text-transform: uppercase; 283 | fill: $black; 284 | font-size: 7px; 285 | } 286 | } 287 | } 288 | 289 | div.quadrant-table { 290 | .quadrant-table__name { 291 | display: none; 292 | } 293 | 294 | max-height: 0; 295 | max-width: 0; 296 | position: absolute; 297 | overflow: hidden; 298 | 299 | transition: max-height 0.5s ease 1s; 300 | 301 | h3 { 302 | text-transform: uppercase; 303 | font-size: $baseFont; 304 | margin: 0; 305 | font-weight: bold; 306 | } 307 | 308 | &.first { 309 | &.selected { 310 | float: right; 311 | } 312 | } 313 | 314 | &.second { 315 | &.selected { 316 | float: left; 317 | } 318 | } 319 | 320 | &.third { 321 | &.selected { 322 | float: left; 323 | } 324 | } 325 | 326 | &.fourth { 327 | &.selected { 328 | float: right; 329 | } 330 | } 331 | 332 | &.selected { 333 | position: relative; 334 | max-height: 10000px; 335 | max-width: 40%; 336 | } 337 | 338 | ul { 339 | padding: 0; 340 | margin-left: 0; 341 | 342 | li { 343 | list-style-type: none; 344 | padding-left: 0; 345 | 346 | .blip-list-item { 347 | padding: 2px 5px; 348 | border-radius: 2px; 349 | cursor: pointer; 350 | font-size: $baseFont; 351 | font-weight: 400; 352 | 353 | &.highlight { 354 | color: white; 355 | background-color: rgba(0, 0, 0, 0.8); 356 | } 357 | } 358 | 359 | .blip-item-description { 360 | max-height: 0; 361 | overflow: hidden; 362 | width: 300px; 363 | 364 | p { 365 | margin: 0; 366 | border-top: 1px solid rgb(119, 119, 119); 367 | border-bottom: 1px solid rgb(119, 119, 119); 368 | padding: 20px; 369 | color: $grey-text; 370 | font-weight: 100; 371 | font-size: 14px; 372 | } 373 | 374 | transition: max-height 0.2s ease; 375 | 376 | &.expanded { 377 | transition: max-height 0.5s ease 0.2s; 378 | max-height: 1000px; 379 | } 380 | } 381 | } 382 | } 383 | } 384 | } 385 | } 386 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Thoughtworks](https://circleci.com/gh/thoughtworks/build-your-own-radar.svg?style=shield)](https://circleci.com/gh/thoughtworks/build-your-own-radar) 2 | [![Stars](https://badgen.net/github/stars/thoughtworks/build-your-own-radar)](https://github.com/thoughtworks/build-your-own-radar) 3 | [![dependencies Status](https://david-dm.org/thoughtworks/build-your-own-radar/status.svg)](https://david-dm.org/thoughtworks/build-your-own-radar) 4 | [![devDependencies Status](https://david-dm.org/thoughtworks/build-your-own-radar/dev-status.svg)](https://david-dm.org/thoughtworks/build-your-own-radar?type=dev) 5 | [![peerDependencies Status](https://david-dm.org/thoughtworks/build-your-own-radar/peer-status.svg)](https://david-dm.org/thoughtworks/build-your-own-radar?type=peer) 6 | [![Docker Hub Pulls](https://img.shields.io/docker/pulls/wwwthoughtworks/build-your-own-radar.svg)](https://hub.docker.com/r/wwwthoughtworks/build-your-own-radar) 7 | [![GitHub contributors](https://badgen.net/github/contributors/thoughtworks/build-your-own-radar?color=cyan)](https://github.com/thoughtworks/build-your-own-radar/graphs/contributors) 8 | [![Prettier-Standard Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/sheerun/prettier-standard) 9 | [![AGPL License](https://badgen.net/github/license/thoughtworks/build-your-own-radar)](https://github.com/thoughtworks/build-your-own-radar) 10 | 11 | A library that generates an interactive radar, inspired by [thoughtworks.com/radar](http://thoughtworks.com/radar). 12 | 13 | ## Demo 14 | 15 | You can see this in action at https://radar.thoughtworks.com. If you plug in [this data](https://docs.google.com/spreadsheets/d/1GBX3-jzlGkiKpYHF9RvVtu6GxSrco5OYTBv9YsOTXVg/edit#gid=0) you'll see [this visualization](https://radar.thoughtworks.com/?sheetId=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1GBX3-jzlGkiKpYHF9RvVtu6GxSrco5OYTBv9YsOTXVg%2Fedit%23gid%3D0). 16 | 17 | ## How To Use 18 | 19 | The easiest way to use the app out of the box is to provide a _public_ Google Sheet ID from which all the data will be fetched. You can enter that ID into the input field, sign in to Google using the prompt and your radar will be generated. The data must conform to the format below for the radar to be generated correctly. 20 | 21 | ### Setting up your data 22 | 23 | You need to make your data public in a form we can digest. 24 | 25 | Create a Google Sheet. Give it at least the below column headers, and put in the content that you want: 26 | 27 | | name | ring | quadrant | isNew | description | 28 | | ------------- | ------ | ---------------------- | ----- | ------------------------------------------------------- | 29 | | Composer | adopt | tools | TRUE | Although the idea of dependency management ... | 30 | | Canary builds | trial | techniques | FALSE | Many projects have external code dependencies ... | 31 | | Apache Kylin | assess | platforms | TRUE | Apache Kylin is an open source analytics solution ... | 32 | | JSF | hold | languages & frameworks | FALSE | We continue to see teams run into trouble using JSF ... | 33 | 34 | ### Sharing the sheet 35 | 36 | - In Google sheets, go to 'File', choose 'Publish to the web...' and then click 'Publish'. 37 | - Close the 'Publish to the web' dialog. 38 | - Copy the URL of your editable sheet from the browser (Don't worry, this does not share the editable version). 39 | 40 | The URL will be similar to [https://docs.google.com/spreadsheets/d/1waDG0_W3-yNiAaUfxcZhTKvl7AUCgXwQw8mdPjCz86U/edit](https://docs.google.com/spreadsheets/d/1waDG0_W3-yNiAaUfxcZhTKvl7AUCgXwQw8mdPjCz86U/edit). In theory we are only interested in the part between '/d/' and '/edit' but you can use the whole URL if you want. 41 | 42 | ### Using CSV data 43 | 44 | The other way to provide your data is using CSV document format. 45 | You can enter a publicly accessible URL (not behind any authentication) of a CSV file into the input field on the first page. 46 | For example, a [raw URL](https://raw.githubusercontent.com/thoughtworks/build-your-own-radar/master/spec/end_to_end_tests/resources/sheet.csv) for a CSV file hosted publicly on GitHub can be used. 47 | The format is just the same as that of the Google Sheet, the example is as follows: 48 | 49 | ``` 50 | name,ring,quadrant,isNew,description 51 | Composer,adopt,tools,TRUE,"Although the idea of dependency management ..." 52 | Canary builds,trial,techniques,FALSE,"Many projects have external code dependencies ..." 53 | Apache Kylin,assess,platforms,TRUE,"Apache Kylin is an open source analytics solution ..." 54 | JSF,hold,languages & frameworks,FALSE,"We continue to see teams run into trouble using JSF ..." 55 | ``` 56 | 57 | If you do not want to host the CSV file publicly, you can follow [these steps](#advanced-option---docker-image-with-a-csvjson-file-from-the-host-machine) to host the file locally on your BYOR docker instance itself. 58 | 59 | **_Note:_** The CSV file parsing is using D3 library, so consult the [D3 documentation](https://github.com/d3/d3-request/blob/master/README.md#csv) for the data format details. 60 | 61 | ### Using JSON data 62 | 63 | Another other way to provide your data is using a JSON array. 64 | You can enter a publicly accessible URL (not behind any authentication) of a JSON file into the input field on the first page. 65 | For example, a [raw URL](https://raw.githubusercontent.com/thoughtworks/build-your-own-radar/master/spec/end_to_end_tests/resources/data.json) for a JSON file hosted publicly on GitHub can be used. 66 | The format of the JSON is an array of objects with the the fields: `name`, `ring`, `quadrant`, `isNew`, and `description`. 67 | 68 | An example: 69 | 70 | ```json 71 | [ 72 | { 73 | "name": "Composer", 74 | "ring": "adopt", 75 | "quadrant": "tools", 76 | "isNew": "TRUE", 77 | "description": "Although the idea of dependency management ..." 78 | }, 79 | { 80 | "name": "Canary builds", 81 | "ring": "trial", 82 | "quadrant": "techniques", 83 | "isNew": "FALSE", 84 | "description": "Many projects have external code dependencies ..." 85 | }, 86 | { 87 | "name": "Apache Kylin", 88 | "ring": "assess", 89 | "quadrant": "platforms", 90 | "isNew": "TRUE", 91 | "description": "Apache Kylin is an open source analytics solution ..." 92 | }, 93 | { 94 | "name": "JSF", 95 | "ring": "hold", 96 | "quadrant": "languages & frameworks", 97 | "isNew": "FALSE", 98 | "description": "We continue to see teams run into trouble using JSF ..." 99 | } 100 | ] 101 | ``` 102 | 103 | If you do not want to host the JSON file publicly, you can follow [these steps](#advanced-option---docker-image-with-a-csvjson-file-from-the-host-machine) to host the file locally on your BYOR docker instance itself. 104 | 105 | **_Note:_** The JSON file parsing is using D3 library, so consult the [D3 documentation](https://github.com/d3/d3-request/blob/master/README.md#json) for the data format details. 106 | 107 | ### Building the radar 108 | 109 | Paste the URL in the input field on the home page. 110 | 111 | That's it! 112 | 113 | **_Note:_** The quadrants of the radar, and the order of the rings inside the radar will be drawn in the order they appear in your data. 114 | 115 | Check [this page](https://www.thoughtworks.com/radar/how-to-byor) for step by step guidance. 116 | 117 | ### More complex usage 118 | 119 | To create the data representation, you can use the Google Sheet [factory](/src/util/factory.js) or CSV, or you can also insert all your data straight into the code. 120 | 121 | The app uses [Google Sheets APIs](https://developers.google.com/sheets/api/reference/rest) to fetch the data from a Google Sheet or [D3.js](https://d3js.org/) if supplied as CSV, so refer to their documentation for more advanced interaction. The input data is sanitized by whitelisting HTML tags with [sanitize-html](https://github.com/punkave/sanitize-html). 122 | 123 | The application uses [webpack](https://webpack.github.io/) to package dependencies and minify all .js and .scss files. 124 | 125 | By default, there is no distinction between both public and private Google Sheets as we now require authentication from Google (using OAuth Client ID and optionally, API Key), per Google's updated documentation. OAuth Client ID and API Key can be obtained from your Google developer console. 126 | 127 | ``` 128 | export CLIENT_ID=[Google Client ID] 129 | ``` 130 | 131 | Optionally, API Key can be set to bypass Google Authentication for public sheets. 132 | 133 | ``` 134 | export API_KEY=[Google API Key] 135 | ``` 136 | 137 | To enable Google Tag Manager, add the following environment variable. 138 | 139 | ``` 140 | export GTM_ID=[GTM ID] 141 | ``` 142 | 143 | ## Docker Image 144 | 145 | We have released BYOR as a docker image for our users. The image is available in our [DockerHub Repo](https://hub.docker.com/r/wwwthoughtworks/build-your-own-radar/). To pull and run the image, run the following commands. 146 | 147 | ``` 148 | $ docker pull wwwthoughtworks/build-your-own-radar 149 | $ docker run --rm -p 8080:80 -e CLIENT_ID="[Google Client ID]" wwwthoughtworks/build-your-own-radar 150 | $ open http://localhost:8080 151 | ``` 152 | 153 | ### Advanced option - Docker image with a CSV/JSON file from the host machine 154 | 155 | You can check your setup by clicking on "Build my radar" and by loading the `csv`/`json` file from these locations: 156 | 157 | - http://localhost:8080/files/radar.csv 158 | - http://localhost:8080/files/radar.json 159 | 160 | ``` 161 | $ docker pull wwwthoughtworks/build-your-own-radar 162 | $ docker run --rm -p 8080:80 -e SERVER_NAMES="localhost 127.0.0.1" -v /mnt/radar/files/:/opt/build-your-own-radar/files wwwthoughtworks/build-your-own-radar 163 | $ open http://localhost:8080 164 | ``` 165 | 166 | This will: 167 | 168 | - Spawn a server that will listen locally on port 8080. 169 | - Mount the host volume on `/mnt/radar/files/` into the container on `/opt/build-your-own-radar/files/`. 170 | - Open http://localhost:8080 and for the URL enter: http://localhost:8080/files/${NAME_OF_YOUR_FILE}.${EXTENSION_OF_YOUR_FILE[csv/json]}. It needs to be a csv/json file. 171 | 172 | You can now work locally on your machine, updating the csv/json file and render the result back on your browser. 173 | There is a sample csv and json file placed in `spec/end_to_end_tests/resources/localfiles/` for reference. 174 | 175 | **_Note:_** 176 | 177 | - If API Key is also available, same can be provided to the `docker run` command as `-e API_KEY=[Google API Key]`. 178 | - For setting the `publicPath` in the webpack config while using this image, the path can be passed as an environment variable called `ASSET_PATH`. 179 | 180 | ## Contribute 181 | 182 | All tasks are defined in `package.json`. 183 | 184 | Pull requests are welcome; please write tests whenever possible. 185 | Make sure you have nodejs installed. 186 | 187 | - `git clone git@github.com:thoughtworks/build-your-own-radar.git` 188 | - `npm install` 189 | - `npm run quality` - to run your tests 190 | - `npm run dev` - to run application in localhost:8080. This will watch the .js and .css files and rebuild on file changes 191 | 192 | ## End to End Tests 193 | 194 | To run End to End tests in headless mode 195 | 196 | - add a new environment variable 'TEST_URL' and set it to 'http://localhost:8080/' 197 | - add a new environment variable 'TEST_ENV' and set it to 'development' or 'production' 198 | - `npm run test:e2e` 199 | 200 | To run End to End tests in debug mode 201 | 202 | - add a new environment variable 'TEST_URL' and set it to 'http://localhost:8080/' 203 | - add a new environment variable 'TEST_ENV' and set it to 'development' or 'production' 204 | - `npm run start` 205 | - Click on 'Run all specs' in cypress window 206 | 207 | **_Note:_** Currently, end to end tests are not working, as the flow requires Google login via prompt, which Cypress does not support. We are working to find some alternative solution for this. 208 | 209 | ### Don't want to install node? Run with one line docker 210 | 211 | $ docker run -p 8080:8080 -v $PWD:/app -w /app -it node:10.15.3 /bin/sh -c 'npm install && npm run dev' 212 | 213 | **_Note:_** If you are facing Node-sass compile error while running, please prefix the command `npm rebuild node-sass` before `npm run dev`. like this 214 | 215 | ``` 216 | npm install && npm rebuild node-sass && npm run dev 217 | ``` 218 | 219 | After building it will start on `localhost:8080` 220 | -------------------------------------------------------------------------------- /src/util/factory.js: -------------------------------------------------------------------------------- 1 | /* eslint no-constant-condition: "off" */ 2 | 3 | const d3 = require('d3') 4 | const _ = { 5 | map: require('lodash/map'), 6 | uniqBy: require('lodash/uniqBy'), 7 | capitalize: require('lodash/capitalize'), 8 | each: require('lodash/each'), 9 | } 10 | 11 | const InputSanitizer = require('./inputSanitizer') 12 | const Radar = require('../models/radar') 13 | const Quadrant = require('../models/quadrant') 14 | const Ring = require('../models/ring') 15 | const Blip = require('../models/blip') 16 | const GraphingRadar = require('../graphing/radar') 17 | const QueryParams = require('./queryParamProcessor') 18 | const MalformedDataError = require('../exceptions/malformedDataError') 19 | const SheetNotFoundError = require('../exceptions/sheetNotFoundError') 20 | const ContentValidator = require('./contentValidator') 21 | const Sheet = require('./sheet') 22 | const ExceptionMessages = require('./exceptionMessages') 23 | const GoogleAuth = require('./googleAuth') 24 | const config = require('../config') 25 | const googleAuth = require('./googleAuth') 26 | 27 | const plotRadar = function (title, blips, currentRadarName, alternativeRadars) { 28 | if (title.endsWith('.csv')) { 29 | title = title.substring(0, title.length - 4) 30 | } 31 | if (title.endsWith('.json')) { 32 | title = title.substring(0, title.length - 5) 33 | } 34 | document.title = title 35 | d3.selectAll('.loading').remove() 36 | 37 | var rings = _.map(_.uniqBy(blips, 'ring'), 'ring') 38 | var ringMap = {} 39 | var maxRings = 4 40 | 41 | _.each(rings, function (ringName, i) { 42 | if (i === maxRings) { 43 | throw new MalformedDataError(ExceptionMessages.TOO_MANY_RINGS) 44 | } 45 | ringMap[ringName] = new Ring(ringName, i) 46 | }) 47 | 48 | var quadrants = {} 49 | _.each(blips, function (blip) { 50 | if (!quadrants[blip.quadrant]) { 51 | quadrants[blip.quadrant] = new Quadrant(_.capitalize(blip.quadrant)) 52 | } 53 | quadrants[blip.quadrant].add( 54 | new Blip(blip.name, ringMap[blip.ring], blip.isNew.toLowerCase() === 'true', blip.topic, blip.description), 55 | ) 56 | }) 57 | 58 | var radar = new Radar() 59 | _.each(quadrants, function (quadrant) { 60 | radar.addQuadrant(quadrant) 61 | }) 62 | 63 | if (alternativeRadars !== undefined || true) { 64 | alternativeRadars.forEach(function (sheetName) { 65 | radar.addAlternative(sheetName) 66 | }) 67 | } 68 | 69 | if (currentRadarName !== undefined || true) { 70 | radar.setCurrentSheet(currentRadarName) 71 | } 72 | 73 | var size = window.innerHeight - 133 < 620 ? 620 : window.innerHeight - 133 74 | 75 | new GraphingRadar(size, radar).init().plot() 76 | } 77 | 78 | const GoogleSheet = function (sheetReference, sheetName) { 79 | var self = {} 80 | 81 | self.build = function () { 82 | var sheet = new Sheet(sheetReference) 83 | sheet.validate(function (error, apiKeyEnabled) { 84 | if (error instanceof SheetNotFoundError) { 85 | plotErrorMessage(error, 'sheet') 86 | return 87 | } 88 | 89 | self.authenticate(false, apiKeyEnabled) 90 | }) 91 | } 92 | 93 | function createBlipsForProtectedSheet(documentTitle, values, sheetNames) { 94 | if (!sheetName) { 95 | sheetName = sheetNames[0] 96 | } 97 | values.forEach(function () { 98 | var contentValidator = new ContentValidator(values[0]) 99 | contentValidator.verifyContent() 100 | contentValidator.verifyHeaders() 101 | }) 102 | 103 | const all = values 104 | const header = all.shift() 105 | var blips = _.map(all, (blip) => new InputSanitizer().sanitizeForProtectedSheet(blip, header)) 106 | plotRadar(documentTitle + ' - ' + sheetName, blips, sheetName, sheetNames) 107 | } 108 | 109 | self.authenticate = function (force = false, apiKeyEnabled, callback) { 110 | GoogleAuth.loadGoogle(force, function () { 111 | const sheet = new Sheet(sheetReference) 112 | sheet.isPublicSheet().then((isPublic) => { 113 | if (!isPublic && !googleAuth.gsiInitiated) { 114 | GoogleAuth.loadGSI() 115 | } else { 116 | sheet.processSheetResponse(sheetName, createBlipsForProtectedSheet, (error) => { 117 | if (error.status === 403) { 118 | plotUnauthorizedErrorMessage() 119 | } else { 120 | plotErrorMessage(error, 'sheet') 121 | } 122 | }) 123 | } 124 | }) 125 | if (callback) { 126 | callback() 127 | } 128 | }) 129 | } 130 | 131 | self.init = function () { 132 | plotLoading() 133 | return self 134 | } 135 | 136 | return self 137 | } 138 | 139 | const CSVDocument = function (url) { 140 | var self = {} 141 | 142 | self.build = function () { 143 | d3.csv(url) 144 | .then(createBlips) 145 | .catch((exception) => { 146 | plotErrorMessage(exception, 'csv') 147 | }) 148 | } 149 | 150 | var createBlips = function (data) { 151 | try { 152 | var columnNames = data.columns 153 | delete data.columns 154 | var contentValidator = new ContentValidator(columnNames) 155 | contentValidator.verifyContent() 156 | contentValidator.verifyHeaders() 157 | var blips = _.map(data, new InputSanitizer().sanitize) 158 | plotRadar(FileName(url), blips, 'CSV File', []) 159 | } catch (exception) { 160 | plotErrorMessage(exception, 'csv') 161 | } 162 | } 163 | 164 | self.init = function () { 165 | plotLoading() 166 | return self 167 | } 168 | 169 | return self 170 | } 171 | 172 | const JSONFile = function (url) { 173 | var self = {} 174 | 175 | self.build = function () { 176 | d3.json(url) 177 | .then(createBlips) 178 | .catch((exception) => { 179 | plotErrorMessage(exception, 'json') 180 | }) 181 | } 182 | 183 | var createBlips = function (data) { 184 | try { 185 | var columnNames = Object.keys(data[0]) 186 | var contentValidator = new ContentValidator(columnNames) 187 | contentValidator.verifyContent() 188 | contentValidator.verifyHeaders() 189 | var blips = _.map(data, new InputSanitizer().sanitize) 190 | plotRadar(FileName(url), blips, 'JSON File', []) 191 | } catch (exception) { 192 | plotErrorMessage(exception, 'json') 193 | } 194 | } 195 | 196 | self.init = function () { 197 | plotLoading() 198 | return self 199 | } 200 | 201 | return self 202 | } 203 | 204 | const DomainName = function (url) { 205 | var search = /.+:\/\/([^\\/]+)/ 206 | var match = search.exec(decodeURIComponent(url.replace(/\+/g, ' '))) 207 | return match == null ? null : match[1] 208 | } 209 | 210 | const FileName = function (url) { 211 | var search = /([^\\/]+)$/ 212 | var match = search.exec(decodeURIComponent(url.replace(/\+/g, ' '))) 213 | if (match != null) { 214 | var str = match[1] 215 | return str 216 | } 217 | return url 218 | } 219 | 220 | const GoogleSheetInput = function () { 221 | var self = {} 222 | var sheet 223 | 224 | self.build = function () { 225 | var domainName = DomainName(window.location.search.substring(1)) 226 | var queryString = window.location.href.match(/sheetId(.*)/) 227 | var queryParams = queryString ? QueryParams(queryString[0]) : {} 228 | 229 | if (queryParams.sheetId && queryParams.sheetId.endsWith('.csv')) { 230 | sheet = CSVDocument(queryParams.sheetId) 231 | sheet.init().build() 232 | } else if (queryParams.sheetId && queryParams.sheetId.endsWith('.json')) { 233 | sheet = JSONFile(queryParams.sheetId) 234 | sheet.init().build() 235 | } else if (domainName && domainName.endsWith('google.com') && queryParams.sheetId) { 236 | sheet = GoogleSheet(queryParams.sheetId, queryParams.sheetName) 237 | 238 | sheet.init().build() 239 | } else { 240 | if (!config.featureToggles.UIRefresh2022) { 241 | document.body.style.opacity = '1' 242 | document.body.innerHTML = '' 243 | const content = d3.select('body').append('div').attr('class', 'input-sheet') 244 | plotLogo(content) 245 | const bannerText = 246 | '

    Build your own radar

    Once you\'ve created your Radar, you can use this service' + 247 | ' to generate an
    interactive version of your Technology Radar. Not sure how? Read this first.

    ' 248 | 249 | plotBanner(content, bannerText) 250 | 251 | plotForm(content) 252 | 253 | plotFooter(content) 254 | } 255 | 256 | setDocumentTitle() 257 | } 258 | } 259 | 260 | return self 261 | } 262 | 263 | function setDocumentTitle() { 264 | document.title = 'Build your own Radar' 265 | } 266 | 267 | function plotLoading(content) { 268 | if (!config.featureToggles.UIRefresh2022) { 269 | document.body.style.opacity = '1' 270 | document.body.innerHTML = '' 271 | content = d3.select('body').append('div').attr('class', 'loading').append('div').attr('class', 'input-sheet') 272 | 273 | setDocumentTitle() 274 | 275 | plotLogo(content) 276 | 277 | var bannerText = 278 | '

    Building your radar...

    Your Technology Radar will be available in just a few seconds

    ' 279 | plotBanner(content, bannerText) 280 | plotFooter(content) 281 | } else { 282 | document.querySelector('.helper-description > p').style.display = 'none' 283 | document.querySelector('.input-sheet-form').style.display = 'none' 284 | document.querySelector('.helper-description .loader-text').style.display = 'block' 285 | } 286 | } 287 | 288 | function plotLogo(content) { 289 | content 290 | .append('div') 291 | .attr('class', 'input-sheet__logo') 292 | .html('') 293 | } 294 | 295 | function plotFooter(content) { 296 | content 297 | .append('div') 298 | .attr('id', 'footer') 299 | .append('div') 300 | .attr('class', 'footer-content') 301 | .append('p') 302 | .html( 303 | 'Powered by Thoughtworks. ' + 304 | 'By using this service you agree to Thoughtworks\' terms of use. ' + 305 | 'You also agree to our privacy policy, which describes how we will gather, use and protect any personal data contained in your public Google Sheet. ' + 306 | 'This software is open source and available for download and self-hosting.', 307 | ) 308 | } 309 | 310 | function plotBanner(content, text) { 311 | content.append('div').attr('class', 'input-sheet__banner').html(text) 312 | } 313 | 314 | function plotForm(content) { 315 | content 316 | .append('div') 317 | .attr('class', 'input-sheet__form') 318 | .append('p') 319 | .html( 320 | 'Enter the URL of your Google Sheet, CSV or JSON file below…', 321 | ) 322 | 323 | var form = content.select('.input-sheet__form').append('form').attr('method', 'get') 324 | 325 | form 326 | .append('input') 327 | .attr('type', 'text') 328 | .attr('name', 'sheetId') 329 | .attr('placeholder', 'e.g. https://docs.google.com/spreadsheets/d/ or hosted CSV/JSON file') 330 | .attr('required', '') 331 | 332 | form.append('button').attr('type', 'submit').append('a').attr('class', 'button').text('Build my radar') 333 | 334 | form.append('p').html("Need help?") 335 | } 336 | 337 | function plotErrorMessage(exception, fileType) { 338 | if (config.featureToggles.UIRefresh2022) { 339 | showErrorMessage(exception, fileType) 340 | } else { 341 | const content = d3.select('body').append('div').attr('class', 'input-sheet') 342 | setDocumentTitle() 343 | 344 | plotLogo(content) 345 | 346 | const bannerText = 347 | '

    Build your own radar

    Once you\'ve created your Radar, you can use this service' + 348 | ' to generate an
    interactive version of your Technology Radar. Not sure how? Read this first.

    ' 349 | 350 | plotBanner(content, bannerText) 351 | 352 | d3.selectAll('.loading').remove() 353 | plotError(exception, content, fileType) 354 | 355 | plotFooter(content) 356 | } 357 | } 358 | 359 | function plotError(exception, container, fileType) { 360 | let file = 'Google Sheet' 361 | if (fileType === 'json') { 362 | file = 'Json file' 363 | } else if (fileType === 'csv') { 364 | file = 'CSV file' 365 | } 366 | let message = `Oops! We can't find the ${file} you've entered` 367 | let faqMessage = 368 | 'Please check FAQs for possible solutions.' 369 | if (exception instanceof MalformedDataError) { 370 | message = message.concat(exception.message) 371 | } else if (exception instanceof SheetNotFoundError) { 372 | message = exception.message 373 | } else { 374 | console.error(exception) 375 | } 376 | container = container.append('div').attr('class', 'error-container') 377 | const errorContainer = container.append('div').attr('class', 'error-container__message') 378 | errorContainer.append('div').append('p').html(message) 379 | errorContainer.append('div').append('p').html(faqMessage) 380 | 381 | let homePageURL = window.location.protocol + '//' + window.location.hostname 382 | homePageURL += window.location.port === '' ? '' : ':' + window.location.port 383 | const homePage = 'GO BACK' 384 | 385 | errorContainer.append('div').append('p').html(homePage) 386 | } 387 | 388 | function showErrorMessage(exception, fileType) { 389 | document.querySelector('.helper-description .loader-text').style.display = 'none' 390 | const container = d3.select('main').append('div').attr('class', 'error-container') 391 | plotError(exception, container, fileType) 392 | } 393 | 394 | function plotUnauthorizedErrorMessage() { 395 | let content 396 | const helperDescription = d3.select('.helper-description') 397 | if (!config.featureToggles.UIRefresh2022) { 398 | content = d3.select('body').append('div').attr('class', 'input-sheet') 399 | setDocumentTitle() 400 | 401 | plotLogo(content) 402 | 403 | const bannerText = '

    Build your own radar

    ' 404 | 405 | plotBanner(content, bannerText) 406 | 407 | d3.selectAll('.loading').remove() 408 | } else { 409 | content = d3.select('main') 410 | helperDescription.style('display', 'none') 411 | } 412 | const currentUser = GoogleAuth.getEmail() 413 | let homePageURL = window.location.protocol + '//' + window.location.hostname 414 | homePageURL += window.location.port === '' ? '' : ':' + window.location.port 415 | const goBack = 'GO BACK' 416 | const message = `Oops! Looks like you are accessing this sheet using ${currentUser}, which does not have permission.Try switching to another account.` 417 | 418 | const container = content.append('div').attr('class', 'error-container') 419 | 420 | const errorContainer = container.append('div').attr('class', 'error-container__message') 421 | 422 | errorContainer.append('div').append('p').attr('class', 'error-title').html(message) 423 | 424 | const button = errorContainer.append('button').attr('class', 'button switch-account-button').text('SWITCH ACCOUNT') 425 | 426 | errorContainer 427 | .append('div') 428 | .append('p') 429 | .attr('class', 'error-subtitle') 430 | .html(`or ${goBack} to try a different sheet.`) 431 | 432 | button.on('click', () => { 433 | var queryString = window.location.href.match(/sheetId(.*)/) 434 | var queryParams = queryString ? QueryParams(queryString[0]) : {} 435 | const sheet = GoogleSheet(queryParams.sheetId, queryParams.sheetName) 436 | sheet.authenticate(true, false, () => { 437 | if (config.featureToggles.UIRefresh2022) { 438 | helperDescription.style('display', 'block') 439 | errorContainer.remove() 440 | } else { 441 | content.remove() 442 | } 443 | }) 444 | }) 445 | } 446 | 447 | module.exports = GoogleSheetInput 448 | -------------------------------------------------------------------------------- /src/graphing/radar.js: -------------------------------------------------------------------------------- 1 | const d3 = require('d3') 2 | const { default: d3tip } = require('d3-tip') 3 | const Chance = require('chance') 4 | const _ = require('lodash/core') 5 | 6 | const RingCalculator = require('../util/ringCalculator') 7 | const QueryParams = require('../util/queryParamProcessor') 8 | const AutoComplete = require('../util/autoComplete') 9 | const config = require('../config') 10 | 11 | const MIN_BLIP_WIDTH = 12 12 | const ANIMATION_DURATION = 1000 13 | 14 | const Radar = function (size, radar) { 15 | var svg, radarElement, quadrantButtons, buttonsGroup, header, alternativeDiv 16 | 17 | var tip = d3tip() 18 | .attr('class', 'd3-tip') 19 | .html(function (text) { 20 | return text 21 | }) 22 | 23 | tip.direction(function () { 24 | if (d3.select('.quadrant-table.selected').node()) { 25 | var selectedQuadrant = d3.select('.quadrant-table.selected') 26 | if (selectedQuadrant.classed('first') || selectedQuadrant.classed('fourth')) { 27 | return 'ne' 28 | } else { 29 | return 'nw' 30 | } 31 | } 32 | return 'n' 33 | }) 34 | 35 | var ringCalculator = new RingCalculator(radar.rings().length, center()) 36 | 37 | var self = {} 38 | var chance 39 | 40 | function center() { 41 | return Math.round(size / 2) 42 | } 43 | 44 | function toRadian(angleInDegrees) { 45 | return (Math.PI * angleInDegrees) / 180 46 | } 47 | 48 | function plotLines(quadrantGroup, quadrant) { 49 | var startX = size * (1 - (-Math.sin(toRadian(quadrant.startAngle)) + 1) / 2) 50 | var endX = size * (1 - (-Math.sin(toRadian(quadrant.startAngle - 90)) + 1) / 2) 51 | 52 | var startY = size * (1 - (Math.cos(toRadian(quadrant.startAngle)) + 1) / 2) 53 | var endY = size * (1 - (Math.cos(toRadian(quadrant.startAngle - 90)) + 1) / 2) 54 | 55 | if (startY > endY) { 56 | var aux = endY 57 | endY = startY 58 | startY = aux 59 | } 60 | 61 | quadrantGroup 62 | .append('line') 63 | .attr('x1', center()) 64 | .attr('x2', center()) 65 | .attr('y1', startY - 2) 66 | .attr('y2', endY + 2) 67 | .attr('stroke-width', 10) 68 | 69 | quadrantGroup 70 | .append('line') 71 | .attr('x1', endX) 72 | .attr('y1', center()) 73 | .attr('x2', startX) 74 | .attr('y2', center()) 75 | .attr('stroke-width', 10) 76 | } 77 | 78 | function plotQuadrant(rings, quadrant) { 79 | var quadrantGroup = svg 80 | .append('g') 81 | .attr('class', 'quadrant-group quadrant-group-' + quadrant.order) 82 | .on('mouseover', mouseoverQuadrant.bind({}, quadrant.order)) 83 | .on('mouseout', mouseoutQuadrant.bind({}, quadrant.order)) 84 | .on('click', selectQuadrant.bind({}, quadrant.order, quadrant.startAngle)) 85 | 86 | rings.forEach(function (ring, i) { 87 | var arc = d3 88 | .arc() 89 | .innerRadius(ringCalculator.getRadius(i)) 90 | .outerRadius(ringCalculator.getRadius(i + 1)) 91 | .startAngle(toRadian(quadrant.startAngle)) 92 | .endAngle(toRadian(quadrant.startAngle - 90)) 93 | 94 | quadrantGroup 95 | .append('path') 96 | .attr('d', arc) 97 | .attr('class', 'ring-arc-' + ring.order()) 98 | .attr('transform', 'translate(' + center() + ', ' + center() + ')') 99 | }) 100 | 101 | return quadrantGroup 102 | } 103 | 104 | function plotTexts(quadrantGroup, rings, quadrant) { 105 | rings.forEach(function (ring, i) { 106 | if (quadrant.order === 'first' || quadrant.order === 'fourth') { 107 | quadrantGroup 108 | .append('text') 109 | .attr('class', 'line-text') 110 | .attr('y', center() + 4) 111 | .attr('x', center() + (ringCalculator.getRadius(i) + ringCalculator.getRadius(i + 1)) / 2) 112 | .attr('text-anchor', 'middle') 113 | .text(ring.name()) 114 | } else { 115 | quadrantGroup 116 | .append('text') 117 | .attr('class', 'line-text') 118 | .attr('y', center() + 4) 119 | .attr('x', center() - (ringCalculator.getRadius(i) + ringCalculator.getRadius(i + 1)) / 2) 120 | .attr('text-anchor', 'middle') 121 | .text(ring.name()) 122 | } 123 | }) 124 | } 125 | 126 | function triangle(blip, x, y, order, group) { 127 | return group 128 | .append('path') 129 | .attr( 130 | 'd', 131 | 'M412.201,311.406c0.021,0,0.042,0,0.063,0c0.067,0,0.135,0,0.201,0c4.052,0,6.106-0.051,8.168-0.102c2.053-0.051,4.115-0.102,8.176-0.102h0.103c6.976-0.183,10.227-5.306,6.306-11.53c-3.988-6.121-4.97-5.407-8.598-11.224c-1.631-3.008-3.872-4.577-6.179-4.577c-2.276,0-4.613,1.528-6.48,4.699c-3.578,6.077-3.26,6.014-7.306,11.723C402.598,306.067,405.426,311.406,412.201,311.406', 132 | ) 133 | .attr( 134 | 'transform', 135 | 'scale(' + 136 | blip.width / 34 + 137 | ') translate(' + 138 | (-404 + x * (34 / blip.width) - 17) + 139 | ', ' + 140 | (-282 + y * (34 / blip.width) - 17) + 141 | ')', 142 | ) 143 | .attr('class', order) 144 | } 145 | 146 | function triangleLegend(x, y, group) { 147 | return group 148 | .append('path') 149 | .attr( 150 | 'd', 151 | 'M412.201,311.406c0.021,0,0.042,0,0.063,0c0.067,0,0.135,0,0.201,0c4.052,0,6.106-0.051,8.168-0.102c2.053-0.051,4.115-0.102,8.176-0.102h0.103c6.976-0.183,10.227-5.306,6.306-11.53c-3.988-6.121-4.97-5.407-8.598-11.224c-1.631-3.008-3.872-4.577-6.179-4.577c-2.276,0-4.613,1.528-6.48,4.699c-3.578,6.077-3.26,6.014-7.306,11.723C402.598,306.067,405.426,311.406,412.201,311.406', 152 | ) 153 | .attr( 154 | 'transform', 155 | 'scale(' + 22 / 64 + ') translate(' + (-404 + x * (64 / 22) - 17) + ', ' + (-282 + y * (64 / 22) - 17) + ')', 156 | ) 157 | } 158 | 159 | function circle(blip, x, y, order, group) { 160 | return (group || svg) 161 | .append('path') 162 | .attr( 163 | 'd', 164 | 'M420.084,282.092c-1.073,0-2.16,0.103-3.243,0.313c-6.912,1.345-13.188,8.587-11.423,16.874c1.732,8.141,8.632,13.711,17.806,13.711c0.025,0,0.052,0,0.074-0.003c0.551-0.025,1.395-0.011,2.225-0.109c4.404-0.534,8.148-2.218,10.069-6.487c1.747-3.886,2.114-7.993,0.913-12.118C434.379,286.944,427.494,282.092,420.084,282.092', 165 | ) 166 | .attr( 167 | 'transform', 168 | 'scale(' + 169 | blip.width / 34 + 170 | ') translate(' + 171 | (-404 + x * (34 / blip.width) - 17) + 172 | ', ' + 173 | (-282 + y * (34 / blip.width) - 17) + 174 | ')', 175 | ) 176 | .attr('class', order) 177 | } 178 | 179 | function circleLegend(x, y, group) { 180 | return (group || svg) 181 | .append('path') 182 | .attr( 183 | 'd', 184 | 'M420.084,282.092c-1.073,0-2.16,0.103-3.243,0.313c-6.912,1.345-13.188,8.587-11.423,16.874c1.732,8.141,8.632,13.711,17.806,13.711c0.025,0,0.052,0,0.074-0.003c0.551-0.025,1.395-0.011,2.225-0.109c4.404-0.534,8.148-2.218,10.069-6.487c1.747-3.886,2.114-7.993,0.913-12.118C434.379,286.944,427.494,282.092,420.084,282.092', 185 | ) 186 | .attr( 187 | 'transform', 188 | 'scale(' + 22 / 64 + ') translate(' + (-404 + x * (64 / 22) - 17) + ', ' + (-282 + y * (64 / 22) - 17) + ')', 189 | ) 190 | } 191 | 192 | function addRing(ring, order) { 193 | var table = d3.select('.quadrant-table.' + order) 194 | table.append('h3').text(ring) 195 | return table.append('ul') 196 | } 197 | 198 | function calculateBlipCoordinates(blip, chance, minRadius, maxRadius, startAngle) { 199 | var adjustX = Math.sin(toRadian(startAngle)) - Math.cos(toRadian(startAngle)) 200 | var adjustY = -Math.cos(toRadian(startAngle)) - Math.sin(toRadian(startAngle)) 201 | 202 | var radius = chance.floating({ 203 | min: minRadius + blip.width / 2, 204 | max: maxRadius - blip.width / 2, 205 | }) 206 | var angleDelta = (Math.asin(blip.width / 2 / radius) * 180) / (Math.PI - 1.25) 207 | angleDelta = angleDelta > 45 ? 45 : angleDelta 208 | var angle = toRadian(chance.integer({ min: angleDelta, max: 90 - angleDelta })) 209 | 210 | var x = center() + radius * Math.cos(angle) * adjustX 211 | var y = center() + radius * Math.sin(angle) * adjustY 212 | 213 | return [x, y] 214 | } 215 | 216 | function thereIsCollision(blip, coordinates, allCoordinates) { 217 | return allCoordinates.some(function (currentCoordinates) { 218 | return ( 219 | Math.abs(currentCoordinates[0] - coordinates[0]) < blip.width && 220 | Math.abs(currentCoordinates[1] - coordinates[1]) < blip.width 221 | ) 222 | }) 223 | } 224 | 225 | function plotBlips(quadrantGroup, rings, quadrantWrapper) { 226 | var blips, quadrant, startAngle, order 227 | 228 | quadrant = quadrantWrapper.quadrant 229 | startAngle = quadrantWrapper.startAngle 230 | order = quadrantWrapper.order 231 | 232 | d3.select('.quadrant-table.' + order) 233 | .append('h2') 234 | .attr('class', 'quadrant-table__name') 235 | .text(quadrant.name()) 236 | 237 | blips = quadrant.blips() 238 | rings.forEach(function (ring, i) { 239 | var ringBlips = blips.filter(function (blip) { 240 | return blip.ring() === ring 241 | }) 242 | 243 | if (ringBlips.length === 0) { 244 | return 245 | } 246 | 247 | var maxRadius, minRadius 248 | 249 | minRadius = ringCalculator.getRadius(i) 250 | maxRadius = ringCalculator.getRadius(i + 1) 251 | 252 | var sumRing = ring 253 | .name() 254 | .split('') 255 | .reduce(function (p, c) { 256 | return p + c.charCodeAt(0) 257 | }, 0) 258 | var sumQuadrant = quadrant 259 | .name() 260 | .split('') 261 | .reduce(function (p, c) { 262 | return p + c.charCodeAt(0) 263 | }, 0) 264 | chance = new Chance(Math.PI * sumRing * ring.name().length * sumQuadrant * quadrant.name().length) 265 | 266 | var ringList = addRing(ring.name(), order) 267 | var allBlipCoordinatesInRing = [] 268 | 269 | ringBlips.forEach(function (blip) { 270 | const coordinates = findBlipCoordinates(blip, minRadius, maxRadius, startAngle, allBlipCoordinatesInRing) 271 | 272 | allBlipCoordinatesInRing.push(coordinates) 273 | drawBlipInCoordinates(blip, coordinates, order, quadrantGroup, ringList) 274 | }) 275 | }) 276 | } 277 | 278 | function findBlipCoordinates(blip, minRadius, maxRadius, startAngle, allBlipCoordinatesInRing) { 279 | const maxIterations = 200 280 | var coordinates = calculateBlipCoordinates(blip, chance, minRadius, maxRadius, startAngle) 281 | var iterationCounter = 0 282 | var foundAPlace = false 283 | 284 | while (iterationCounter < maxIterations) { 285 | if (thereIsCollision(blip, coordinates, allBlipCoordinatesInRing)) { 286 | coordinates = calculateBlipCoordinates(blip, chance, minRadius, maxRadius, startAngle) 287 | } else { 288 | foundAPlace = true 289 | break 290 | } 291 | iterationCounter++ 292 | } 293 | 294 | if (!foundAPlace && blip.width > MIN_BLIP_WIDTH) { 295 | blip.width = blip.width - 1 296 | return findBlipCoordinates(blip, minRadius, maxRadius, startAngle, allBlipCoordinatesInRing) 297 | } else { 298 | return coordinates 299 | } 300 | } 301 | 302 | function drawBlipInCoordinates(blip, coordinates, order, quadrantGroup, ringList) { 303 | var x = coordinates[0] 304 | var y = coordinates[1] 305 | 306 | var group = quadrantGroup 307 | .append('g') 308 | .attr('class', 'blip-link') 309 | .attr('id', 'blip-link-' + blip.number()) 310 | 311 | if (blip.isNew()) { 312 | triangle(blip, x, y, order, group) 313 | } else { 314 | circle(blip, x, y, order, group) 315 | } 316 | 317 | group 318 | .append('text') 319 | .attr('x', x) 320 | .attr('y', y + 4) 321 | .attr('class', 'blip-text') 322 | // derive font-size from current blip width 323 | .style('font-size', (blip.width * 10) / 22 + 'px') 324 | .attr('text-anchor', 'middle') 325 | .text(blip.number()) 326 | 327 | var blipListItem = ringList.append('li') 328 | var blipText = blip.number() + '. ' + blip.name() + (blip.topic() ? '. - ' + blip.topic() : '') 329 | blipListItem 330 | .append('div') 331 | .attr('class', 'blip-list-item') 332 | .attr('id', 'blip-list-item-' + blip.number()) 333 | .text(blipText) 334 | 335 | var blipItemDescription = blipListItem 336 | .append('div') 337 | .attr('id', 'blip-description-' + blip.number()) 338 | .attr('class', 'blip-item-description') 339 | if (blip.description()) { 340 | blipItemDescription.append('p').html(blip.description()) 341 | } 342 | 343 | var mouseOver = function () { 344 | d3.selectAll('g.blip-link').attr('opacity', 0.3) 345 | group.attr('opacity', 1.0) 346 | blipListItem.selectAll('.blip-list-item').classed('highlight', true) 347 | tip.show(blip.name(), group.node()) 348 | } 349 | 350 | var mouseOut = function () { 351 | d3.selectAll('g.blip-link').attr('opacity', 1.0) 352 | blipListItem.selectAll('.blip-list-item').classed('highlight', false) 353 | tip.hide().style('left', 0).style('top', 0) 354 | } 355 | 356 | blipListItem.on('mouseover', mouseOver).on('mouseout', mouseOut) 357 | group.on('mouseover', mouseOver).on('mouseout', mouseOut) 358 | 359 | var clickBlip = function () { 360 | d3.select('.blip-item-description.expanded').node() !== blipItemDescription.node() && 361 | d3.select('.blip-item-description.expanded').classed('expanded', false) 362 | blipItemDescription.classed('expanded', !blipItemDescription.classed('expanded')) 363 | 364 | blipItemDescription.on('click', function () { 365 | d3.event.stopPropagation() 366 | }) 367 | } 368 | 369 | blipListItem.on('click', clickBlip) 370 | } 371 | 372 | function removeHomeLink() { 373 | d3.select('.home-link').remove() 374 | } 375 | 376 | function createHomeLink(pageElement) { 377 | if (pageElement.select('.home-link').empty()) { 378 | pageElement 379 | .insert('div', 'div#alternative-buttons') 380 | .html('« Back to Radar home') 381 | .classed('home-link', true) 382 | .classed('selected', true) 383 | .on('click', redrawFullRadar) 384 | .append('g') 385 | .attr('fill', '#626F87') 386 | .append('path') 387 | .attr( 388 | 'd', 389 | 'M27.6904224,13.939279 C27.6904224,13.7179572 27.6039633,13.5456925 27.4314224,13.4230122 L18.9285959,6.85547454 C18.6819796,6.65886965 18.410898,6.65886965 18.115049,6.85547454 L9.90776939,13.4230122 C9.75999592,13.5456925 9.68592041,13.7179572 9.68592041,13.939279 L9.68592041,25.7825947 C9.68592041,25.979501 9.74761224,26.1391059 9.87092041,26.2620876 C9.99415306,26.3851446 10.1419265,26.4467108 10.3145429,26.4467108 L15.1946918,26.4467108 C15.391698,26.4467108 15.5518551,26.3851446 15.6751633,26.2620876 C15.7984714,26.1391059 15.8600878,25.979501 15.8600878,25.7825947 L15.8600878,18.5142424 L21.4794061,18.5142424 L21.4794061,25.7822933 C21.4794061,25.9792749 21.5410224,26.1391059 21.6643306,26.2620876 C21.7876388,26.3851446 21.9477959,26.4467108 22.1448776,26.4467108 L27.024951,26.4467108 C27.2220327,26.4467108 27.3821898,26.3851446 27.505498,26.2620876 C27.6288061,26.1391059 27.6904224,25.9792749 27.6904224,25.7822933 L27.6904224,13.939279 Z M18.4849735,0.0301425662 C21.0234,0.0301425662 23.4202449,0.515814664 25.6755082,1.48753564 C27.9308469,2.45887984 29.8899592,3.77497963 31.5538265,5.43523218 C33.2173918,7.09540937 34.5358755,9.05083299 35.5095796,11.3015031 C36.4829061,13.5518717 36.9699469,15.9439104 36.9699469,18.4774684 C36.9699469,20.1744196 36.748098,21.8101813 36.3044755,23.3844521 C35.860551,24.9584216 35.238498,26.4281731 34.4373347,27.7934053 C33.6362469,29.158336 32.6753041,30.4005112 31.5538265,31.5197047 C30.432349,32.6388982 29.1876388,33.5981853 27.8199224,34.3973401 C26.4519041,35.1968717 24.9791531,35.8176578 23.4016694,36.2606782 C21.8244878,36.7033971 20.1853878,36.9247943 18.4849735,36.9247943 C16.7841816,36.9247943 15.1453837,36.7033971 13.5679755,36.2606782 C11.9904918,35.8176578 10.5180429,35.1968717 9.15002449,34.3973401 C7.78223265,33.5978839 6.53752245,32.6388982 5.41612041,31.5197047 C4.29464286,30.4005112 3.33339796,29.158336 2.53253673,27.7934053 C1.73144898,26.4281731 1.10909388,24.9584216 0.665395918,23.3844521 C0.22184898,21.8101813 0,20.1744196 0,18.4774684 C0,16.7801405 0.22184898,15.1446802 0.665395918,13.5704847 C1.10909388,11.9962138 1.73144898,10.5267637 2.53253673,9.16153157 C3.33339796,7.79652546 4.29464286,6.55435031 5.41612041,5.43523218 C6.53752245,4.3160387 7.78223265,3.35675153 9.15002449,2.55752138 C10.5180429,1.75806517 11.9904918,1.13690224 13.5679755,0.694183299 C15.1453837,0.251464358 16.7841816,0.0301425662 18.4849735,0.0301425662 L18.4849735,0.0301425662 Z', 390 | ) 391 | } 392 | } 393 | 394 | function removeRadarLegend() { 395 | d3.select('.legend').remove() 396 | } 397 | 398 | function drawLegend(order) { 399 | removeRadarLegend() 400 | 401 | var triangleKey = 'New or moved' 402 | var circleKey = 'No change' 403 | 404 | var container = d3 405 | .select('svg') 406 | .append('g') 407 | .attr('class', 'legend legend' + '-' + order) 408 | 409 | var x = 10 410 | var y = 10 411 | 412 | if (order === 'first') { 413 | x = (4 * size) / 5 414 | y = (1 * size) / 5 415 | } 416 | 417 | if (order === 'second') { 418 | x = (1 * size) / 5 - 15 419 | y = (1 * size) / 5 - 20 420 | } 421 | 422 | if (order === 'third') { 423 | x = (1 * size) / 5 - 15 424 | y = (4 * size) / 5 + 15 425 | } 426 | 427 | if (order === 'fourth') { 428 | x = (4 * size) / 5 429 | y = (4 * size) / 5 430 | } 431 | 432 | d3.select('.legend') 433 | .attr('class', 'legend legend-' + order) 434 | .transition() 435 | .style('visibility', 'visible') 436 | 437 | triangleLegend(x, y, container) 438 | 439 | container 440 | .append('text') 441 | .attr('x', x + 15) 442 | .attr('y', y + 5) 443 | .attr('font-size', '0.8em') 444 | .text(triangleKey) 445 | 446 | circleLegend(x, y + 20, container) 447 | 448 | container 449 | .append('text') 450 | .attr('x', x + 15) 451 | .attr('y', y + 25) 452 | .attr('font-size', '0.8em') 453 | .text(circleKey) 454 | } 455 | 456 | function redrawFullRadar() { 457 | removeHomeLink() 458 | removeRadarLegend() 459 | tip.hide() 460 | d3.selectAll('g.blip-link').attr('opacity', 1.0) 461 | 462 | svg.style('left', 0).style('right', 0) 463 | 464 | d3.selectAll('.button').classed('selected', false).classed('full-view', true) 465 | 466 | d3.selectAll('.quadrant-table').classed('selected', false) 467 | d3.selectAll('.home-link').classed('selected', false) 468 | 469 | d3.selectAll('.quadrant-group').transition().duration(ANIMATION_DURATION).attr('transform', 'scale(1)') 470 | 471 | d3.selectAll('.quadrant-group .blip-link').transition().duration(ANIMATION_DURATION).attr('transform', 'scale(1)') 472 | 473 | d3.selectAll('.quadrant-group').style('pointer-events', 'auto') 474 | } 475 | 476 | function searchBlip(_e, ui) { 477 | const { blip, quadrant } = ui.item 478 | const isQuadrantSelected = d3.select('div.button.' + quadrant.order).classed('selected') 479 | selectQuadrant.bind({}, quadrant.order, quadrant.startAngle)() 480 | const selectedDesc = d3.select('#blip-description-' + blip.number()) 481 | d3.select('.blip-item-description.expanded').node() !== selectedDesc.node() && 482 | d3.select('.blip-item-description.expanded').classed('expanded', false) 483 | selectedDesc.classed('expanded', true) 484 | 485 | d3.selectAll('g.blip-link').attr('opacity', 0.3) 486 | const group = d3.select('#blip-link-' + blip.number()) 487 | group.attr('opacity', 1.0) 488 | d3.selectAll('.blip-list-item').classed('highlight', false) 489 | d3.select('#blip-list-item-' + blip.number()).classed('highlight', true) 490 | if (isQuadrantSelected) { 491 | tip.show(blip.name(), group.node()) 492 | } else { 493 | // need to account for the animation time associated with selecting a quadrant 494 | tip.hide() 495 | 496 | setTimeout(function () { 497 | tip.show(blip.name(), group.node()) 498 | }, ANIMATION_DURATION) 499 | } 500 | } 501 | 502 | function plotRadarHeader() { 503 | header = d3.select('body').insert('header', '#radar') 504 | header 505 | .append('div') 506 | .attr('class', 'radar-title') 507 | .append('div') 508 | .attr('class', 'radar-title__text') 509 | .append('h1') 510 | .text(document.title) 511 | .style('cursor', 'pointer') 512 | .on('click', redrawFullRadar) 513 | 514 | header 515 | .select('.radar-title') 516 | .append('div') 517 | .attr('class', 'radar-title__logo') 518 | .html(' ') 519 | 520 | buttonsGroup = header.append('div').classed('buttons-group', true) 521 | 522 | quadrantButtons = buttonsGroup.append('div').classed('quadrant-btn--group', true) 523 | 524 | alternativeDiv = header.append('div').attr('id', 'alternative-buttons') 525 | 526 | return header 527 | } 528 | 529 | function plotHeader() { 530 | document.querySelector('.hero-banner__title-text').innerHTML = document.title 531 | const radarWrapper = d3.select('main .graph-placeholder') 532 | document.querySelector('.hero-banner__title-text').addEventListener('click', redrawFullRadar) 533 | 534 | buttonsGroup = radarWrapper.append('div').classed('buttons-group', true) 535 | 536 | quadrantButtons = buttonsGroup.append('div').classed('quadrant-btn--group', true) 537 | 538 | alternativeDiv = radarWrapper.append('div').attr('id', 'alternative-buttons') 539 | 540 | return radarWrapper 541 | } 542 | 543 | function plotQuadrantButtons(quadrants) { 544 | function addButton(quadrant) { 545 | radarElement.append('div').attr('class', 'quadrant-table ' + quadrant.order) 546 | 547 | quadrantButtons 548 | .append('div') 549 | .attr('class', 'button ' + quadrant.order + ' full-view') 550 | .text(quadrant.quadrant.name()) 551 | .on('mouseover', mouseoverQuadrant.bind({}, quadrant.order)) 552 | .on('mouseout', mouseoutQuadrant.bind({}, quadrant.order)) 553 | .on('click', selectQuadrant.bind({}, quadrant.order, quadrant.startAngle)) 554 | } 555 | 556 | _.each([0, 1, 2, 3], function (i) { 557 | addButton(quadrants[i]) 558 | }) 559 | 560 | buttonsGroup 561 | .append('div') 562 | .classed('print-radar-btn', true) 563 | .append('div') 564 | .classed('print-radar button no-capitalize', true) 565 | .text('Print this radar') 566 | .on('click', window.print.bind(window)) 567 | 568 | alternativeDiv 569 | .append('div') 570 | .classed('search-box', true) 571 | .append('input') 572 | .attr('id', 'auto-complete') 573 | .attr('placeholder', 'Search') 574 | .classed('search-radar', true) 575 | 576 | AutoComplete('#auto-complete', quadrants, searchBlip) 577 | } 578 | 579 | function plotRadarFooter() { 580 | d3.select('body') 581 | .insert('div', '#radar-plot + *') 582 | .attr('id', 'footer') 583 | .append('div') 584 | .attr('class', 'footer-content') 585 | .append('p') 586 | .html( 587 | 'Powered by Thoughtworks. ' + 588 | 'By using this service you agree to Thoughtworks\' terms of use. ' + 589 | 'You also agree to our privacy policy, which describes how we will gather, use and protect any personal data contained in your public Google Sheet. ' + 590 | 'This software is open source and available for download and self-hosting.', 591 | ) 592 | } 593 | 594 | function mouseoverQuadrant(order) { 595 | d3.select('.quadrant-group-' + order).style('opacity', 1) 596 | d3.selectAll('.quadrant-group:not(.quadrant-group-' + order + ')').style('opacity', 0.3) 597 | } 598 | 599 | function mouseoutQuadrant(order) { 600 | d3.selectAll('.quadrant-group:not(.quadrant-group-' + order + ')').style('opacity', 1) 601 | } 602 | 603 | function selectQuadrant(order, startAngle) { 604 | d3.selectAll('.home-link').classed('selected', false) 605 | createHomeLink(d3.select('header')) 606 | 607 | d3.selectAll('.button').classed('selected', false).classed('full-view', false) 608 | d3.selectAll('.button.' + order).classed('selected', true) 609 | d3.selectAll('.quadrant-table').classed('selected', false) 610 | d3.selectAll('.quadrant-table.' + order).classed('selected', true) 611 | d3.selectAll('.blip-item-description').classed('expanded', false) 612 | 613 | var scale = 2 614 | 615 | var adjustX = Math.sin(toRadian(startAngle)) - Math.cos(toRadian(startAngle)) 616 | var adjustY = Math.cos(toRadian(startAngle)) + Math.sin(toRadian(startAngle)) 617 | 618 | var translateX = ((-1 * (1 + adjustX) * size) / 2) * (scale - 1) + -adjustX * (1 - scale / 2) * size 619 | var translateY = -1 * (1 - adjustY) * (size / 2 - 7) * (scale - 1) - ((1 - adjustY) / 2) * (1 - scale / 2) * size 620 | 621 | var translateXAll = (((1 - adjustX) / 2) * size * scale) / 2 + ((1 - adjustX) / 2) * (1 - scale / 2) * size 622 | var translateYAll = (((1 + adjustY) / 2) * size * scale) / 2 623 | 624 | var moveRight = ((1 + adjustX) * (0.8 * window.innerWidth - size)) / 2 625 | var moveLeft = ((1 - adjustX) * (0.8 * window.innerWidth - size)) / 2 626 | 627 | var blipScale = 3 / 4 628 | var blipTranslate = (1 - blipScale) / blipScale 629 | 630 | svg.style('left', moveLeft + 'px').style('right', moveRight + 'px') 631 | d3.select('.quadrant-group-' + order) 632 | .transition() 633 | .duration(ANIMATION_DURATION) 634 | .attr('transform', 'translate(' + translateX + ',' + translateY + ')scale(' + scale + ')') 635 | d3.selectAll('.quadrant-group-' + order + ' .blip-link text').each(function () { 636 | var x = d3.select(this).attr('x') 637 | var y = d3.select(this).attr('y') 638 | d3.select(this.parentNode) 639 | .transition() 640 | .duration(ANIMATION_DURATION) 641 | .attr('transform', 'scale(' + blipScale + ')translate(' + blipTranslate * x + ',' + blipTranslate * y + ')') 642 | }) 643 | 644 | d3.selectAll('.quadrant-group').style('pointer-events', 'auto') 645 | 646 | d3.selectAll('.quadrant-group:not(.quadrant-group-' + order + ')') 647 | .transition() 648 | .duration(ANIMATION_DURATION) 649 | .style('pointer-events', 'none') 650 | .attr('transform', 'translate(' + translateXAll + ',' + translateYAll + ')scale(0)') 651 | 652 | if (d3.select('.legend.legend-' + order).empty()) { 653 | drawLegend(order) 654 | } 655 | } 656 | 657 | self.init = function () { 658 | const selector = config.featureToggles.UIRefresh2022 ? 'main' : 'body' 659 | radarElement = d3.select(selector).append('div').attr('id', 'radar') 660 | return self 661 | } 662 | 663 | function constructSheetUrl(sheetName) { 664 | var noParamUrl = window.location.href.substring(0, window.location.href.indexOf(window.location.search)) 665 | var queryParams = QueryParams(window.location.search.substring(1)) 666 | var sheetUrl = noParamUrl + '?sheetId=' + queryParams.sheetId + '&sheetName=' + encodeURIComponent(sheetName) 667 | return sheetUrl 668 | } 669 | 670 | function plotAlternativeRadars(alternatives, currentSheet) { 671 | var alternativeSheetButton = alternativeDiv.append('div').classed('multiple-sheet-button-group', true) 672 | 673 | alternativeSheetButton.append('p').text('Choose a sheet to populate radar') 674 | alternatives.forEach(function (alternative) { 675 | alternativeSheetButton 676 | .append('div:a') 677 | .attr('class', 'first full-view alternative multiple-sheet-button') 678 | .attr('href', constructSheetUrl(alternative)) 679 | .text(alternative) 680 | 681 | if (alternative === currentSheet) { 682 | d3.selectAll('.alternative') 683 | .filter(function () { 684 | return d3.select(this).text() === alternative 685 | }) 686 | .attr('class', 'highlight multiple-sheet-button') 687 | } 688 | }) 689 | } 690 | 691 | self.plot = function () { 692 | var rings, quadrants, alternatives, currentSheet 693 | 694 | rings = radar.rings() 695 | quadrants = radar.quadrants() 696 | alternatives = radar.getAlternatives() 697 | currentSheet = radar.getCurrentSheet() 698 | 699 | if (config.featureToggles.UIRefresh2022) { 700 | const landingPageElements = document.querySelectorAll('main .home-page') 701 | landingPageElements.forEach((elem) => { 702 | elem.style.display = 'none' 703 | }) 704 | plotHeader() 705 | } else { 706 | plotRadarHeader() 707 | plotRadarFooter() 708 | } 709 | 710 | if (alternatives.length) { 711 | plotAlternativeRadars(alternatives, currentSheet) 712 | } 713 | 714 | plotQuadrantButtons(quadrants) 715 | 716 | radarElement.style('height', size + 14 + 'px') 717 | svg = radarElement.append('svg').call(tip) 718 | svg 719 | .attr('id', 'radar-plot') 720 | .attr('width', size) 721 | .attr('height', size + 14) 722 | 723 | _.each(quadrants, function (quadrant) { 724 | var quadrantGroup = plotQuadrant(rings, quadrant) 725 | plotLines(quadrantGroup, quadrant) 726 | plotTexts(quadrantGroup, rings, quadrant) 727 | plotBlips(quadrantGroup, rings, quadrant) 728 | }) 729 | } 730 | 731 | return self 732 | } 733 | 734 | module.exports = Radar 735 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Bruno Trecenti 2 | Copyright (c) 2016 Thoughtworks, Inc 3 | 4 | GNU AFFERO GENERAL PUBLIC LICENSE 5 | Version 3, 19 November 2007 6 | 7 | Copyright (C) 2007 Free Software Foundation, Inc. 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | Preamble 12 | 13 | The GNU Affero General Public License is a free, copyleft license for 14 | software and other kinds of works, specifically designed to ensure 15 | cooperation with the community in the case of network server software. 16 | 17 | The licenses for most software and other practical works are designed 18 | to take away your freedom to share and change the works. By contrast, 19 | our General Public Licenses are intended to guarantee your freedom to 20 | share and change all versions of a program--to make sure it remains free 21 | software for all its users. 22 | 23 | When we speak of free software, we are referring to freedom, not 24 | price. Our General Public Licenses are designed to make sure that you 25 | have the freedom to distribute copies of free software (and charge for 26 | them if you wish), that you receive source code or can get it if you 27 | want it, that you can change the software or use pieces of it in new 28 | free programs, and that you know you can do these things. 29 | 30 | Developers that use our General Public Licenses protect your rights 31 | with two steps: (1) assert copyright on the software, and (2) offer 32 | you this License which gives you legal permission to copy, distribute 33 | and/or modify the software. 34 | 35 | A secondary benefit of defending all users' freedom is that 36 | improvements made in alternate versions of the program, if they 37 | receive widespread use, become available for other developers to 38 | incorporate. Many developers of free software are heartened and 39 | encouraged by the resulting cooperation. However, in the case of 40 | software used on network servers, this result may fail to come about. 41 | The GNU General Public License permits making a modified version and 42 | letting the public access it on a server without ever releasing its 43 | source code to the public. 44 | 45 | The GNU Affero General Public License is designed specifically to 46 | ensure that, in such cases, the modified source code becomes available 47 | to the community. It requires the operator of a network server to 48 | provide the source code of the modified version running there to the 49 | users of that server. Therefore, public use of a modified version, on 50 | a publicly accessible server, gives the public access to the source 51 | code of the modified version. 52 | 53 | An older license, called the Affero General Public License and 54 | published by Affero, was designed to accomplish similar goals. This is 55 | a different license, not a version of the Affero GPL, but Affero has 56 | released a new version of the Affero GPL which permits relicensing under 57 | this license. 58 | 59 | The precise terms and conditions for copying, distribution and 60 | modification follow. 61 | 62 | TERMS AND CONDITIONS 63 | 64 | 0. Definitions. 65 | 66 | "This License" refers to version 3 of the GNU Affero General Public License. 67 | 68 | "Copyright" also means copyright-like laws that apply to other kinds of 69 | works, such as semiconductor masks. 70 | 71 | "The Program" refers to any copyrightable work licensed under this 72 | License. Each licensee is addressed as "you". "Licensees" and 73 | "recipients" may be individuals or organizations. 74 | 75 | To "modify" a work means to copy from or adapt all or part of the work 76 | in a fashion requiring copyright permission, other than the making of an 77 | exact copy. The resulting work is called a "modified version" of the 78 | earlier work or a work "based on" the earlier work. 79 | 80 | A "covered work" means either the unmodified Program or a work based 81 | on the Program. 82 | 83 | To "propagate" a work means to do anything with it that, without 84 | permission, would make you directly or secondarily liable for 85 | infringement under applicable copyright law, except executing it on a 86 | computer or modifying a private copy. Propagation includes copying, 87 | distribution (with or without modification), making available to the 88 | public, and in some countries other activities as well. 89 | 90 | To "convey" a work means any kind of propagation that enables other 91 | parties to make or receive copies. Mere interaction with a user through 92 | a computer network, with no transfer of a copy, is not conveying. 93 | 94 | An interactive user interface displays "Appropriate Legal Notices" 95 | to the extent that it includes a convenient and prominently visible 96 | feature that (1) displays an appropriate copyright notice, and (2) 97 | tells the user that there is no warranty for the work (except to the 98 | extent that warranties are provided), that licensees may convey the 99 | work under this License, and how to view a copy of this License. If 100 | the interface presents a list of user commands or options, such as a 101 | menu, a prominent item in the list meets this criterion. 102 | 103 | 1. Source Code. 104 | 105 | The "source code" for a work means the preferred form of the work 106 | for making modifications to it. "Object code" means any non-source 107 | form of a work. 108 | 109 | A "Standard Interface" means an interface that either is an official 110 | standard defined by a recognized standards body, or, in the case of 111 | interfaces specified for a particular programming language, one that 112 | is widely used among developers working in that language. 113 | 114 | The "System Libraries" of an executable work include anything, other 115 | than the work as a whole, that (a) is included in the normal form of 116 | packaging a Major Component, but which is not part of that Major 117 | Component, and (b) serves only to enable use of the work with that 118 | Major Component, or to implement a Standard Interface for which an 119 | implementation is available to the public in source code form. A 120 | "Major Component", in this context, means a major essential component 121 | (kernel, window system, and so on) of the specific operating system 122 | (if any) on which the executable work runs, or a compiler used to 123 | produce the work, or an object code interpreter used to run it. 124 | 125 | The "Corresponding Source" for a work in object code form means all 126 | the source code needed to generate, install, and (for an executable 127 | work) run the object code and to modify the work, including scripts to 128 | control those activities. However, it does not include the work's 129 | System Libraries, or general-purpose tools or generally available free 130 | programs which are used unmodified in performing those activities but 131 | which are not part of the work. For example, Corresponding Source 132 | includes interface definition files associated with source files for 133 | the work, and the source code for shared libraries and dynamically 134 | linked subprograms that the work is specifically designed to require, 135 | such as by intimate data communication or control flow between those 136 | subprograms and other parts of the work. 137 | 138 | The Corresponding Source need not include anything that users 139 | can regenerate automatically from other parts of the Corresponding 140 | Source. 141 | 142 | The Corresponding Source for a work in source code form is that 143 | same work. 144 | 145 | 2. Basic Permissions. 146 | 147 | All rights granted under this License are granted for the term of 148 | copyright on the Program, and are irrevocable provided the stated 149 | conditions are met. This License explicitly affirms your unlimited 150 | permission to run the unmodified Program. The output from running a 151 | covered work is covered by this License only if the output, given its 152 | content, constitutes a covered work. This License acknowledges your 153 | rights of fair use or other equivalent, as provided by copyright law. 154 | 155 | You may make, run and propagate covered works that you do not 156 | convey, without conditions so long as your license otherwise remains 157 | in force. You may convey covered works to others for the sole purpose 158 | of having them make modifications exclusively for you, or provide you 159 | with facilities for running those works, provided that you comply with 160 | the terms of this License in conveying all material for which you do 161 | not control copyright. Those thus making or running the covered works 162 | for you must do so exclusively on your behalf, under your direction 163 | and control, on terms that prohibit them from making any copies of 164 | your copyrighted material outside their relationship with you. 165 | 166 | Conveying under any other circumstances is permitted solely under 167 | the conditions stated below. Sublicensing is not allowed; section 10 168 | makes it unnecessary. 169 | 170 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 171 | 172 | No covered work shall be deemed part of an effective technological 173 | measure under any applicable law fulfilling obligations under article 174 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 175 | similar laws prohibiting or restricting circumvention of such 176 | measures. 177 | 178 | When you convey a covered work, you waive any legal power to forbid 179 | circumvention of technological measures to the extent such circumvention 180 | is effected by exercising rights under this License with respect to 181 | the covered work, and you disclaim any intention to limit operation or 182 | modification of the work as a means of enforcing, against the work's 183 | users, your or third parties' legal rights to forbid circumvention of 184 | technological measures. 185 | 186 | 4. Conveying Verbatim Copies. 187 | 188 | You may convey verbatim copies of the Program's source code as you 189 | receive it, in any medium, provided that you conspicuously and 190 | appropriately publish on each copy an appropriate copyright notice; 191 | keep intact all notices stating that this License and any 192 | non-permissive terms added in accord with section 7 apply to the code; 193 | keep intact all notices of the absence of any warranty; and give all 194 | recipients a copy of this License along with the Program. 195 | 196 | You may charge any price or no price for each copy that you convey, 197 | and you may offer support or warranty protection for a fee. 198 | 199 | 5. Conveying Modified Source Versions. 200 | 201 | You may convey a work based on the Program, or the modifications to 202 | produce it from the Program, in the form of source code under the 203 | terms of section 4, provided that you also meet all of these conditions: 204 | 205 | a) The work must carry prominent notices stating that you modified 206 | it, and giving a relevant date. 207 | 208 | b) The work must carry prominent notices stating that it is 209 | released under this License and any conditions added under section 210 | 7. This requirement modifies the requirement in section 4 to 211 | "keep intact all notices". 212 | 213 | c) You must license the entire work, as a whole, under this 214 | License to anyone who comes into possession of a copy. This 215 | License will therefore apply, along with any applicable section 7 216 | additional terms, to the whole of the work, and all its parts, 217 | regardless of how they are packaged. This License gives no 218 | permission to license the work in any other way, but it does not 219 | invalidate such permission if you have separately received it. 220 | 221 | d) If the work has interactive user interfaces, each must display 222 | Appropriate Legal Notices; however, if the Program has interactive 223 | interfaces that do not display Appropriate Legal Notices, your 224 | work need not make them do so. 225 | 226 | A compilation of a covered work with other separate and independent 227 | works, which are not by their nature extensions of the covered work, 228 | and which are not combined with it such as to form a larger program, 229 | in or on a volume of a storage or distribution medium, is called an 230 | "aggregate" if the compilation and its resulting copyright are not 231 | used to limit the access or legal rights of the compilation's users 232 | beyond what the individual works permit. Inclusion of a covered work 233 | in an aggregate does not cause this License to apply to the other 234 | parts of the aggregate. 235 | 236 | 6. Conveying Non-Source Forms. 237 | 238 | You may convey a covered work in object code form under the terms 239 | of sections 4 and 5, provided that you also convey the 240 | machine-readable Corresponding Source under the terms of this License, 241 | in one of these ways: 242 | 243 | a) Convey the object code in, or embodied in, a physical product 244 | (including a physical distribution medium), accompanied by the 245 | Corresponding Source fixed on a durable physical medium 246 | customarily used for software interchange. 247 | 248 | b) Convey the object code in, or embodied in, a physical product 249 | (including a physical distribution medium), accompanied by a 250 | written offer, valid for at least three years and valid for as 251 | long as you offer spare parts or customer support for that product 252 | model, to give anyone who possesses the object code either (1) a 253 | copy of the Corresponding Source for all the software in the 254 | product that is covered by this License, on a durable physical 255 | medium customarily used for software interchange, for a price no 256 | more than your reasonable cost of physically performing this 257 | conveying of source, or (2) access to copy the 258 | Corresponding Source from a network server at no charge. 259 | 260 | c) Convey individual copies of the object code with a copy of the 261 | written offer to provide the Corresponding Source. This 262 | alternative is allowed only occasionally and noncommercially, and 263 | only if you received the object code with such an offer, in accord 264 | with subsection 6b. 265 | 266 | d) Convey the object code by offering access from a designated 267 | place (gratis or for a charge), and offer equivalent access to the 268 | Corresponding Source in the same way through the same place at no 269 | further charge. You need not require recipients to copy the 270 | Corresponding Source along with the object code. If the place to 271 | copy the object code is a network server, the Corresponding Source 272 | may be on a different server (operated by you or a third party) 273 | that supports equivalent copying facilities, provided you maintain 274 | clear directions next to the object code saying where to find the 275 | Corresponding Source. Regardless of what server hosts the 276 | Corresponding Source, you remain obligated to ensure that it is 277 | available for as long as needed to satisfy these requirements. 278 | 279 | e) Convey the object code using peer-to-peer transmission, provided 280 | you inform other peers where the object code and Corresponding 281 | Source of the work are being offered to the general public at no 282 | charge under subsection 6d. 283 | 284 | A separable portion of the object code, whose source code is excluded 285 | from the Corresponding Source as a System Library, need not be 286 | included in conveying the object code work. 287 | 288 | A "User Product" is either (1) a "consumer product", which means any 289 | tangible personal property which is normally used for personal, family, 290 | or household purposes, or (2) anything designed or sold for incorporation 291 | into a dwelling. In determining whether a product is a consumer product, 292 | doubtful cases shall be resolved in favor of coverage. For a particular 293 | product received by a particular user, "normally used" refers to a 294 | typical or common use of that class of product, regardless of the status 295 | of the particular user or of the way in which the particular user 296 | actually uses, or expects or is expected to use, the product. A product 297 | is a consumer product regardless of whether the product has substantial 298 | commercial, industrial or non-consumer uses, unless such uses represent 299 | the only significant mode of use of the product. 300 | 301 | "Installation Information" for a User Product means any methods, 302 | procedures, authorization keys, or other information required to install 303 | and execute modified versions of a covered work in that User Product from 304 | a modified version of its Corresponding Source. The information must 305 | suffice to ensure that the continued functioning of the modified object 306 | code is in no case prevented or interfered with solely because 307 | modification has been made. 308 | 309 | If you convey an object code work under this section in, or with, or 310 | specifically for use in, a User Product, and the conveying occurs as 311 | part of a transaction in which the right of possession and use of the 312 | User Product is transferred to the recipient in perpetuity or for a 313 | fixed term (regardless of how the transaction is characterized), the 314 | Corresponding Source conveyed under this section must be accompanied 315 | by the Installation Information. But this requirement does not apply 316 | if neither you nor any third party retains the ability to install 317 | modified object code on the User Product (for example, the work has 318 | been installed in ROM). 319 | 320 | The requirement to provide Installation Information does not include a 321 | requirement to continue to provide support service, warranty, or updates 322 | for a work that has been modified or installed by the recipient, or for 323 | the User Product in which it has been modified or installed. Access to a 324 | network may be denied when the modification itself materially and 325 | adversely affects the operation of the network or violates the rules and 326 | protocols for communication across the network. 327 | 328 | Corresponding Source conveyed, and Installation Information provided, 329 | in accord with this section must be in a format that is publicly 330 | documented (and with an implementation available to the public in 331 | source code form), and must require no special password or key for 332 | unpacking, reading or copying. 333 | 334 | 7. Additional Terms. 335 | 336 | "Additional permissions" are terms that supplement the terms of this 337 | License by making exceptions from one or more of its conditions. 338 | Additional permissions that are applicable to the entire Program shall 339 | be treated as though they were included in this License, to the extent 340 | that they are valid under applicable law. If additional permissions 341 | apply only to part of the Program, that part may be used separately 342 | under those permissions, but the entire Program remains governed by 343 | this License without regard to the additional permissions. 344 | 345 | When you convey a copy of a covered work, you may at your option 346 | remove any additional permissions from that copy, or from any part of 347 | it. (Additional permissions may be written to require their own 348 | removal in certain cases when you modify the work.) You may place 349 | additional permissions on material, added by you to a covered work, 350 | for which you have or can give appropriate copyright permission. 351 | 352 | Notwithstanding any other provision of this License, for material you 353 | add to a covered work, you may (if authorized by the copyright holders of 354 | that material) supplement the terms of this License with terms: 355 | 356 | a) Disclaiming warranty or limiting liability differently from the 357 | terms of sections 15 and 16 of this License; or 358 | 359 | b) Requiring preservation of specified reasonable legal notices or 360 | author attributions in that material or in the Appropriate Legal 361 | Notices displayed by works containing it; or 362 | 363 | c) Prohibiting misrepresentation of the origin of that material, or 364 | requiring that modified versions of such material be marked in 365 | reasonable ways as different from the original version; or 366 | 367 | d) Limiting the use for publicity purposes of names of licensors or 368 | authors of the material; or 369 | 370 | e) Declining to grant rights under trademark law for use of some 371 | trade names, trademarks, or service marks; or 372 | 373 | f) Requiring indemnification of licensors and authors of that 374 | material by anyone who conveys the material (or modified versions of 375 | it) with contractual assumptions of liability to the recipient, for 376 | any liability that these contractual assumptions directly impose on 377 | those licensors and authors. 378 | 379 | All other non-permissive additional terms are considered "further 380 | restrictions" within the meaning of section 10. If the Program as you 381 | received it, or any part of it, contains a notice stating that it is 382 | governed by this License along with a term that is a further 383 | restriction, you may remove that term. If a license document contains 384 | a further restriction but permits relicensing or conveying under this 385 | License, you may add to a covered work material governed by the terms 386 | of that license document, provided that the further restriction does 387 | not survive such relicensing or conveying. 388 | 389 | If you add terms to a covered work in accord with this section, you 390 | must place, in the relevant source files, a statement of the 391 | additional terms that apply to those files, or a notice indicating 392 | where to find the applicable terms. 393 | 394 | Additional terms, permissive or non-permissive, may be stated in the 395 | form of a separately written license, or stated as exceptions; 396 | the above requirements apply either way. 397 | 398 | 8. Termination. 399 | 400 | You may not propagate or modify a covered work except as expressly 401 | provided under this License. Any attempt otherwise to propagate or 402 | modify it is void, and will automatically terminate your rights under 403 | this License (including any patent licenses granted under the third 404 | paragraph of section 11). 405 | 406 | However, if you cease all violation of this License, then your 407 | license from a particular copyright holder is reinstated (a) 408 | provisionally, unless and until the copyright holder explicitly and 409 | finally terminates your license, and (b) permanently, if the copyright 410 | holder fails to notify you of the violation by some reasonable means 411 | prior to 60 days after the cessation. 412 | 413 | Moreover, your license from a particular copyright holder is 414 | reinstated permanently if the copyright holder notifies you of the 415 | violation by some reasonable means, this is the first time you have 416 | received notice of violation of this License (for any work) from that 417 | copyright holder, and you cure the violation prior to 30 days after 418 | your receipt of the notice. 419 | 420 | Termination of your rights under this section does not terminate the 421 | licenses of parties who have received copies or rights from you under 422 | this License. If your rights have been terminated and not permanently 423 | reinstated, you do not qualify to receive new licenses for the same 424 | material under section 10. 425 | 426 | 9. Acceptance Not Required for Having Copies. 427 | 428 | You are not required to accept this License in order to receive or 429 | run a copy of the Program. Ancillary propagation of a covered work 430 | occurring solely as a consequence of using peer-to-peer transmission 431 | to receive a copy likewise does not require acceptance. However, 432 | nothing other than this License grants you permission to propagate or 433 | modify any covered work. These actions infringe copyright if you do 434 | not accept this License. Therefore, by modifying or propagating a 435 | covered work, you indicate your acceptance of this License to do so. 436 | 437 | 10. Automatic Licensing of Downstream Recipients. 438 | 439 | Each time you convey a covered work, the recipient automatically 440 | receives a license from the original licensors, to run, modify and 441 | propagate that work, subject to this License. You are not responsible 442 | for enforcing compliance by third parties with this License. 443 | 444 | An "entity transaction" is a transaction transferring control of an 445 | organization, or substantially all assets of one, or subdividing an 446 | organization, or merging organizations. If propagation of a covered 447 | work results from an entity transaction, each party to that 448 | transaction who receives a copy of the work also receives whatever 449 | licenses to the work the party's predecessor in interest had or could 450 | give under the previous paragraph, plus a right to possession of the 451 | Corresponding Source of the work from the predecessor in interest, if 452 | the predecessor has it or can get it with reasonable efforts. 453 | 454 | You may not impose any further restrictions on the exercise of the 455 | rights granted or affirmed under this License. For example, you may 456 | not impose a license fee, royalty, or other charge for exercise of 457 | rights granted under this License, and you may not initiate litigation 458 | (including a cross-claim or counterclaim in a lawsuit) alleging that 459 | any patent claim is infringed by making, using, selling, offering for 460 | sale, or importing the Program or any portion of it. 461 | 462 | 11. Patents. 463 | 464 | A "contributor" is a copyright holder who authorizes use under this 465 | License of the Program or a work on which the Program is based. The 466 | work thus licensed is called the contributor's "contributor version". 467 | 468 | A contributor's "essential patent claims" are all patent claims 469 | owned or controlled by the contributor, whether already acquired or 470 | hereafter acquired, that would be infringed by some manner, permitted 471 | by this License, of making, using, or selling its contributor version, 472 | but do not include claims that would be infringed only as a 473 | consequence of further modification of the contributor version. For 474 | purposes of this definition, "control" includes the right to grant 475 | patent sublicenses in a manner consistent with the requirements of 476 | this License. 477 | 478 | Each contributor grants you a non-exclusive, worldwide, royalty-free 479 | patent license under the contributor's essential patent claims, to 480 | make, use, sell, offer for sale, import and otherwise run, modify and 481 | propagate the contents of its contributor version. 482 | 483 | In the following three paragraphs, a "patent license" is any express 484 | agreement or commitment, however denominated, not to enforce a patent 485 | (such as an express permission to practice a patent or covenant not to 486 | sue for patent infringement). To "grant" such a patent license to a 487 | party means to make such an agreement or commitment not to enforce a 488 | patent against the party. 489 | 490 | If you convey a covered work, knowingly relying on a patent license, 491 | and the Corresponding Source of the work is not available for anyone 492 | to copy, free of charge and under the terms of this License, through a 493 | publicly available network server or other readily accessible means, 494 | then you must either (1) cause the Corresponding Source to be so 495 | available, or (2) arrange to deprive yourself of the benefit of the 496 | patent license for this particular work, or (3) arrange, in a manner 497 | consistent with the requirements of this License, to extend the patent 498 | license to downstream recipients. "Knowingly relying" means you have 499 | actual knowledge that, but for the patent license, your conveying the 500 | covered work in a country, or your recipient's use of the covered work 501 | in a country, would infringe one or more identifiable patents in that 502 | country that you have reason to believe are valid. 503 | 504 | If, pursuant to or in connection with a single transaction or 505 | arrangement, you convey, or propagate by procuring conveyance of, a 506 | covered work, and grant a patent license to some of the parties 507 | receiving the covered work authorizing them to use, propagate, modify 508 | or convey a specific copy of the covered work, then the patent license 509 | you grant is automatically extended to all recipients of the covered 510 | work and works based on it. 511 | 512 | A patent license is "discriminatory" if it does not include within 513 | the scope of its coverage, prohibits the exercise of, or is 514 | conditioned on the non-exercise of one or more of the rights that are 515 | specifically granted under this License. You may not convey a covered 516 | work if you are a party to an arrangement with a third party that is 517 | in the business of distributing software, under which you make payment 518 | to the third party based on the extent of your activity of conveying 519 | the work, and under which the third party grants, to any of the 520 | parties who would receive the covered work from you, a discriminatory 521 | patent license (a) in connection with copies of the covered work 522 | conveyed by you (or copies made from those copies), or (b) primarily 523 | for and in connection with specific products or compilations that 524 | contain the covered work, unless you entered into that arrangement, 525 | or that patent license was granted, prior to 28 March 2007. 526 | 527 | Nothing in this License shall be construed as excluding or limiting 528 | any implied license or other defenses to infringement that may 529 | otherwise be available to you under applicable patent law. 530 | 531 | 12. No Surrender of Others' Freedom. 532 | 533 | If conditions are imposed on you (whether by court order, agreement or 534 | otherwise) that contradict the conditions of this License, they do not 535 | excuse you from the conditions of this License. If you cannot convey a 536 | covered work so as to satisfy simultaneously your obligations under this 537 | License and any other pertinent obligations, then as a consequence you may 538 | not convey it at all. For example, if you agree to terms that obligate you 539 | to collect a royalty for further conveying from those to whom you convey 540 | the Program, the only way you could satisfy both those terms and this 541 | License would be to refrain entirely from conveying the Program. 542 | 543 | 13. Remote Network Interaction; Use with the GNU General Public License. 544 | 545 | Notwithstanding any other provision of this License, if you modify the 546 | Program, your modified version must prominently offer all users 547 | interacting with it remotely through a computer network (if your version 548 | supports such interaction) an opportunity to receive the Corresponding 549 | Source of your version by providing access to the Corresponding Source 550 | from a network server at no charge, through some standard or customary 551 | means of facilitating copying of software. This Corresponding Source 552 | shall include the Corresponding Source for any work covered by version 3 553 | of the GNU General Public License that is incorporated pursuant to the 554 | following paragraph. 555 | 556 | Notwithstanding any other provision of this License, you have 557 | permission to link or combine any covered work with a work licensed 558 | under version 3 of the GNU General Public License into a single 559 | combined work, and to convey the resulting work. The terms of this 560 | License will continue to apply to the part which is the covered work, 561 | but the work with which it is combined will remain governed by version 562 | 3 of the GNU General Public License. 563 | 564 | 14. Revised Versions of this License. 565 | 566 | The Free Software Foundation may publish revised and/or new versions of 567 | the GNU Affero General Public License from time to time. Such new versions 568 | will be similar in spirit to the present version, but may differ in detail to 569 | address new problems or concerns. 570 | 571 | Each version is given a distinguishing version number. If the 572 | Program specifies that a certain numbered version of the GNU Affero General 573 | Public License "or any later version" applies to it, you have the 574 | option of following the terms and conditions either of that numbered 575 | version or of any later version published by the Free Software 576 | Foundation. If the Program does not specify a version number of the 577 | GNU Affero General Public License, you may choose any version ever published 578 | by the Free Software Foundation. 579 | 580 | If the Program specifies that a proxy can decide which future 581 | versions of the GNU Affero General Public License can be used, that proxy's 582 | public statement of acceptance of a version permanently authorizes you 583 | to choose that version for the Program. 584 | 585 | Later license versions may give you additional or different 586 | permissions. However, no additional obligations are imposed on any 587 | author or copyright holder as a result of your choosing to follow a 588 | later version. 589 | 590 | 15. Disclaimer of Warranty. 591 | 592 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 593 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 594 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 595 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 596 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 597 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 598 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 599 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 600 | 601 | 16. Limitation of Liability. 602 | 603 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 604 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 605 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 606 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 607 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 608 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 609 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 610 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 611 | SUCH DAMAGES. 612 | 613 | 17. Interpretation of Sections 15 and 16. 614 | 615 | If the disclaimer of warranty and limitation of liability provided 616 | above cannot be given local legal effect according to their terms, 617 | reviewing courts shall apply local law that most closely approximates 618 | an absolute waiver of all civil liability in connection with the 619 | Program, unless a warranty or assumption of liability accompanies a 620 | copy of the Program in return for a fee. 621 | 622 | END OF TERMS AND CONDITIONS 623 | 624 | How to Apply These Terms to Your New Programs 625 | 626 | If you develop a new program, and you want it to be of the greatest 627 | possible use to the public, the best way to achieve this is to make it 628 | free software which everyone can redistribute and change under these terms. 629 | 630 | To do so, attach the following notices to the program. It is safest 631 | to attach them to the start of each source file to most effectively 632 | state the exclusion of warranty; and each file should have at least 633 | the "copyright" line and a pointer to where the full notice is found. 634 | 635 | 636 | Copyright (C) 637 | 638 | This program is free software: you can redistribute it and/or modify 639 | it under the terms of the GNU Affero General Public License as published 640 | by the Free Software Foundation, either version 3 of the License, or 641 | (at your option) any later version. 642 | 643 | This program is distributed in the hope that it will be useful, 644 | but WITHOUT ANY WARRANTY; without even the implied warranty of 645 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 646 | GNU Affero General Public License for more details. 647 | 648 | You should have received a copy of the GNU Affero General Public License 649 | along with this program. If not, see . 650 | 651 | Also add information on how to contact you by electronic and paper mail. 652 | 653 | If your software can interact with users remotely through a computer 654 | network, you should also make sure that it provides a way for users to 655 | get its source. For example, if your program is a web application, its 656 | interface could display a "Source" link that leads users to an archive 657 | of the code. There are many ways you could offer source, and different 658 | solutions will be better for different programs; see section 13 for the 659 | specific requirements. 660 | 661 | You should also get your employer (if you work as a programmer) or school, 662 | if any, to sign a "copyright disclaimer" for the program, if necessary. 663 | For more information on this, and how to apply and follow the GNU AGPL, see 664 | . 665 | --------------------------------------------------------------------------------