Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spinnaker/docker

Package Overview
Dependencies
Maintainers
13
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spinnaker/docker - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

2

.cache-loader/3656936c0746b470ca1b3b8521ceec69.json

@@ -1,1 +0,1 @@

{"remainingRequest":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/thread-loader/dist/cjs.js??ref--5-1!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/ts-loader/index.js??ref--5-2!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","dependencies":[{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","mtime":1538713056376},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/cache-loader/dist/cjs.js","mtime":0},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/thread-loader/dist/cjs.js","mtime":0},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/ts-loader/index.js","mtime":1525713677000},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js","mtime":1519899048000}],"contextDependencies":[],"result":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst React = require(\"react\");\nconst react_select_1 = require(\"react-select\");\nconst lodash_1 = require(\"lodash\");\nconst core_1 = require(\"@spinnaker/core\");\nconst DockerImageReader_1 = require(\"./DockerImageReader\");\nclass DockerImageAndTagSelector extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n accountOptions: [],\n imagesLoaded: false,\n imagesLoading: false,\n imagesRefreshing: false,\n organizationMap: {},\n organizationOptions: [],\n repositoryMap: {},\n repositoryOptions: [],\n tagOptions: [],\n };\n }\n getAccountMap(images) {\n const groupedImages = lodash_1.groupBy(images.filter(image => image.account), 'account');\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => `${i.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`));\n return acc;\n }, {});\n }\n getRegistryMap(images) {\n return images.reduce((m, image) => {\n m[image.account] = image.registry;\n return m;\n }, {});\n }\n getOrganizationMap(images) {\n const extractGroupByKey = (image) => `${image.account}/${image.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`;\n const groupedImages = lodash_1.groupBy(images.filter(image => image.repository), extractGroupByKey);\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => i.repository));\n return acc;\n }, {});\n }\n getRepositoryMap(images) {\n const groupedImages = lodash_1.groupBy(images.filter(image => image.account), 'repository');\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => i.tag));\n return acc;\n }, {});\n }\n getOrganizationsList(accountMap) {\n return accountMap ? accountMap[this.props.showRegistry ? this.props.account : this.props.registry] || [] : [];\n }\n getRepositoryList(organizationMap, organization, registry) {\n if (organizationMap) {\n const key = `${this.props.showRegistry ? this.props.account : registry}/${organization || ''}`;\n return organizationMap[key] || [];\n }\n return [];\n }\n getTags(repositoryMap, repository) {\n let tag = this.props.tag;\n let tags = [];\n if (this.props.specifyTagByRegex) {\n if (tag && lodash_1.trim(tag) === '') {\n tag = '';\n }\n }\n else {\n if (repositoryMap) {\n tags = repositoryMap[repository] || [];\n if (!tags.includes(tag) && tag && !tag.includes('${')) {\n tag = '';\n }\n }\n }\n return { tag, tags };\n }\n componentWillReceiveProps(nextProps) {\n if (!this.images || ['account', 'showRegistry'].some(key => this.props[key] !== nextProps[key])) {\n this.refreshImages(nextProps);\n }\n else if (['organization', 'registry', 'repository'].some(key => this.props[key] !== nextProps[key])) {\n this.updateThings(nextProps);\n }\n }\n updateThings(props) {\n let { organization, registry, repository } = props;\n const { account, showRegistry } = props;\n const registryMap = this.getRegistryMap(this.images);\n const accountMap = this.getAccountMap(this.images);\n const newAccounts = this.accounts || Object.keys(accountMap);\n const organizationMap = this.getOrganizationMap(this.images);\n // this.organizations.push(...Object.keys(this.organizationMap)); // wat...\n const repositoryMap = this.getRepositoryMap(this.images);\n const organizations = this.getOrganizationsList(accountMap);\n organization =\n !organizations.includes(organization) && organization && !organization.includes('${') ? '' : organization;\n if (showRegistry) {\n registry = registryMap[account];\n }\n const repositories = this.getRepositoryList(organizationMap, organization, registry);\n if (!repositories.includes(repository) && repository && !repository.includes('${')) {\n repository = '';\n }\n const { tag, tags } = this.getTags(repositoryMap, repository);\n if (this.props.onChange) {\n this.props.onChange({ organization, registry, repository, tag });\n }\n this.setState({\n accountOptions: newAccounts.sort().map(a => ({ label: a, value: a })),\n organizationOptions: organizations\n .filter(o => o)\n .sort()\n .map(o => ({ label: o, value: o })),\n imagesLoaded: true,\n organizationMap,\n repositoryMap,\n repositoryOptions: repositories.sort().map(r => ({ label: r, value: r })),\n tagOptions: tags.sort().map(t => ({ label: t, value: t })),\n });\n }\n initializeImages(props, refresh) {\n if (this.state.imagesLoading) {\n return;\n }\n const { showRegistry, account, registry } = props;\n const imageConfig = {\n provider: 'dockerRegistry',\n account: showRegistry ? account : registry,\n };\n this.setState({\n imagesLoading: true,\n imagesRefreshing: refresh ? true : false,\n });\n DockerImageReader_1.DockerImageReader.findImages(imageConfig)\n .then((images) => {\n this.images = images;\n this.updateThings(props);\n })\n .finally(() => {\n this.setState({\n imagesLoading: false,\n imagesRefreshing: false,\n });\n });\n }\n handleRefreshImages() {\n this.refreshImages(this.props);\n }\n refreshImages(props) {\n this.initializeImages(props, true);\n }\n initializeAccounts(props) {\n let { account } = props;\n core_1.AccountService.listAccounts('dockerRegistry').then((allAccounts) => {\n const accounts = allAccounts.map((a) => a.name);\n if (this.props.showRegistry && !account) {\n account = accounts[0];\n }\n this.accounts = accounts;\n this.refreshImages(Object.assign({}, props, { account }));\n });\n }\n isNew() {\n const { account, organization, registry, repository, tag } = this.props;\n return !account && !organization && !registry && !repository && !tag;\n }\n componentDidMount() {\n if (!this.props.deferInitialization && (this.props.registry || this.isNew())) {\n this.initializeAccounts(this.props);\n }\n }\n valueChanged(name, value) {\n this.props.onChange && this.props.onChange({ [name]: value });\n }\n render() {\n const { account, fieldClass, labelClass, organization, repository, showRegistry, specifyTagByRegex, tag, } = this.props;\n const { accountOptions, imagesLoading, imagesRefreshing, organizationOptions, repositoryOptions, tagOptions, } = this.state;\n return (React.createElement(React.Fragment, null,\n showRegistry && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Registry Name\"),\n React.createElement(\"div\", { className: fieldClass },\n React.createElement(react_select_1.default, { value: account, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('account', o.value), options: accountOptions })),\n React.createElement(\"div\", { className: \"col-md-1 text-center\" },\n React.createElement(core_1.Tooltip, { value: imagesRefreshing ? 'Images refreshing' : 'Refresh images list' },\n React.createElement(\"a\", { className: \"clickable\", onClick: this.handleRefreshImages },\n React.createElement(\"span\", { className: `fa fa-sync-alt ${imagesRefreshing ? 'fa-spin' : ''}` })))))),\n React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Organization\"),\n React.createElement(\"div\", { className: fieldClass },\n imagesLoading && (React.createElement(\"div\", { className: \"form-field-loading\" },\n React.createElement(core_1.Spinner, { size: \"small\" }))),\n !imagesLoading &&\n (organization.includes('${') ? (React.createElement(\"input\", { className: \"form-control input-sm\", value: organization, onChange: e => this.valueChanged('organization', e.target.value) })) : (React.createElement(react_select_1.default, { value: organization, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('organization', (o && o.value) || ''), placeholder: \"No organization\", options: organizationOptions }))))),\n React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Image\"),\n React.createElement(\"div\", { className: fieldClass },\n imagesLoading && (React.createElement(\"div\", { className: \"form-field-loading\" },\n React.createElement(core_1.Spinner, { size: \"small\" }))),\n !imagesLoading &&\n (repository.includes('${') ? (React.createElement(\"input\", { className: \"form-control input-sm\", value: repository, onChange: e => this.valueChanged('repository', e.target.value) })) : (React.createElement(react_select_1.default, { value: repository, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('repository', (o && o.value) || ''), options: repositoryOptions, required: true }))))),\n specifyTagByRegex && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` },\n \"Tag \",\n React.createElement(core_1.HelpField, { id: \"pipeline.config.docker.trigger.tag\" })),\n React.createElement(\"div\", { className: fieldClass },\n React.createElement(\"input\", { type: \"text\", className: \"form-control input-sm\", value: tag, disabled: imagesRefreshing || !repository, onChange: e => this.valueChanged('tag', e.target.value) })))),\n !specifyTagByRegex && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Tag\"),\n React.createElement(\"div\", { className: fieldClass },\n imagesLoading && (React.createElement(\"div\", { className: \"form-field-loading\" },\n React.createElement(core_1.Spinner, { size: \"small\" }))),\n !imagesLoading &&\n (tag.includes('${') ? (React.createElement(\"input\", { className: \"form-control input-sm\", value: tag, onChange: e => this.valueChanged('tag', e.target.value), required: true })) : (React.createElement(react_select_1.default, { value: tag, disabled: imagesRefreshing || !repository, onChange: (o) => this.valueChanged('tag', o.value), options: tagOptions, placeholder: \"No tag\", required: true }))))))));\n }\n}\nDockerImageAndTagSelector.defaultProps = {\n fieldClass: 'col-md-8',\n labelClass: 'col-md-3',\n organization: '',\n registry: '',\n repository: '',\n tag: '',\n};\nexports.DockerImageAndTagSelector = DockerImageAndTagSelector;\n",{"version":3,"file":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","sourceRoot":"","sources":["/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,+CAA8C;AAC9C,mCAAqD;AAErD,0CAA0G;AAE1G,2DAAsE;AAoCtE,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAGpD;IAaC,YAAmB,KAAsC;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACX,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;YACpB,gBAAgB,EAAE,KAAK;YACvB,eAAe,EAAE,EAAE;YACnB,mBAAmB,EAAE,EAAE;YACvB,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;SACf,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,MAAsB;QAC1C,MAAM,aAAa,GAAG,gBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;QAChF,OAAO,eAAM,CACX,aAAa,EACb,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAClB,GAAG,CAAC,GAAG,CAAC,GAAG,aAAI,CACb,KAAK,CAAC,GAAG,CACP,CAAC,CAAC,EAAE,CACF,GAAG,CAAC,CAAC,UAAU;iBACZ,KAAK,CAAC,GAAG,CAAC;iBACV,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBACZ,IAAI,CAAC,GAAG,CAAC,EAAE,CACjB,CACF,CAAC;YACF,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAE,CACH,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,MAAsB;QAC3C,OA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CAAC,EACvD,QAAQ,EAAE,IAAI,GACd,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,sBAAM,IACL,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,gBAAgB,IAAI,CAAC,UAAU,EACzC,QAAQ,EAAE,CAAC,CAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,EAClE,OAAO,EAAE,UAAU,EACnB,WAAW,EAAC,QAAQ,EACpB,QAAQ,EAAE,IAAI,GACd,CACH,CAAC,CACA,CACF,CACP,CACA,CACJ,CAAC;IACJ,CAAC;;AA3Xa,sCAAY,GAA6C;IACrE,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;IACd,GAAG,EAAE,EAAE;CACR,CAAC;AAXJ,8DAgYC","sourcesContent":["import * as React from 'react';\nimport Select, { Option } from 'react-select';\nimport { groupBy, reduce, trim, uniq } from 'lodash';\n\nimport { AccountService, HelpField, IAccount, IFindImageParams, Tooltip, Spinner } from '@spinnaker/core';\n\nimport { DockerImageReader, IDockerImage } from './DockerImageReader';\n\nexport interface IDockerImageAndTagChanges {\n account?: string;\n organization?: string;\n registry?: string;\n repository?: string;\n tag?: string;\n}\n\nexport interface IDockerImageAndTagSelectorProps {\n specifyTagByRegex: boolean;\n organization: string;\n registry: string;\n repository: string;\n tag: string;\n account: string;\n showRegistry?: boolean;\n labelClass?: string;\n fieldClass?: string;\n onChange: (changes: IDockerImageAndTagChanges) => void;\n deferInitialization?: boolean;\n}\n\nexport interface IDockerImageAndTagSelectorState {\n accountOptions: Array<Option<string>>;\n imagesLoaded: boolean;\n imagesLoading: boolean;\n imagesRefreshing: boolean;\n organizationMap: { [key: string]: string[] };\n organizationOptions: Array<Option<string>>;\n repositoryMap: { [key: string]: string[] };\n repositoryOptions: Array<Option<string>>;\n tagOptions: Array<Option<string>>;\n}\n\nexport class DockerImageAndTagSelector extends React.Component<\n IDockerImageAndTagSelectorProps,\n IDockerImageAndTagSelectorState\n> {\n public static defaultProps: Partial<IDockerImageAndTagSelectorProps> = {\n fieldClass: 'col-md-8',\n labelClass: 'col-md-3',\n organization: '',\n registry: '',\n repository: '',\n tag: '',\n };\n\n private images: IDockerImage[];\n private accounts: string[];\n\n public constructor(props: IDockerImageAndTagSelectorProps) {\n super(props);\n\n this.state = {\n accountOptions: [],\n imagesLoaded: false,\n imagesLoading: false,\n imagesRefreshing: false,\n organizationMap: {},\n organizationOptions: [],\n repositoryMap: {},\n repositoryOptions: [],\n tagOptions: [],\n };\n }\n\n private getAccountMap(images: IDockerImage[]): { [key: string]: string[] } {\n const groupedImages = groupBy(images.filter(image => image.account), 'account');\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(\n image.map(\n i =>\n `${i.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`,\n ),\n );\n return acc;\n },\n {},\n );\n }\n\n private getRegistryMap(images: IDockerImage[]) {\n return images.reduce(\n (m: { [key: string]: string }, image: IDockerImage) => {\n m[image.account] = image.registry;\n return m;\n },\n {} as { [key: string]: string },\n );\n }\n\n private getOrganizationMap(images: IDockerImage[]): { [key: string]: string[] } {\n const extractGroupByKey = (image: IDockerImage) =>\n `${image.account}/${image.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`;\n const groupedImages = groupBy(images.filter(image => image.repository), extractGroupByKey);\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(image.map(i => i.repository));\n return acc;\n },\n {},\n );\n }\n\n private getRepositoryMap(images: IDockerImage[]) {\n const groupedImages = groupBy(images.filter(image => image.account), 'repository');\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(image.map(i => i.tag));\n return acc;\n },\n {},\n );\n }\n\n private getOrganizationsList(accountMap: { [key: string]: string[] }) {\n return accountMap ? accountMap[this.props.showRegistry ? this.props.account : this.props.registry] || [] : [];\n }\n\n private getRepositoryList(organizationMap: { [key: string]: string[] }, organization: string, registry: string) {\n if (organizationMap) {\n const key = `${this.props.showRegistry ? this.props.account : registry}/${organization || ''}`;\n return organizationMap[key] || [];\n }\n return [];\n }\n\n private getTags(repositoryMap: { [key: string]: string[] }, repository: string) {\n let tag = this.props.tag;\n let tags: string[] = [];\n if (this.props.specifyTagByRegex) {\n if (tag && trim(tag) === '') {\n tag = '';\n }\n } else {\n if (repositoryMap) {\n tags = repositoryMap[repository] || [];\n if (!tags.includes(tag) && tag && !tag.includes('${')) {\n tag = '';\n }\n }\n }\n\n return { tag, tags };\n }\n\n public componentWillReceiveProps(nextProps: IDockerImageAndTagSelectorProps) {\n if (!this.images || ['account', 'showRegistry'].some(key => (this.props as any)[key] !== (nextProps as any)[key])) {\n this.refreshImages(nextProps);\n } else if (\n ['organization', 'registry', 'repository'].some(key => (this.props as any)[key] !== (nextProps as any)[key])\n ) {\n this.updateThings(nextProps);\n }\n }\n\n private updateThings(props: IDockerImageAndTagSelectorProps) {\n let { organization, registry, repository } = props;\n const { account, showRegistry } = props;\n\n const registryMap = this.getRegistryMap(this.images);\n const accountMap = this.getAccountMap(this.images);\n const newAccounts = this.accounts || Object.keys(accountMap);\n\n const organizationMap = this.getOrganizationMap(this.images);\n // this.organizations.push(...Object.keys(this.organizationMap)); // wat...\n const repositoryMap = this.getRepositoryMap(this.images);\n const organizations = this.getOrganizationsList(accountMap);\n\n organization =\n !organizations.includes(organization) && organization && !organization.includes('${') ? '' : organization;\n\n if (showRegistry) {\n registry = registryMap[account];\n }\n\n const repositories = this.getRepositoryList(organizationMap, organization, registry);\n\n if (!repositories.includes(repository) && repository && !repository.includes('${')) {\n repository = '';\n }\n\n const { tag, tags } = this.getTags(repositoryMap, repository);\n if (this.props.onChange) {\n this.props.onChange({ organization, registry, repository, tag });\n }\n\n this.setState({\n accountOptions: newAccounts.sort().map(a => ({ label: a, value: a })), // def internal state\n organizationOptions: organizations\n .filter(o => o)\n .sort()\n .map(o => ({ label: o, value: o })),\n imagesLoaded: true, // def internal state\n organizationMap,\n repositoryMap,\n repositoryOptions: repositories.sort().map(r => ({ label: r, value: r })),\n tagOptions: tags.sort().map(t => ({ label: t, value: t })),\n });\n }\n\n private initializeImages(props: IDockerImageAndTagSelectorProps, refresh?: boolean) {\n if (this.state.imagesLoading) {\n return;\n }\n\n const { showRegistry, account, registry } = props;\n\n const imageConfig: IFindImageParams = {\n provider: 'dockerRegistry',\n account: showRegistry ? account : registry,\n };\n\n this.setState({\n imagesLoading: true,\n imagesRefreshing: refresh ? true : false,\n });\n DockerImageReader.findImages(imageConfig)\n .then((images: IDockerImage[]) => {\n this.images = images;\n this.updateThings(props);\n })\n .finally(() => {\n this.setState({\n imagesLoading: false,\n imagesRefreshing: false,\n });\n });\n }\n\n public handleRefreshImages(): void {\n this.refreshImages(this.props);\n }\n\n public refreshImages(props: IDockerImageAndTagSelectorProps): void {\n this.initializeImages(props, true);\n }\n\n private initializeAccounts(props: IDockerImageAndTagSelectorProps) {\n let { account } = props;\n AccountService.listAccounts('dockerRegistry').then((allAccounts: IAccount[]) => {\n const accounts = allAccounts.map((a: IAccount) => a.name);\n if (this.props.showRegistry && !account) {\n account = accounts[0];\n }\n this.accounts = accounts;\n this.refreshImages({ ...props, ...{ account } });\n });\n }\n\n private isNew(): boolean {\n const { account, organization, registry, repository, tag } = this.props;\n return !account && !organization && !registry && !repository && !tag;\n }\n\n public componentDidMount() {\n if (!this.props.deferInitialization && (this.props.registry || this.isNew())) {\n this.initializeAccounts(this.props);\n }\n }\n\n private valueChanged(name: string, value: string) {\n this.props.onChange && this.props.onChange({ [name]: value });\n }\n\n public render() {\n const {\n account,\n fieldClass,\n labelClass,\n organization,\n repository,\n showRegistry,\n specifyTagByRegex,\n tag,\n } = this.props;\n const {\n accountOptions,\n imagesLoading,\n imagesRefreshing,\n organizationOptions,\n repositoryOptions,\n tagOptions,\n } = this.state;\n\n return (\n <>\n {showRegistry && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Registry Name</div>\n <div className={fieldClass}>\n <Select\n value={account}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('account', o.value)}\n options={accountOptions}\n />\n </div>\n <div className=\"col-md-1 text-center\">\n <Tooltip value={imagesRefreshing ? 'Images refreshing' : 'Refresh images list'}>\n <a className=\"clickable\" onClick={this.handleRefreshImages}>\n <span className={`fa fa-sync-alt ${imagesRefreshing ? 'fa-spin' : ''}`} />\n </a>\n </Tooltip>\n </div>\n </div>\n )}\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Organization</div>\n <div className={fieldClass}>\n {imagesLoading && (\n <div className=\"form-field-loading\">\n <Spinner size=\"small\" />\n </div>\n )}\n {!imagesLoading &&\n (organization.includes('${') ? (\n <input\n className=\"form-control input-sm\"\n value={organization}\n onChange={e => this.valueChanged('organization', e.target.value)}\n />\n ) : (\n <Select\n value={organization}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('organization', (o && o.value) || '')}\n placeholder=\"No organization\"\n options={organizationOptions}\n />\n ))}\n </div>\n </div>\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Image</div>\n <div className={fieldClass}>\n {imagesLoading && (\n <div className=\"form-field-loading\">\n <Spinner size=\"small\" />\n </div>\n )}\n {!imagesLoading &&\n (repository.includes('${') ? (\n <input\n className=\"form-control input-sm\"\n value={repository}\n onChange={e => this.valueChanged('repository', e.target.value)}\n />\n ) : (\n <Select\n value={repository}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('repository', (o && o.value) || '')}\n options={repositoryOptions}\n required={true}\n />\n ))}\n </div>\n </div>\n {specifyTagByRegex && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>\n Tag <HelpField id=\"pipeline.config.docker.trigger.tag\" />\n </div>\n <div className={fieldClass}>\n <input\n type=\"text\"\n className=\"form-control input-sm\"\n value={tag}\n disabled={imagesRefreshing || !repository}\n onChange={e => this.valueChanged('tag', e.target.value)}\n />\n </div>\n </div>\n )}\n {!specifyTagByRegex && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Tag</div>\n <div className={fieldClass}>\n {imagesLoading && (\n <div className=\"form-field-loading\">\n <Spinner size=\"small\" />\n </div>\n )}\n {!imagesLoading &&\n (tag.includes('${') ? (\n <input\n className=\"form-control input-sm\"\n value={tag}\n onChange={e => this.valueChanged('tag', e.target.value)}\n required={true}\n />\n ) : (\n <Select\n value={tag}\n disabled={imagesRefreshing || !repository}\n onChange={(o: Option<string>) => this.valueChanged('tag', o.value)}\n options={tagOptions}\n placeholder=\"No tag\"\n required={true}\n />\n ))}\n </div>\n </div>\n )}\n </>\n );\n }\n}\n"]}]}
{"remainingRequest":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/thread-loader/dist/cjs.js??ref--5-1!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/ts-loader/index.js??ref--5-2!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","dependencies":[{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","mtime":1538771861253},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/cache-loader/dist/cjs.js","mtime":0},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/thread-loader/dist/cjs.js","mtime":0},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/ts-loader/index.js","mtime":1525713677000},{"path":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js","mtime":1519899048000}],"contextDependencies":[],"result":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst React = require(\"react\");\nconst react_select_1 = require(\"react-select\");\nconst lodash_1 = require(\"lodash\");\nconst core_1 = require(\"@spinnaker/core\");\nconst DockerImageReader_1 = require(\"./DockerImageReader\");\nclass DockerImageAndTagSelector extends React.Component {\n constructor(props) {\n super(props);\n const accountOptions = props.account ? [{ label: props.account, value: props.account }] : [];\n const organizationOptions = props.organization && props.organization.length ? [{ label: props.organization, value: props.organization }] : [];\n const repositoryOptions = props.repository && props.repository.length ? [{ label: props.repository, value: props.repository }] : [];\n const tagOptions = props.tag && props.tag.length ? [{ label: props.tag, value: props.tag }] : [];\n this.state = {\n accountOptions,\n imagesLoaded: false,\n imagesLoading: false,\n imagesRefreshing: false,\n organizationMap: {},\n organizationOptions,\n repositoryMap: {},\n repositoryOptions,\n tagOptions,\n };\n }\n getAccountMap(images) {\n const groupedImages = lodash_1.groupBy(images.filter(image => image.account), 'account');\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => `${i.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`));\n return acc;\n }, {});\n }\n getRegistryMap(images) {\n return images.reduce((m, image) => {\n m[image.account] = image.registry;\n return m;\n }, {});\n }\n getOrganizationMap(images) {\n const extractGroupByKey = (image) => `${image.account}/${image.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`;\n const groupedImages = lodash_1.groupBy(images.filter(image => image.repository), extractGroupByKey);\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => i.repository));\n return acc;\n }, {});\n }\n getRepositoryMap(images) {\n const groupedImages = lodash_1.groupBy(images.filter(image => image.account), 'repository');\n return lodash_1.reduce(groupedImages, (acc, image, key) => {\n acc[key] = lodash_1.uniq(image.map(i => i.tag));\n return acc;\n }, {});\n }\n getOrganizationsList(accountMap) {\n return accountMap ? accountMap[this.props.showRegistry ? this.props.account : this.props.registry] || [] : [];\n }\n getRepositoryList(organizationMap, organization, registry) {\n if (organizationMap) {\n const key = `${this.props.showRegistry ? this.props.account : registry}/${organization || ''}`;\n return organizationMap[key] || [];\n }\n return [];\n }\n getTags(repositoryMap, repository) {\n let tag = this.props.tag;\n let tags = [];\n if (this.props.specifyTagByRegex) {\n if (tag && lodash_1.trim(tag) === '') {\n tag = '';\n }\n }\n else {\n if (repositoryMap) {\n tags = repositoryMap[repository] || [];\n if (!tags.includes(tag) && tag && !tag.includes('${')) {\n tag = '';\n }\n }\n }\n return { tag, tags };\n }\n componentWillReceiveProps(nextProps) {\n if (!this.images || ['account', 'showRegistry'].some(key => this.props[key] !== nextProps[key])) {\n this.refreshImages(nextProps);\n }\n else if (['organization', 'registry', 'repository'].some(key => this.props[key] !== nextProps[key])) {\n this.updateThings(nextProps);\n }\n }\n updateThings(props) {\n let { organization, registry, repository } = props;\n const { account, showRegistry } = props;\n const registryMap = this.getRegistryMap(this.images);\n const accountMap = this.getAccountMap(this.images);\n const newAccounts = this.accounts || Object.keys(accountMap);\n const organizationMap = this.getOrganizationMap(this.images);\n const repositoryMap = this.getRepositoryMap(this.images);\n const organizations = this.getOrganizationsList(accountMap);\n organization =\n !organizations.includes(organization) && organization && !organization.includes('${') ? '' : organization;\n if (showRegistry) {\n registry = registryMap[account];\n }\n const repositories = this.getRepositoryList(organizationMap, organization, registry);\n if (!repositories.includes(repository) && repository && !repository.includes('${')) {\n repository = '';\n }\n const { tag, tags } = this.getTags(repositoryMap, repository);\n if (this.props.onChange) {\n this.props.onChange({ organization, registry, repository, tag });\n }\n this.setState({\n accountOptions: newAccounts.sort().map(a => ({ label: a, value: a })),\n organizationOptions: organizations\n .filter(o => o)\n .sort()\n .map(o => ({ label: o, value: o })),\n imagesLoaded: true,\n organizationMap,\n repositoryMap,\n repositoryOptions: repositories.sort().map(r => ({ label: r, value: r })),\n tagOptions: tags.sort().map(t => ({ label: t, value: t })),\n });\n }\n initializeImages(props, refresh) {\n if (this.state.imagesLoading) {\n return;\n }\n const { showRegistry, account, registry } = props;\n const imageConfig = {\n provider: 'dockerRegistry',\n account: showRegistry ? account : registry,\n };\n this.setState({\n imagesLoading: true,\n imagesRefreshing: refresh ? true : false,\n });\n DockerImageReader_1.DockerImageReader.findImages(imageConfig)\n .then((images) => {\n this.images = images;\n this.updateThings(props);\n })\n .finally(() => {\n this.setState({\n imagesLoading: false,\n imagesRefreshing: false,\n });\n });\n }\n handleRefreshImages() {\n this.refreshImages(this.props);\n }\n refreshImages(props) {\n this.initializeImages(props, true);\n }\n initializeAccounts(props) {\n let { account } = props;\n core_1.AccountService.listAccounts('dockerRegistry').then((allAccounts) => {\n const accounts = allAccounts.map((a) => a.name);\n if (this.props.showRegistry && !account) {\n account = accounts[0];\n }\n this.accounts = accounts;\n this.refreshImages(Object.assign({}, props, { account }));\n });\n }\n isNew() {\n const { account, organization, registry, repository, tag } = this.props;\n return !account && !organization && !registry && !repository && !tag;\n }\n componentDidMount() {\n if (!this.props.deferInitialization && (this.props.registry || this.isNew())) {\n this.initializeAccounts(this.props);\n }\n }\n valueChanged(name, value) {\n this.props.onChange && this.props.onChange({ [name]: value });\n }\n render() {\n const { account, fieldClass, labelClass, organization, repository, showRegistry, specifyTagByRegex, tag, } = this.props;\n const { accountOptions, imagesLoading, imagesRefreshing, organizationOptions, repositoryOptions, tagOptions, } = this.state;\n return (React.createElement(React.Fragment, null,\n showRegistry && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Registry Name\"),\n React.createElement(\"div\", { className: fieldClass },\n React.createElement(react_select_1.default, { value: account, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('account', o.value), options: accountOptions, isLoading: imagesRefreshing })),\n React.createElement(\"div\", { className: \"col-md-1 text-center\" },\n React.createElement(core_1.Tooltip, { value: imagesRefreshing ? 'Images refreshing' : 'Refresh images list' },\n React.createElement(\"a\", { className: \"clickable\", onClick: this.handleRefreshImages },\n React.createElement(\"span\", { className: `fa fa-sync-alt ${imagesRefreshing ? 'fa-spin' : ''}` })))))),\n React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Organization\"),\n React.createElement(\"div\", { className: fieldClass }, organization.includes('${') ? (React.createElement(\"input\", { disabled: imagesRefreshing, className: \"form-control input-sm\", value: organization, onChange: e => this.valueChanged('organization', e.target.value) })) : (React.createElement(react_select_1.default, { value: organization, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('organization', (o && o.value) || ''), placeholder: \"No organization\", options: organizationOptions, isLoading: imagesRefreshing })))),\n React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Image\"),\n React.createElement(\"div\", { className: fieldClass }, repository.includes('${') ? (React.createElement(\"input\", { className: \"form-control input-sm\", disabled: imagesRefreshing, value: repository, onChange: e => this.valueChanged('repository', e.target.value) })) : (React.createElement(react_select_1.default, { value: repository, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('repository', (o && o.value) || ''), options: repositoryOptions, required: true, isLoading: imagesRefreshing })))),\n specifyTagByRegex && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` },\n \"Tag \",\n React.createElement(core_1.HelpField, { id: \"pipeline.config.docker.trigger.tag\" })),\n React.createElement(\"div\", { className: fieldClass },\n React.createElement(\"input\", { type: \"text\", className: \"form-control input-sm\", value: tag, disabled: imagesRefreshing || !repository, onChange: e => this.valueChanged('tag', e.target.value) })))),\n !specifyTagByRegex && (React.createElement(\"div\", { className: \"form-group\" },\n React.createElement(\"div\", { className: `sm-label-right ${labelClass}` }, \"Tag\"),\n React.createElement(\"div\", { className: fieldClass }, tag.includes('${') ? (React.createElement(\"input\", { className: \"form-control input-sm\", disabled: imagesRefreshing, value: tag, onChange: e => this.valueChanged('tag', e.target.value), required: true })) : (React.createElement(react_select_1.default, { value: tag, disabled: imagesRefreshing || !repository, isLoading: imagesLoading, onChange: (o) => this.valueChanged('tag', o.value), options: tagOptions, placeholder: \"No tag\", required: true })))))));\n }\n}\nDockerImageAndTagSelector.defaultProps = {\n fieldClass: 'col-md-8',\n labelClass: 'col-md-3',\n organization: '',\n registry: '',\n repository: '',\n tag: '',\n};\nexports.DockerImageAndTagSelector = DockerImageAndTagSelector;\n",{"version":3,"file":"/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx","sourceRoot":"","sources":["/Users/jreynolds/Development/Netflix/git/spinnaker/deck/node_modules/tslint-loader/index.js!/Users/jreynolds/Development/Netflix/git/spinnaker/deck/app/scripts/modules/docker/src/image/DockerImageAndTagSelector.tsx"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,+CAA8C;AAC9C,mCAAqD;AAErD,0CAAiG;AAEjG,2DAAsE;AAoCtE,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAGpD;IAaC,YAAmB,KAAsC;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,MAAM,mBAAmB,GACvB,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpH,MAAM,iBAAiB,GACrB,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CA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AAE,UAAU;IACtB,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;IACd,GAAG,EAAE,EAAE;CACR,CAAC;AAXJ,8DA2XC","sourcesContent":["import * as React from 'react';\nimport Select, { Option } from 'react-select';\nimport { groupBy, reduce, trim, uniq } from 'lodash';\n\nimport { AccountService, HelpField, IAccount, IFindImageParams, Tooltip } from '@spinnaker/core';\n\nimport { DockerImageReader, IDockerImage } from './DockerImageReader';\n\nexport interface IDockerImageAndTagChanges {\n account?: string;\n organization?: string;\n registry?: string;\n repository?: string;\n tag?: string;\n}\n\nexport interface IDockerImageAndTagSelectorProps {\n specifyTagByRegex: boolean;\n organization: string;\n registry: string;\n repository: string;\n tag: string;\n account: string;\n showRegistry?: boolean;\n labelClass?: string;\n fieldClass?: string;\n onChange: (changes: IDockerImageAndTagChanges) => void;\n deferInitialization?: boolean;\n}\n\nexport interface IDockerImageAndTagSelectorState {\n accountOptions: Array<Option<string>>;\n imagesLoaded: boolean;\n imagesLoading: boolean;\n imagesRefreshing: boolean;\n organizationMap: { [key: string]: string[] };\n organizationOptions: Array<Option<string>>;\n repositoryMap: { [key: string]: string[] };\n repositoryOptions: Array<Option<string>>;\n tagOptions: Array<Option<string>>;\n}\n\nexport class DockerImageAndTagSelector extends React.Component<\n IDockerImageAndTagSelectorProps,\n IDockerImageAndTagSelectorState\n> {\n public static defaultProps: Partial<IDockerImageAndTagSelectorProps> = {\n fieldClass: 'col-md-8',\n labelClass: 'col-md-3',\n organization: '',\n registry: '',\n repository: '',\n tag: '',\n };\n\n private images: IDockerImage[];\n private accounts: string[];\n\n public constructor(props: IDockerImageAndTagSelectorProps) {\n super(props);\n\n const accountOptions = props.account ? [{ label: props.account, value: props.account }] : [];\n const organizationOptions =\n props.organization && props.organization.length ? [{ label: props.organization, value: props.organization }] : [];\n const repositoryOptions =\n props.repository && props.repository.length ? [{ label: props.repository, value: props.repository }] : [];\n const tagOptions = props.tag && props.tag.length ? [{ label: props.tag, value: props.tag }] : [];\n\n this.state = {\n accountOptions,\n imagesLoaded: false,\n imagesLoading: false,\n imagesRefreshing: false,\n organizationMap: {},\n organizationOptions,\n repositoryMap: {},\n repositoryOptions,\n tagOptions,\n };\n }\n\n private getAccountMap(images: IDockerImage[]): { [key: string]: string[] } {\n const groupedImages = groupBy(images.filter(image => image.account), 'account');\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(\n image.map(\n i =>\n `${i.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`,\n ),\n );\n return acc;\n },\n {},\n );\n }\n\n private getRegistryMap(images: IDockerImage[]) {\n return images.reduce(\n (m: { [key: string]: string }, image: IDockerImage) => {\n m[image.account] = image.registry;\n return m;\n },\n {} as { [key: string]: string },\n );\n }\n\n private getOrganizationMap(images: IDockerImage[]): { [key: string]: string[] } {\n const extractGroupByKey = (image: IDockerImage) =>\n `${image.account}/${image.repository\n .split('/')\n .slice(0, -1)\n .join('/')}`;\n const groupedImages = groupBy(images.filter(image => image.repository), extractGroupByKey);\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(image.map(i => i.repository));\n return acc;\n },\n {},\n );\n }\n\n private getRepositoryMap(images: IDockerImage[]) {\n const groupedImages = groupBy(images.filter(image => image.account), 'repository');\n return reduce<IDockerImage[], { [key: string]: string[] }>(\n groupedImages,\n (acc, image, key) => {\n acc[key] = uniq(image.map(i => i.tag));\n return acc;\n },\n {},\n );\n }\n\n private getOrganizationsList(accountMap: { [key: string]: string[] }) {\n return accountMap ? accountMap[this.props.showRegistry ? this.props.account : this.props.registry] || [] : [];\n }\n\n private getRepositoryList(organizationMap: { [key: string]: string[] }, organization: string, registry: string) {\n if (organizationMap) {\n const key = `${this.props.showRegistry ? this.props.account : registry}/${organization || ''}`;\n return organizationMap[key] || [];\n }\n return [];\n }\n\n private getTags(repositoryMap: { [key: string]: string[] }, repository: string) {\n let tag = this.props.tag;\n let tags: string[] = [];\n if (this.props.specifyTagByRegex) {\n if (tag && trim(tag) === '') {\n tag = '';\n }\n } else {\n if (repositoryMap) {\n tags = repositoryMap[repository] || [];\n if (!tags.includes(tag) && tag && !tag.includes('${')) {\n tag = '';\n }\n }\n }\n\n return { tag, tags };\n }\n\n public componentWillReceiveProps(nextProps: IDockerImageAndTagSelectorProps) {\n if (!this.images || ['account', 'showRegistry'].some(key => (this.props as any)[key] !== (nextProps as any)[key])) {\n this.refreshImages(nextProps);\n } else if (\n ['organization', 'registry', 'repository'].some(key => (this.props as any)[key] !== (nextProps as any)[key])\n ) {\n this.updateThings(nextProps);\n }\n }\n\n private updateThings(props: IDockerImageAndTagSelectorProps) {\n let { organization, registry, repository } = props;\n const { account, showRegistry } = props;\n\n const registryMap = this.getRegistryMap(this.images);\n const accountMap = this.getAccountMap(this.images);\n const newAccounts = this.accounts || Object.keys(accountMap);\n\n const organizationMap = this.getOrganizationMap(this.images);\n const repositoryMap = this.getRepositoryMap(this.images);\n const organizations = this.getOrganizationsList(accountMap);\n\n organization =\n !organizations.includes(organization) && organization && !organization.includes('${') ? '' : organization;\n\n if (showRegistry) {\n registry = registryMap[account];\n }\n\n const repositories = this.getRepositoryList(organizationMap, organization, registry);\n\n if (!repositories.includes(repository) && repository && !repository.includes('${')) {\n repository = '';\n }\n\n const { tag, tags } = this.getTags(repositoryMap, repository);\n if (this.props.onChange) {\n this.props.onChange({ organization, registry, repository, tag });\n }\n\n this.setState({\n accountOptions: newAccounts.sort().map(a => ({ label: a, value: a })), // def internal state\n organizationOptions: organizations\n .filter(o => o)\n .sort()\n .map(o => ({ label: o, value: o })),\n imagesLoaded: true, // def internal state\n organizationMap,\n repositoryMap,\n repositoryOptions: repositories.sort().map(r => ({ label: r, value: r })),\n tagOptions: tags.sort().map(t => ({ label: t, value: t })),\n });\n }\n\n private initializeImages(props: IDockerImageAndTagSelectorProps, refresh?: boolean) {\n if (this.state.imagesLoading) {\n return;\n }\n\n const { showRegistry, account, registry } = props;\n\n const imageConfig: IFindImageParams = {\n provider: 'dockerRegistry',\n account: showRegistry ? account : registry,\n };\n\n this.setState({\n imagesLoading: true,\n imagesRefreshing: refresh ? true : false,\n });\n DockerImageReader.findImages(imageConfig)\n .then((images: IDockerImage[]) => {\n this.images = images;\n this.updateThings(props);\n })\n .finally(() => {\n this.setState({\n imagesLoading: false,\n imagesRefreshing: false,\n });\n });\n }\n\n public handleRefreshImages(): void {\n this.refreshImages(this.props);\n }\n\n public refreshImages(props: IDockerImageAndTagSelectorProps): void {\n this.initializeImages(props, true);\n }\n\n private initializeAccounts(props: IDockerImageAndTagSelectorProps) {\n let { account } = props;\n AccountService.listAccounts('dockerRegistry').then((allAccounts: IAccount[]) => {\n const accounts = allAccounts.map((a: IAccount) => a.name);\n if (this.props.showRegistry && !account) {\n account = accounts[0];\n }\n this.accounts = accounts;\n this.refreshImages({ ...props, ...{ account } });\n });\n }\n\n private isNew(): boolean {\n const { account, organization, registry, repository, tag } = this.props;\n return !account && !organization && !registry && !repository && !tag;\n }\n\n public componentDidMount() {\n if (!this.props.deferInitialization && (this.props.registry || this.isNew())) {\n this.initializeAccounts(this.props);\n }\n }\n\n private valueChanged(name: string, value: string) {\n this.props.onChange && this.props.onChange({ [name]: value });\n }\n\n public render() {\n const {\n account,\n fieldClass,\n labelClass,\n organization,\n repository,\n showRegistry,\n specifyTagByRegex,\n tag,\n } = this.props;\n const {\n accountOptions,\n imagesLoading,\n imagesRefreshing,\n organizationOptions,\n repositoryOptions,\n tagOptions,\n } = this.state;\n\n return (\n <>\n {showRegistry && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Registry Name</div>\n <div className={fieldClass}>\n <Select\n value={account}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('account', o.value)}\n options={accountOptions}\n isLoading={imagesRefreshing}\n />\n </div>\n <div className=\"col-md-1 text-center\">\n <Tooltip value={imagesRefreshing ? 'Images refreshing' : 'Refresh images list'}>\n <a className=\"clickable\" onClick={this.handleRefreshImages}>\n <span className={`fa fa-sync-alt ${imagesRefreshing ? 'fa-spin' : ''}`} />\n </a>\n </Tooltip>\n </div>\n </div>\n )}\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Organization</div>\n <div className={fieldClass}>\n {organization.includes('${') ? (\n <input\n disabled={imagesRefreshing}\n className=\"form-control input-sm\"\n value={organization}\n onChange={e => this.valueChanged('organization', e.target.value)}\n />\n ) : (\n <Select\n value={organization}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('organization', (o && o.value) || '')}\n placeholder=\"No organization\"\n options={organizationOptions}\n isLoading={imagesRefreshing}\n />\n )}\n </div>\n </div>\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Image</div>\n <div className={fieldClass}>\n {repository.includes('${') ? (\n <input\n className=\"form-control input-sm\"\n disabled={imagesRefreshing}\n value={repository}\n onChange={e => this.valueChanged('repository', e.target.value)}\n />\n ) : (\n <Select\n value={repository}\n disabled={imagesRefreshing}\n onChange={(o: Option<string>) => this.valueChanged('repository', (o && o.value) || '')}\n options={repositoryOptions}\n required={true}\n isLoading={imagesRefreshing}\n />\n )}\n </div>\n </div>\n {specifyTagByRegex && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>\n Tag <HelpField id=\"pipeline.config.docker.trigger.tag\" />\n </div>\n <div className={fieldClass}>\n <input\n type=\"text\"\n className=\"form-control input-sm\"\n value={tag}\n disabled={imagesRefreshing || !repository}\n onChange={e => this.valueChanged('tag', e.target.value)}\n />\n </div>\n </div>\n )}\n {!specifyTagByRegex && (\n <div className=\"form-group\">\n <div className={`sm-label-right ${labelClass}`}>Tag</div>\n <div className={fieldClass}>\n {tag.includes('${') ? (\n <input\n className=\"form-control input-sm\"\n disabled={imagesRefreshing}\n value={tag}\n onChange={e => this.valueChanged('tag', e.target.value)}\n required={true}\n />\n ) : (\n <Select\n value={tag}\n disabled={imagesRefreshing || !repository}\n isLoading={imagesLoading}\n onChange={(o: Option<string>) => this.valueChanged('tag', o.value)}\n options={tagOptions}\n placeholder=\"No tag\"\n required={true}\n />\n )}\n </div>\n </div>\n )}\n </>\n );\n }\n}\n"]}]}

@@ -11,4 +11,8 @@ "use strict";

super(props);
const accountOptions = props.account ? [{ label: props.account, value: props.account }] : [];
const organizationOptions = props.organization && props.organization.length ? [{ label: props.organization, value: props.organization }] : [];
const repositoryOptions = props.repository && props.repository.length ? [{ label: props.repository, value: props.repository }] : [];
const tagOptions = props.tag && props.tag.length ? [{ label: props.tag, value: props.tag }] : [];
this.state = {
accountOptions: [],
accountOptions,
imagesLoaded: false,

@@ -18,6 +22,6 @@ imagesLoading: false,

organizationMap: {},
organizationOptions: [],
organizationOptions,
repositoryMap: {},
repositoryOptions: [],
tagOptions: [],
repositoryOptions,
tagOptions,
};

@@ -102,3 +106,2 @@ }

const organizationMap = this.getOrganizationMap(this.images);
// this.organizations.push(...Object.keys(this.organizationMap)); // wat...
const repositoryMap = this.getRepositoryMap(this.images);

@@ -193,3 +196,3 @@ const organizations = this.getOrganizationsList(accountMap);

React.createElement("div", { className: fieldClass },
React.createElement(react_select_1.default, { value: account, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('account', o.value), options: accountOptions })),
React.createElement(react_select_1.default, { value: account, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('account', o.value), options: accountOptions, isLoading: imagesRefreshing })),
React.createElement("div", { className: "col-md-1 text-center" },

@@ -201,14 +204,6 @@ React.createElement(core_1.Tooltip, { value: imagesRefreshing ? 'Images refreshing' : 'Refresh images list' },

React.createElement("div", { className: `sm-label-right ${labelClass}` }, "Organization"),
React.createElement("div", { className: fieldClass },
imagesLoading && (React.createElement("div", { className: "form-field-loading" },
React.createElement(core_1.Spinner, { size: "small" }))),
!imagesLoading &&
(organization.includes('${') ? (React.createElement("input", { className: "form-control input-sm", value: organization, onChange: e => this.valueChanged('organization', e.target.value) })) : (React.createElement(react_select_1.default, { value: organization, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('organization', (o && o.value) || ''), placeholder: "No organization", options: organizationOptions }))))),
React.createElement("div", { className: fieldClass }, organization.includes('${') ? (React.createElement("input", { disabled: imagesRefreshing, className: "form-control input-sm", value: organization, onChange: e => this.valueChanged('organization', e.target.value) })) : (React.createElement(react_select_1.default, { value: organization, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('organization', (o && o.value) || ''), placeholder: "No organization", options: organizationOptions, isLoading: imagesRefreshing })))),
React.createElement("div", { className: "form-group" },
React.createElement("div", { className: `sm-label-right ${labelClass}` }, "Image"),
React.createElement("div", { className: fieldClass },
imagesLoading && (React.createElement("div", { className: "form-field-loading" },
React.createElement(core_1.Spinner, { size: "small" }))),
!imagesLoading &&
(repository.includes('${') ? (React.createElement("input", { className: "form-control input-sm", value: repository, onChange: e => this.valueChanged('repository', e.target.value) })) : (React.createElement(react_select_1.default, { value: repository, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('repository', (o && o.value) || ''), options: repositoryOptions, required: true }))))),
React.createElement("div", { className: fieldClass }, repository.includes('${') ? (React.createElement("input", { className: "form-control input-sm", disabled: imagesRefreshing, value: repository, onChange: e => this.valueChanged('repository', e.target.value) })) : (React.createElement(react_select_1.default, { value: repository, disabled: imagesRefreshing, onChange: (o) => this.valueChanged('repository', (o && o.value) || ''), options: repositoryOptions, required: true, isLoading: imagesRefreshing })))),
specifyTagByRegex && (React.createElement("div", { className: "form-group" },

@@ -222,7 +217,3 @@ React.createElement("div", { className: `sm-label-right ${labelClass}` },

React.createElement("div", { className: `sm-label-right ${labelClass}` }, "Tag"),
React.createElement("div", { className: fieldClass },
imagesLoading && (React.createElement("div", { className: "form-field-loading" },
React.createElement(core_1.Spinner, { size: "small" }))),
!imagesLoading &&
(tag.includes('${') ? (React.createElement("input", { className: "form-control input-sm", value: tag, onChange: e => this.valueChanged('tag', e.target.value), required: true })) : (React.createElement(react_select_1.default, { value: tag, disabled: imagesRefreshing || !repository, onChange: (o) => this.valueChanged('tag', o.value), options: tagOptions, placeholder: "No tag", required: true }))))))));
React.createElement("div", { className: fieldClass }, tag.includes('${') ? (React.createElement("input", { className: "form-control input-sm", disabled: imagesRefreshing, value: tag, onChange: e => this.valueChanged('tag', e.target.value), required: true })) : (React.createElement(react_select_1.default, { value: tag, disabled: imagesRefreshing || !repository, isLoading: imagesLoading, onChange: (o) => this.valueChanged('tag', o.value), options: tagOptions, placeholder: "No tag", required: true })))))));
}

