Skip to content

Commit

Permalink
Merge branch 'gjaskiewicz/refactor-combobox-ts' of https://github.com…
Browse files Browse the repository at this point in the history
…/cloudoperators/juno into gjaskiewicz/refactor-combobox-ts
  • Loading branch information
[email protected] committed Nov 17, 2024
2 parents 1c962ed + 61be78d commit fc2dfe7
Show file tree
Hide file tree
Showing 94 changed files with 1,908 additions and 900 deletions.
5 changes: 0 additions & 5 deletions .changeset/bright-adults-applaud.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/famous-dryers-train.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/five-boats-cheat.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/grumpy-spies-hunt.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/grumpy-squids-hear.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/silent-maps-attend.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/scripts/build-vite-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ build_folder=$(dirname $entry_file)
package_name=$(jq -r '.name' $PACKAGE_PATH/package.json)

# Run build using turbo
npx turbo run build:static --filter $package_name
npx turbo run build:static --filter $package_name -- --base ./

# Copy build folder to deploy path
mkdir -p "$DEPLOY_PATH/$TARGET_FOLDER"
cp -r "$PACKAGE_PATH/$build_folder/." "$DEPLOY_PATH/$TARGET_FOLDER"

# Generate appProps.json if APP_PROPS_BASE64 is non-empty
if [ -n "$APP_PROPS_BASE64" ]; then
echo "$APP_PROPS_BASE64" | base64 -d > "$DEPLOY_PATH/$TARGET_FOLDER/appProps.json"
echo "$APP_PROPS_BASE64" | base64 -d >"$DEPLOY_PATH/$TARGET_FOLDER/appProps.json"
fi
2 changes: 1 addition & 1 deletion .github/workflows/ci-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
- name: Install Dependencies
run: npm ci
- name: Run Prettier
run: npm run check-format
run: npm run check-format --check "**/*.{js,jsx,ts,tsx}"

