Skip to content

Commit 70f5570

Browse files
authored
Merge pull request #3 from zenoxs/feature-edit-bundled-app
Feature edit bundled app
2 parents 93ac51f + cfac2a8 commit 70f5570

File tree

19 files changed

+410
-147
lines changed

19 files changed

+410
-147
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ jobs:
3333
- uses: tauri-apps/tauri-action@v0
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
37+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A companion app written with **React** and **Tauri** to help you manage your app
2323
- [x] Light/dark theme
2424
- [ ] View the logs of your builds
2525
- [ ] View all the available builds
26-
- [ ] Edit / remove a bundled app
26+
- [x] Edit / remove a bundled app
2727

2828
## How to use it ?
2929

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "tauri-appcenter-companion",
33
"private": false,
44
"repository": "https://github.com/zenoxs/tauri-appcenter-companion",
5-
"version": "0.3.6",
5+
"version": "0.4.0",
66
"license": "GPL-3.0",
77
"author": "Amaury CIVIER",
88
"scripts": {
99
"dev": "vite",
1010
"build": "tsc && vite build",
1111
"preview": "vite preview",
12-
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
12+
"lint": "eslint src --ext .ts,.tsx,.js,.jsx --max-warnings=0",
1313
"tauri": "tauri",
1414
"tauri:dev": "tauri dev",
1515
"postinstall": "cd node_modules/tauri-plugin-websocket && yarn && yarn build"

src-tauri/Cargo.lock

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tauri-appcenter-companion"
3-
version = "0.3.6"
3+
version = "0.4.0"
44
description = "Companion app for Appcenter"
55
authors = ["Amaury CIVIER"]
66
license = "GPL-3.0"
@@ -18,7 +18,7 @@ tauri-build = { version = "1.0.0-rc.8", features = [] }
1818
serde_json = "1.0"
1919
window-vibrancy = "0.1.2"
2020
serde = { version = "1.0", features = ["derive"] }
21-
tauri = { version = "1.0.0-rc.10", features = ["http-all", "macos-private-api", "os-all", "updater", "window-start-dragging"] }
21+
tauri = { version = "1.0.0-rc.10", features = ["http-all", "macos-private-api", "os-all", "shell-open", "updater", "window-start-dragging"] }
2222

2323
[target."cfg(target_os = \"macos\")".dependencies]
2424
cocoa = "0.24"

src-tauri/tauri.conf.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"package": {
33
"productName": "AC Companion",
4-
"version": "0.3.6"
4+
"version": "0.4.0"
55
},
66
"build": {
77
"distDir": "../dist",
@@ -56,6 +56,9 @@
5656
"window": {
5757
"startDragging": true
5858
},
59+
"shell": {
60+
"open": true
61+
},
5962
"http": {
6063
"all": true,
6164
"request": true,

src/app/navigation/AppNavigator.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import {
1010
ThemeContext
1111
} from '@fluentui/react'
1212
import { os } from '@tauri-apps/api'
13-
import { ApplicationList } from '../screens/application-list/ApplicationList'
13+
import { ApplicationListScreen } from '../screens/application-list/ApplicationListScreen'
1414
import { Routes, Route, useNavigate, useLocation, Location } from 'react-router-dom'
1515
import './AppNavigator.css'
1616
import { APITokenListModal } from '../screens/api-token/APITokenListModal'
1717
import { AddBundledAppDialog } from '../screens/application-list/AddBundledAppDialog'
18+
import { useConst } from '@fluentui/react-hooks'
1819

1920
const navStyles = (theme: Theme): Partial<INavStyles> => ({
2021
root: {
@@ -63,6 +64,7 @@ export const AppNavigator = () => {
6364
const navigate = useNavigate()
6465
const location = useLocation()
6566
const state = location.state as { backgroundLocation?: Location }
67+
const titleBarHeight = useConst('35px')
6668

6769
// set non transparent background for linux systems
6870
const [background, setBackground] = useState<string | undefined>()
@@ -76,7 +78,7 @@ export const AppNavigator = () => {
7678

7779
return (
7880
<Stack verticalFill styles={{ root: { height: '100vh', width: '100vw', background } }}>
79-
<div className='titlebar' data-tauri-drag-region style={{ height: '35px' }}></div>
81+
<div className='titlebar' data-tauri-drag-region style={{ height: titleBarHeight }}></div>
8082
<Stack className='container' grow horizontal styles={{ root: { display: 'flex' } }}>
8183
<Stack>
8284
<Stack.Item align='center'>
@@ -108,13 +110,15 @@ export const AppNavigator = () => {
108110
root: {
109111
backgroundColor: theme.semanticColors.bodyBackground,
110112
overflowX: 'hidden',
113+
overflowY: 'auto',
114+
height: `calc(100vh - ${titleBarHeight})`,
111115
borderRadius: '10px 0px 0px 0px'
112116
}
113117
}}
114118
tokens={{ padding: theme.spacing.m }}
115119
>
116120
<Routes location={state?.backgroundLocation ?? location}>
117-
<Route path='/' element={<ApplicationList />} />
121+
<Route path='/' element={<ApplicationListScreen />} />
118122
</Routes>
119123
{state?.backgroundLocation && (
120124
<Routes>
Lines changed: 9 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,23 @@
1-
import React, { useEffect, useState } from 'react'
1+
import React from 'react'
22
import {
33
DefaultButton,
4-
DetailsHeader,
54
Dialog,
65
DialogFooter,
76
DialogType,
8-
IColumn,
9-
IDetailsHeaderProps,
10-
IGroup,
117
PrimaryButton,
128
Stack,
139
TextField,
14-
Selection,
15-
DetailsList,
16-
Spinner,
17-
SpinnerSize
10+
Selection
1811
} from '@fluentui/react'
1912
import { useNavigate } from 'react-router-dom'
20-
import { observer } from 'mobx-react-lite'
2113
import { useForm } from 'react-hook-form'
2214
import { Branch, BundledApplicationSnapshotIn, useStores } from '../../../models'
15+
import { SelectApplicationList } from './SelectApplicationList'
2316
import { useConst } from '@fluentui/react-hooks'
2417

25-
const columns: Array<IColumn> = [
26-
{
27-
key: 'name',
28-
name: 'Name',
29-
fieldName: 'name',
30-
minWidth: 100,
31-
maxWidth: 200,
32-
isResizable: true
33-
},
34-
{
35-
key: 'token',
36-
name: 'token',
37-
onRender: (item: Branch) => item.application?.token?.name,
38-
minWidth: 100,
39-
maxWidth: 200,
40-
isResizable: true
41-
}
42-
]
43-
44-
export const AddBundledAppDialog = observer(() => {
18+
export const AddBundledAppDialog = () => {
4519
const {
46-
applicationStore: { fetchApplications, applicationList },
47-
bundledApplicationStore: { addBundledApplication },
48-
tokenStore: { tokens }
20+
bundledApplicationStore: { addBundledApplication }
4921
} = useStores()
5022

5123
const navigate = useNavigate()
@@ -58,8 +30,6 @@ export const AddBundledAppDialog = observer(() => {
5830
formState: { errors }
5931
} = useForm<BundledApplicationSnapshotIn>()
6032

61-
const [isLoading, setIsLoading] = useState(true)
62-
6333
// TODO: a rules to check that their is at least one branches
6434
React.useEffect(() => {
6535
register('branches')
@@ -68,42 +38,16 @@ export const AddBundledAppDialog = observer(() => {
6838

6939
const selection = useConst(
7040
() =>
71-
new Selection({
41+
new Selection<Branch>({
7242
onSelectionChanged: () => {
7343
setValue(
7444
'branches',
75-
(selection.getSelection() as Array<Branch>).map((b) => b.id)
45+
selection.getSelection().map((branch) => branch.id)
7646
)
7747
}
7848
})
7949
)
8050

81-
useEffect(() => {
82-
setIsLoading(true)
83-
Promise.all(
84-
tokens.map((token) => fetchApplications(token.token, { withBranches: true }))
85-
).finally(() => setIsLoading(false))
86-
}, [])
87-
88-
const [items, groups] = (() => {
89-
let items: Array<Branch> = []
90-
const groups: Array<IGroup> = []
91-
for (const application of applicationList) {
92-
const branches = application.configuredBranches
93-
groups.push({
94-
key: application.id,
95-
name: application.displayName,
96-
startIndex: items.length,
97-
count: branches.length,
98-
level: 0,
99-
isCollapsed: true
100-
})
101-
items = items.concat(branches)
102-
}
103-
104-
return [items, groups]
105-
})()
106-
10751
const onDismiss = () => {
10852
navigate(-1)
10953
}
@@ -135,38 +79,7 @@ export const AddBundledAppDialog = observer(() => {
13579
{...register('name', { required: { value: true, message: 'Name is required' } })}
13680
errorMessage={errors.name?.message}
13781
/>
138-
{isLoading ? (
139-
<Spinner size={SpinnerSize.large} label='Fetching applications...' />
140-
) : (
141-
<DetailsList
142-
styles={{ root: { flex: 1 } }}
143-
selection={selection}
144-
items={items}
145-
groups={groups}
146-
columns={columns}
147-
ariaLabelForSelectAllCheckbox='Toggle selection for all items'
148-
ariaLabelForSelectionColumn='Toggle selection'
149-
checkButtonAriaLabel='select row'
150-
checkButtonGroupAriaLabel='select section'
151-
onRenderDetailsHeader={(props?: IDetailsHeaderProps) => (
152-
<DetailsHeader
153-
{...props!}
154-
ariaLabelForToggleAllGroupsButton={'Expand collapse groups'}
155-
/>
156-
)}
157-
groupProps={{
158-
showEmptyGroups: true
159-
}}
160-
onRenderItemColumn={(item?: Branch, index?: number, column?: IColumn) => {
161-
const value =
162-
item && column && column.fieldName
163-
? item[column.fieldName as keyof Branch] || ''
164-
: ''
165-
166-
return <div data-is-focusable={true}>{value}</div>
167-
}}
168-
/>
169-
)}
82+
<SelectApplicationList selection={selection} />
17083
</Stack>
17184
<DialogFooter>
17285
<PrimaryButton type='submit' text='Save' />
@@ -175,4 +88,4 @@ export const AddBundledAppDialog = observer(() => {
17588
</form>
17689
</Dialog>
17790
)
178-
})
91+
}

0 commit comments

Comments
 (0)