Skip to content

Commit 4b118c5

Browse files
committed
Add download manifest feature, fix non-git supply manifest feature
1 parent 95166ae commit 4b118c5

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

pkg/epinio/components/application/AppSource.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,13 @@ export default Vue.extend<Data, any, any, any>({
131131
try {
132132
const parsed: any = jsyaml.load(file);
133133
134-
if (parsed.origin) {
135-
if (parsed.origin.container) {
136-
Vue.set(this, 'type', APPLICATION_SOURCE_TYPE.CONTAINER_URL);
137-
Vue.set(this.container, 'url', parsed.origin.container);
138-
} else if (parsed.origin.git) {
139-
Vue.set(this, 'type', APPLICATION_SOURCE_TYPE.GIT_URL);
140-
Vue.set(this.gitUrl, 'url', parsed.origin.git.url);
141-
Vue.set(this.gitUrl, 'branch', parsed.origin.git.revision);
142-
}
134+
if (parsed.origin?.container) {
135+
Vue.set(this, 'type', APPLICATION_SOURCE_TYPE.CONTAINER_URL);
136+
Vue.set(this.container, 'url', parsed.origin.container);
137+
} else if (parsed.origin.git?.url && parsed.origin.git?.revision) {
138+
Vue.set(this, 'type', APPLICATION_SOURCE_TYPE.GIT_URL);
139+
Vue.set(this.gitUrl, 'url', parsed.origin.git.url);
140+
Vue.set(this.gitUrl, 'branch', parsed.origin.git.revision);
143141
}
144142
145143
const appInfo: EpinioAppInfo = {

pkg/epinio/l10n/en-us.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ epinio:
155155
label: Rebuild
156156
restart:
157157
label: Restart
158+
createManifest:
159+
label: Download Manifest
158160
wm:
159161
containerName: 'Instance: {label}'
160162
noData: There are no log entries to show.

pkg/epinio/models/applications.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createEpinioRoute } from '../utils/custom-routing';
33
import { formatSi } from '@shell/utils/units';
44
import { classify } from '@shell/plugins/dashboard-store/classify';
55
import EpinioResource from './epinio-resource';
6+
import { downloadFile } from '@shell/utils/download';
67

78
// See https://github.com/epinio/epinio/blob/00684bc36780a37ab90091498e5c700337015a96/pkg/api/core/v1/models/app.go#L11
89
const STATES = {
@@ -141,6 +142,13 @@ export default class EpinioApplication extends EpinioResource {
141142
enabled: isRunning
142143
},
143144
{ divider: true },
145+
{
146+
action: 'createManifest',
147+
label: this.t('epinio.applications.actions.createManifest.label'),
148+
icon: 'icon icon-fw icon-download',
149+
},
150+
{ divider: true },
151+
144152
...super._availableActions);
145153

146154
return res;
@@ -555,4 +563,20 @@ export default class EpinioApplication extends EpinioResource {
555563
await this.forceFetch();
556564
this.showAppLog();
557565
}
566+
567+
createManifest() {
568+
const date = new Date().toISOString().split('.')[0];
569+
const fileName = `${ this.metadata.namespace }-${ this.nameDisplay }-${ date }.json`;
570+
571+
const manifest = {
572+
name: this.metadata.name,
573+
configuration: this.configuration,
574+
origin: this.origin,
575+
};
576+
577+
downloadFile(fileName, JSON.stringify(manifest))
578+
.catch((e) => {
579+
console.error('Failed to download manifest: ', e);// eslint-disable-line no-console
580+
});
581+
}
558582
}

0 commit comments

Comments
 (0)