Pārlūkot izejas kodu

Fix Dashboard Recent Activity entries

Fixes deployment entry routing and description
Daniel Vincze 1 gadu atpakaļ
vecāks
revīzija
53cbbdf7c6

+ 2 - 2
src/@types/MainItem.ts

@@ -128,7 +128,7 @@ export type DeploymentItemOptions = DeploymentItem & {
   shutdown_instances: boolean;
 };
 
-export type TransferItem = ReplicaItem | MigrationItem | DeploymentItem;
+export type TransferItem = ReplicaItem | DeploymentItem;
 
 export type ReplicaItemDetails = ReplicaItem & {
   executions: Execution[];
@@ -142,7 +142,7 @@ export type DeploymentItemDetails = DeploymentItem & {
   tasks: Task[];
 };
 
-export type TransferItemDetails = ReplicaItemDetails | MigrationItemDetails | DeploymentItemDetails;
+export type TransferItemDetails = ReplicaItemDetails | DeploymentItemDetails;
 
 export const getTransferItemTitle = (item: TransferItem | null) => {
   if (!item) {

+ 7 - 3
src/components/modules/DashboardModule/DashboardActivity/DashboardActivity.tsx

@@ -104,11 +104,15 @@ class DashboardActivity extends React.Component<Props> {
         {this.props.notificationItems
           .filter((_, i) => i < (this.props.large ? 10 : 5))
           .map((item, i) => {
+            const actionHref =
+              item.type === "replica"
+                ? "transfers" : "deployments"
+
             const executionsHref =
               item.status === "RUNNING"
                 ? item.type === "replica"
                   ? "/executions"
-                  : item.type === "migration"
+                  : item.type === "deployment"
                   ? "/tasks"
                   : ""
                 : "";
@@ -116,7 +120,7 @@ class DashboardActivity extends React.Component<Props> {
             return (
               <ListItem
                 key={item.id}
-                to={`/transfers/${item.id}${executionsHref}`}
+                to={`/${actionHref}/${item.id}${executionsHref}`}
                 style={{
                   width: `calc(${this.props.large ? 50 : 100}% - 32px)`,
                   paddingTop: i === 0 || i === 5 ? "16px" : "8px",
@@ -126,7 +130,7 @@ class DashboardActivity extends React.Component<Props> {
                   <MainItemInfo>
                     <StatusIcon status={item.status} hollow />
                     <ItemReplicaBadge type={item.type}>
-                      {item.type === "replica" ? "RE" : "MI"}
+                      {item.type === "replica" ? "TR" : "DE"}
                     </ItemReplicaBadge>
                     <ItemTitle nowrap>{item.name}</ItemTitle>
                   </MainItemInfo>

+ 1 - 1
src/components/ui/Dropdowns/NotificationDropdown/NotificationDropdown.tsx

@@ -306,7 +306,7 @@ class NotificationDropdown extends React.Component<Props, State> {
                 <MainItemInfo>
                   <StatusIcon status={item.status} hollow />
                   <ItemReplicaBadge type={item.type}>
-                    {item.type === "replica" ? "RE" : "DE"}
+                    {item.type === "replica" ? "TR" : "DE"}
                   </ItemReplicaBadge>
                   <ItemTitle>{item.name}</ItemTitle>
                 </MainItemInfo>

+ 1 - 1
src/sources/NotificationSource.ts

@@ -80,7 +80,7 @@ class NotificationStorage {
 class DataUtils {
   static getItemDescription(item: TransferItem) {
     let item_type = item.type === "replica"
-      ? "replica"
+      ? "transfer"
       : "deployment";
     return `New ${item_type} ${item.id.substr(
       0,