Skip to content

Commit

Permalink
Changed aliases to _ - root folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bond95 committed Nov 21, 2018
1 parent 21e41f5 commit 5f071ca
Show file tree
Hide file tree
Showing 117 changed files with 196 additions and 218 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

[options]
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/config/flow/css.js.flow'
module.name_mapper='^_\/\(.*\)$' ->'<PROJECT_ROOT>/src/\1'
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,6 @@ For Chrome: [https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekc

For Firefox: [https://addons.mozilla.org/en-us/firefox/addon/remotedev/](https://addons.mozilla.org/en-us/firefox/addon/remotedev/)


### Aliases configuration in IDE

You need to configure your IDE to properly work with aliases.

#### VSCode

Find or create `jsconfig.json` in root project folder and add there next lines:

```
{
"compilerOptions": {
...
"allowSyntheticDefaultImports": false,
"baseUrl": "./",
"paths": {
"ovirtapi": ["src/ovirtapi/index.js"],
"app-intl": ["src/intl/index.js"],
"app-actions": ["src/actions/index.js"],
"app-reducers/*": ["src/reducers/*"],
"app-constants": ["src/constants/index.js"],
"app-helpers": ["src/helpers.js"]
}
},
...
}
```

## Technical Details
- based on React, Patternfly, Redux, Redux-Saga
- based on ejected [create-react-app](https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html)
Expand Down
8 changes: 1 addition & 7 deletions config/webpack.config.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ exports.addFlowBabelWebpackPlugin = function (webpackConfig) {

exports.commonAliases = function () {
return {
'ovirtapi': `${paths.appSrc}/ovirtapi/index.js`,
'app-utils': `${paths.appSrc}/utils/index.js`,
'app-intl': `${paths.appSrc}/intl/index.js`,
'app-reducers': `${paths.appSrc}/reducers`,
'app-actions': `${paths.appSrc}/actions/index.js`,
'app-helpers': `${paths.appSrc}/helpers.js`,
'app-constants': `${paths.appSrc}/constants/index.js`
'_': `${paths.appSrc}`
}
}
16 changes: 16 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2017",
"allowSyntheticDefaultImports": false,
"baseUrl": "./",
"paths": {
"ovirtapi": ["src/ovirtapi/index.js"],
"app-intl": ["src/intl/index.js"],
"app-actions": ["src/actions/index.js"],
"app-reducers/*": ["src/reducers/*"],
"app-constants": ["src/constants/index.js"],
"app-helpers": ["src/helpers.js"]
}
},
"exclude": ["node_modules", "dist"]
}
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/config/jest/FileStub.js",
"^.+\\.css$": "<rootDir>/config/jest/CSSStub.js",
"ovirtapi": "<rootDir>/src/mock/ovirtapi.mock.js",
"app-intl": "<rootDir>/src/intl/index.js",
"app-actions": "<rootDir>/src/actions/index.js",
"app-reducers(.*)$": "<rootDir>/src/reducers/$1",
"app-constants": "<rootDir>/src/constants/index.js",
"app-helpers": "<rootDir>/src/helpers.js"
"_/ovirtapi": "<rootDir>/src/mock/ovirtapi.mock.js",
"_/(.*)$": "<rootDir>/src/$1"
},
"transform": {
".*": "<rootDir>/config/jest/transform.js"
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ToastNotifications from './components/ToastNotifications'
import getRoutes from './routes'
import AppConfiguration from './config'
import { fixedStrings } from './branding'
import { msg } from 'app-intl'
import { msg } from '_/intl'

/**
* Login (token) to Engine is missing.
Expand Down
2 changes: 1 addition & 1 deletion src/GlobalErrorBoundary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import * as branding from './branding'
import { msg } from 'app-intl'
import { msg } from '_/intl'
import styles from './error.css'
import AppConfiguration from './config'

Expand Down
2 changes: 1 addition & 1 deletion src/actions/activeRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ADD_ACTIVE_REQUEST,
REMOVE_ACTIVE_REQUEST,
DELAYED_REMOVE_ACTIVE_REQUEST,
} from 'app-constants'
} from '_/constants'

export function addActiveRequest (requestId) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/clusters.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
GET_ALL_CLUSTERS,
SET_CLUSTERS,
} from 'app-constants'
} from '_/constants'

export function setClusters (clusters) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/console.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SET_CONSOLE_IN_USE, CHECK_CONSOLE_IN_USE, SET_CONSOLE_VALID } from 'app-constants'
import { SET_CONSOLE_IN_USE, CHECK_CONSOLE_IN_USE, SET_CONSOLE_VALID } from '_/constants'

export function setConsoleInUse ({ vmId, consoleInUse }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/dataCenters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {
SET_DATA_CENTERS,
} from 'app-constants'
} from '_/constants'

export function setDataCenters (dataCenters: Array<Object>): Object {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FAILED_EXTERNAL_ACTION, LOGIN_FAILED } from 'app-constants'
import { FAILED_EXTERNAL_ACTION, LOGIN_FAILED } from '_/constants'

function customizeErrorMessage (message) {
const result = message.replace('Vm ', 'VM ')
Expand Down
2 changes: 1 addition & 1 deletion src/actions/hosts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
GET_ALL_HOSTS,
SET_HOSTS,
} from 'app-constants'
} from '_/constants'

export function setHosts (hosts) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SHOW_TOKEN_EXPIRED_MSG,
START_SCHEDULER_FIXED_DELAY,
STOP_SCHEDULER_FIXED_DELAY,
} from 'app-constants'
} from '_/constants'

export * from './error'
export * from './vm'
Expand Down
2 changes: 1 addition & 1 deletion src/actions/operatingSystems.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
GET_ALL_OS,
SET_OPERATING_SYSTEMS,
} from 'app-constants'
} from '_/constants'

/**
* @param {Array<OperatingSystem>} operatingSystems
Expand Down
2 changes: 1 addition & 1 deletion src/actions/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
GET_CONSOLE_OPTIONS,
SAVE_CONSOLE_OPTIONS,
SET_CONSOLE_OPTIONS,
} from 'app-constants'
} from '_/constants'

export function setConsoleOptions ({ vmId, options }) {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/pendingTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
REMOVE_SNAPSHOT_ADD_PENDING_TASK,
REMOVE_SNAPSHOT_REMOVAL_PENDING_TASK,
REMOVE_SNAPSHOT_RESTORE_PENDING_TASK,
} from 'app-constants'
} from '_/constants'

import { PendingTaskTypes } from 'app-reducers/pendingTasks'
import { PendingTaskTypes } from '_/reducers/pendingTasks'

export function addDiskRemovalPendingTask (diskId: string) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
START_POOL,
UPDATE_POOLS,
UPDATE_VMPOOLS_COUNT,
} from 'app-constants'
} from '_/constants'

export function getPoolsByPage ({ page }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/storageDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GET_ISO_STORAGE_DOMAINS,
SET_STORAGE_DOMAIN_FILES,
SET_STORAGE_DOMAINS,
} from 'app-constants'
} from '_/constants'

export function getAllStorageDomains (): Object {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/templates.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
GET_ALL_TEMPLATES,
SET_TEMPLATES,
} from 'app-constants'
} from '_/constants'

/**
* @param {Array<Object>} templates
Expand Down
2 changes: 1 addition & 1 deletion src/actions/userMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
CLEAR_USER_MSGS,
DISMISS_USER_MSG,
SET_USERMSG_NOTIFIED,
} from 'app-constants'
} from '_/constants'

export function addUserMessage ({ message, shortMessage, type = '' }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/visibility.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
SELECT_POOL_DETAIL,
SELECT_VM_DETAIL,
} from 'app-constants'
} from '_/constants'

export function selectVmDetail ({ vmId }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
UPDATE_VM_DISK,
UPDATE_VMS,
VM_ACTION_IN_PROGRESS,
} from 'app-constants'
} from '_/constants'

export function login ({ username, password, token, userId }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/vnicProfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ADD_NETWORKS_TO_VNIC_PROFILES,
SET_VNIC_PROFILES,
GET_ALL_VNIC_PROFILES,
} from 'app-constants'
} from '_/constants'

export function setVnicProfiles ({ vnicProfiles }) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/components/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'

import { connect } from 'react-redux'

import { msg } from 'app-intl'
import { msg } from '_/intl'

import { Modal } from 'patternfly-react'
import Product from '../version'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import { msg } from 'app-intl'
import { msg } from '_/intl'

const buildPath = (vms, branches) => {
const res = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/CloudInitEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import Switch from 'react-bootstrap-switch'

import { msg } from 'app-intl'
import { msg } from '_/intl'
import FieldHelp from '../FieldHelp/index'

import style from './style.css'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConsoleOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Switch from 'react-bootstrap-switch'

import style from './style.css'
import FieldHelp from '../FieldHelp/index'
import { msg } from 'app-intl'
import { msg } from '_/intl'

class ConsoleOptions extends React.Component {
constructor (props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FieldHelp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import $ from 'jquery'

import { Popover, OverlayTrigger } from 'react-bootstrap'

import { msg } from 'app-intl'
import { msg } from '_/intl'
import style from './style.css'

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/HostConsole/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'

import { connect } from 'react-redux'

import AppConfiguration from '../../config'
import { msg } from 'app-intl'
import AppConfiguration from '_/config'
import { msg } from '_/intl'

import style from './style.css'

Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'

import { connect } from 'react-redux'

import { msg } from 'app-intl'
import { msg } from '_/intl'
import style from './style.css'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationConfirmationModal/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Modal, Button, Alert } from 'patternfly-react'
import { msg } from 'app-intl'
import { msg } from '_/intl'

const NavigationConfirmationModal = ({ show, onYes, onNo }) => {
const idPrefix = 'close-dialog-confim'
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewDiskDialog/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SET_NEW_DISK_DIALOG_PROGRESS_INDICATOR,
SET_NEW_DISK_DIALOG_ERROR_TEXT,
SET_NEW_DISK_DIALOG_DONE,
} from 'app-constants'
} from '_/constants'

export function cleanNewDiskDialogSubtree () {
return {
Expand Down
5 changes: 2 additions & 3 deletions src/components/NewDiskDialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { Modal } from 'patternfly-react'

import { createDiskForVm } from '_/actions'
import { cleanNewDiskDialogSubtree } from './actions'

import { msg } from 'app-intl'
import { msg } from '_/intl'
import SelectBox from '../SelectBox'
import { flatMap, parseGbToBytes } from 'app-utils'
import { flatMap, parseGbToBytes } from '_/utils'
import style from './style.css'

class NewDiskDialog extends React.Component {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewDiskDialog/reducers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fromJS } from 'immutable'

import { actionReducer } from 'app-reducers/utils.js'
import { actionReducer } from '_/reducers/utils.js'
import {
CLEAN_NEW_DISK_DIALOG_SUBTREE,
SET_NEW_DISK_DIALOG_DONE,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsDialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
saveSSHKey,
} from './actions'

import { msg } from 'app-intl'
import { msg } from '_/intl'

class OptionsDialog extends React.Component {
constructor (props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsDialog/sagas.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { put, takeEvery } from 'redux-saga/effects'
import { SAVE_SSH_KEY, GET_SSH_KEY } from './constants'
import { setSSHKey, setUnloaded } from './actions'
import Api from 'ovirtapi'
import Api from '_/ovirtapi'

function* saveSSHKey (sagas, action) {
yield sagas.callExternalAction('saveSSHKey', Api.saveSSHKey, action)
Expand Down
2 changes: 1 addition & 1 deletion src/components/OvirtApiCheckFailed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'

import { connect } from 'react-redux'
import Product from '../version'
import { msg } from 'app-intl'
import { msg } from '_/intl'
import { fixedStrings } from '../branding'
import ErrorAlert from './ErrorAlert'

Expand Down
Loading

0 comments on commit 5f071ca

Please sign in to comment.