- {{ service ? service?.metadata?.name : ingress?.metadata?.name }}
+ {{ app.metadata?.name }}
@@ -135,10 +105,10 @@ export default {
- {{ isGlobalApp || isFavorited ? `${clusterName}` : '' }}/{{ namespace }}/{{ name }}
+ {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}` : '' }}/{{ namespace }}/{{ name }}
- {{ isGlobalApp || isFavorited ? `${clusterName}` : '' }}/{{ ingressPath }}
+ {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}` : '' }}/{{ ingressPath }}
@@ -147,7 +117,7 @@ export default {
0) {
- this.selectedCluster = "ALL_CLUSTERS";
- }
+ this.selectedCluster = "ALL_CLUSTERS";
this.generateClusterOptions();
// Retrieve global services based on annotations
@@ -75,8 +71,9 @@ export default {
cluster.services.forEach((service) => {
if (service.metadata?.annotations?.['extensions.applauncher/global-app'] === 'true') {
this.favoritedApps.push({
+ ...service,
clusterId: cluster.id,
- app: service,
+ clusterName: cluster.name,
});
}
});
@@ -87,8 +84,9 @@ export default {
cluster.ingresses.forEach((ingress) => {
if (ingress.metadata?.annotations?.['extensions.applauncher/global-app'] === 'true') {
this.favoritedApps.push({
+ ...ingress,
clusterId: cluster.id,
- app: ingress,
+ clusterName: cluster.name,
});
}
});
@@ -136,7 +134,11 @@ export default {
url: `/k8s/clusters/${cluster.id}/v1/services`,
})
).data;
- clusterData.services = services;
+ clusterData.services = services.map((service) => ({
+ ...service,
+ clusterId: cluster.id,
+ clusterName: cluster.spec.displayName,
+ }));
} catch (error) {
console.error(`Error fetching services for cluster ${cluster.id}:`, error);
clusterData.error = true;
@@ -165,7 +167,11 @@ export default {
url: `/k8s/clusters/${cluster.id}/v1/networking.k8s.io.ingresses`,
})
).data;
- clusterData.ingresses = ingresses;
+ clusterData.ingresses = ingresses.map((ingress) => ({
+ ...ingress,
+ clusterId: cluster.id,
+ clusterName: cluster.spec.displayName,
+ }));
} catch (error) {
console.error(`Error fetching ingresses for cluster ${cluster.id}:`, error);
clusterData.error = true;
@@ -185,16 +191,16 @@ export default {
toggleSortOrder() {
this.tableHeaders[0].sortOrder = this.tableHeaders[0].sortOrder === 'asc' ? 'desc' : 'asc';
},
- getEndpoints(service) {
+ getEndpoints(app) {
return (
- service?.spec.ports?.map((port) => {
+ app?.spec.ports?.map((port) => {
const endpoint = `${
isMaybeSecure(port.port, port.protocol) ? 'https' : 'http'
- }:${service.metadata.name}:${port.port}`;
+ }:${app.metadata.name}:${port.port}`;
return {
label: `${endpoint}${port.protocol === 'UDP' ? ' (UDP)' : ''}`,
- value: `/k8s/clusters/${this.selectedCluster}/api/v1/namespaces/${service.metadata.namespace}/services/${endpoint}/proxy`,
+ value: `/k8s/clusters/${this.selectedCluster}/api/v1/namespaces/${app.metadata.namespace}/services/${endpoint}/proxy`,
};
}) ?? []
);
@@ -205,27 +211,26 @@ export default {
toggleFavorite(item) {
const index = this.favoritedApps.findIndex(
(favoritedApp) =>
- favoritedApp.app.id === item.id &&
- favoritedApp.app.kind === item.kind
+ favoritedApp.id === item.id &&
+ favoritedApp.kind === item.kind
);
if (index !== -1) {
this.favoritedApps.splice(index, 1);
} else {
this.favoritedApps.push({
- clusterId: item.clusterId,
- app: item,
+ ...item
});
}
// Store updated favorites in localStorage
- const favsToStore = JSON.stringify(this.favoritedApps.filter((item) => (item.app.metadata.annotations?.['extensions.applauncher/global-app'] !== 'true')));
+ const favsToStore = JSON.stringify(this.favoritedApps.filter((item) => (item.metadata.annotations?.['extensions.applauncher/global-app'] !== 'true')));
localStorage.setItem('favoritedApps', favsToStore);
},
isFavorited(app, favoritedApps) {
return favoritedApps.some(
(favoritedService) =>
- favoritedService.app.id === app.id
+ favoritedService.id === app.id
);
},
},
@@ -233,9 +238,14 @@ export default {
selectedClusterData() {
const cluster = this.getCluster(this.selectedCluster);
if (cluster) {
- const ingresses = this.ingressesByCluster.find(
+ let ingresses = this.ingressesByCluster.find(
(ingressCluster) => ingressCluster.id === cluster.id
)?.ingresses || [];
+ ingresses = ingresses.map((ingress) => ({
+ ...ingress,
+ clusterId: cluster.id,
+ clusterName: cluster.name,
+ }));
const services = cluster.services.map((service) => {
const relatedIngress = ingresses.find((ingress) =>
@@ -247,6 +257,8 @@ export default {
);
return {
...service,
+ clusterId: cluster.id,
+ clusterName: cluster.name,
relatedIngress,
};
});
@@ -266,11 +278,13 @@ export default {
},
displayedClusterData() {
if (this.selectedCluster === 'ALL_CLUSTERS') {
- return this.servicesByCluster.map(cluster => ({
+
+ const allClustersData = this.servicesByCluster.map(cluster => ({
...cluster,
ingresses: this.ingressesByCluster.find(ingressCluster => ingressCluster.id === cluster.id)?.ingresses || [],
filteredApps: this.filteredApps(cluster.services, this.ingressesByCluster.find(ingressCluster => ingressCluster.id === cluster.id)?.ingresses || []),
}));
+ return allClustersData;
} else {
return [this.selectedClusterData]; // This just remakes use of selectedClusterData for single cluster view
}
@@ -279,13 +293,15 @@ export default {
if (this.selectedClusterData) {
const services = this.selectedClusterData.services.map((service) => ({
...service,
- type: 'service',
+ clusterId: this.selectedClusterData.id,
+ clusterName: this.selectedClusterData.name,
uniqueId: `service-${service.id}`,
}));
const ingresses = this.selectedClusterData.ingresses.map((ingress) => ({
...ingress,
- type: 'ingress',
+ clusterId: this.selectedClusterData.id,
+ clusterName: this.selectedClusterData.name,
uniqueId: `ingress-${ingress.id}`,
}));
@@ -327,20 +343,6 @@ export default {
}
};
},
- sortedServices() {
- if (this.selectedClusterData) {
- return [...this.selectedClusterData.services].sort((a, b) => {
- const nameA = a.metadata.name.toLowerCase();
- const nameB = b.metadata.name.toLowerCase();
- if (this.tableHeaders[0].sortOrder === 'asc') {
- return nameA.localeCompare(nameB);
- } else {
- return nameB.localeCompare(nameA);
- }
- });
- }
- return [];
- },
},
layout: 'plain',
};
@@ -375,13 +377,11 @@ export default {
{{ t('appLauncher.globalApps') }}
@@ -397,13 +397,10 @@ export default {
From a426034e46e37f6ceb4c232f91196748883ddb07 Mon Sep 17 00:00:00 2001
From: John Gardner
Date: Fri, 12 Apr 2024 14:30:16 -0400
Subject: [PATCH 3/9] feat: for APPLAUNCHER-28 typo
---
pkg/app-launcher/components/AppLauncherCard.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pkg/app-launcher/components/AppLauncherCard.vue b/pkg/app-launcher/components/AppLauncherCard.vue
index d07b533..60245a9 100644
--- a/pkg/app-launcher/components/AppLauncherCard.vue
+++ b/pkg/app-launcher/components/AppLauncherCard.vue
@@ -105,10 +105,10 @@ export default {
- {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}` : '' }}/{{ namespace }}/{{ name }}
+ {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}/` : '' }}{{ namespace }}/{{ name }}
-
- {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}` : '' }}/{{ ingressPath }}
+
+ {{ (isGlobalApp || isFavorited) && isInGlobalView ? `${app.clusterName}: ` : '' }}{{ ingressPath }}
From f9b41a040f03377847c969dd8e4df13170adf01b Mon Sep 17 00:00:00 2001
From: John Gardner
Date: Mon, 15 Apr 2024 10:51:43 -0400
Subject: [PATCH 4/9] feat: for APPLAUNCHER-37 commit to see changes on new
components
---
.../components/ClusterActions.vue | 80 +++++++++++++++++++
pkg/app-launcher/components/ClusterView.vue | 0
pkg/app-launcher/pages/index.vue | 17 +++-
3 files changed, 94 insertions(+), 3 deletions(-)
create mode 100644 pkg/app-launcher/components/ClusterActions.vue
create mode 100644 pkg/app-launcher/components/ClusterView.vue
diff --git a/pkg/app-launcher/components/ClusterActions.vue b/pkg/app-launcher/components/ClusterActions.vue
new file mode 100644
index 0000000..52c179b
--- /dev/null
+++ b/pkg/app-launcher/components/ClusterActions.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg/app-launcher/components/ClusterView.vue b/pkg/app-launcher/components/ClusterView.vue
new file mode 100644
index 0000000..e69de29
diff --git a/pkg/app-launcher/pages/index.vue b/pkg/app-launcher/pages/index.vue
index 1a60548..722b9ac 100644
--- a/pkg/app-launcher/pages/index.vue
+++ b/pkg/app-launcher/pages/index.vue
@@ -4,14 +4,15 @@ import Loading from '@shell/components/Loading';
import SortableTable from '@shell/components/SortableTable';
import ButtonDropDown from '@shell/components/ButtonDropdown';
import { isMaybeSecure } from '@shell/utils/url';
-import { ingressFullPath } from '@shell/models/networking.k8s.io.ingress';
import AppLauncherCard from '../components/AppLauncherCard.vue';
+import ClusterActions from '../components/ClusterActions.vue';
export default {
components: {
Loading,
AppLauncherCard,
+ ClusterActions,
SortableTable,
ButtonDropDown
},
@@ -351,7 +352,17 @@ export default {