test:
needs: install-dependencies
Expand Down
1 change: 0 additions & 1 deletion apps/carbon/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default defineConfig(({ mode }) => {
if (mode === "static") {
return {
...sharedConfig,
base: "./", // Relative Path in Generated index.html
build: {
outDir: "build",
},
Expand Down
1 change: 0 additions & 1 deletion apps/doop/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default defineConfig(({ mode }) => {
if (mode === "static") {
return {
...sharedConfig,
base: "./", // Relative Path in Generated index.html
build: {
outDir: "build",
},
Expand Down
1 change: 0 additions & 1 deletion apps/example/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default defineConfig(({ mode }) => {
if (mode === "static") {
return {
...sharedConfig,
base: "./", // Relative Path in Generated index.html
build: {
outDir: "build",
},
Expand Down
33 changes: 33 additions & 0 deletions apps/greenhouse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# @cloudoperators/juno-app-greenhouse

## 0.3.6

### Patch Changes

- a6789db: This change corrects URL state handling for filter property
- Updated dependencies [a6789db]
- @cloudoperators/juno-app-heureka@2.10.1

## 0.3.5

### Patch Changes

- 3810a93: add support_group only if supportGroups exists and is an array
- Updated dependencies [b1a5eb1]
- Updated dependencies [c9190d0]
- Updated dependencies [879812b]
- Updated dependencies [18ebaba]
- @cloudoperators/juno-ui-components@2.30.0
- @cloudoperators/juno-app-supernova@0.14.3

## 0.3.4

### Patch Changes

- eea5de6: The pagination is added to the list of component instances for a selected service on the service details page.
- Updated dependencies [63a951c]
- Updated dependencies [5a4e3d1]
- Updated dependencies [7cb142d]
- Updated dependencies [eea5de6]
- Updated dependencies [a278544]
- @cloudoperators/juno-ui-components@2.29.0
- @cloudoperators/juno-app-heureka@2.10.0

## 0.3.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/greenhouse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudoperators/juno-app-greenhouse",
"version": "0.3.3",
"version": "0.3.6",
"orgAdminVersion": "latest",
"author": "UI-Team",
"contributors": [
Expand Down
13 changes: 10 additions & 3 deletions apps/greenhouse/src/hooks/useApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ const useApi = () => {
const url = conf.status?.uiApplication?.url

// temporary fix to forward initialFilters to the Plugins until middleware is implemented
const appProps = { username: authData?.parsed?.fullName }
appProps.initialFilters = {
support_group: authData?.parsed?.supportGroups?.map((group) => group),
// Extract username and support group information for appProps
const appProps = {
username: authData?.parsed?.fullName,
}

// Conditionally add initialFilters if supportGroups exists and is an array
if (Array.isArray(authData?.parsed?.supportGroups)) {
appProps.initialFilters = {
support_group: authData.parsed.supportGroups.map((group) => String(group)),
}
}

const newConf = createPluginConfig({
Expand Down
1 change: 0 additions & 1 deletion apps/greenhouse/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default defineConfig(({ mode }) => {
if (mode === "static") {
return {
...sharedConfig,
base: "./", // Relative Path in Generated index.html
build: {
outDir: "build",
},
Expand Down
20 changes: 20 additions & 0 deletions apps/heureka/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @cloudoperators/juno-app-heureka

## 2.10.1

### Patch Changes

- a6789db: This change corrects URL state handling for filter property

## 2.10.0

### Minor Changes

- eea5de6: The pagination is added to the list of component instances for a selected service on the service details page.

### Patch Changes

- Updated dependencies [63a951c]
- Updated dependencies [5a4e3d1]
- Updated dependencies [7cb142d]
- Updated dependencies [a278544]
- @cloudoperators/juno-ui-components@2.29.0

## 2.9.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/heureka/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudoperators/juno-app-heureka",
"version": "2.9.2",
"version": "2.10.1",
"author": "UI-Team",
"contributors": [
"Hoda Noori, Arturo Reuschenbach Pucernau",
Expand Down
1 change: 1 addition & 0 deletions apps/heureka/src/components/filters/Filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const Filters = ({
isLoading={isLoading}
filterLabels={filterLabels}
filterLabelValues={filterLabelValues}
activeFilters={activeFilters}
searchTerm={searchTerm}
searchTargets={searchTargets}
/>
Expand Down
31 changes: 25 additions & 6 deletions apps/heureka/src/hooks/useUrlState.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
import { useLayoutEffect, useEffect, useState } from "react"
import { registerConsumer } from "@cloudoperators/juno-url-state-provider-v1"
import {
useAuthLoggedIn,
useGlobalsShowPanel,
useGlobalsActiveView,
useGlobalsActions,
useGlobalsShowServiceDetail,
useGlobalsShowIssueDetail,
useServiceActiveFilters,
useIssueMatchesActiveFilters,
useComponentActiveFilters,
useFilterActions,
} from "../components/StoreProvider"
import constants from "../components/shared/constants"
Expand All @@ -18,12 +22,16 @@ const urlStateManager = registerConsumer("heureka")

const useUrlState = () => {
const [isURLRead, setIsURLRead] = useState(false)
const loggedIn = useAuthLoggedIn()
const { setFiltersFromURL, syncFiltersWithURL } = useFilterActions()

const activeView = useGlobalsActiveView()
const detailsFor = useGlobalsShowPanel()
const showServiceDetail = useGlobalsShowServiceDetail()
const showIssueDetail = useGlobalsShowIssueDetail()
const { setShowPanel, setActiveView, setServiceDetail, setIssueDetail, syncDetailsWithURL } = useGlobalsActions()
const serviceActiveFilters = useServiceActiveFilters()
const issueMatchesActiveFilters = useIssueMatchesActiveFilters()
const componentActiveFilters = useComponentActiveFilters()

// Set initial state from URL (on login)
useLayoutEffect(() => {
Expand Down Expand Up @@ -57,24 +65,35 @@ const useUrlState = () => {
}

setIsURLRead(true)
}, [isURLRead])
}, [isURLRead, setActiveView, setFiltersFromURL, setShowPanel, setServiceDetail, setIssueDetail])

// Sync URL with the desired states
useEffect(() => {
if (!isURLRead) return

const updatedState = {
[constants.ACTIVE_VIEW]: activeView, // Include active view
...syncFiltersWithURL(),
...syncDetailsWithURL(),
...syncFiltersWithURL(issueMatchesActiveFilters, serviceActiveFilters, componentActiveFilters),
...syncDetailsWithURL(showServiceDetail, showIssueDetail, detailsFor),
}

// Construct the URL state
const currentState = urlStateManager.currentState()
if (JSON.stringify(updatedState) !== JSON.stringify(currentState)) {
urlStateManager.push(updatedState)
}
}, [loggedIn, detailsFor, activeView])
}, [
activeView,
isURLRead,
detailsFor,
showServiceDetail,
showIssueDetail,
serviceActiveFilters,
issueMatchesActiveFilters,
componentActiveFilters,
syncFiltersWithURL,
syncDetailsWithURL,
])

// Support for back button
useEffect(() => {
Expand Down
8 changes: 4 additions & 4 deletions apps/heureka/src/lib/slices/createFiltersSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const createFiltersSlice = (set, get) => ({
`filters.setFiltersFromURL`
),

syncFiltersWithURL: () => {
syncFiltersWithURL: (issueFilters, serviceFilters, componentFilters) => {
const encodedSearchTerm = btoa(
JSON.stringify({
[ISSUEMATCHES]: get().filters[ISSUEMATCHES].search,
Expand All @@ -167,9 +167,9 @@ const createFiltersSlice = (set, get) => ({
)

const activeFilters = {
[ISSUEMATCHES]: get().filters[ISSUEMATCHES].activeFilters,
[SERVICES]: get().filters[SERVICES].activeFilters,
[COMPONENTS]: get().filters[COMPONENTS].activeFilters,
[ISSUEMATCHES]: issueFilters,
[SERVICES]: serviceFilters,
[COMPONENTS]: componentFilters,
}

return {
Expand Down
8 changes: 1 addition & 7 deletions apps/heureka/src/lib/slices/createFiltersSlice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,7 @@ describe("createFiltersSlice", () => {

it("should synchronize filters with URL correctly", () => {
const { syncFiltersWithURL } = store.getState().filters.actions

// Set up initial filters and search terms
store.getState().filters.actions.setActiveFilters(ISSUEMATCHES, { filter1: ["value1"] })
store.getState().filters.actions.setActiveFilters(SERVICES, { filter2: ["value2"] })
store.getState().filters.actions.setActiveFilters(COMPONENTS, { filter3: ["value3"] })

const result = syncFiltersWithURL()
const result = syncFiltersWithURL({ filter1: ["value1"] }, { filter2: ["value2"] }, { filter3: ["value3"] })

expect(result).toEqual({
[constants.ACTIVE_FILTERS]: {
Expand Down
18 changes: 12 additions & 6 deletions apps/heureka/src/lib/slices/createGlobalsSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,19 @@ const createGlobalsSlice = (set, get, options) => ({
),

// Sync details state with the URL
syncDetailsWithURL: () => {
const state = get().globals
syncDetailsWithURL: (serviceDetail, issueDetail, panelType) => {
if (panelType === undefined || panelType === null) {
return {
[constants.DETAILS_FOR]: panelType,
[constants.SERVICE_NAME]: undefined,
[constants.ISSUE_ID]: undefined,
}
}
const updatedState = {
[constants.DETAILS_FOR]: state.showPanel,
// Include `iid` or `svn` immediately after `d:issue/service`
[state.showPanel === constants.PANEL_SERVICE ? constants.SERVICE_NAME : constants.ISSUE_ID]:
state.showPanel === constants.PANEL_SERVICE ? state.showServiceDetail : state.showIssueDetail,
[constants.DETAILS_FOR]: panelType,
// Include `iid` or `svn` immediately after `d:issue/service` in the URL
[panelType === constants.PANEL_SERVICE ? constants.SERVICE_NAME : constants.ISSUE_ID]:
panelType === constants.PANEL_SERVICE ? serviceDetail : issueDetail,
}
return updatedState
},
Expand Down
21 changes: 15 additions & 6 deletions apps/heureka/src/lib/slices/createGlobalsSlice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,29 @@ describe("createGlobalsSlice", () => {
})

it("should sync details with URL correctly for service", () => {
useStore.getState().globals.actions.setServiceDetail("service-123")
const urlState = useStore.getState().globals.actions.syncDetailsWithURL()
const serviceId = "service-123"
const urlState = useStore.getState().globals.actions.syncDetailsWithURL(serviceId, null, constants.PANEL_SERVICE)
expect(urlState).toEqual({
[constants.DETAILS_FOR]: constants.PANEL_SERVICE,
[constants.SERVICE_NAME]: "service-123",
[constants.SERVICE_NAME]: serviceId,
})
})

it("should sync details with URL correctly for issue", () => {
useStore.getState().globals.actions.setIssueDetail("issue-456")
const urlState = useStore.getState().globals.actions.syncDetailsWithURL()
const issueId = "issue-456"
const urlState = useStore.getState().globals.actions.syncDetailsWithURL(null, issueId, constants.PANEL_ISSUE)
expect(urlState).toEqual({
[constants.DETAILS_FOR]: constants.PANEL_ISSUE,
[constants.ISSUE_ID]: "issue-456",
[constants.ISSUE_ID]: issueId,
})
})

it("should handle clearing details for URL correctly when no panel is open", () => {
const urlState = useStore.getState().globals.actions.syncDetailsWithURL(undefined, undefined, undefined)
expect(urlState).toEqual({
[constants.DETAILS_FOR]: undefined,
[constants.SERVICE_NAME]: undefined,
[constants.ISSUE_ID]: undefined,
})
})
})
1 change: 0 additions & 1 deletion apps/heureka/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default defineConfig(({ mode }) => {
if (mode === "static") {
return {
...sharedConfig,
base: "./", // Relative Path in Generated index.html
build: {
outDir: "build",
},
Expand Down
10 changes: 10 additions & 0 deletions apps/supernova/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @cloudoperators/juno-app-supernova

## 0.14.3

### Patch Changes

- 879812b: InitialFilters whose value is not an array are not added to ActiveFilters.
- Updated dependencies [b1a5eb1]
- Updated dependencies [c9190d0]
- Updated dependencies [18ebaba]
- @cloudoperators/juno-ui-components@2.30.0

## 0.14.2

### Patch Changes
Expand Down
Loading

0 comments on commit fc2dfe7

Please sign in to comment.