File tree 7 files changed +53
-9
lines changed
7 files changed +53
-9
lines changed Original file line number Diff line number Diff line change
1
+ ### v2.2.0 (TBA)
2
+ - Added option to set custom description for apps ([ #201 ] ( https://github.com/pawelmalak/flame/issues/201 ) )
3
+
1
4
### v2.1.1 (2021-12-02)
2
5
- Added support for Docker secrets ([ #189 ] ( https://github.com/pawelmalak/flame/issues/189 ) )
3
6
- Changed some messages and buttons to make it easier to open bookmarks editor ([ #239 ] ( https://github.com/pawelmalak/flame/issues/239 ) )
Original file line number Diff line number Diff line change @@ -8,24 +8,23 @@ import { State } from '../../../store/reducers';
8
8
9
9
interface Props {
10
10
app : App ;
11
- pinHandler ?: Function ;
12
11
}
13
12
14
- export const AppCard = ( props : Props ) : JSX . Element => {
13
+ export const AppCard = ( { app } : Props ) : JSX . Element => {
15
14
const { config } = useSelector ( ( state : State ) => state . config ) ;
16
15
17
- const [ displayUrl , redirectUrl ] = urlParser ( props . app . url ) ;
16
+ const [ displayUrl , redirectUrl ] = urlParser ( app . url ) ;
18
17
19
18
let iconEl : JSX . Element ;
20
- const { icon } = props . app ;
19
+ const { icon } = app ;
21
20
22
21
if ( isImage ( icon ) ) {
23
22
const source = isUrl ( icon ) ? icon : `/uploads/${ icon } ` ;
24
23
25
24
iconEl = (
26
25
< img
27
26
src = { source }
28
- alt = { `${ props . app . name } icon` }
27
+ alt = { `${ app . name } icon` }
29
28
className = { classes . CustomIcon }
30
29
/>
31
30
) ;
@@ -54,8 +53,8 @@ export const AppCard = (props: Props): JSX.Element => {
54
53
>
55
54
< div className = { classes . AppCardIcon } > { iconEl } </ div >
56
55
< div className = { classes . AppCardDetails } >
57
- < h5 > { props . app . name } </ h5 >
58
- < span > { displayUrl } </ span >
56
+ < h5 > { app . name } </ h5 >
57
+ < span > { ! app . description . length ? displayUrl : app . description } </ span >
59
58
</ div >
60
59
</ a >
61
60
) ;
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export const AppForm = ({ modalHandler }: Props): JSX.Element => {
96
96
< ModalForm modalHandler = { modalHandler } formHandler = { formSubmitHandler } >
97
97
{ /* NAME */ }
98
98
< InputGroup >
99
- < label htmlFor = "name" > App Name </ label >
99
+ < label htmlFor = "name" > App name </ label >
100
100
< input
101
101
type = "text"
102
102
name = "name"
@@ -122,11 +122,27 @@ export const AppForm = ({ modalHandler }: Props): JSX.Element => {
122
122
/>
123
123
</ InputGroup >
124
124
125
+ { /* DESCRIPTION */ }
126
+ < InputGroup >
127
+ < label htmlFor = "description" > App description</ label >
128
+ < input
129
+ type = "text"
130
+ name = "description"
131
+ id = "description"
132
+ placeholder = "My self-hosted app"
133
+ value = { formData . description }
134
+ onChange = { ( e ) => inputChangeHandler ( e ) }
135
+ />
136
+ < span >
137
+ Optional - If description is not set, app URL will be displayed
138
+ </ span >
139
+ </ InputGroup >
140
+
125
141
{ /* ICON */ }
126
142
{ ! useCustomIcon ? (
127
143
// use mdi icon
128
144
< InputGroup >
129
- < label htmlFor = "icon" > App Icon </ label >
145
+ < label htmlFor = "icon" > App icon </ label >
130
146
< input
131
147
type = "text"
132
148
name = "icon"
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export interface NewApp {
5
5
url : string ;
6
6
icon : string ;
7
7
isPublic : boolean ;
8
+ description : string ;
8
9
}
9
10
10
11
export interface App extends Model , NewApp {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export const newAppTemplate: NewApp = {
5
5
url : '' ,
6
6
icon : '' ,
7
7
isPublic : true ,
8
+ description : '' ,
8
9
} ;
9
10
10
11
export const appTemplate : App = {
Original file line number Diff line number Diff line change
1
+ const { DataTypes } = require ( 'sequelize' ) ;
2
+ const { STRING } = DataTypes ;
3
+
4
+ const up = async ( query ) => {
5
+ await query . addColumn ( 'apps' , 'description' , {
6
+ type : STRING ,
7
+ allowNull : false ,
8
+ defaultValue : '' ,
9
+ } ) ;
10
+ } ;
11
+
12
+ const down = async ( query ) => {
13
+ await query . removeColumn ( 'apps' , 'description' ) ;
14
+ } ;
15
+
16
+ module . exports = {
17
+ up,
18
+ down,
19
+ } ;
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ const App = sequelize.define(
31
31
allowNull : true ,
32
32
defaultValue : 1 ,
33
33
} ,
34
+ description : {
35
+ type : DataTypes . STRING ,
36
+ allowNull : false ,
37
+ defaultValue : '' ,
38
+ } ,
34
39
} ,
35
40
{
36
41
tableName : 'apps' ,
You can’t perform that action at this time.
0 commit comments