Skip to content

Commit 2c2d0cd

Browse files
committed
fix: updates
1 parent c84aa95 commit 2c2d0cd

File tree

12 files changed

+179
-108
lines changed

12 files changed

+179
-108
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
yarn install
2727
yarn build
2828
env:
29+
REACT_APP_HUB_API_URL: 'https://hubapi.zenml.io'
2930
REACT_APP_BASE_API_URL: "/api/v1"
3031
REACT_APP_MOCKAPI_RESPONSE: false
3132
REACT_APP_VERSION: ${{ steps.get_version.outputs.VERSION }}

global.d.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ interface TUser {
4848
}
4949

5050
interface THubUser {
51-
id: TId;
52-
website: string;
53-
bio: string;
51+
id: string;
52+
email: string;
53+
is_active: boolean;
54+
is_superuser: boolean;
55+
is_verified: boolean;
56+
username: string;
5457
avatar_url?: string;
58+
bio: string;
59+
website: string;
5560
}
5661

5762
interface TOrganization {

src/routes/appRoutesConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ const routes = [
510510
Component: CreatePlugin,
511511
visibility: {
512512
// auth handled separately through HubConnectPrompt; need to be able to auth-restrict actions like starring on the list plugins page so needs to be more granular than just page-level
513-
authentication: RouteVisibilityAuthentication.always,
513+
authentication: RouteVisibilityAuthentication.authenticatedOnly,
514514
},
515515
exact: true,
516516
},

src/services/locales/zu.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@
3434
"placeholder": "John Doe"
3535
},
3636
"username": {
37-
"label": "Username",
37+
"label": "Server Username",
3838
"placeholder": "johndoe"
3939
},
40+
"hubUsername": {
41+
"label": "Hub Username",
42+
"placeholder": "Connect Hub first"
43+
},
4044
"email": {
4145
"label": "Email address",
4246
"placeholder": "[email protected]"

src/ui/layouts/plugins/CreatePlugin/index.tsx

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { workspaceSelectors } from '../../../../redux/selectors';
2323
import { getTranslateByScope } from '../../../../services';
2424
import { DEFAULT_WORKSPACE_NAME, iconColors } from '../../../../constants';
2525
import { HUB_API_URL } from '../../../../api/constants';
26-
import { useHubToken } from '../../../hooks/auth';
26+
import { useHubToken, useHubUser } from '../../../hooks/auth';
2727
import { PluginsLayout } from '../shared/Layout';
2828
import { getTagOptions } from '../api';
2929
import { debounce } from 'lodash';
@@ -44,7 +44,7 @@ const CreatePlugin: React.FC = () => {
4444
const history = useHistory();
4545
const { failureToast } = useToaster();
4646
const [creatingPlugin, setCreatingPlugin] = useState(false);
47-
47+
const hubUser = useHubUser();
4848
const [packageName, setPackageName] = useState('');
4949
const [versionNumber, setVersionNumber] = useState('');
5050
const [packageNameStatus, setPackageNameStatus] = useState({
@@ -149,9 +149,21 @@ const CreatePlugin: React.FC = () => {
149149

150150
{/* package name and repository URL */}
151151
<Box marginVertical="xl">
152-
<Box marginBottom="lg">
152+
<Box
153+
marginBottom="lg"
154+
style={{
155+
display: 'flex',
156+
alignItems: 'end',
157+
gap: '1rem',
158+
}}
159+
>
160+
{hubUser && (
161+
<Paragraph style={{ paddingBottom: '1rem' }}>
162+
{hubUser.username}/
163+
</Paragraph>
164+
)}
153165
<ValidatedTextField
154-
label="Package Name"
166+
label="Package Name *"
155167
value={packageName}
156168
onChange={(p: string) => {
157169
if (!/^[a-zA-Z]\w*$/.test(p)) {
@@ -170,31 +182,31 @@ const CreatePlugin: React.FC = () => {
170182
/>
171183
</Box>
172184

173-
{/* version number */}
185+
{/* repository URL */}
174186
<Box marginBottom="lg">
175187
<ValidatedTextField
176-
label="Version Number (optional)"
177-
value={versionNumber}
178-
onChange={setVersionNumber}
188+
label="Repository URL *"
189+
value={repositoryUrl}
190+
onChange={setRepositoryUrl}
179191
status={{ status: 'editing' }}
180-
placeholder="Version number"
181192
/>
182193
</Box>
183194

184-
{/* repository URL */}
195+
{/* version number */}
185196
<Box marginBottom="lg">
186197
<ValidatedTextField
187-
label="Repository URL"
188-
value={repositoryUrl}
189-
onChange={setRepositoryUrl}
198+
label="Version Number (optional)"
199+
value={versionNumber}
200+
onChange={setVersionNumber}
190201
status={{ status: 'editing' }}
202+
placeholder="Version number"
191203
/>
192204
</Box>
193205

194206
{/* repository subdirectory */}
195207
<Box marginBottom="lg">
196208
<InputWithLabel
197-
label="Subdirectory of repository"
209+
label="Subdirectory of repository (optional)"
198210
InputComponent={
199211
<TextInput
200212
value={repositorySubdirectory}
@@ -207,7 +219,7 @@ const CreatePlugin: React.FC = () => {
207219
{/* repository branch */}
208220
<Box marginBottom="lg">
209221
<InputWithLabel
210-
label="Branch of repository"
222+
label="Branch of repository (optional)"
211223
InputComponent={
212224
<TextInput
213225
value={repositoryBranch}
@@ -230,7 +242,7 @@ const CreatePlugin: React.FC = () => {
230242
{/* commit hash */}
231243
<Box marginBottom="lg">
232244
<InputWithLabel
233-
label="Commit hash"
245+
label="Commit hash (optional)"
234246
InputComponent={
235247
<TextInput
236248
value={commitHash}
@@ -242,7 +254,7 @@ const CreatePlugin: React.FC = () => {
242254

243255
{/* Logo URL */}
244256
<ValidatedTextField
245-
label="Logo URL"
257+
label="Logo URL (optional)"
246258
value={logoUrl}
247259
onChange={setLogoUrl}
248260
status={{ status: 'editing' }}
@@ -254,7 +266,7 @@ const CreatePlugin: React.FC = () => {
254266
onChangeText={setTagText}
255267
tags={tags}
256268
onChangeTags={setTags}
257-
label="Add tags"
269+
label="Add tags (optional)"
258270
placeholder="Ex. Artificial Intelligence"
259271
getTagOptions={debouncedGetTagOptions}
260272
/>
@@ -282,15 +294,16 @@ const CreatePlugin: React.FC = () => {
282294
href="https://hub.zenml.io/tou"
283295
>
284296
Terms of use
285-
</a>
297+
</a>{' '}
298+
*
286299
</p>
287300
}
288301
value={checkGuidelines}
289302
setValue={setCheckGuidelines}
290303
/>
291304
</Box>
292305
<CheckboxInput
293-
label="I agree to publicly publish my plugin on the ZenML Hub under the Apache license."
306+
label="I agree to publicly publish my plugin on the ZenML Hub under the Apache license. *"
294307
value={checkPublish}
295308
setValue={setCheckPublish}
296309
/>

src/ui/layouts/plugins/ListPlugins/index.tsx

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ const ListPlugins: React.FC = () => {
141141
width: '290px',
142142
boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.05)',
143143
borderRadius: '4px',
144+
display: 'flex',
145+
flexDirection: 'column',
146+
justifyContent: 'space-between',
144147
margin: '0 16px 16px 0',
145148
}}
146149
onClick={() =>
@@ -152,50 +155,57 @@ const ListPlugins: React.FC = () => {
152155
)
153156
}
154157
>
155-
{p.author === 'ZenML' && (
156-
<icons.verified color={iconColors.primary} size="sm" />
157-
)}
158-
{/* logo */}
159-
<img
160-
src={p.logo_url || ZenMLLogo}
161-
alt={`${p.name} logo`}
162-
style={{
163-
height: '80px',
164-
maxWidth: '60%',
165-
objectFit: 'contain',
166-
display: 'block',
167-
margin: 'auto',
168-
marginTop: 24,
169-
marginBottom: 16,
170-
}}
171-
/>
172-
173-
<H4
174-
color="primary"
175-
style={{
176-
fontSize: '16px',
177-
marginTop: 12,
178-
marginBottom: 4,
179-
whiteSpace: 'nowrap',
180-
overflow: 'hidden',
181-
textOverflow: 'ellipsis',
182-
}}
183-
>
184-
<span title={`${p.author}/${p.name}`}>
185-
{p.author}/{p.name}
186-
</span>
187-
</H4>
158+
<div>
159+
{p.author === 'ZenML' && (
160+
<icons.verified color={iconColors.primary} size="sm" />
161+
)}
162+
{/* logo */}
163+
<img
164+
src={p.logo_url || ZenMLLogo}
165+
alt={`${p.name} logo`}
166+
style={{
167+
height: '80px',
168+
maxWidth: '60%',
169+
objectFit: 'contain',
170+
display: 'block',
171+
margin: 'auto',
172+
marginTop: 24,
173+
marginBottom: 16,
174+
}}
175+
/>
176+
</div>
177+
<div>
178+
<H4
179+
color="primary"
180+
style={{
181+
fontSize: '16px',
182+
marginTop: 12,
183+
marginBottom: 4,
184+
whiteSpace: 'nowrap',
185+
overflow: 'hidden',
186+
textOverflow: 'ellipsis',
187+
}}
188+
>
189+
<span title={`${p.author}/${p.name}`}>
190+
{p.author}/{p.name}
191+
</span>
192+
</H4>
188193

189-
<Paragraph
190-
style={{
191-
color: '#A8A8A8',
192-
fontSize: '12px',
193-
lineHeight: '14px',
194-
marginBottom: 20,
195-
}}
196-
>
197-
{p.description}
198-
</Paragraph>
194+
<Paragraph
195+
style={{
196+
color: '#A8A8A8',
197+
fontSize: '12px',
198+
lineHeight: '14px',
199+
marginBottom: 20,
200+
whiteSpace: 'nowrap',
201+
overflow: 'hidden',
202+
textOverflow: 'ellipsis',
203+
}}
204+
>
205+
{' '}
206+
<span title={p.description}>{p.description}</span>
207+
</Paragraph>
208+
</div>
199209

200210
{/* <FlexBox justifyContent="space-between">
201211
<Box>
@@ -257,9 +267,8 @@ const ListPlugins: React.FC = () => {
257267
}
258268
}}
259269
paddingRight="md"
260-
>
261-
<StarIcon size="sm" color={iconColors.primary} />
262-
</Box>
270+
></Box>
271+
<StarIcon size="sm" color={iconColors.primary} />
263272
</FlexBox>
264273
</LinkBox>
265274
);

src/ui/layouts/plugins/PluginDetail/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ const PluginDetail: React.FC = () => {
355355
) : (
356356
<Box>
357357
{versions.map((v) => (
358-
<FlexBox key={v.version} marginVertical="md">
358+
<FlexBox
359+
key={v.version}
360+
marginVertical="md"
361+
style={{ alignItems: 'center' }}
362+
>
359363
{/* version */}
360364
<Box style={{ width: '125px' }}>
361365
<Paragraph
@@ -371,7 +375,7 @@ const PluginDetail: React.FC = () => {
371375

372376
{/* details */}
373377
<FlexBox fullWidth>
374-
<Paragraph size="tiny" color="grey">
378+
<Paragraph size="body" color="grey">
375379
{v.release_notes ??
376380
'No release notes for this version'}
377381
</Paragraph>

src/ui/layouts/plugins/UpdatePlugin/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ const UpdatePlugin: React.FC = () => {
135135
paddingRight="lg2"
136136
style={{ maxWidth: '650px', flexGrow: 1 }}
137137
>
138+
{/* repository URL */}
139+
<Box marginBottom="lg">
140+
<ValidatedTextField
141+
label="Repository URL *"
142+
value={repositoryUrl}
143+
onChange={setRepositoryUrl}
144+
status={{ status: 'editing' }}
145+
placeholder="Repository URL"
146+
/>
147+
</Box>
148+
138149
{/* version number */}
139150
<Box marginBottom="lg">
140151
<ValidatedTextField
@@ -151,17 +162,6 @@ const UpdatePlugin: React.FC = () => {
151162
/>
152163
</Box>
153164

154-
{/* repository URL */}
155-
<Box marginBottom="lg">
156-
<ValidatedTextField
157-
label="Repository URL"
158-
value={repositoryUrl}
159-
onChange={setRepositoryUrl}
160-
status={{ status: 'editing' }}
161-
placeholder="Repository URL"
162-
/>
163-
</Box>
164-
165165
{/* repository branch */}
166166
<Box marginBottom="lg">
167167
<InputWithLabel

0 commit comments

Comments
 (0)