Apply prettier on javascript files
use prettier 2.0 Change-Id: I3a7b8ae39029a7f52f3c8f953bba7bfea82c2f1a
This commit is contained in:
parent
a7213aeffb
commit
57acf74e4a
@ -16,7 +16,7 @@ class App extends Component {
|
||||
_isMounted = false;
|
||||
|
||||
state = {
|
||||
isLoading: true
|
||||
isLoading: true,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -24,7 +24,7 @@ class App extends Component {
|
||||
store
|
||||
.dispatch(getConfig())
|
||||
.then(() => store.dispatch(checkAuthentification()))
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (this._isMounted) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ const axiosMock = new axiosMockAdapter(axios);
|
||||
|
||||
it("renders without crashing", () => {
|
||||
axiosMock.onGet("config.json").reply(200, {
|
||||
apiURL: "http://localhost:8000"
|
||||
apiURL: "http://localhost:8000",
|
||||
});
|
||||
const div = document.createElement("div");
|
||||
ReactDOM.render(<App />, div);
|
||||
|
@ -8,14 +8,14 @@ class PrivateRoute extends Component {
|
||||
return (
|
||||
<Route
|
||||
{...props}
|
||||
render={props =>
|
||||
render={(props) =>
|
||||
isAuthenticated ? (
|
||||
<Component {...props} />
|
||||
) : (
|
||||
<Redirect
|
||||
to={{
|
||||
pathname: "/login",
|
||||
state: { from: props.location }
|
||||
state: { from: props.location },
|
||||
}}
|
||||
/>
|
||||
)
|
||||
@ -27,7 +27,7 @@ class PrivateRoute extends Component {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { setCredentials, removeCredentials } from "./localStorage";
|
||||
export function logout() {
|
||||
removeCredentials();
|
||||
return {
|
||||
type: types.LOGOUT
|
||||
type: types.LOGOUT,
|
||||
};
|
||||
}
|
||||
|
||||
@ -14,15 +14,15 @@ export function checkAuthentification() {
|
||||
const state = getState();
|
||||
return http({
|
||||
method: "get",
|
||||
url: `${state.config.apiURL}/api/v1/`
|
||||
url: `${state.config.apiURL}/api/v1/`,
|
||||
})
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: types.LOGIN
|
||||
type: types.LOGIN,
|
||||
});
|
||||
return response;
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (error.response && error.response.status === 401) {
|
||||
dispatch(logout());
|
||||
}
|
||||
@ -32,7 +32,7 @@ export function checkAuthentification() {
|
||||
}
|
||||
|
||||
export function login(username, password) {
|
||||
return dispatch => {
|
||||
return (dispatch) => {
|
||||
setCredentials({ username, password });
|
||||
return dispatch(checkAuthentification());
|
||||
};
|
||||
|
@ -15,8 +15,8 @@ it("checkAuthentification", () => {
|
||||
axiosMock.onGet("https://api.example.org/api/v1/").reply(200, {});
|
||||
const expectedActions = [
|
||||
{
|
||||
type: types.LOGIN
|
||||
}
|
||||
type: types.LOGIN,
|
||||
},
|
||||
];
|
||||
const store = mockStore({ config: { apiURL: "https://api.example.org" } });
|
||||
return store.dispatch(checkAuthentification()).then(() => {
|
||||
@ -28,8 +28,8 @@ it("checkAuthentification unauthorized", () => {
|
||||
axiosMock.onGet("https://api.example.org/api/v1/").reply(401, {});
|
||||
const expectedActions = [
|
||||
{
|
||||
type: types.LOGOUT
|
||||
}
|
||||
type: types.LOGOUT,
|
||||
},
|
||||
];
|
||||
const store = mockStore({ config: { apiURL: "https://api.example.org" } });
|
||||
return store.dispatch(checkAuthentification()).catch(() => {
|
||||
|
@ -1,20 +1,20 @@
|
||||
import * as types from "./authActionsTypes";
|
||||
|
||||
const initialState = {
|
||||
isAuthenticated: true
|
||||
isAuthenticated: true,
|
||||
};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case types.LOGIN:
|
||||
return {
|
||||
...state,
|
||||
isAuthenticated: true
|
||||
isAuthenticated: true,
|
||||
};
|
||||
case types.LOGOUT:
|
||||
return {
|
||||
...state,
|
||||
isAuthenticated: false
|
||||
isAuthenticated: false,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
@ -7,18 +7,18 @@ it("returns the initial state", () => {
|
||||
|
||||
it("LOGIN", () => {
|
||||
const newState = reducer(undefined, {
|
||||
type: types.LOGIN
|
||||
type: types.LOGIN,
|
||||
});
|
||||
expect(newState).toEqual({
|
||||
isAuthenticated: true
|
||||
isAuthenticated: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("LOGOUT", () => {
|
||||
const newState = reducer(undefined, {
|
||||
type: types.LOGOUT
|
||||
type: types.LOGOUT,
|
||||
});
|
||||
expect(newState).toEqual({
|
||||
isAuthenticated: false
|
||||
isAuthenticated: false,
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
setCredentials,
|
||||
getCredentials,
|
||||
removeCredentials
|
||||
removeCredentials,
|
||||
} from "./localStorage";
|
||||
|
||||
it("localStorage getCredentials", () => {
|
||||
@ -11,7 +11,7 @@ it("localStorage getCredentials", () => {
|
||||
it("localStorage setCredentials getCredentials removeCredentials", () => {
|
||||
const credentials = {
|
||||
username: "foo",
|
||||
password: "bar"
|
||||
password: "bar",
|
||||
};
|
||||
setCredentials(credentials);
|
||||
expect(getCredentials()).toEqual(credentials);
|
||||
|
@ -4,16 +4,18 @@ import * as types from "./configActionsTypes";
|
||||
export function setConfig(config) {
|
||||
return {
|
||||
type: types.SET_CONFIG,
|
||||
config
|
||||
config,
|
||||
};
|
||||
}
|
||||
|
||||
export function getConfig() {
|
||||
return dispatch => {
|
||||
return http.get(`${process.env.PUBLIC_URL}/config.json`).then(response => {
|
||||
const config = response.data;
|
||||
dispatch(setConfig(config));
|
||||
return response;
|
||||
});
|
||||
return (dispatch) => {
|
||||
return http
|
||||
.get(`${process.env.PUBLIC_URL}/config.json`)
|
||||
.then((response) => {
|
||||
const config = response.data;
|
||||
dispatch(setConfig(config));
|
||||
return response;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ it("setConfig", () => {
|
||||
const config = { apiURL: "http://example.org" };
|
||||
const expectedActions = {
|
||||
type: types.SET_CONFIG,
|
||||
config
|
||||
config,
|
||||
};
|
||||
expect(actions.setConfig(config)).toEqual(expectedActions);
|
||||
});
|
||||
|
@ -2,11 +2,11 @@ import * as types from "./configActionsTypes";
|
||||
|
||||
const initialState = {};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case types.SET_CONFIG:
|
||||
return {
|
||||
...action.config
|
||||
...action.config,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
@ -11,8 +11,8 @@ it("SET_CONFIG", () => {
|
||||
{
|
||||
type: types.SET_CONFIG,
|
||||
config: {
|
||||
apiURL: "http://example.org"
|
||||
}
|
||||
apiURL: "http://example.org",
|
||||
},
|
||||
}
|
||||
);
|
||||
expect(state.apiURL).toBe("http://example.org");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import { getCredentials } from "./auth/localStorage";
|
||||
|
||||
axios.interceptors.request.use(config => {
|
||||
axios.interceptors.request.use((config) => {
|
||||
const credentials = getCredentials();
|
||||
if (credentials) {
|
||||
config.auth = credentials;
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
NavItem,
|
||||
NavList,
|
||||
NavVariants,
|
||||
PageHeader
|
||||
PageHeader,
|
||||
} from "@patternfly/react-core";
|
||||
import logo from "../images/logo.svg";
|
||||
|
||||
@ -53,7 +53,7 @@ class Header extends Component {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,17 @@ import {
|
||||
Card,
|
||||
CardBody,
|
||||
PageSection,
|
||||
PageSectionVariants
|
||||
PageSectionVariants,
|
||||
} from "@patternfly/react-core";
|
||||
|
||||
export default class LoadingPage extends Component {
|
||||
state = {
|
||||
seconds: 0
|
||||
seconds: 0,
|
||||
};
|
||||
|
||||
tick() {
|
||||
this.setState(state => ({
|
||||
seconds: state.seconds + 1
|
||||
this.setState((state) => ({
|
||||
seconds: state.seconds + 1,
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
Bullseye,
|
||||
Button,
|
||||
PageSection,
|
||||
PageSectionVariants
|
||||
PageSectionVariants,
|
||||
} from "@patternfly/react-core";
|
||||
|
||||
export default class Page404 extends Component {
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
LoginFooterItem,
|
||||
LoginForm,
|
||||
LoginPage,
|
||||
ListItem
|
||||
ListItem,
|
||||
} from "@patternfly/react-core";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import logo from "../images/logo.svg";
|
||||
@ -18,18 +18,18 @@ export class AraLoginPage extends Component {
|
||||
isValidUsername: true,
|
||||
password: "",
|
||||
isValidPassword: true,
|
||||
redirectToReferrer: false
|
||||
redirectToReferrer: false,
|
||||
};
|
||||
|
||||
handleUsernameChange = username => {
|
||||
handleUsernameChange = (username) => {
|
||||
this.setState({ username });
|
||||
};
|
||||
|
||||
handlePasswordChange = password => {
|
||||
handlePasswordChange = (password) => {
|
||||
this.setState({ password });
|
||||
};
|
||||
|
||||
onLoginButtonClick = event => {
|
||||
onLoginButtonClick = (event) => {
|
||||
event.preventDefault();
|
||||
const { username, password } = this.state;
|
||||
const { login } = this.props;
|
||||
@ -42,7 +42,7 @@ export class AraLoginPage extends Component {
|
||||
showHelperText: true,
|
||||
isValidUsername: false,
|
||||
isValidPassword: false,
|
||||
helperText: "Invalid username or password"
|
||||
helperText: "Invalid username or password",
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -55,7 +55,7 @@ export class AraLoginPage extends Component {
|
||||
isValidPassword,
|
||||
showHelperText,
|
||||
helperText,
|
||||
redirectToReferrer
|
||||
redirectToReferrer,
|
||||
} = this.state;
|
||||
const { location, isAuthenticated } = this.props;
|
||||
const { from } = location.state || { from: { pathname: "/" } };
|
||||
@ -100,17 +100,14 @@ export class AraLoginPage extends Component {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
};
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
login: (username, password) => dispatch(login(username, password))
|
||||
login: (username, password) => dispatch(login(username, password)),
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(AraLoginPage);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AraLoginPage);
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
Card,
|
||||
CardHeader,
|
||||
PageSection,
|
||||
PageSectionVariants
|
||||
PageSectionVariants,
|
||||
} from "@patternfly/react-core";
|
||||
import { connect } from "react-redux";
|
||||
import { isEmpty } from "lodash";
|
||||
@ -16,14 +16,14 @@ import { extractTasksFromPlays } from "../tasks/task";
|
||||
export class PlaybookPage extends Component {
|
||||
state = {
|
||||
isLoading: true,
|
||||
playbook: null
|
||||
playbook: null,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.props
|
||||
.getPlaybook({ id: this.props.match.params.id })
|
||||
.then(response => this.setState({ playbook: response.data }))
|
||||
.catch(error => console.log(error))
|
||||
.then((response) => this.setState({ playbook: response.data }))
|
||||
.catch((error) => console.log(error))
|
||||
.then(() => this.setState({ isLoading: false }));
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ export class PlaybookPage extends Component {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{playbook.hosts.map(host => (
|
||||
{playbook.hosts.map((host) => (
|
||||
<tr key={host.id}>
|
||||
<td data-label="Name">{host.name}</td>
|
||||
<td data-label="OK">{host.ok}</td>
|
||||
@ -81,11 +81,8 @@ export class PlaybookPage extends Component {
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
getPlaybook: playbook => dispatch(getPlaybook(playbook))
|
||||
getPlaybook: (playbook) => dispatch(getPlaybook(playbook)),
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(PlaybookPage);
|
||||
export default connect(null, mapDispatchToProps)(PlaybookPage);
|
||||
|
@ -6,14 +6,14 @@ import {
|
||||
ExclamationCircleIcon,
|
||||
PauseCircleIcon,
|
||||
CalendarAltIcon,
|
||||
ClockIcon
|
||||
ClockIcon,
|
||||
} from "@patternfly/react-icons";
|
||||
import {
|
||||
global_danger_color_100,
|
||||
global_success_color_100,
|
||||
global_active_color_100,
|
||||
global_warning_color_100,
|
||||
global_Color_light_100
|
||||
global_Color_light_100,
|
||||
} from "@patternfly/react-tokens";
|
||||
|
||||
const StatusIcon = ({ status }) => {
|
||||
@ -56,21 +56,13 @@ const StatusIcon = ({ status }) => {
|
||||
function getBackground(status, backgroundColor = global_Color_light_100.value) {
|
||||
switch (status) {
|
||||
case "running":
|
||||
return `linear-gradient(to right,${global_active_color_100.value} 0,${
|
||||
global_active_color_100.value
|
||||
} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
return `linear-gradient(to right,${global_active_color_100.value} 0,${global_active_color_100.value} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
case "completed":
|
||||
return `linear-gradient(to right,${global_success_color_100.value} 0,${
|
||||
global_success_color_100.value
|
||||
} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
return `linear-gradient(to right,${global_success_color_100.value} 0,${global_success_color_100.value} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
case "failed":
|
||||
return `linear-gradient(to right,${global_danger_color_100.value} 0,${
|
||||
global_danger_color_100.value
|
||||
} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
return `linear-gradient(to right,${global_danger_color_100.value} 0,${global_danger_color_100.value} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
default:
|
||||
return `linear-gradient(to right,${global_warning_color_100.value} 0,${
|
||||
global_warning_color_100.value
|
||||
} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
return `linear-gradient(to right,${global_warning_color_100.value} 0,${global_warning_color_100.value} 5px,${backgroundColor} 5px,${backgroundColor} 100%) no-repeat`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +70,7 @@ const PlaybookWrapper = styled.div`
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
.pf-c-card {
|
||||
background: ${props => getBackground(props.status)};
|
||||
background: ${(props) => getBackground(props.status)};
|
||||
}
|
||||
`;
|
||||
|
||||
@ -184,7 +176,7 @@ export default class Playbook extends Component {
|
||||
</PlaybookInfo>
|
||||
</PlaybookInfos>
|
||||
<Labels>
|
||||
{playbook.labels.map(label => (
|
||||
{playbook.labels.map((label) => (
|
||||
<Label className="pf-u-mr-md" isCompact>
|
||||
{label.name}
|
||||
</Label>
|
||||
@ -198,9 +190,7 @@ export default class Playbook extends Component {
|
||||
</Duration>
|
||||
<Duration>
|
||||
<ClockIcon />
|
||||
<span className="pf-u-ml-sm">
|
||||
{playbook.duration}
|
||||
</span>
|
||||
<span className="pf-u-ml-sm">{playbook.duration}</span>
|
||||
</Duration>
|
||||
</PlaybookContent>
|
||||
</CardBody>
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
EmptyStateBody,
|
||||
PageSection,
|
||||
PageSectionVariants,
|
||||
Title
|
||||
Title,
|
||||
} from "@patternfly/react-core";
|
||||
import { CubesIcon, ErrorCircleOIcon } from "@patternfly/react-icons";
|
||||
import { LoadingPage } from "../pages";
|
||||
@ -23,20 +23,18 @@ export class PlaybooksPage extends Component {
|
||||
state = {
|
||||
isLoading: true,
|
||||
hasError: false,
|
||||
errorMessage: ""
|
||||
errorMessage: "",
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { getPlaybooks, config } = this.props;
|
||||
getPlaybooks()
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
let errorMessage = "";
|
||||
if (error.response) {
|
||||
errorMessage = error.message;
|
||||
} else {
|
||||
errorMessage = `Server located at ${
|
||||
config.apiURL
|
||||
} is unreachable. Check your configuration. Verify that cross-origin requests are not blocked.`;
|
||||
errorMessage = `Server located at ${config.apiURL} is unreachable. Check your configuration. Verify that cross-origin requests are not blocked.`;
|
||||
}
|
||||
this.setState({ errorMessage, hasError: true });
|
||||
})
|
||||
@ -105,7 +103,7 @@ export class PlaybooksPage extends Component {
|
||||
|
||||
return (
|
||||
<PageSection variant={PageSectionVariants.default}>
|
||||
{playbooks.map(playbook => (
|
||||
{playbooks.map((playbook) => (
|
||||
<PlaybookSummary
|
||||
key={playbook.id}
|
||||
playbook={playbook}
|
||||
@ -120,17 +118,14 @@ export class PlaybooksPage extends Component {
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
config: state.config,
|
||||
playbooks: Object.values(state.playbooks)
|
||||
playbooks: Object.values(state.playbooks),
|
||||
};
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
getPlaybooks: () => dispatch(getPlaybooks())
|
||||
getPlaybooks: () => dispatch(getPlaybooks()),
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PlaybooksPage);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PlaybooksPage);
|
||||
|
@ -4,10 +4,10 @@ import * as types from "./playbooksActionsTypes";
|
||||
export function getPlaybooks() {
|
||||
return (dispatch, getState) => {
|
||||
const { apiURL } = getState().config;
|
||||
return http.get(`${apiURL}/api/v1/playbooks`).then(response => {
|
||||
return http.get(`${apiURL}/api/v1/playbooks`).then((response) => {
|
||||
dispatch({
|
||||
type: types.FETCH_PLAYBOOKS,
|
||||
playbooks: response.data.results
|
||||
playbooks: response.data.results,
|
||||
});
|
||||
return response;
|
||||
});
|
||||
|
@ -16,13 +16,13 @@ it("getPlaybooks", () => {
|
||||
count: 1,
|
||||
next: null,
|
||||
previous: null,
|
||||
results: [{ id: "p1" }]
|
||||
results: [{ id: "p1" }],
|
||||
});
|
||||
const expectedActions = [
|
||||
{
|
||||
type: types.FETCH_PLAYBOOKS,
|
||||
playbooks: [{ id: "p1" }]
|
||||
}
|
||||
playbooks: [{ id: "p1" }],
|
||||
},
|
||||
];
|
||||
const store = mockStore({ config: { apiURL: "https://api.example.org" } });
|
||||
return store.dispatch(getPlaybooks()).then(() => {
|
||||
|
@ -2,7 +2,7 @@ import * as types from "./playbooksActionsTypes";
|
||||
|
||||
const initialState = {};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case types.FETCH_PLAYBOOKS:
|
||||
return action.playbooks.reduce((accumulator, playbook) => {
|
||||
|
@ -4,9 +4,9 @@ import * as types from "./playbooksActionsTypes";
|
||||
it("FETCH_PLAYBOOKS", () => {
|
||||
const newState = reducer(undefined, {
|
||||
type: types.FETCH_PLAYBOOKS,
|
||||
playbooks: [{ id: "p1" }]
|
||||
playbooks: [{ id: "p1" }],
|
||||
});
|
||||
expect(newState).toEqual({
|
||||
p1: { id: "p1" }
|
||||
p1: { id: "p1" },
|
||||
});
|
||||
});
|
||||
|
@ -1,18 +1,18 @@
|
||||
const localStorageMock = (function() {
|
||||
const localStorageMock = (function () {
|
||||
let store = {};
|
||||
return {
|
||||
getItem: function(key) {
|
||||
getItem: function (key) {
|
||||
return store[key] || null;
|
||||
},
|
||||
setItem: function(key, value) {
|
||||
setItem: function (key, value) {
|
||||
store[key] = value.toString();
|
||||
},
|
||||
removeItem: function(key) {
|
||||
removeItem: function (key) {
|
||||
delete store[key];
|
||||
},
|
||||
clear: function() {
|
||||
clear: function () {
|
||||
store = {};
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
|
@ -8,7 +8,7 @@ const store = createStore(
|
||||
combineReducers({
|
||||
config: configReducer,
|
||||
playbooks: playbooksReducer,
|
||||
auth: authReducer
|
||||
auth: authReducer,
|
||||
}),
|
||||
applyMiddleware(thunk)
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
global_danger_color_100,
|
||||
global_success_color_100,
|
||||
global_active_color_100,
|
||||
global_warning_color_100
|
||||
global_warning_color_100,
|
||||
} from "@patternfly/react-tokens";
|
||||
|
||||
const Status = ({ status, children }) => {
|
||||
@ -14,7 +14,7 @@ const Status = ({ status, children }) => {
|
||||
unreachable: global_warning_color_100.value,
|
||||
changed: global_active_color_100.value,
|
||||
ignored: global_warning_color_100.value,
|
||||
unknown: global_warning_color_100.value
|
||||
unknown: global_warning_color_100.value,
|
||||
};
|
||||
return (
|
||||
<span
|
||||
@ -30,8 +30,8 @@ const Statuses = ({ statuses }) => {
|
||||
return (
|
||||
<div>
|
||||
{Object.keys(statuses)
|
||||
.filter(status => statuses[status] !== 0)
|
||||
.map(status => (
|
||||
.filter((status) => statuses[status] !== 0)
|
||||
.map((status) => (
|
||||
<Status status={status}>{`${statuses[status]} ${status}`}</Status>
|
||||
))}
|
||||
</div>
|
||||
@ -40,11 +40,11 @@ const Statuses = ({ statuses }) => {
|
||||
|
||||
export default class TaskRow extends Component {
|
||||
state = {
|
||||
isExpanded: false
|
||||
isExpanded: false,
|
||||
};
|
||||
|
||||
toggleExpand = () => {
|
||||
this.setState(prevState => ({ isExpanded: !prevState.isExpanded }));
|
||||
this.setState((prevState) => ({ isExpanded: !prevState.isExpanded }));
|
||||
};
|
||||
render() {
|
||||
const { isExpanded } = this.state;
|
||||
@ -54,8 +54,9 @@ export default class TaskRow extends Component {
|
||||
<tr>
|
||||
<td className="pf-c-table__toggle">
|
||||
<button
|
||||
className={`pf-c-button pf-m-plain ${isExpanded &&
|
||||
"pf-m-expanded"}`}
|
||||
className={`pf-c-button pf-m-plain ${
|
||||
isExpanded && "pf-m-expanded"
|
||||
}`}
|
||||
aria-label="Details"
|
||||
aria-controls={`expandable task ${task.name}`}
|
||||
aria-expanded={isExpanded ? "true" : "false"}
|
||||
@ -75,13 +76,15 @@ export default class TaskRow extends Component {
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
className={`pf-c-table__expandable-row ${isExpanded &&
|
||||
"pf-m-expanded"}`}
|
||||
className={`pf-c-table__expandable-row ${
|
||||
isExpanded && "pf-m-expanded"
|
||||
}`}
|
||||
>
|
||||
<td colspan="5" className="pf-u-p-0">
|
||||
<div
|
||||
className={`pf-c-table__expandable-row-content ${isExpanded &&
|
||||
"pf-m-expanded"}`}
|
||||
className={`pf-c-table__expandable-row-content ${
|
||||
isExpanded && "pf-m-expanded"
|
||||
}`}
|
||||
>
|
||||
<table
|
||||
className="pf-c-table pf-m-compact pf-m-no-border-rows"
|
||||
@ -98,7 +101,7 @@ export default class TaskRow extends Component {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{task.results.map(result => (
|
||||
{task.results.map((result) => (
|
||||
<tr>
|
||||
<td
|
||||
data-label="Status"
|
||||
|
@ -19,7 +19,7 @@ export default class Tasks extends Component {
|
||||
<td className="pf-u-text-align-center">Status</td>
|
||||
</tr>
|
||||
</thead>
|
||||
{tasks.map(task => (
|
||||
{tasks.map((task) => (
|
||||
<TaskRow task={task} />
|
||||
))}
|
||||
</table>
|
||||
|
@ -18,8 +18,8 @@ function _getAveragesFromTask(task) {
|
||||
unreachable: 0,
|
||||
changed: 0,
|
||||
ignored: 0,
|
||||
unknown: 0
|
||||
}
|
||||
unknown: 0,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -33,7 +33,7 @@ export function extractTasksFromPlays(plays) {
|
||||
results: task.results,
|
||||
task_id: task.id,
|
||||
statuses: taskAverages.statuses,
|
||||
average_duration: taskAverages.average_duration
|
||||
average_duration: taskAverages.average_duration,
|
||||
});
|
||||
}
|
||||
return acc;
|
||||
|
@ -17,13 +17,13 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 3, name: "localhost", alias: "localhost" },
|
||||
started: "2019-05-17T16:55:07.993741",
|
||||
ended: "2019-05-17T16:55:09.695842",
|
||||
status: "ok"
|
||||
}
|
||||
status: "ok",
|
||||
},
|
||||
],
|
||||
file: {
|
||||
id: 6,
|
||||
path:
|
||||
"/home/zuul/src/opendev.org/recordsansible/ara/tests/integration/hosts.yaml"
|
||||
"/home/zuul/src/opendev.org/recordsansible/ara/tests/integration/hosts.yaml",
|
||||
},
|
||||
started: "2019-05-17T16:55:07.993741",
|
||||
ended: "2019-05-17T16:55:09.787161",
|
||||
@ -32,13 +32,13 @@ test("extractTasksFromPlays", () => {
|
||||
lineno: 19,
|
||||
handler: false,
|
||||
status: "completed",
|
||||
play: 4
|
||||
}
|
||||
play: 4,
|
||||
},
|
||||
],
|
||||
started: "2019-05-17T16:55:07.795907",
|
||||
ended: "2019-05-17T16:55:10.006643",
|
||||
name: "Create fake hosts for host tests",
|
||||
status: "completed"
|
||||
status: "completed",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
@ -55,7 +55,7 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 5, name: "host3", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:11.263736",
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
@ -63,7 +63,7 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 6, name: "host2", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:11.421475",
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
@ -71,13 +71,13 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 7, name: "host1", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:12.195753",
|
||||
status: "ok"
|
||||
}
|
||||
status: "ok",
|
||||
},
|
||||
],
|
||||
file: {
|
||||
id: 6,
|
||||
path:
|
||||
"/home/zuul/src/opendev.org/recordsansible/ara/tests/integration/hosts.yaml"
|
||||
"/home/zuul/src/opendev.org/recordsansible/ara/tests/integration/hosts.yaml",
|
||||
},
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:12.289771",
|
||||
@ -86,14 +86,14 @@ test("extractTasksFromPlays", () => {
|
||||
lineno: 33,
|
||||
handler: false,
|
||||
status: "completed",
|
||||
play: 5
|
||||
}
|
||||
play: 5,
|
||||
},
|
||||
],
|
||||
started: "2019-05-17T16:55:10.135506",
|
||||
ended: "2019-05-17T16:55:14.488333",
|
||||
name: "ARA Hosts test play",
|
||||
status: "completed"
|
||||
}
|
||||
status: "completed",
|
||||
},
|
||||
];
|
||||
|
||||
const expectedTasks = [
|
||||
@ -108,7 +108,7 @@ test("extractTasksFromPlays", () => {
|
||||
unreachable: 0,
|
||||
changed: 0,
|
||||
ignored: 0,
|
||||
unknown: 0
|
||||
unknown: 0,
|
||||
},
|
||||
results: [
|
||||
{
|
||||
@ -117,10 +117,10 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 3, name: "localhost", alias: "localhost" },
|
||||
started: "2019-05-17T16:55:07.993741",
|
||||
ended: "2019-05-17T16:55:09.695842",
|
||||
status: "ok"
|
||||
}
|
||||
status: "ok",
|
||||
},
|
||||
],
|
||||
task_id: 5
|
||||
task_id: 5,
|
||||
},
|
||||
{
|
||||
name: "Gathering Facts",
|
||||
@ -133,7 +133,7 @@ test("extractTasksFromPlays", () => {
|
||||
unreachable: 0,
|
||||
changed: 0,
|
||||
ignored: 0,
|
||||
unknown: 0
|
||||
unknown: 0,
|
||||
},
|
||||
task_id: 6,
|
||||
results: [
|
||||
@ -143,7 +143,7 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 5, name: "host3", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:11.263736",
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
@ -151,7 +151,7 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 6, name: "host2", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:11.421475",
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
@ -159,10 +159,10 @@ test("extractTasksFromPlays", () => {
|
||||
host: { id: 7, name: "host1", alias: null },
|
||||
started: "2019-05-17T16:55:10.330416",
|
||||
ended: "2019-05-17T16:55:12.195753",
|
||||
status: "ok"
|
||||
}
|
||||
]
|
||||
}
|
||||
status: "ok",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
expect(extractTasksFromPlays(plays)).toEqual(expectedTasks);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user