Skip to content

Commit

Permalink
Support for Docker stacks git repository
Browse files Browse the repository at this point in the history
This also commit introduces alert event handling in the real-time notification system. Additionally, it renames and refactors several enums and components relating to repositories, aligning with the new type nomenclature. Both the `Git` and `Local` repository types have been updated, alongside improvements in the custom stacks and playbooks repository controllers.
  • Loading branch information
SquirrelDevelopper committed Nov 5, 2024
1 parent 0edb457 commit b26e609
Show file tree
Hide file tree
Showing 79 changed files with 2,276 additions and 401 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pr-to-release-branch-on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Create PR to Release Branch

on:
push:
tags: [ 'v*.*.*' ]

jobs:
create-pr:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Fetch all branches
run: git fetch --all

- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
source-branch: master
destination-branch: release
commit-message: 'chore: Merge master into release branch'
title: '[CHORE] Create PR from master to release'
body: 'The workflow is triggered by publishing a new tag. This PR merges changes from master to release.'
branch: 'pr-branch'
30 changes: 16 additions & 14 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
"buffer": "^6.0.3",
"classnames": "^2.5.1",
"dayjs": "^1.11.13",
"framer-motion": "^11.11.10",
"framer-motion": "^11.11.11",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"monaco-editor-webpack-plugin": "^7.1.0",
"monaco-languageserver-types": "^0.4.0",
"monaco-yaml": "^5.2.2",
"monaco-yaml": "^5.2.3",
"rc-banner-anim": "^2.4.5",
"rc-menu": "^9.15.1",
"rc-queue-anim": "^2.0.0",
Expand All @@ -92,13 +92,13 @@
"@babel/preset-typescript": "^7.26.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@types/classnames": "^2.3.4",
"@types/express": "^5.0.0",
"@types/history": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.12",
"@types/lodash": "^4.17.13",
"@types/luxon": "^3.4.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
Expand Down
2 changes: 2 additions & 0 deletions client/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AlertNotification from '@/components/Alert/AlertNotification';
import Footer from '@/components/Footer';
import {
AvatarDropdown,
Expand Down Expand Up @@ -116,6 +117,7 @@ export const layout: RunTimeLayoutConfig = ({
version != initialState?.currentUser?.settings?.server.version;
return (
<>
<AlertNotification />
{initialState?.currentUser?.settings?.server.version &&
versionMismatch && (
<Alert
Expand Down
35 changes: 35 additions & 0 deletions client/src/components/Alert/AlertNotification.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { socket } from '@/socket';
import { notification, Typography } from 'antd';
import React, { useEffect } from 'react';
import { SsmEvents } from 'ssm-shared-lib';

const AlertNotification: React.FC = () => {
const [api, contextHolder] = notification.useNotification();
const openNotificationWithIcon = (payload: any) => {
if (payload?.severity === 'error') {
api.error({
message: 'Alert',
description: (
<Typography.Text style={{ fontSize: 13 }}>
{payload?.message
?.split('\n')
.map((line: string, index: number) => <p key={index}>{line}</p>)}
</Typography.Text>
),
duration: 0,
});
}
};
useEffect(() => {
socket.connect();
socket.on(SsmEvents.Alert.NEW_ALERT, openNotificationWithIcon);

return () => {
socket.off(SsmEvents.Alert.NEW_ALERT, openNotificationWithIcon);
socket.disconnect();
};
}, []);
return <>{contextHolder}</>;
};

export default AlertNotification;
19 changes: 19 additions & 0 deletions client/src/components/Icons/CustomIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2471,3 +2471,22 @@ const UpdateLineSvg = React.memo((props) => (
export const UpdateLine = (props: Partial<CustomIconComponentProps>) => (
<Icon component={UpdateLineSvg} {...props} />
);

const ErrorCircleSettings20RegularSvg = React.memo((props) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 20 20"
{...props}
>
<path
fill="currentColor"
d="M18 10a8 8 0 1 0-7.411 7.979a5.462 5.462 0 0 1-.383-.982a7 7 0 1 1 6.79-6.79c.343.096.671.224.983.382c.014-.195.021-.391.021-.589Zm-7.342 2.89a.75.75 0 1 0-.442 1.078c.11-.378.258-.739.442-1.079Zm-.166-6.48a.5.5 0 0 0-.992.09V11l.008.09A.5.5 0 0 0 10.5 11V6.5l-.008-.09Zm1.143 8.51a2 2 0 0 0 1.43-2.478l-.155-.557c.254-.195.529-.362.821-.497l.338.358a2 2 0 0 0 2.91.001l.324-.343c.298.14.578.314.835.518l-.126.422a2 2 0 0 0 1.456 2.519l.349.082a4.697 4.697 0 0 1 .01 1.017l-.46.118a2 2 0 0 0-1.431 2.478l.156.556c-.254.196-.53.363-.822.498l-.337-.358a2 2 0 0 0-2.91-.002l-.325.345a4.32 4.32 0 0 1-.835-.518l.127-.423a2 2 0 0 0-1.456-2.519l-.35-.083a4.715 4.715 0 0 1-.01-1.016l.461-.118Zm4.865.58a1 1 0 1 0-2 0a1 1 0 0 0 2 0Z"
/>
</svg>
));

export const ErrorCircleSettings20Regular = (
props: Partial<CustomIconComponentProps>,
) => <Icon component={ErrorCircleSettings20RegularSvg} {...props} />;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
export type NewUnManagedDeviceModalProps = {
isModalOpen: boolean;
setIsModalOpen: any;
onAddNewUnmanagedDevice: () => void;
};
const { Text } = Typography;

Expand All @@ -20,6 +21,7 @@ const NewUnManagedDeviceModal: React.FC<NewUnManagedDeviceModalProps> = (
const handleCancel = () => {
setDeviceUuid(undefined);
props.setIsModalOpen(false);
props.onAddNewUnmanagedDevice();
};
const formRef = React.useRef();

Expand Down
5 changes: 5 additions & 0 deletions client/src/pages/Admin/Inventory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ const Inventory: React.FC = () => {
});
};

const onAddNewUnmanagedDevice = () => {
actionRef?.current?.reload();
};

const onDeleteNewDevice = async () => {
if (currentRow) {
await deleteDevice(currentRow?.uuid).then(() => {
Expand Down Expand Up @@ -171,6 +175,7 @@ const Inventory: React.FC = () => {
<NewUnManagedDeviceModal
isModalOpen={addNewUnManagedDeviceModalIsOpen}
setIsModalOpen={setAddNewUnManagedDeviceModalIsOpen}
onAddNewUnmanagedDevice={onAddNewUnmanagedDevice}
/>

<ProTable<API.DeviceItem, API.PageParams>
Expand Down
10 changes: 10 additions & 0 deletions client/src/pages/Admin/Settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Title, { TitleColors } from '@/components/Template/Title';
import AdvancedSettings from '@/pages/Admin/Settings/components/AdvancedSettings';
import AuthenticationSettings from '@/pages/Admin/Settings/components/AuthenticationSettings';
import ContainerStacksSettings from '@/pages/Admin/Settings/components/ContainerStacksSettings';
import GeneralSettings from '@/pages/Admin/Settings/components/GeneralSettings';
import Information from '@/pages/Admin/Settings/components/Information';
import PlaybookSettings from '@/pages/Admin/Settings/components/PlaybooksSettings';
Expand Down Expand Up @@ -42,6 +43,15 @@ const Settings: React.FC = () => {
),
children: <PlaybookSettings />,
},
{
key: 'container-stacks',
label: (
<div>
<SettingOutlined /> Container Stacks
</div>
),
children: <ContainerStacksSettings />,
},
{
key: 'container-registries',
label: (
Expand Down
Loading

0 comments on commit b26e609

Please sign in to comment.