diff --git a/client/src/components/main/Root.js b/client/src/components/main/Root.js index b8a3b0038b..008e7d0c59 100644 --- a/client/src/components/main/Root.js +++ b/client/src/components/main/Root.js @@ -25,7 +25,6 @@ import notifications from '../../models/notifications/ActiveNotifications'; import userNotifications from '../../models/notifications/CurrentUserNotifications'; import pipelines from '../../models/pipelines/Pipelines'; import projects from '../../models/folders/FolderProjects'; -import FireCloudMethods from '../../models/firecloud/FireCloudMethods'; import runDefaultParameters from '../../models/pipelines/PipelineRunDefaultParameters'; import configurations from '../../models/configuration/Configurations'; import AllConfigurations from '../../models/configuration/ConfigurationsLoadAll'; @@ -76,7 +75,6 @@ const localization = AppLocalization.localization; const hiddenObjects = new HiddenObjects(preferences, authenticatedUserInfo); const myIssues = new MyIssues(); const googleApi = new GoogleApi(preferences); -const fireCloudMethods = new FireCloudMethods(googleApi); const users = new Users(); const usersInfo = new UsersInfo(); const allowedInstanceTypes = new AllowedInstanceTypes(); @@ -123,7 +121,6 @@ const Root = () => {...{ routing, googleApi, - fireCloudMethods, localization, history, preferences, diff --git a/client/src/components/pipelines/browser/FireCloudBrowser.js b/client/src/components/pipelines/browser/FireCloudBrowser.js deleted file mode 100644 index 303e88ec7c..0000000000 --- a/client/src/components/pipelines/browser/FireCloudBrowser.js +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import {inject, observer} from 'mobx-react'; -import {computed} from 'mobx'; -import {Alert, Avatar, Button, Col, Icon, Input, Row, Select} from 'antd'; -import LoadingView from '../../special/LoadingView'; -import FireCloudMethodsBrowser from './FireCloudMethodsBrowser'; -import FireCloudMethodSnapshotConfigurations from './FireCloudMethodSnapshotConfigurations'; -import styles from './Browser.css'; - -@inject('googleApi', 'fireCloudMethods') -@observer -export default class FireCloudBrowser extends React.Component { - - static propTypes = { - namespace: PropTypes.string, - method: PropTypes.string, - snapshot: PropTypes.string, - configuration: PropTypes.string, - configurationSnapshot: PropTypes.string, - onFireCloudItemSelect: PropTypes.func, - onNewFireCloudItemSelect: PropTypes.func - }; - - state = { - selectedMethod: this.props.method || null, - selectedNameSpace: this.props.namespace || null, - selectedMethodSnapshot: this.props.snapshot || null, - selectedMethodConfiguration: this.props.configuration || null, - selectedMethodConfigurationSnapshot: this.props.configurationSnapshot || null, - methodSearchString: undefined - }; - - @computed - get methods () { - if (this.props.fireCloudMethods.loaded) { - return (this.props.fireCloudMethods.value || []).map(m => m); - } - return []; - } - - @computed - get currentMethodIsSelected () { - return this.props.namespace === this.state.selectedNameSpace && - this.props.method === this.state.selectedMethod && - this.props.snapshot === this.state.selectedMethodSnapshot; - } - - renderSignIn = () => { - return ( - - - You must sign in with your Google account to browse FireCloud methods - - - - - - ); - }; - - onMethodSelect = (methodName, methodNamespace) => { - if (this.props.onMethodSelect) { - this.props.onMethodSelect(methodName, methodNamespace); - } - this.setState({ - selectedMethod: methodName, - selectedNameSpace: methodNamespace, - selectedMethodSnapshot: null - }); - }; - - onMethodConfigurationSelect = (configurationId, configurationSnapshotId) => { - this.setState({ - selectedMethodConfiguration: configurationId, - selectedMethodConfigurationSnapshot: configurationSnapshotId - }, this.onFireCloudItemSelect); - }; - - onCreateNewConfigurationClicked = () => { - if (this.props.onNewFireCloudItemSelect) { - this.props.onNewFireCloudItemSelect({ - namespace: this.state.selectedNameSpace, - name: this.state.selectedMethod, - snapshot: this.state.selectedMethodSnapshot, - configuration: null, - configurationSnapshot: null - }); - } - }; - - onFireCloudItemSelect = () => { - if (this.props.onFireCloudItemSelect) { - this.props.onFireCloudItemSelect({ - namespace: this.state.selectedNameSpace, - name: this.state.selectedMethod, - snapshot: this.state.selectedMethodSnapshot, - configuration: this.state.selectedMethodConfiguration, - configurationSnapshot: this.state.selectedMethodConfigurationSnapshot - }); - } - }; - - onMethodsSearch = (text) => { - this.setState({methodSearchString: text}); - }; - - @computed - get currentMethod () { - if (this.state.selectedMethod) { - return this.methods - .filter( - m => m.name === this.state.selectedMethod && m.namespace === this.state.selectedNameSpace - ) - .shift(); - } - return null; - } - - @computed - get snapshots () { - if (this.currentMethod) { - return (this.currentMethod.snapshotIds || []) - .map(id => id); - } - return []; - } - - onSelectSnapshot = (snapshot) => { - this.setState({selectedMethodSnapshot: snapshot}); - }; - - render () { - if (this.props.googleApi.error) { - return ; - } - if (!this.props.googleApi.loaded) { - return ; - } - if (!this.props.googleApi.isSignedIn) { - return this.renderSignIn(); - } - let content; - if (this.state.selectedMethod) { - if (!this.state.selectedMethodSnapshot) { - this.setState({selectedMethodSnapshot: this.snapshots[this.snapshots.length - 1]}); - return ; - } - content = ; - } else { - content = ; - } - const googleInfoContent = this.props.googleApi.userAuthEnabled ? ( - - - - {this.props.googleApi.authenticatedGoogleUser} - - - - ) : undefined; - let contentHeader; - if (this.state.selectedMethod) { - contentHeader = ( - - - - - - {this.state.selectedMethod} - { - this.snapshots && - - } - - - { - googleInfoContent && - - {googleInfoContent} - - } - - ); - } else { - contentHeader = ( - - - - - { - googleInfoContent && - - {googleInfoContent} - - } - - ); - } - return ( -
- {contentHeader} - {content} -
- ); - } - - componentWillReceiveProps (nextProps) { - if (this.props.method !== nextProps.method || - this.props.namespace !== nextProps.namespace || - this.props.snapshot !== nextProps.snapshot || - this.props.configuration !== nextProps.configuration || - this.props.configurationSnapshot !== nextProps.configurationSnapshot) { - this.setState({ - selectedMethod: nextProps.method, - selectedNameSpace: nextProps.namespace, - selectedMethodSnapshot: nextProps.snapshot, - selectedMethodConfiguration: nextProps.configuration, - selectedMethodConfigurationSnapshot: nextProps.configurationSnapshot - }); - } - } - -} diff --git a/client/src/components/pipelines/browser/FireCloudMethodSnapshotConfigurations.js b/client/src/components/pipelines/browser/FireCloudMethodSnapshotConfigurations.js deleted file mode 100644 index 9d13900a60..0000000000 --- a/client/src/components/pipelines/browser/FireCloudMethodSnapshotConfigurations.js +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import {inject, observer} from 'mobx-react'; -import {computed, observable} from 'mobx'; -import {Button, Icon, Row, Select, Table} from 'antd'; -import styles from './Browser.css'; -import {ItemTypes} from '../model/treeStructureFunctions'; -import FireCloudMethodSnapshotConfigurationsRequest - from '../../../models/firecloud/FireCloudMethodSnapshotConfigurations'; - -@inject('googleApi', 'fireCloudMethods') -@observer -export default class FireCloudMethodSnapshotConfigurations extends React.Component { - - static propTypes = { - namespace: PropTypes.string, - method: PropTypes.string, - snapshot: PropTypes.string, - configuration: PropTypes.string, - configurationSnapshot: PropTypes.string, - onConfigurationSelect: PropTypes.func, - isSelected: PropTypes.bool, - onCreateNew: PropTypes.func - }; - - @observable - _configurations = new FireCloudMethodSnapshotConfigurationsRequest( - this.props.googleApi, - this.props.namespace, - this.props.method, - this.props.snapshot - ); - - @computed - get currentMethod () { - if (this.props.fireCloudMethods.loaded) { - return (this.props.fireCloudMethods.value || []) - .filter(m => m.name === this.props.method) - .map(m => ({...m, key: `${m.namespace}_${m.name}`})).shift(); - } - return null; - } - - @computed - get configurations () { - if (this._configurations.loaded) { - const configurations = {}; - (this._configurations.value || []) - .forEach((c, i, arr) => { - if (!configurations[c.name]) { - configurations[c.name] = { - name: c.name, - namespace: c.namespace, - key: `${this.currentMethod.name}_${this.props.snapshot}_${c.name}`, - type: ItemTypes.fireCloudMethodConfiguration, - selectedSnapshot: this.props.configurationSnapshot || arr[arr.length - 1].snapshotId, - snapshots: [] - }; - } - configurations[c.name].snapshots.push(c.snapshotId); - }); - return Object.values(configurations); - } - return []; - } - - onConfigurationSelect = (configuration) => { - if (this.props.onConfigurationSelect && configuration.selectedSnapshot) { - this.props.onConfigurationSelect(configuration.name, configuration.selectedSnapshot); - } - }; - - onConfigurationSnapshotSelect = (item) => (snapshot) => { - item.selectedSnapshot = snapshot; - if (this.props.configuration) { - this.onConfigurationSelect(item); - } - }; - - renderTreeItemSelection = (item) => { - if (this.props.isSelected && item.name === this.props.configuration) { - return ( - - - - ); - } - return undefined; - }; - - renderTreeItemType = (item) => { - switch (item.type) { - case ItemTypes.fireCloudMethodConfiguration: - return ; - default: return
; - } - }; - - renderTreeItemActions = (item) => { - if (!item.snapshots) { - return undefined; - } - - return ( - - ); - }; - - columns = [ - { - key: 'selection', - className: styles.treeItemSelection, - render: (item) => this.renderTreeItemSelection(item), - onCellClick: (item) => this.onConfigurationSelect(item) - }, - { - key: 'type', - className: styles.treeItemType, - render: (item) => this.renderTreeItemType(item), - onCellClick: (item) => this.onConfigurationSelect(item) - }, - { - dataIndex: 'name', - key: 'name', - title: 'Name', - className: styles.treeItemName, - onCellClick: (item) => this.onConfigurationSelect(item) - }, - { - key: 'actions', - className: styles.treeItemActions, - render: (item) => this.renderTreeItemActions(item) - } - ]; - - render () { - if (!this.props.fireCloudMethods.pending && - !!this._configurations && - !this._configurations.pending && - this.configurations.length === 0) { - return ( -
- { - this.currentMethod && this.currentMethod.synopsis && - - {this.currentMethod.synopsis} - - } - - - -
- ); - } - return ( -
- { - this.currentMethod && this.currentMethod.synopsis && - - {this.currentMethod.synopsis} - - } - - item.key} /> - - - ); - } - - componentDidUpdate (prevProps) { - if (this.props.method !== prevProps.method || this.props.namespace !== prevProps.namespace || - this.props.snapshot !== prevProps.snapshot) { - this._configurations = new FireCloudMethodSnapshotConfigurationsRequest( - this.props.googleApi, - this.props.namespace, - this.props.method, - this.props.snapshot); - } - } - -} diff --git a/client/src/components/pipelines/browser/FireCloudMethodsBrowser.js b/client/src/components/pipelines/browser/FireCloudMethodsBrowser.js deleted file mode 100644 index 2d7581cb32..0000000000 --- a/client/src/components/pipelines/browser/FireCloudMethodsBrowser.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import {inject, observer} from 'mobx-react'; -import {computed} from 'mobx'; -import {Row, Table} from 'antd'; -import styles from './Browser.css'; - -@inject('fireCloudMethods') -@observer -export default class FireCloudMethodsBrowser extends React.Component { - - static propTypes = { - methodSearchString: PropTypes.string, - onMethodSelect: PropTypes.func - }; - - @computed - get methods () { - if (this.props.fireCloudMethods.loaded) { - let methods = this.props.fireCloudMethods.value || []; - if (this.props.methodSearchString) { - methods = methods - .filter(m => - m.name.toLowerCase().indexOf(this.props.methodSearchString.toLowerCase()) >= 0 || - m.namespace.toLowerCase().indexOf(this.props.methodSearchString.toLowerCase()) >= 0 || - (m.synopsis && m.synopsis.toLowerCase() - .indexOf(this.props.methodSearchString.toLowerCase()) >= 0) - ); - } - return methods.map(m => ({...m, key: `${m.namespace}_${m.name}`})); - } - return []; - } - - onMethodSelect = (method) => { - this.props.onMethodSelect && this.props.onMethodSelect(method.name, method.namespace); - }; - - columns = [ - { - dataIndex: 'name', - title: 'Name', - className: styles.fireCloudMethodNameColumn, - render: (name, method) => { - return ( - - {method.namespace} - {method.name} - - ); - } - }, - { - dataIndex: 'synopsis', - title: 'Synopsis' - } - ]; - - render () { - return ( - -
styles.fireCloudMethodRow} - onRowClick={this.onMethodSelect} - style={{width: '100%'}} - columns={this.columns} - dataSource={this.methods} - pagination={false} - showHeader={false} - locale={{emptyText: 'No FireCloud methods'}} - size="small" /> - - ); - } -} diff --git a/client/src/components/pipelines/configuration/DetachedConfiguration.js b/client/src/components/pipelines/configuration/DetachedConfiguration.js index 1e1c661e1a..22c4694ca9 100644 --- a/client/src/components/pipelines/configuration/DetachedConfiguration.js +++ b/client/src/components/pipelines/configuration/DetachedConfiguration.js @@ -426,30 +426,6 @@ export default class DetachedConfiguration extends localization.LocalizedReactCo return false; }; - @computed - get selectedFireCloudMethod () { - if (this.selectedConfiguration) { - const configuration = this.selectedConfiguration; - if (configuration && - configuration.methodName && - configuration.methodSnapshot) { - const nameParts = configuration.methodName.split('/'); - const configurationNameParts = configuration.methodConfigurationName - ? configuration.methodConfigurationName.split('/') : []; - return { - namespace: nameParts[0], - name: nameParts[1], - snapshot: configuration.methodSnapshot, - configuration: configurationNameParts.pop(), - configurationSnapshot: configuration.methodConfigurationSnapshot, - methodInputs: (configuration.methodInputs || []).map(i => i), - methodOutputs: (configuration.methodOutputs || []).map(o => o) - }; - } - } - return undefined; - } - getPipelines = () => { if (!this.props.pipelines.loaded || this.props.pipelines.error || !this.props.pipelines.value) { return []; @@ -949,7 +925,7 @@ export default class DetachedConfiguration extends localization.LocalizedReactCo }; onConfigurationSelectPipeline = async (opts, callback) => { - if (opts && !opts.isFireCloud) { + if (opts) { const {pipeline, version, configuration} = opts; const request = new PipelineConfigurations(pipeline.id, version); await request.fetch(); @@ -1095,7 +1071,6 @@ export default class DetachedConfiguration extends localization.LocalizedReactCo isDetachedConfiguration configurationId={this.props.configurationId} selectedPipelineParametersIsLoading={this.state.selectedPipelineParametersIsLoading} - fireCloudMethod={this.selectedFireCloudMethod} onModified={this.onConfigurationModified} /> diff --git a/client/src/components/pipelines/launch/dialogs/PipelineBrowser.js b/client/src/components/pipelines/launch/dialogs/PipelineBrowser.js index e81a54e978..1b1225db19 100644 --- a/client/src/components/pipelines/launch/dialogs/PipelineBrowser.js +++ b/client/src/components/pipelines/launch/dialogs/PipelineBrowser.js @@ -24,7 +24,6 @@ import SplitPane from 'react-split-pane'; import {Modal, Button, Row, Col, Alert, Icon, Tree, Input} from 'antd'; import Folder from '../../browser/Folder'; import Pipeline from '../../browser/Pipeline'; -import FireCloudBrowser from '../../browser/FireCloudBrowser'; import pipelinesLibrary from '../../../../models/folders/FolderLoadTree'; import LoadingView from '../../../special/LoadingView'; import { @@ -44,7 +43,7 @@ import HiddenObjects from '../../../../utils/hidden-objects'; @connect({ pipelinesLibrary }) -@inject('fireCloudMethods', 'preferences') +@inject('preferences') @inject(() => ({ library: pipelinesLibrary })) @@ -59,11 +58,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen pipelineName: PropTypes.string, version: PropTypes.string, pipelineConfiguration: PropTypes.string, - fireCloudMethod: PropTypes.string, - fireCloudNamespace: PropTypes.string, - fireCloudMethodSnapshot: PropTypes.string, - fireCloudMethodConfiguration: PropTypes.string, - fireCloudMethodConfigurationSnapshot: PropTypes.string, visible: PropTypes.bool, onSelect: PropTypes.func, onCancel: PropTypes.func, @@ -75,12 +69,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen state = { folderId: null, pipelineId: null, - fireCloud: false, - fireCloudMethod: this.props.fireCloudMethod || null, - fireCloudNamespace: this.props.fireCloudNamespace || null, - fireCloudMethodSnapshot: this.props.fireCloudMethodSnapshot || null, - fireCloudMethodConfiguration: this.props.fireCloudMethodConfiguration || null, - fireCloudMethodConfigurationSnapshot: this.props.fireCloudMethodConfigurationSnapshot || null, selectedPipeline: null, expandedKeys: [], selectedKeys: [], @@ -92,11 +80,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen onClearSelectionClicked = () => { this.setState({ selectedPipeline: null, - fireCloudMethod: null, - fireCloudNamespace: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, selectionChanged: true }); }; @@ -106,11 +89,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen this.props.onCancel(); this.setState({ selectedPipeline: null, - fireCloudMethod: null, - fireCloudNamespace: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, selectionChanged: false }); } @@ -118,27 +96,10 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen onSelectClicked = async () => { if (this.props.onSelect) { - let result = false; - if (!this.state.fireCloud) { - result = await this.props.onSelect(this.state.selectedPipeline); - } else { - result = await this.props.onSelect({ - name: this.state.fireCloudMethod, - namespace: this.state.fireCloudNamespace, - snapshot: this.state.fireCloudMethodSnapshot, - configuration: this.state.fireCloudMethodConfiguration, - configurationSnapshot: this.state.fireCloudMethodConfigurationSnapshot - }, true); - } + let result = await this.props.onSelect(this.state.selectedPipeline); if (result) { this.setState({ selectedPipeline: null, - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, selectionChanged: false }); } @@ -163,16 +124,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen icon = 'hdd'; } break; - case ItemTypes.fireCloud: - icon = 'cloud-o'; - style.color = '#2796dd'; - style.fontWeight = 'bold'; - break; - case ItemTypes.fireCloudMethod: - icon = 'fork'; - style.color = '#2796dd'; - style.fontWeight = 'bold'; - break; } let name = item.name; if (item.searchResult) { @@ -242,10 +193,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen this.onSelectPipeline(item); } else if (item.type === ItemTypes.folder) { this.onSelectFolder(item.id); - } else if (item.type === ItemTypes.fireCloud) { - this.onSelectFireCloud(); - } else if (item.type === ItemTypes.fireCloudMethod) { - this.onSelectFireCloudMethod(item.id, item.namespace); } }; @@ -257,20 +204,12 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen return {}; } - @computed - get fireCloudItems () { - if (this.props.fireCloudMethods.loaded) { - return (this.props.fireCloudMethods.value || []).map(m => m); - } - return []; - } - generateTree () { if (!this.rootItems) { this.rootItems = generateTreeData( - {...this.libraryItems, fireCloud: {methods: this.fireCloudItems}}, + {...this.libraryItems}, { - types: [ItemTypes.pipeline, ItemTypes.fireCloud], + types: [ItemTypes.pipeline], filter: this.props.hiddenObjectsTreeFilter() } ); @@ -288,43 +227,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen ); } - onSelectFireCloud = () => { - this.props.fireCloudMethods.fetch(); - let expandedKeys = this.state.expandedKeys; - if (this.rootItems) { - const item = getTreeItemByKey(ItemTypes.fireCloud, this.rootItems); - if (item) { - expandItem(item, this.rootItems); - expandedKeys = getExpandedKeys(this.rootItems); - } - } - this.setState({ - fireCloud: true, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, - pipelineId: null, - folderId: null, - selectedKeys: [ItemTypes.fireCloud], - expandedKeys - }); - }; - - onSelectFireCloudMethod = (id, namespace) => { - this.setState({ - fireCloud: true, - fireCloudNamespace: namespace, - fireCloudMethod: id, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, - pipelineId: null, - folderId: null - }); - }; - onSelectFolder = (id) => { let expandedKeys = this.state.expandedKeys; if (this.rootItems) { @@ -335,12 +237,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen } } this.setState({ - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, pipelineId: null, folderId: id, selectedKeys: [`${ItemTypes.folder}_${id}`], @@ -359,12 +255,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen } } this.setState({ - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, pipelineId: id, folderId: null, selectedKeys: [`${ItemTypes.pipeline}_${id}`], @@ -390,42 +280,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen } }; - onFireCloudItemSelect = (fireCloudItem) => { - this.setState({ - fireCloudNamespace: fireCloudItem.namespace, - fireCloudMethod: fireCloudItem.name, - fireCloudMethodSnapshot: fireCloudItem.snapshot, - fireCloudMethodConfiguration: fireCloudItem.configuration, - fireCloudMethodConfigurationSnapshot: fireCloudItem.configurationSnapshot, - selectedPipeline: null, - selectionChanged: true - }); - }; - - onNewFireCloudItemSelect = async (fireCloudItem) => { - if (this.props.onSelect) { - const result = await this.props.onSelect({ - name: fireCloudItem.name, - namespace: fireCloudItem.namespace, - snapshot: fireCloudItem.snapshot, - configuration: null, - configurationSnapshot: null - }, true); - if (result) { - this.setState({ - selectedPipeline: null, - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, - selectionChanged: false - }); - } - } - }; - onSearchChanged = async (e) => { await search(e, this.rootItems); const expandedKeys = getExpandedKeys(this.rootItems); @@ -443,24 +297,7 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen overflowY: 'auto', overflowX: 'hidden' }; - if (this.state.fireCloud) { - listingContainerStyle.width = '100%'; - listingContainerStyle.height = '100%'; - listingContainerStyle.display = 'flex'; - listingContainerStyle.flexDirection = 'column'; - pane2Style.overflowY = 'inherit'; - listingContent = ( - - ); - } else if (this.state.pipelineId) { + if (this.state.pipelineId) { let selectedVersion, selectedConfiguration; if ( this.state.selectedPipeline && @@ -556,9 +393,7 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen } updateState = () => { - if (this.props.pipelineId && this.props.version && - !this.props.fireCloudMethod && !this.props.fireCloudNamespace && - !this.props.fireCloudMethodSnapshot) { + if (this.props.pipelineId && this.props.version) { let expandedKeys = this.state.expandedKeys; if (this.rootItems) { const item = getTreeItemByKey( @@ -571,12 +406,6 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen } } this.setState({ - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, folderId: null, pipelineId: this.props.pipelineId, selectedPipeline: { @@ -588,30 +417,8 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen expandedKeys, selectionChanged: false }); - } else if (this.props.fireCloudMethod && this.props.fireCloudNamespace && - this.props.fireCloudMethodSnapshot) { - this.setState({ - fireCloud: true, - fireCloudNamespace: this.props.fireCloudNamespace, - fireCloudMethod: this.props.fireCloudMethod, - fireCloudMethodSnapshot: this.props.fireCloudMethodSnapshot, - fireCloudMethodConfiguration: this.props.fireCloudMethodConfiguration, - fireCloudMethodConfigurationSnapshot: this.props.fireCloudMethodConfigurationSnapshot, - folderId: null, - pipelineId: null, - selectedPipeline: null, - expandedKeys: [], - selectedKeys: [ItemTypes.fireCloud], - selectionChanged: false - }); } else { this.setState({ - fireCloud: false, - fireCloudNamespace: null, - fireCloudMethod: null, - fireCloudMethodSnapshot: null, - fireCloudMethodConfiguration: null, - fireCloudMethodConfigurationSnapshot: null, folderId: null, pipelineId: null, selectedPipeline: null, @@ -641,13 +448,7 @@ export default class PipelineBrowser extends localization.LocalizedReactComponen if (prevProps.pipelineId !== this.props.pipelineId || prevProps.version !== this.props.version || prevProps.pipelineConfiguration !== this.props.pipelineConfiguration || - prevProps.visible !== this.props.visible || - this.props.fireCloudMethod !== prevProps.fireCloudMethod || - this.props.fireCloudNamespace !== prevProps.fireCloudNamespace || - this.props.fireCloudMethodSnapshot !== prevProps.fireCloudMethodSnapshot || - this.props.fireCloudMethodConfiguration !== prevProps.fireCloudMethodConfiguration || - this.props.fireCloudMethodConfigurationSnapshot !== - prevProps.fireCloudMethodConfigurationSnapshot + prevProps.visible !== this.props.visible ) { this.updateState(); } else if (!this.state.treeReady && this.rootItems && this.rootItems.length > 0) { diff --git a/client/src/components/pipelines/model/treeStructureFunctions.js b/client/src/components/pipelines/model/treeStructureFunctions.js index b2f6976863..b507f05576 100644 --- a/client/src/components/pipelines/model/treeStructureFunctions.js +++ b/client/src/components/pipelines/model/treeStructureFunctions.js @@ -24,11 +24,6 @@ const metadata = 'metadata'; const metadataFolder = 'metadataFolder'; const projectHistory = 'projectHistory'; -const fireCloud = 'fireCloud'; -const fireCloudMethod = 'fireCloudMethod'; -const fireCloudMethodVersion = 'fireCloudMethodVersion'; -const fireCloudMethodConfiguration = 'fireCloudMethodVersion'; - export const ItemTypes = { folder, pipeline, @@ -38,11 +33,7 @@ export const ItemTypes = { configuration, metadata, metadataFolder, - projectHistory, - fireCloud, - fireCloudMethod, - fireCloudMethodVersion, - fireCloudMethodConfiguration + projectHistory }; export function generateUrl (item) { @@ -98,7 +89,6 @@ function nameSorter (pA, pB) { * @property {*} [metadata] * @property {number|string} [id] * @property {*} [objectMetadata] - * @property {*} [fireCloud] */ /** @@ -128,8 +118,7 @@ export function generateTreeData ( configurations, metadata, id, - objectMetadata, - fireCloud + objectMetadata } = libraryTree || {}; const { ignoreChildren = false, @@ -164,58 +153,6 @@ export function generateTreeData ( if (sortRoot) { configurationsSorted.sort(nameSorter); } - if (fireCloud && (!types || types.indexOf(ItemTypes.fireCloud) >= 0)) { - const fireCloudItem = { - id: ItemTypes.fireCloud, - key: ItemTypes.fireCloud, - name: 'FireCloud', - type: ItemTypes.fireCloud, - url () { - return generateUrl(this); - } - }; - if ( - fireCloud.methods && - fireCloud.methods.length > 0 && - (!types || types.indexOf(ItemTypes.fireCloudMethod) >= 0) - ) { - fireCloudItem.children = []; - for (let i = 0; i < fireCloud.methods.length; i++) { - const method = fireCloud.methods[i]; - const fireCloudMethod = { - id: method.name, - key: `${ItemTypes.fireCloudMethod}_${method.namespace}_${method.name}`, - name: method.name, - namespace: method.namespace, - type: ItemTypes.fireCloudMethod, - parent: fireCloudItem - }; - if ( - method.snapshotIds && - method.snapshotIds.length > 0 && - (!types || types.indexOf(ItemTypes.fireCloudMethodVersion) >= 0) - ) { - fireCloudMethod.children = []; - for (let j = 0; j < method.snapshotIds.length; j++) { - const snapshotId = method.snapshotIds[j]; - const fireCloudMethodVersion = { - id: snapshotId, - key: `${ItemTypes.fireCloudMethodVersion}_${snapshotId}`, - name: snapshotId, - type: ItemTypes.fireCloudMethodVersion, - parent: fireCloudMethod, - isLeaf: true - }; - fireCloudMethod.children.push(fireCloudMethodVersion); - } - } - fireCloudMethod.isLeaf = !fireCloudMethod.children || fireCloudMethod.children.length === 0; - fireCloudItem.children.push(fireCloudMethod); - } - } - fireCloudItem.isLeaf = !fireCloudItem.children || fireCloudItem.children.length === 0; - children.push(fireCloudItem); - } if (childFoldersSorted.length) { for (let i = 0; i < childFoldersSorted.length; i++) { if (!filter(childFoldersSorted[i], ItemTypes.folder)) { diff --git a/client/src/components/runs/logs/Log.js b/client/src/components/runs/logs/Log.js index 3fc3c98a0f..c9923968bd 100644 --- a/client/src/components/runs/logs/Log.js +++ b/client/src/components/runs/logs/Log.js @@ -104,7 +104,6 @@ import RunStatuses, {isRunStatusNodePending} from '../../special/run-status-icon import {confirmRunContinuation, continueRun, runSupportsContinue} from '../actions/continue-run'; import {checkRunActionAvailable, runActions} from '../actions/actions-availability'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; const DTS_ENVIRONMENT = 'DTS'; const MAX_PARAMETER_VALUES_TO_DISPLAY = 5; const MAX_NESTED_RUNS_TO_DISPLAY = 10; @@ -710,8 +709,6 @@ class Logs extends localization.LocalizedReactComponent { if (this.isDtsEnvironment) { const dts = this.dtsList.filter(dts => dts.id === run.executionPreferences.dtsId)[0]; environment = dts ? `${dts.name}` : `${run.executionPreferences.dtsId}`; - } else if (this.isFireCloudEnvironment) { - environment = 'FireCloud'; } else { environment = this.props.preferences.deploymentName || 'EPAM Cloud Pipeline'; } @@ -1470,13 +1467,6 @@ class Logs extends localization.LocalizedReactComponent { run.executionPreferences.environment === DTS_ENVIRONMENT; } - @computed - get isFireCloudEnvironment () { - const {run} = this.state; - return run && run.executionPreferences && - run.executionPreferences.environment === FIRE_CLOUD_ENVIRONMENT; - } - @computed get initializeEnvironmentFinished () { const {run} = this.state; diff --git a/client/src/components/runs/run-details/sections/parameters/instance-parameters/exec-environment.js b/client/src/components/runs/run-details/sections/parameters/instance-parameters/exec-environment.js index 2e43591f27..312b796639 100644 --- a/client/src/components/runs/run-details/sections/parameters/instance-parameters/exec-environment.js +++ b/client/src/components/runs/run-details/sections/parameters/instance-parameters/exec-environment.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {inject, observer} from 'mobx-react'; import {Icon} from 'antd'; -import {isDtsEnvironment, isFireCloudEnvironment} from './utilities'; +import {isDtsEnvironment} from './utilities'; const ExecEnvironment = inject( 'dtsList', @@ -35,8 +35,6 @@ const ExecEnvironment = inject( const dts = (dtsList.value || []).find((d) => d.id === dtsId); result = dts ? dts.name : `${dtsId}`; } - } else if (isFireCloudEnvironment(run)) { - result = 'FireCloud'; } else if (preferences) { (preferences.fetchIfNeededOrWait)(); result = preferences.deploymentName || 'EPAM Cloud Pipeline'; diff --git a/client/src/components/runs/run-details/sections/parameters/instance-parameters/utilities.js b/client/src/components/runs/run-details/sections/parameters/instance-parameters/utilities.js index 61fab00b37..1f0550c2e2 100644 --- a/client/src/components/runs/run-details/sections/parameters/instance-parameters/utilities.js +++ b/client/src/components/runs/run-details/sections/parameters/instance-parameters/utilities.js @@ -1,12 +1,6 @@ const DTS_ENVIRONMENT = 'DTS'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; export function isDtsEnvironment (run) { return run && run.executionPreferences && run.executionPreferences.environment === DTS_ENVIRONMENT; } - -export function isFireCloudEnvironment (run) { - return run && run.executionPreferences && - run.executionPreferences.environment === FIRE_CLOUD_ENVIRONMENT; -} diff --git a/client/src/components/runs/run-details/widgets/run-header/run-actions/run-fs-browser-button.js b/client/src/components/runs/run-details/widgets/run-header/run-actions/run-fs-browser-button.js index 7e1db93538..eff92f39d9 100644 --- a/client/src/components/runs/run-details/widgets/run-header/run-actions/run-fs-browser-button.js +++ b/client/src/components/runs/run-details/widgets/run-header/run-actions/run-fs-browser-button.js @@ -10,7 +10,6 @@ import styles from './run-actions.css'; import {checkRunActionAvailable, runActions} from '../../../../actions/actions-availability'; import {Icon} from 'antd'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; const DTS_ENVIRONMENT = 'DTS'; @inject('preferences') @@ -61,13 +60,6 @@ class RunFsBrowserButton extends React.Component { run.executionPreferences.environment === DTS_ENVIRONMENT; } - @computed - get isFireCloudEnvironment () { - const {run} = this.props; - return run && run.executionPreferences && - run.executionPreferences.environment === FIRE_CLOUD_ENVIRONMENT; - } - @computed get initializeEnvironmentFinished () { const {run} = this.props; diff --git a/client/src/components/runs/run-details/widgets/run-header/run-actions/run-ssh-button.js b/client/src/components/runs/run-details/widgets/run-header/run-actions/run-ssh-button.js index 90928c0218..68e83cd403 100644 --- a/client/src/components/runs/run-details/widgets/run-header/run-actions/run-ssh-button.js +++ b/client/src/components/runs/run-details/widgets/run-header/run-actions/run-ssh-button.js @@ -7,9 +7,8 @@ import roleModel from '../../../../../../utils/roleModel'; import pipelineRunSSHCache from '../../../../../../models/pipelines/PipelineRunSSHCache'; import MultizoneUrl from '../../../../../special/multizone-url'; import styles from './run-actions.css'; -import {Icon} from "antd"; +import {Icon} from 'antd'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; const DTS_ENVIRONMENT = 'DTS'; @inject('preferences') @@ -60,13 +59,6 @@ class RunSSHButton extends React.Component { run.executionPreferences.environment === DTS_ENVIRONMENT; } - @computed - get isFireCloudEnvironment () { - const {run} = this.props; - return run && run.executionPreferences && - run.executionPreferences.environment === FIRE_CLOUD_ENVIRONMENT; - } - @computed get initializeEnvironmentFinished () { const {run} = this.props; diff --git a/client/src/components/search/preview/ConfigurationPreview.js b/client/src/components/search/preview/ConfigurationPreview.js index e590ef781d..b66f7f9e86 100644 --- a/client/src/components/search/preview/ConfigurationPreview.js +++ b/client/src/components/search/preview/ConfigurationPreview.js @@ -27,7 +27,6 @@ import styles from './preview.css'; import AWSRegionTag from '../../special/AWSRegionTag'; import {getSpotTypeName} from '../../special/spot-instance-names'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; const DTS_ENVIRONMENT = 'DTS'; @inject('cloudProviders') @@ -163,12 +162,6 @@ export default class ConfigurationPreview extends React.Component { this.configurationEntry.executionEnvironment === DTS_ENVIRONMENT; } - @computed - get isFireCloudEnvironment () { - return this.configurationEntry && - this.configurationEntry.executionEnvironment === FIRE_CLOUD_ENVIRONMENT; - } - @computed get ExecEnvString () { if (!this.configurationEntry) { @@ -178,8 +171,6 @@ export default class ConfigurationPreview extends React.Component { if (this.isDtsEnvironment) { const dts = this.dtsList.filter(dts => dts.id === this.configurationEntry.dtsId)[0]; environment = dts ? `${dts.name}` : `${this.configurationEntry.dtsId}`; - } else if (this.isFireCloudEnvironment) { - environment = 'FireCloud'; } else { environment = this.props.preferences.deploymentName || 'EPAM Cloud Pipeline'; } @@ -199,20 +190,12 @@ export default class ConfigurationPreview extends React.Component { if (this.configurationEntry.pipelineVersion && !this.pipeline.unknown) { inputValue = `${inputValue} (${this.configurationEntry.pipelineVersion})`; } - } else if (this.isFireCloudEnvironment && - this.configurationEntry.methodName && - this.configurationEntry.methodSnapshot) { - if (this.configurationEntry.methodConfigurationName) { - inputValue = `${this.configurationEntry.methodName} (${this.configurationEntry.methodConfigurationName})`; - } else { - inputValue = `${this.configurationEntry.methodName}`; - } } return inputValue ? (
- {this.isFireCloudEnvironment ? 'FireCloud method' : 'Pipeline'} + Pipeline {inputValue} @@ -247,7 +230,7 @@ export default class ConfigurationPreview extends React.Component { const dockerImage = this.isDtsEnvironment ? configuration.docker_image : configuration.configuration && configuration.configuration.docker_image; - const cloudRegion = !this.isDtsEnvironment && !this.isFireCloudEnvironment + const cloudRegion = !this.isDtsEnvironment ? - { !this.isDtsEnvironment && !this.isFireCloudEnvironment && + {!this.isDtsEnvironment &&
Price type @@ -441,41 +425,6 @@ export default class ConfigurationPreview extends React.Component { ); }; - renderFireCloudIOList = (listPropName = 'methodInputs') => { - if (this.props.configuration.pending) { - return ( - - - - ); - } - if (!this.configurationEntry) { - return null; - } - - const parameters = this.configurationEntry[listPropName]; - - return parameters - ? (
- - - { - parameters.map(param => - ( - - - )) - } - -
- {param.name} - - {param.value} -
-
) - : null; - }; - render () { if (!this.props.item) { return null; @@ -486,8 +435,6 @@ export default class ConfigurationPreview extends React.Component { const advanced = this.renderAdvancedSection(); const systemParameters = this.renderParameters(true); const parameters = this.renderParameters(); - const fireCloudInputs = this.renderFireCloudIOList(); - const fireCloudOutputs = this.renderFireCloudIOList('methodOutputs'); return (
); diff --git a/client/src/components/search/preview/PipelineRunPreview.js b/client/src/components/search/preview/PipelineRunPreview.js index bc781ec9de..a136643117 100644 --- a/client/src/components/search/preview/PipelineRunPreview.js +++ b/client/src/components/search/preview/PipelineRunPreview.js @@ -37,7 +37,6 @@ import RunTags from '../../runs/run-tags'; import {parseRunServiceUrlConfiguration} from '../../../utils/multizone'; import MultizoneUrl from '../../special/multizone-url'; -const FIRE_CLOUD_ENVIRONMENT = 'FIRECLOUD'; const DTS_ENVIRONMENT = 'DTS'; const icons = { @@ -171,12 +170,6 @@ export default class PipelineRunPreview extends React.Component { this.props.runInfo.value.executionPreferences.environment === DTS_ENVIRONMENT; } - @computed - get isFireCloudEnvironment () { - return this.props.runInfo.loaded && this.props.runInfo.value.executionPreferences && - this.props.runInfo.value.executionPreferences.environment === FIRE_CLOUD_ENVIRONMENT; - } - @computed get dtsList () { if (this.props.dtsList.loaded) { @@ -190,8 +183,6 @@ export default class PipelineRunPreview extends React.Component { if (this.isDtsEnvironment) { const dts = this.dtsList.filter(dts => dts.id === run.executionPreferences.dtsId)[0]; environment = dts ? `${dts.name}` : `${run.executionPreferences.dtsId}`; - } else if (this.isFireCloudEnvironment) { - environment = 'FireCloud'; } else { environment = this.props.preferences.deploymentName || 'EPAM Cloud Pipeline'; } diff --git a/client/src/models/firecloud/FireCloudMethodParameters.js b/client/src/models/firecloud/FireCloudMethodParameters.js deleted file mode 100644 index c86f8c6261..0000000000 --- a/client/src/models/firecloud/FireCloudMethodParameters.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Remote from '../basic/Remote'; -import {computed} from 'mobx'; -import defer from '../../utils/defer'; -import GoogleApi from '../google/GoogleApi'; - -export default class FireCloudMethodParameters extends Remote { - googleApi; - initialized = false; - constructor (googleApi, namespace, method, snapshot) { - super(); - this.googleApi = googleApi; - this.url = `/firecloud/methods/${namespace}/${method}/${snapshot}/parameters`; - } - - _initialize = async () => { - if (!this.initialized) { - this.initialized = true; - await this.googleApi.initialize(); - this.googleApi.listenSignInStatusUpdate(this.onSignInStatusChanged); - } - }; - - @computed - get loaded () { - if (this.isSignedIn) { - this._fetchIfNeeded(); - return this._loaded; - } - return false; - } - - @computed - get isSignedIn () { - if (this.googleApi) { - return this.googleApi.isSignedIn; - } - return false; - } - - onSignInStatusChanged = () => { - this.fetch(); - }; - - async fetch () { - await this._initialize(); - let headers = this.constructor.fetchOptions.headers; - if (!headers) { - headers = {}; - } - if (this.googleApi.userAuthEnabled) { - const refreshToken = GoogleApi.getRefreshToken(); - if (refreshToken) { - headers['Firecloud-Token'] = refreshToken; - } - } - this.constructor.fetchOptions.headers = headers; - if (this.isSignedIn) { - await super.fetch(); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - } else { - await defer(); - this._pending = true; - await defer(); - this.update({payload: [], message: 'Unauthorized'}); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - this._value = []; - this._pending = false; - } - } -} diff --git a/client/src/models/firecloud/FireCloudMethodSnapshotConfigurations.js b/client/src/models/firecloud/FireCloudMethodSnapshotConfigurations.js deleted file mode 100644 index dadf5b92c2..0000000000 --- a/client/src/models/firecloud/FireCloudMethodSnapshotConfigurations.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Remote from '../basic/Remote'; -import {computed} from 'mobx'; -import defer from '../../utils/defer'; -import GoogleApi from '../google/GoogleApi'; - -export default class FireCloudMethodSnapshotConfigurations extends Remote { - googleApi; - initialized = false; - constructor (googleApi, namespace, method, snapshot) { - super(); - this.googleApi = googleApi; - this.url = `/firecloud/methods/${namespace}/${method}/${snapshot}/configurations`; - } - - _initialize = async () => { - if (!this.initialized) { - this.initialized = true; - await this.googleApi.initialize(); - this.googleApi.listenSignInStatusUpdate(this.onSignInStatusChanged); - } - }; - - @computed - get loaded () { - if (this.isSignedIn) { - this._fetchIfNeeded(); - return this._loaded; - } - return false; - } - - @computed - get isSignedIn () { - if (this.googleApi) { - return this.googleApi.isSignedIn; - } - return false; - } - - onSignInStatusChanged = () => { - this.fetch(); - }; - - async fetch () { - await this._initialize(); - let headers = this.constructor.fetchOptions.headers; - if (!headers) { - headers = {}; - } - if (this.googleApi.userAuthEnabled) { - const refreshToken = GoogleApi.getRefreshToken(); - if (refreshToken) { - headers['Firecloud-Token'] = refreshToken; - } - } - this.constructor.fetchOptions.headers = headers; - if (this.isSignedIn) { - await super.fetch(); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - } else { - await defer(); - this._pending = true; - await defer(); - this.update({payload: [], message: 'Unauthorized'}); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - this._value = []; - this._pending = false; - } - } -} diff --git a/client/src/models/firecloud/FireCloudMethods.js b/client/src/models/firecloud/FireCloudMethods.js deleted file mode 100644 index b781ffac68..0000000000 --- a/client/src/models/firecloud/FireCloudMethods.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Remote from '../basic/Remote'; -import {computed} from 'mobx'; -import defer from '../../utils/defer'; -import GoogleApi from '../google/GoogleApi'; - -export default class FireCloudMethods extends Remote { - googleApi; - initialized = false; - constructor (googleApi) { - super(); - this.googleApi = googleApi; - this.url = '/firecloud/methods'; - } - - _initialize = async () => { - if (!this.initialized) { - this.initialized = true; - await this.googleApi.initialize(); - this.googleApi.listenSignInStatusUpdate(this.onSignInStatusChanged); - } - }; - - @computed - get loaded () { - if (this.isSignedIn) { - this._fetchIfNeeded(); - return this._loaded; - } - return false; - } - - @computed - get isSignedIn () { - if (this.googleApi) { - return this.googleApi.isSignedIn; - } - return false; - } - - onSignInStatusChanged = () => { - this.fetch(); - }; - - async fetch () { - await this._initialize(); - let headers = this.constructor.fetchOptions.headers; - if (!headers) { - headers = {}; - } - if (this.googleApi.userAuthEnabled) { - const refreshToken = GoogleApi.getRefreshToken(); - if (refreshToken) { - headers['Firecloud-Token'] = refreshToken; - } - } - this.constructor.fetchOptions.headers = headers; - if (this.isSignedIn) { - await super.fetch(); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - } else { - await defer(); - this._pending = true; - await defer(); - this.update({payload: [], message: 'Unauthorized'}); - if (this.error && this.error.toLowerCase().indexOf('an error during google authorization') >= 0) { - GoogleApi.setRefreshToken(''); - } - this._value = []; - this._pending = false; - } - } -}