@@ -229,0 +220,0 @@ }

@@ -1,2 +0,2 @@

!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("@spinnaker/core")):"function"==typeof define&&define.amd?define("@spinnaker/docker",["@spinnaker/core"],factory):"object"==typeof exports?exports["@spinnaker/docker"]=factory(require("@spinnaker/core")):root["@spinnaker/docker"]=factory(root["@spinnaker/core"])}(window,function(__WEBPACK_EXTERNAL_MODULE__0__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=20)}([function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("react")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0);exports.DockerImageReader=class{static getImage(imageName,region,credentials){return core_1.API.all("images").one(credentials).one(region).one(imageName).withParams({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/find").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/tags").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeStage.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeStageCtrl as bakeStageCtrl">\n <stage-config-field label="Package" help-key="pipeline.config.bake.package">\n <input type="text" class="form-control input-sm"\n ng-model="stage.package"/>\n </stage-config-field>\n <stage-config-field label="Organization" help-key="pipeline.config.docker.bake.organization">\n <input type="text" class="form-control input-sm"\n ng-model="stage.organization"/>\n </stage-config-field>\n <stage-config-field label="Image Name" help-key="pipeline.config.docker.bake.targetImage">\n <input type="text" class="form-control input-sm"\n ng-model="stage.ami_name"/>\n </stage-config-field>\n <stage-config-field label="Image tag" help-key="pipeline.config.docker.bake.targetImageTag">\n <input type="text" class="form-control input-sm"\n ng-model="stage.extendedAttributes[\'docker_target_image_tag\']"/>\n </stage-config-field>\n <stage-config-field label="Base OS">\n <bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>\n </stage-config-field>\n\n <stage-config-field label="Base Label">\n <label class="radio-inline" ng-repeat="baseLabel in baseLabelOptions">\n <input type="radio"\n ng-model="stage.baseLabel"\n ng-value="baseLabel"/>\n {{baseLabel}}\n </label>\n </stage-config-field>\n <stage-config-field label="Rebake">\n <div class="checkbox" style="margin-bottom: 0">\n <label>\n <input type="checkbox"\n ng-model="stage.rebake">\n </input>\n Rebake image without regard to the status of any existing bake\n </label>\n </div>\n </stage-config-field>\n</div>\n')}]),module.exports=path},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeExecutionDetails.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeExecutionDetailsCtrl">\n <execution-details-section-nav sections="configSections"></execution-details-section-nav>\n <div class="step-section-details" ng-if="detailsSection === \'bakeConfig\'">\n <div class="row">\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt if-multiple-providers>Provider</dt>\n <dd if-multiple-providers>Docker</dd>\n <dt>Organization</dt>\n <dd>{{stage.context.organization}}</dd>\n <dt>Image Name</dt>\n <dd>{{stage.context.ami_name}}</dd>\n <dt>Image Tag</dt>\n <dd>{{stage.context.extendedAttributes[\'docker_target_image_tag\']}}</dd>\n <dt>Image</dt>\n <dd>{{stage.context.ami}}</dd>\n </dl>\n </div>\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt>Base OS</dt>\n <dd>{{stage.context.baseOs}}</dd>\n <dt>Region</dt>\n <dd>{{stage.context.region}}</dd>\n <dt>Package</dt>\n <dd>{{stage.context.package}}</dd>\n <dt>Label</dt>\n <dd>{{stage.context.baseLabel}}</dd>\n </dl>\n </div>\n </div>\n <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>\n\n <div class="row" ng-if="stage.context.region && stage.context.status.resourceId">\n <div class="col-md-12">\n <div class="alert alert-{{stage.isFailed ? \'danger\' : \'info\'}}">\n <a target="_blank" href="{{ bakeryDetailUrl(stage) }}">\n View Bakery Details\n </a>\n </div>\n </div>\n </div>\n\n </div>\n <div class="step-section-details" ng-if="detailsSection === \'taskStatus\'">\n <div class="row">\n <execution-step-details item="stage"></execution-step-details>\n </div>\n </div>\n</div>\n')}]),module.exports=path},function(module,exports){module.exports=require("lodash")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),react_select_1=__webpack_require__(18),lodash_1=__webpack_require__(6),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3);class DockerImageAndTagSelector extends React.Component{constructor(props){super(props),this.state={accountOptions:[],imagesLoaded:!1,imagesLoading:!1,imagesRefreshing:!1,organizationMap:{},organizationOptions:[],repositoryMap:{},repositoryOptions:[],tagOptions:[]}}getAccountMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"account");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>`${i.repository.split("/").slice(0,-1).join("/")}`)),acc),{})}getRegistryMap(images){return images.reduce((m,image)=>(m[image.account]=image.registry,m),{})}getOrganizationMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"repository");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.tag)),acc),{})}getOrganizationsList(accountMap){return accountMap&&accountMap[this.props.showRegistry?this.props.account:this.props.registry]||[]}getRepositoryList(organizationMap,organization,registry){if(organizationMap){return organizationMap[`${this.props.showRegistry?this.props.account:registry}/${organization||""}`]||[]}return[]}getTags(repositoryMap,repository){let tag=this.props.tag,tags=[];return this.props.specifyTagByRegex?tag&&""===lodash_1.trim(tag)&&(tag=""):repositoryMap&&((tags=repositoryMap[repository]||[]).includes(tag)||!tag||tag.includes("${")||(tag="")),{tag:tag,tags:tags}}componentWillReceiveProps(nextProps){!this.images||["account","showRegistry"].some(key=>this.props[key]!==nextProps[key])?this.refreshImages(nextProps):["organization","registry","repository"].some(key=>this.props[key]!==nextProps[key])&&this.updateThings(nextProps)}updateThings(props){let{organization:organization,registry:registry,repository:repository}=props;const{account:account,showRegistry:showRegistry}=props,registryMap=this.getRegistryMap(this.images),accountMap=this.getAccountMap(this.images),newAccounts=this.accounts||Object.keys(accountMap),organizationMap=this.getOrganizationMap(this.images),repositoryMap=this.getRepositoryMap(this.images),organizations=this.getOrganizationsList(accountMap);organization=organizations.includes(organization)||!organization||organization.includes("${")?organization:"",showRegistry&&(registry=registryMap[account]);const repositories=this.getRepositoryList(organizationMap,organization,registry);repositories.includes(repository)||!repository||repository.includes("${")||(repository="");const{tag:tag,tags:tags}=this.getTags(repositoryMap,repository);this.props.onChange&&this.props.onChange({organization:organization,registry:registry,repository:repository,tag:tag}),this.setState({accountOptions:newAccounts.sort().map(a=>({label:a,value:a})),organizationOptions:organizations.filter(o=>o).sort().map(o=>({label:o,value:o})),imagesLoaded:!0,organizationMap:organizationMap,repositoryMap:repositoryMap,repositoryOptions:repositories.sort().map(r=>({label:r,value:r})),tagOptions:tags.sort().map(t=>({label:t,value:t}))})}initializeImages(props,refresh){if(this.state.imagesLoading)return;const{showRegistry:showRegistry,account:account,registry:registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0,imagesRefreshing:!!refresh}),DockerImageReader_1.DockerImageReader.findImages(imageConfig).then(images=>{this.images=images,this.updateThings(props)}).finally(()=>{this.setState({imagesLoading:!1,imagesRefreshing:!1})})}handleRefreshImages(){this.refreshImages(this.props)}refreshImages(props){this.initializeImages(props,!0)}initializeAccounts(props){let{account:account}=props;core_1.AccountService.listAccounts("dockerRegistry").then(allAccounts=>{const accounts=allAccounts.map(a=>a.name);this.props.showRegistry&&!account&&(account=accounts[0]),this.accounts=accounts,this.refreshImages(Object.assign({},props,{account:account}))})}isNew(){const{account:account,organization:organization,registry:registry,repository:repository,tag:tag}=this.props;return!(account||organization||registry||repository||tag)}componentDidMount(){this.props.deferInitialization||!this.props.registry&&!this.isNew()||this.initializeAccounts(this.props)}valueChanged(name,value){this.props.onChange&&this.props.onChange({[name]:value})}render(){const{account:account,fieldClass:fieldClass,labelClass:labelClass,organization:organization,repository:repository,showRegistry:showRegistry,specifyTagByRegex:specifyTagByRegex,tag:tag}=this.props,{accountOptions:accountOptions,imagesLoading:imagesLoading,imagesRefreshing:imagesRefreshing,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions}=this.state;return React.createElement(React.Fragment,null,showRegistry&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Registry Name"),React.createElement("div",{className:fieldClass},React.createElement(react_select_1.default,{value:account,disabled:imagesRefreshing,onChange:o=>this.valueChanged("account",o.value),options:accountOptions})),React.createElement("div",{className:"col-md-1 text-center"},React.createElement(core_1.Tooltip,{value:imagesRefreshing?"Images refreshing":"Refresh images list"},React.createElement("a",{className:"clickable",onClick:this.handleRefreshImages},React.createElement("span",{className:`fa fa-sync-alt ${imagesRefreshing?"fa-spin":""}`}))))),React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Organization"),React.createElement("div",{className:fieldClass},imagesLoading&&React.createElement("div",{className:"form-field-loading"},React.createElement(core_1.Spinner,{size:"small"})),!imagesLoading&&(organization.includes("${")?React.createElement("input",{className:"form-control input-sm",value:organization,onChange:e=>this.valueChanged("organization",e.target.value)}):React.createElement(react_select_1.default,{value:organization,disabled:imagesRefreshing,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions})))),React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image"),React.createElement("div",{className:fieldClass},imagesLoading&&React.createElement("div",{className:"form-field-loading"},React.createElement(core_1.Spinner,{size:"small"})),!imagesLoading&&(repository.includes("${")?React.createElement("input",{className:"form-control input-sm",value:repository,onChange:e=>this.valueChanged("repository",e.target.value)}):React.createElement(react_select_1.default,{value:repository,disabled:imagesRefreshing,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0})))),specifyTagByRegex&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag ",React.createElement(core_1.HelpField,{id:"pipeline.config.docker.trigger.tag"})),React.createElement("div",{className:fieldClass},React.createElement("input",{type:"text",className:"form-control input-sm",value:tag,disabled:imagesRefreshing||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))),!specifyTagByRegex&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag"),React.createElement("div",{className:fieldClass},imagesLoading&&React.createElement("div",{className:"form-field-loading"},React.createElement(core_1.Spinner,{size:"small"})),!imagesLoading&&(tag.includes("${")?React.createElement("input",{className:"form-control input-sm",value:tag,onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):React.createElement(react_select_1.default,{value:tag,disabled:imagesRefreshing||!repository,onChange:o=>this.valueChanged("tag",o.value),options:tagOptions,placeholder:"No tag",required:!0})))))}}DockerImageAndTagSelector.defaultProps={fieldClass:"col-md-8",labelClass:"col-md-3",organization:"",registry:"",repository:"",tag:""},exports.DockerImageAndTagSelector=DockerImageAndTagSelector},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports,__webpack_require__){"use strict";var _core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[__webpack_require__(8).default]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];let initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate(_core.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}])},function(module,exports,__webpack_require__){"use strict";var obj,_lodash=__webpack_require__(6),_lodash2=(obj=_lodash)&&obj.__esModule?obj:{default:obj},_core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bakeStage",[__webpack_require__(9).name]).config(function(){_core.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image in the specified region",templateUrl:__webpack_require__(4),executionDetailsUrl:__webpack_require__(5),executionLabelComponent:_core.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,defaultTimeoutMs:36e5,validators:[{type:"requiredField",fieldName:"package"}],restartable:!0})}).controller("dockerBakeStageCtrl",["$scope","$q",function($scope,$q){$scope.stage.region="global",$scope.stage.user||($scope.stage.user=_core.AuthenticationService.getAuthenticatedUser().name),$scope.viewState={loading:!0},$scope.$watch("stage",function(){_lodash2.default.forOwn($scope.stage,function(val,key){""===val&&delete $scope.stage[key]})},!0),$scope.viewState.providerSelected=!0,$q.all({baseOsOptions:_core.BakeryReader.getBaseOsOptions("docker"),baseLabelOptions:_core.BakeryReader.getBaseLabelOptions()}).then(function(results){$scope.baseOsOptions=results.baseOsOptions.baseImages,$scope.baseLabelOptions=results.baseLabelOptions,!$scope.stage.baseOs&&$scope.baseOsOptions&&$scope.baseOsOptions.length&&($scope.stage.baseOs=$scope.baseOsOptions[0].id),!$scope.stage.baseLabel&&$scope.baseLabelOptions&&$scope.baseLabelOptions.length&&($scope.stage.baseLabel=$scope.baseLabelOptions[0]),$scope.viewState.loading=!1})}])},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":5,"./pipeline/stages/bake/bakeStage.html":4};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){var id=map[req];if(!(id+1)){var e=new Error('Cannot find module "'+req+'".');throw e.code="MODULE_NOT_FOUND",e}return id}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=11},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),core_1=__webpack_require__(0),DockerImageAndTagSelector_1=__webpack_require__(7);exports.DockerTriggerConfig=class extends React.Component{constructor(){super(...arguments),this.state={fiatEnabled:core_1.SETTINGS.feature.fiatEnabled,serviceAccounts:[]},this.dockerChanged=(changes=>{Object.assign(this.props.trigger,changes),this.props.fieldUpdated(),this.setState({})}),this.runAsUserChanged=(user=>{this.props.trigger.runAsUser=""!==user?user:null,this.props.fieldUpdated(),this.setState({})})}componentDidMount(){core_1.ServiceAccountReader.getServiceAccounts().then(serviceAccounts=>{this.setState({serviceAccounts:serviceAccounts})})}render(){const{trigger:trigger}=this.props,{fiatEnabled:fiatEnabled,serviceAccounts:serviceAccounts}=this.state;return React.createElement("div",{className:"form-horizontal"},React.createElement(DockerImageAndTagSelector_1.DockerImageAndTagSelector,{specifyTagByRegex:!0,account:trigger.account||"",organization:trigger.organization||"",registry:trigger.registry||"",repository:trigger.repository||"",tag:trigger.tag||"",showRegistry:!0,onChange:this.dockerChanged}),fiatEnabled&&React.createElement("div",{className:"form-group"},React.createElement(core_1.RunAsUser,{serviceAccounts:serviceAccounts,value:trigger.runAsUser,onChange:this.runAsUserChanged})))}}},function(module,exports){module.exports=require("rxjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),ngimport_1=__webpack_require__(14),rxjs_1=__webpack_require__(13),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3);exports.DockerTriggerTemplate=class extends React.Component{constructor(props){super(props),this.queryStream=new rxjs_1.Subject,this.handleQuery=(()=>{const trigger=this.props.command.trigger;return rxjs_1.Observable.fromPromise(DockerImageReader_1.DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))}),this.updateSelectedTag=(tag=>{const{command:command}=this.props,trigger=command.trigger;if(command.extraFields.tag=tag,trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository,command.extraFields.artifacts=[{type:"docker/image",name:imageName,version:tag,reference:imageName+":"+tag}]}this.setState({selectedTag:tag})}),this.tagLoadSuccess=(tags=>{const{command:command}=this.props,trigger=command.trigger,newState={};if(newState.tags=tags,newState.tags.length){const defaultSelection=newState.tags.find(t=>t===trigger.tag)||newState.tags[0];newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)}newState.tagsLoading=!1,this.setState(newState)}),this.tagLoadFailure=(()=>{this.setState({tagsLoading:!1,loadError:!0})}),this.initialize=(()=>{const{command:command}=this.props;this.subscription=this.queryStream.debounceTime(250).switchMap(this.handleQuery).subscribe(this.tagLoadSuccess,this.tagLoadFailure),command.extraFields={},"docker"===command.trigger.type?this.searchTags():this.subscription.unsubscribe()}),this.searchTags=((query="")=>{this.setState({tags:[`<span>Finding tags${query&&` matching ${query}`}...</span>`]}),this.queryStream.next()}),this.state={tags:[],tagsLoading:!0,loadError:!1,selectedTag:""}}static formatLabel(trigger){return ngimport_1.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}componentWillReceiveProps(nextProps){nextProps.command!==this.props.command&&this.initialize()}componentDidMount(){this.initialize()}render(){const{tags:tags,tagsLoading:tagsLoading,loadError:loadError,selectedTag:selectedTag}=this.state,options=tags.map(tag=>({value:tag}));return React.createElement("div",{className:"form-group"},React.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&React.createElement("div",{className:"col-md-6"},React.createElement("div",{className:"form-control-static text-center"},React.createElement(core_1.Spinner,{size:"small"}))),React.createElement("input",{type:"hidden",required:tagsLoading,value:selectedTag}),loadError&&React.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&React.createElement("div",{className:"col-md-6"},0===tags.length&&React.createElement("div",null,React.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&React.createElement(core_1.TetheredSelect,{options:options,optionRenderer:o=>React.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>React.createElement("span",null,React.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value)})))}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0),DockerTriggerTemplate_1=__webpack_require__(15),DockerTriggerConfig_1=__webpack_require__(12);core_1.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:DockerTriggerConfig_1.DockerTriggerConfig,manualExecutionComponent:DockerTriggerTemplate_1.DockerTriggerTemplate,validators:[{type:"requiredField",fieldName:"account",message:"<strong>Registry</strong> is a required field for Docker Registry triggers."},{type:"requiredField",fieldName:"repository",message:"<strong>Image</strong> is a required field for Docker Registry triggers."},{type:"serviceAccountAccess",preventSave:!0,message:"You do not have access to the service account configured in this pipeline's Docker Registry trigger.\n You will not be able to save your edits to this pipeline."}]})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const angular_1=__webpack_require__(1);__webpack_require__(16);const templates=__webpack_require__(11);templates.keys().forEach(function(key){templates(key)}),exports.DOCKER_MODULE="spinnaker.docker",angular_1.module(exports.DOCKER_MODULE,[__webpack_require__(10).name])},function(module,exports){module.exports=require("react-select")},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(3)),__export(__webpack_require__(7))},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(19)),__export(__webpack_require__(17))}])});
!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("@spinnaker/core")):"function"==typeof define&&define.amd?define("@spinnaker/docker",["@spinnaker/core"],factory):"object"==typeof exports?exports["@spinnaker/docker"]=factory(require("@spinnaker/core")):root["@spinnaker/docker"]=factory(root["@spinnaker/core"])}(window,function(__WEBPACK_EXTERNAL_MODULE__0__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=20)}([function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,exports){module.exports=require("angular")},function(module,exports){module.exports=require("react")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0);exports.DockerImageReader=class{static getImage(imageName,region,credentials){return core_1.API.all("images").one(credentials).one(region).one(imageName).withParams({provider:"docker"}).get().then(results=>results&&results.length?results[0]:null).catch(()=>null)}static findImages(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/find").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}static findTags(params){return core_1.RetryService.buildRetrySequence(()=>core_1.API.all("images/tags").getList(params),results=>results.length>0,10,1e3).then(results=>results).catch(()=>[])}}},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeStage.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeStageCtrl as bakeStageCtrl">\n <stage-config-field label="Package" help-key="pipeline.config.bake.package">\n <input type="text" class="form-control input-sm"\n ng-model="stage.package"/>\n </stage-config-field>\n <stage-config-field label="Organization" help-key="pipeline.config.docker.bake.organization">\n <input type="text" class="form-control input-sm"\n ng-model="stage.organization"/>\n </stage-config-field>\n <stage-config-field label="Image Name" help-key="pipeline.config.docker.bake.targetImage">\n <input type="text" class="form-control input-sm"\n ng-model="stage.ami_name"/>\n </stage-config-field>\n <stage-config-field label="Image tag" help-key="pipeline.config.docker.bake.targetImageTag">\n <input type="text" class="form-control input-sm"\n ng-model="stage.extendedAttributes[\'docker_target_image_tag\']"/>\n </stage-config-field>\n <stage-config-field label="Base OS">\n <bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>\n </stage-config-field>\n\n <stage-config-field label="Base Label">\n <label class="radio-inline" ng-repeat="baseLabel in baseLabelOptions">\n <input type="radio"\n ng-model="stage.baseLabel"\n ng-value="baseLabel"/>\n {{baseLabel}}\n </label>\n </stage-config-field>\n <stage-config-field label="Rebake">\n <div class="checkbox" style="margin-bottom: 0">\n <label>\n <input type="checkbox"\n ng-model="stage.rebake">\n </input>\n Rebake image without regard to the status of any existing bake\n </label>\n </div>\n </stage-config-field>\n</div>\n')}]),module.exports=path},function(module,exports){var path="docker/src/pipeline/stages/bake/bakeExecutionDetails.html";window.angular.module("ng").run(["$templateCache",function(c){c.put(path,'<div ng-controller="dockerBakeExecutionDetailsCtrl">\n <execution-details-section-nav sections="configSections"></execution-details-section-nav>\n <div class="step-section-details" ng-if="detailsSection === \'bakeConfig\'">\n <div class="row">\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt if-multiple-providers>Provider</dt>\n <dd if-multiple-providers>Docker</dd>\n <dt>Organization</dt>\n <dd>{{stage.context.organization}}</dd>\n <dt>Image Name</dt>\n <dd>{{stage.context.ami_name}}</dd>\n <dt>Image Tag</dt>\n <dd>{{stage.context.extendedAttributes[\'docker_target_image_tag\']}}</dd>\n <dt>Image</dt>\n <dd>{{stage.context.ami}}</dd>\n </dl>\n </div>\n <div class="col-md-6">\n <dl class="dl-narrow dl-horizontal">\n <dt>Base OS</dt>\n <dd>{{stage.context.baseOs}}</dd>\n <dt>Region</dt>\n <dd>{{stage.context.region}}</dd>\n <dt>Package</dt>\n <dd>{{stage.context.package}}</dd>\n <dt>Label</dt>\n <dd>{{stage.context.baseLabel}}</dd>\n </dl>\n </div>\n </div>\n <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>\n\n <div class="row" ng-if="stage.context.region && stage.context.status.resourceId">\n <div class="col-md-12">\n <div class="alert alert-{{stage.isFailed ? \'danger\' : \'info\'}}">\n <a target="_blank" href="{{ bakeryDetailUrl(stage) }}">\n View Bakery Details\n </a>\n </div>\n </div>\n </div>\n\n </div>\n <div class="step-section-details" ng-if="detailsSection === \'taskStatus\'">\n <div class="row">\n <execution-step-details item="stage"></execution-step-details>\n </div>\n </div>\n</div>\n')}]),module.exports=path},function(module,exports){module.exports=require("lodash")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),react_select_1=__webpack_require__(18),lodash_1=__webpack_require__(6),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3);class DockerImageAndTagSelector extends React.Component{constructor(props){super(props);const accountOptions=props.account?[{label:props.account,value:props.account}]:[],organizationOptions=props.organization&&props.organization.length?[{label:props.organization,value:props.organization}]:[],repositoryOptions=props.repository&&props.repository.length?[{label:props.repository,value:props.repository}]:[],tagOptions=props.tag&&props.tag.length?[{label:props.tag,value:props.tag}]:[];this.state={accountOptions:accountOptions,imagesLoaded:!1,imagesLoading:!1,imagesRefreshing:!1,organizationMap:{},organizationOptions:organizationOptions,repositoryMap:{},repositoryOptions:repositoryOptions,tagOptions:tagOptions}}getAccountMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"account");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>`${i.repository.split("/").slice(0,-1).join("/")}`)),acc),{})}getRegistryMap(images){return images.reduce((m,image)=>(m[image.account]=image.registry,m),{})}getOrganizationMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.repository),image=>`${image.account}/${image.repository.split("/").slice(0,-1).join("/")}`);return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.repository)),acc),{})}getRepositoryMap(images){const groupedImages=lodash_1.groupBy(images.filter(image=>image.account),"repository");return lodash_1.reduce(groupedImages,(acc,image,key)=>(acc[key]=lodash_1.uniq(image.map(i=>i.tag)),acc),{})}getOrganizationsList(accountMap){return accountMap&&accountMap[this.props.showRegistry?this.props.account:this.props.registry]||[]}getRepositoryList(organizationMap,organization,registry){if(organizationMap){return organizationMap[`${this.props.showRegistry?this.props.account:registry}/${organization||""}`]||[]}return[]}getTags(repositoryMap,repository){let tag=this.props.tag,tags=[];return this.props.specifyTagByRegex?tag&&""===lodash_1.trim(tag)&&(tag=""):repositoryMap&&((tags=repositoryMap[repository]||[]).includes(tag)||!tag||tag.includes("${")||(tag="")),{tag:tag,tags:tags}}componentWillReceiveProps(nextProps){!this.images||["account","showRegistry"].some(key=>this.props[key]!==nextProps[key])?this.refreshImages(nextProps):["organization","registry","repository"].some(key=>this.props[key]!==nextProps[key])&&this.updateThings(nextProps)}updateThings(props){let{organization:organization,registry:registry,repository:repository}=props;const{account:account,showRegistry:showRegistry}=props,registryMap=this.getRegistryMap(this.images),accountMap=this.getAccountMap(this.images),newAccounts=this.accounts||Object.keys(accountMap),organizationMap=this.getOrganizationMap(this.images),repositoryMap=this.getRepositoryMap(this.images),organizations=this.getOrganizationsList(accountMap);organization=organizations.includes(organization)||!organization||organization.includes("${")?organization:"",showRegistry&&(registry=registryMap[account]);const repositories=this.getRepositoryList(organizationMap,organization,registry);repositories.includes(repository)||!repository||repository.includes("${")||(repository="");const{tag:tag,tags:tags}=this.getTags(repositoryMap,repository);this.props.onChange&&this.props.onChange({organization:organization,registry:registry,repository:repository,tag:tag}),this.setState({accountOptions:newAccounts.sort().map(a=>({label:a,value:a})),organizationOptions:organizations.filter(o=>o).sort().map(o=>({label:o,value:o})),imagesLoaded:!0,organizationMap:organizationMap,repositoryMap:repositoryMap,repositoryOptions:repositories.sort().map(r=>({label:r,value:r})),tagOptions:tags.sort().map(t=>({label:t,value:t}))})}initializeImages(props,refresh){if(this.state.imagesLoading)return;const{showRegistry:showRegistry,account:account,registry:registry}=props,imageConfig={provider:"dockerRegistry",account:showRegistry?account:registry};this.setState({imagesLoading:!0,imagesRefreshing:!!refresh}),DockerImageReader_1.DockerImageReader.findImages(imageConfig).then(images=>{this.images=images,this.updateThings(props)}).finally(()=>{this.setState({imagesLoading:!1,imagesRefreshing:!1})})}handleRefreshImages(){this.refreshImages(this.props)}refreshImages(props){this.initializeImages(props,!0)}initializeAccounts(props){let{account:account}=props;core_1.AccountService.listAccounts("dockerRegistry").then(allAccounts=>{const accounts=allAccounts.map(a=>a.name);this.props.showRegistry&&!account&&(account=accounts[0]),this.accounts=accounts,this.refreshImages(Object.assign({},props,{account:account}))})}isNew(){const{account:account,organization:organization,registry:registry,repository:repository,tag:tag}=this.props;return!(account||organization||registry||repository||tag)}componentDidMount(){this.props.deferInitialization||!this.props.registry&&!this.isNew()||this.initializeAccounts(this.props)}valueChanged(name,value){this.props.onChange&&this.props.onChange({[name]:value})}render(){const{account:account,fieldClass:fieldClass,labelClass:labelClass,organization:organization,repository:repository,showRegistry:showRegistry,specifyTagByRegex:specifyTagByRegex,tag:tag}=this.props,{accountOptions:accountOptions,imagesLoading:imagesLoading,imagesRefreshing:imagesRefreshing,organizationOptions:organizationOptions,repositoryOptions:repositoryOptions,tagOptions:tagOptions}=this.state;return React.createElement(React.Fragment,null,showRegistry&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Registry Name"),React.createElement("div",{className:fieldClass},React.createElement(react_select_1.default,{value:account,disabled:imagesRefreshing,onChange:o=>this.valueChanged("account",o.value),options:accountOptions,isLoading:imagesRefreshing})),React.createElement("div",{className:"col-md-1 text-center"},React.createElement(core_1.Tooltip,{value:imagesRefreshing?"Images refreshing":"Refresh images list"},React.createElement("a",{className:"clickable",onClick:this.handleRefreshImages},React.createElement("span",{className:`fa fa-sync-alt ${imagesRefreshing?"fa-spin":""}`}))))),React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Organization"),React.createElement("div",{className:fieldClass},organization.includes("${")?React.createElement("input",{disabled:imagesRefreshing,className:"form-control input-sm",value:organization,onChange:e=>this.valueChanged("organization",e.target.value)}):React.createElement(react_select_1.default,{value:organization,disabled:imagesRefreshing,onChange:o=>this.valueChanged("organization",o&&o.value||""),placeholder:"No organization",options:organizationOptions,isLoading:imagesRefreshing}))),React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Image"),React.createElement("div",{className:fieldClass},repository.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:repository,onChange:e=>this.valueChanged("repository",e.target.value)}):React.createElement(react_select_1.default,{value:repository,disabled:imagesRefreshing,onChange:o=>this.valueChanged("repository",o&&o.value||""),options:repositoryOptions,required:!0,isLoading:imagesRefreshing}))),specifyTagByRegex&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag ",React.createElement(core_1.HelpField,{id:"pipeline.config.docker.trigger.tag"})),React.createElement("div",{className:fieldClass},React.createElement("input",{type:"text",className:"form-control input-sm",value:tag,disabled:imagesRefreshing||!repository,onChange:e=>this.valueChanged("tag",e.target.value)}))),!specifyTagByRegex&&React.createElement("div",{className:"form-group"},React.createElement("div",{className:`sm-label-right ${labelClass}`},"Tag"),React.createElement("div",{className:fieldClass},tag.includes("${")?React.createElement("input",{className:"form-control input-sm",disabled:imagesRefreshing,value:tag,onChange:e=>this.valueChanged("tag",e.target.value),required:!0}):React.createElement(react_select_1.default,{value:tag,disabled:imagesRefreshing||!repository,isLoading:imagesLoading,onChange:o=>this.valueChanged("tag",o.value),options:tagOptions,placeholder:"No tag",required:!0}))))}}DockerImageAndTagSelector.defaultProps={fieldClass:"col-md-8",labelClass:"col-md-3",organization:"",registry:"",repository:"",tag:""},exports.DockerImageAndTagSelector=DockerImageAndTagSelector},function(module,exports){module.exports=require("@uirouter/angularjs")},function(module,exports,__webpack_require__){"use strict";var _core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bake.executionDetails.controller",[__webpack_require__(8).default]).controller("dockerBakeExecutionDetailsCtrl",["$scope","$stateParams","executionDetailsSectionService","$interpolate",function($scope,$stateParams,executionDetailsSectionService,$interpolate){$scope.configSections=["bakeConfig","taskStatus"];let initialized=()=>{$scope.detailsSection=$stateParams.details,$scope.provider=$scope.stage.context.cloudProviderType||"docker",$scope.bakeryDetailUrl=$interpolate(_core.SETTINGS.bakeryDetailUrl)},initialize=()=>executionDetailsSectionService.synchronizeSection($scope.configSections,initialized);initialize(),$scope.$on("$stateChangeSuccess",initialize)}])},function(module,exports,__webpack_require__){"use strict";var obj,_lodash=__webpack_require__(6),_lodash2=(obj=_lodash)&&obj.__esModule?obj:{default:obj},_core=__webpack_require__(0);const angular=__webpack_require__(1);module.exports=angular.module("spinnaker.docker.pipeline.stage.bakeStage",[__webpack_require__(9).name]).config(function(){_core.Registry.pipeline.registerStage({provides:"bake",cloudProvider:"docker",label:"Bake",description:"Bakes an image in the specified region",templateUrl:__webpack_require__(4),executionDetailsUrl:__webpack_require__(5),executionLabelComponent:_core.BakeExecutionLabel,extraLabelLines:stage=>stage.masterStage.context.allPreviouslyBaked||stage.masterStage.context.somePreviouslyBaked?1:0,defaultTimeoutMs:36e5,validators:[{type:"requiredField",fieldName:"package"}],restartable:!0})}).controller("dockerBakeStageCtrl",["$scope","$q",function($scope,$q){$scope.stage.region="global",$scope.stage.user||($scope.stage.user=_core.AuthenticationService.getAuthenticatedUser().name),$scope.viewState={loading:!0},$scope.$watch("stage",function(){_lodash2.default.forOwn($scope.stage,function(val,key){""===val&&delete $scope.stage[key]})},!0),$scope.viewState.providerSelected=!0,$q.all({baseOsOptions:_core.BakeryReader.getBaseOsOptions("docker"),baseLabelOptions:_core.BakeryReader.getBaseLabelOptions()}).then(function(results){$scope.baseOsOptions=results.baseOsOptions.baseImages,$scope.baseLabelOptions=results.baseLabelOptions,!$scope.stage.baseOs&&$scope.baseOsOptions&&$scope.baseOsOptions.length&&($scope.stage.baseOs=$scope.baseOsOptions[0].id),!$scope.stage.baseLabel&&$scope.baseLabelOptions&&$scope.baseLabelOptions.length&&($scope.stage.baseLabel=$scope.baseLabelOptions[0]),$scope.viewState.loading=!1})}])},function(module,exports,__webpack_require__){var map={"./pipeline/stages/bake/bakeExecutionDetails.html":5,"./pipeline/stages/bake/bakeStage.html":4};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){var id=map[req];if(!(id+1)){var e=new Error('Cannot find module "'+req+'".');throw e.code="MODULE_NOT_FOUND",e}return id}webpackContext.keys=function(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id=11},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),core_1=__webpack_require__(0),DockerImageAndTagSelector_1=__webpack_require__(7);exports.DockerTriggerConfig=class extends React.Component{constructor(){super(...arguments),this.state={fiatEnabled:core_1.SETTINGS.feature.fiatEnabled,serviceAccounts:[]},this.dockerChanged=(changes=>{Object.assign(this.props.trigger,changes),this.props.fieldUpdated(),this.setState({})}),this.runAsUserChanged=(user=>{this.props.trigger.runAsUser=""!==user?user:null,this.props.fieldUpdated(),this.setState({})})}componentDidMount(){core_1.ServiceAccountReader.getServiceAccounts().then(serviceAccounts=>{this.setState({serviceAccounts:serviceAccounts})})}render(){const{trigger:trigger}=this.props,{fiatEnabled:fiatEnabled,serviceAccounts:serviceAccounts}=this.state;return React.createElement("div",{className:"form-horizontal"},React.createElement(DockerImageAndTagSelector_1.DockerImageAndTagSelector,{specifyTagByRegex:!0,account:trigger.account||"",organization:trigger.organization||"",registry:trigger.registry||"",repository:trigger.repository||"",tag:trigger.tag||"",showRegistry:!0,onChange:this.dockerChanged}),fiatEnabled&&React.createElement("div",{className:"form-group"},React.createElement(core_1.RunAsUser,{serviceAccounts:serviceAccounts,value:trigger.runAsUser,onChange:this.runAsUserChanged})))}}},function(module,exports){module.exports=require("rxjs")},function(module,exports){module.exports=require("ngimport")},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const React=__webpack_require__(2),ngimport_1=__webpack_require__(14),rxjs_1=__webpack_require__(13),core_1=__webpack_require__(0),DockerImageReader_1=__webpack_require__(3);exports.DockerTriggerTemplate=class extends React.Component{constructor(props){super(props),this.queryStream=new rxjs_1.Subject,this.handleQuery=(()=>{const trigger=this.props.command.trigger;return rxjs_1.Observable.fromPromise(DockerImageReader_1.DockerImageReader.findTags({provider:"dockerRegistry",account:trigger.account,repository:trigger.repository}))}),this.updateSelectedTag=(tag=>{const{command:command}=this.props,trigger=command.trigger;if(command.extraFields.tag=tag,trigger&&trigger.repository){let imageName="";trigger.registry&&(imageName+=trigger.registry+"/"),imageName+=trigger.repository,command.extraFields.artifacts=[{type:"docker/image",name:imageName,version:tag,reference:imageName+":"+tag}]}this.setState({selectedTag:tag})}),this.tagLoadSuccess=(tags=>{const{command:command}=this.props,trigger=command.trigger,newState={};if(newState.tags=tags,newState.tags.length){const defaultSelection=newState.tags.find(t=>t===trigger.tag)||newState.tags[0];newState.selectedTag=defaultSelection,this.updateSelectedTag(defaultSelection)}newState.tagsLoading=!1,this.setState(newState)}),this.tagLoadFailure=(()=>{this.setState({tagsLoading:!1,loadError:!0})}),this.initialize=(()=>{const{command:command}=this.props;this.subscription=this.queryStream.debounceTime(250).switchMap(this.handleQuery).subscribe(this.tagLoadSuccess,this.tagLoadFailure),command.extraFields={},"docker"===command.trigger.type?this.searchTags():this.subscription.unsubscribe()}),this.searchTags=((query="")=>{this.setState({tags:[`<span>Finding tags${query&&` matching ${query}`}...</span>`]}),this.queryStream.next()}),this.state={tags:[],tagsLoading:!0,loadError:!1,selectedTag:""}}static formatLabel(trigger){return ngimport_1.$q.when(`(Docker Registry) ${trigger.account?trigger.account+":":""} ${trigger.repository||""}`)}componentWillReceiveProps(nextProps){nextProps.command!==this.props.command&&this.initialize()}componentDidMount(){this.initialize()}render(){const{tags:tags,tagsLoading:tagsLoading,loadError:loadError,selectedTag:selectedTag}=this.state,options=tags.map(tag=>({value:tag}));return React.createElement("div",{className:"form-group"},React.createElement("label",{className:"col-md-4 sm-label-right"},"Tag"),tagsLoading&&React.createElement("div",{className:"col-md-6"},React.createElement("div",{className:"form-control-static text-center"},React.createElement(core_1.Spinner,{size:"small"}))),React.createElement("input",{type:"hidden",required:tagsLoading,value:selectedTag}),loadError&&React.createElement("div",{className:"col-md-6"},"Error loading tags!"),!tagsLoading&&React.createElement("div",{className:"col-md-6"},0===tags.length&&React.createElement("div",null,React.createElement("p",{className:"form-control-static"},"No tags found")),tags.length>0&&React.createElement(core_1.TetheredSelect,{options:options,optionRenderer:o=>React.createElement("span",null,o.value),clearable:!1,value:selectedTag,valueRenderer:o=>React.createElement("span",null,React.createElement("strong",null,o.value)),onChange:o=>this.updateSelectedTag(o.value)})))}}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=__webpack_require__(0),DockerTriggerTemplate_1=__webpack_require__(15),DockerTriggerConfig_1=__webpack_require__(12);core_1.Registry.pipeline.registerTrigger({label:"Docker Registry",description:"Executes the pipeline on an image update",key:"docker",component:DockerTriggerConfig_1.DockerTriggerConfig,manualExecutionComponent:DockerTriggerTemplate_1.DockerTriggerTemplate,validators:[{type:"requiredField",fieldName:"account",message:"<strong>Registry</strong> is a required field for Docker Registry triggers."},{type:"requiredField",fieldName:"repository",message:"<strong>Image</strong> is a required field for Docker Registry triggers."},{type:"serviceAccountAccess",preventSave:!0,message:"You do not have access to the service account configured in this pipeline's Docker Registry trigger.\n You will not be able to save your edits to this pipeline."}]})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const angular_1=__webpack_require__(1);__webpack_require__(16);const templates=__webpack_require__(11);templates.keys().forEach(function(key){templates(key)}),exports.DOCKER_MODULE="spinnaker.docker",angular_1.module(exports.DOCKER_MODULE,[__webpack_require__(10).name])},function(module,exports){module.exports=require("react-select")},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(3)),__export(__webpack_require__(7))},function(module,exports,__webpack_require__){"use strict";function __export(m){for(var p in m)exports.hasOwnProperty(p)||(exports[p]=m[p])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(__webpack_require__(19)),__export(__webpack_require__(17))}])});
//# sourceMappingURL=lib.js.map
{
"name": "@spinnaker/docker",
"version": "0.0.18",
"version": "0.0.19",
"main": "lib/lib.js",

@@ -5,0 +5,0 @@ "typings": "lib/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc