Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Jenkinsfile #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
19 changes: 19 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@Library('factual-shared-libs') _
pipeline {
agent none
stages {
stage ('Build') {
steps {
docker_build name: 'infraeng-consoleme'
}
}
stage ('Deploy') {
when {
branch 'jenkins_build'
}
steps {
k8s_deploy cluster: 'eks-us-use1-infra', team: 'consoleme-dev', app: 'dev', image_name: '087473112489.dkr.ecr.us-east-1.amazonaws.com/infraeng-consoleme'
}
}
}
}
5 changes: 3 additions & 2 deletions ui/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ const ConsoleMeHeader = () => {
header
name="header"
style={{
fontSize: "20px",
fontSize: "15px",
textTransform: "uppercase",
width: "240px",
backgroundColor: "#22be34",
}}
href="/"
>
Expand All @@ -186,7 +187,7 @@ const ConsoleMeHeader = () => {
src="/images/logos/logo192.png"
style={{ marginRight: "1.5em" }}
/>
ConsoleMe
ConsoleMe-Dev
</Menu.Item>
<Menu.Menu position="left">
<Menu.Item active={false} exact as={NavLink} name="roles" to="/">
Expand Down
23 changes: 23 additions & 0 deletions ui/src/components/SettingsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "semantic-ui-react";
import {
editor_themes,
sign_in_actions,
getLocalStorageSettings,
setLocalStorageSettings,
} from "../helpers/utils";
Expand Down Expand Up @@ -36,6 +37,13 @@ const SettingsModal = (props) => {
setCurrentSettings(oldSettings);
};

const updateSignInAction = (e, data) => {
const oldSettings = currentSettings;
oldSettings.signInAction = data.value;
setMessages([]);
setCurrentSettings(oldSettings);
};

const updateDefaultAwsConsoleRegion = (e, data) => {
const oldSettings = currentSettings;
oldSettings.defaultAwsConsoleRegion = data.value;
Expand Down Expand Up @@ -75,6 +83,21 @@ const SettingsModal = (props) => {
/>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={4} floated="left">
Sign-In Action
</Grid.Column>
<Grid.Column width={8}>
<Dropdown
fluid
placeholder="Sign-In Action"
selection
onChange={updateSignInAction}
defaultValue={currentSettings.signInAction}
options={sign_in_actions}
/>
</Grid.Column>
</Grid.Row>
</Grid>
);
};
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/blocks/datatable/DataTableComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const DataTableComponent = ({ config }) => {
};

const rowsPerPage = tableConfig.rowsPerPage || DEFAULT_ROWS_PER_PAGE;
const totalPages = parseInt(filteredData.length / rowsPerPage, 10);
const totalPages = Math.ceil(filteredData.length / rowsPerPage);

if (isLoading) {
return (
Expand Down
2 changes: 2 additions & 0 deletions ui/src/components/blocks/datatable/DataTableRowsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const DataTableRowsComponent = ({
if (column.onClick && column.onClick.action === "redirect") {
// TODO, change this to useHistory
setRedirect(entry[column.key] + window.location.search || "");
} else if (column.onClick && column.onClick.action === "newtab") {
window.open(window.location.origin + entry[column.key] + window.location.search || "")
}
};

Expand Down
11 changes: 10 additions & 1 deletion ui/src/components/roles/SelectRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ import { Header } from "semantic-ui-react";
import ConsoleMeDataTable from "../blocks/datatable/DataTableComponent";
import ReactMarkdown from "react-markdown";
import { useAuth } from "../../auth/AuthProviderDefault";
import {
getLocalStorageSettings
} from "../../helpers/utils"

const SelectRoles = () => {
const [pageConfig, setPageConfig] = useState(null);
const auth = useAuth();
const { sendRequestCommon } = auth;
const userSignInAction = getLocalStorageSettings(
"signInAction"
)

useEffect(() => {
(async () => {
Expand All @@ -19,9 +25,12 @@ const SelectRoles = () => {
if (!data) {
return;
}
if (userSignInAction && userSignInAction !== data.tableConfig.columns[0].onClick.action) {
data.tableConfig.columns[0].onClick.action = userSignInAction
}
setPageConfig(data);
})();
}, [sendRequestCommon]);
}, [sendRequestCommon, userSignInAction]);

if (!pageConfig) {
return null;
Expand Down
14 changes: 14 additions & 0 deletions ui/src/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,22 @@ export const editor_themes = [
},
];

export const sign_in_actions = [
{
key: "redirect",
text: "Redirect",
value: "redirect",
},
{
key: "newtab",
text: "New Tab",
value: "newtab",
}
]

const default_user_settings = {
editorTheme: "vs-light",
signInAction: "redirect"
};

export const getLocalStorageSettings = (specificSetting = "") => {
Expand Down