Skip to content

Commit

Permalink
chore(frontend): adopt status icon component from ui (#1332)
Browse files Browse the repository at this point in the history
Signed-off-by: axel7083 <[email protected]>
  • Loading branch information
axel7083 authored Jul 4, 2024
1 parent c051ba0 commit e6ebd99
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 99 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"watch": "vite --mode development build -w"
},
"dependencies": {
"@podman-desktop/ui-svelte": "1.12.0-202407021227-4f9d4c6",
"@podman-desktop/ui-svelte": "1.12.0-202407040932-c24ce23",
"tinro": "^0.6.12"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/lib/RecipeDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import { findLocalRepositoryByRecipeId } from '/@/utils/localRepositoriesUtils';
import { tasks } from '/@/stores/tasks';
import { filterByLabel } from '/@/utils/taskUtils';
import PodIcon from '/@/lib/images/PodIcon.svelte';
import StatusIcon from '/@/lib/StatusIcon.svelte';
import { getApplicationStatus, getApplicationStatusText } from '../pages/applications';
import { Button, Spinner } from '@podman-desktop/ui-svelte';
import { Button, Spinner, StatusIcon } from '@podman-desktop/ui-svelte';
export let recipeId: string;
export let modelId: string;
Expand Down
35 changes: 0 additions & 35 deletions packages/frontend/src/lib/StatusIcon.svelte

This file was deleted.

19 changes: 0 additions & 19 deletions packages/frontend/src/lib/StatusIcon.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts">
import { getApplicationStatus } from '../../../pages/applications';
import type { ApplicationState } from '@shared/src/models/IApplicationState';
import StatusIcon from '../../StatusIcon.svelte';
import PodIcon from '../../images/PodIcon.svelte';
import { Spinner } from '@podman-desktop/ui-svelte';
import { Spinner, StatusIcon } from '@podman-desktop/ui-svelte';
export let object: ApplicationState;
$: status = getApplicationStatus(object);
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/lib/table/model/ModelColumnIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import type { ModelInfo } from '@shared/src/models/IModelInfo';
import ModelWhite from '../../icons/ModelWhite.svelte';
import { onMount } from 'svelte';
import { inferenceServers } from '/@/stores/inferenceServers';
import StatusIcon from '/@/lib/StatusIcon.svelte';
import { StatusIcon } from '@podman-desktop/ui-svelte';
export let object: ModelInfo;
let status: string | undefined = undefined;
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/lib/table/service/ServiceStatus.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import type { InferenceServer } from '@shared/src/models/IInference';
import StatusIcon from '/@/lib/StatusIcon.svelte';
import { studioClient } from '/@/utils/client';
import { Spinner } from '@podman-desktop/ui-svelte';
import { Spinner, StatusIcon } from '@podman-desktop/ui-svelte';
import { ContainerIcon } from '@podman-desktop/ui-svelte/icons';
export let object: InferenceServer;
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/pages/Playground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import ChatMessage from '../lib/conversation/ChatMessage.svelte';
import SystemPromptBanner from '/@/lib/conversation/SystemPromptBanner.svelte';
import { inferenceServers } from '/@/stores/inferenceServers';
import { faCircleInfo, faMicrochip, faPaperPlane } from '@fortawesome/free-solid-svg-icons';
import { Button, Tooltip, DetailsPage } from '@podman-desktop/ui-svelte';
import StatusIcon from '../lib/StatusIcon.svelte';
import { Button, Tooltip, DetailsPage, StatusIcon } from '@podman-desktop/ui-svelte';
import Badge from '../lib/Badge.svelte';
import { router } from 'tinro';
import ConversationActions from '../lib/conversation/ConversationActions.svelte';
Expand Down
5 changes: 2 additions & 3 deletions packages/frontend/src/pages/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
***********************************************************************/

import type { ApplicationState } from '@shared/src/models/IApplicationState';
import type { KnownStatus } from '../lib/StatusIcon';

/* returns the status of the AI application, to be used by <IconStatus> */
export function getApplicationStatus(appState: ApplicationState): KnownStatus | 'UNKNOWN' {
export function getApplicationStatus(appState: ApplicationState): string {
const podStatus = appState.pod.Status.toUpperCase();
if (['DEGRADED', 'STARTING', 'USED', 'DELETING', 'CREATED'].includes(podStatus)) {
return podStatus as KnownStatus;
return podStatus;
}
if (podStatus !== 'RUNNING') {
return 'UNKNOWN';
Expand Down
39 changes: 7 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@
resolved "https://registry.yarnpkg.com/@podman-desktop/tests-playwright/-/tests-playwright-1.11.1.tgz#0d9944367853ba81df828c633c6dae4a7a954409"
integrity sha512-qwVOagtPopld3/LgZkGhl+HgexpCPrJ/uc1r/yR0bJk8Wiz2Ox+xGfljihav/8lAgHue0z6wI9hxgbVEmxaQnQ==

"@podman-desktop/[email protected]202407021227-4f9d4c6":
version "1.12.0-202407021227-4f9d4c6"
resolved "https://registry.yarnpkg.com/@podman-desktop/ui-svelte/-/ui-svelte-1.12.0-202407021227-4f9d4c6.tgz#32320c66ecceef21d03ac333b736affd61870179"
integrity sha512-gHbrgopcOj6mET0HqGHjtLBnnFnUGRxtzJniVTogJGvI4VfprDuhXGbyjZMuZStAhg2zD6OegPLrxpAcBJd3Fg==
"@podman-desktop/[email protected]202407040932-c24ce23":
version "1.12.0-202407040932-c24ce23"
resolved "https://registry.yarnpkg.com/@podman-desktop/ui-svelte/-/ui-svelte-1.12.0-202407040932-c24ce23.tgz#89cc1b6a6297d00e586f1f06ad598156a9dd3024"
integrity sha512-00IL3/XEZWDCiW/l4YrESMmUCs/5E+DLC7s2RKxPZIa0F3lch4ZyGabAyD0NLxq+YHQDHCMg3Ht4rXXWmYGClA==
dependencies:
"@fortawesome/fontawesome-free" "^6.5.2"
"@fortawesome/free-brands-svg-icons" "^6.5.2"
Expand Down Expand Up @@ -4176,16 +4176,7 @@ std-env@^3.5.0:
resolved "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz"
integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -4237,14 +4228,7 @@ string_decoder@^1.1.1:
dependencies:
safe-buffer "~5.2.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -4864,16 +4848,7 @@ winreg@^1.2.5:
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.5.tgz#b650383e89278952494b5d113ba049a5a4fa96d8"
integrity sha512-uf7tHf+tw0B1y+x+mKTLHkykBgK2KMs3g+KlzmyMbLvICSHQyB/xOFjTT8qZ3oeTFyU7Bbj4FzXitGG6jvKhYw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit e6ebd99

Please sign in to comment.