Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dedicated.netapp): add hold snapshot feature #13888

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default {
applyPolicy: '<',
trackClick: '<',
goToRestoreSnapshot: '<',
goToSnapshots: '<',
},
controller,
template,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ export const STATUS = {
PENDING: ['creating', 'deleting', 'restoring'],
};

export const SNAPSHOT_STATUS = {
AVAILABLE: 'available',
MANAGE_ERROR: 'manage_error',
};

export const FETCH_INTERVAL = 1000;

export default {
MAXIMUM_SNAPSHOT_ALLOWED,
SNAPSHOT_TYPE,
STATUS,
SNAPSHOT_STATUS,
FETCH_INTERVAL,
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { MAXIMUM_SNAPSHOT_ALLOWED, SNAPSHOT_TYPE } from './constants';

export default class NetAppVolumesDashboardSnapshotsController {
/* @ngInject */
constructor(Alerter, $translate) {
constructor(Alerter, $translate, NetAppSnapshotService) {
this.Alerter = Alerter;
this.$translate = $translate;
this.MAXIMUM_SNAPSHOT_ALLOWED = MAXIMUM_SNAPSHOT_ALLOWED;
this.SNAPSHOT_TYPE = SNAPSHOT_TYPE;
this.NetAppSnapshotService = NetAppSnapshotService;
this.loadingSnapshotHold = false;
}

$onInit() {
Expand Down Expand Up @@ -37,4 +40,39 @@ export default class NetAppVolumesDashboardSnapshotsController {
),
);
}

holdSnapshot(snapshotId) {
this.trackClick('hold');
this.loadingSnapshotHold = true;
this.Alerter.set(
'alert-info',
this.$translate.instant('netapp_volumes_snapshots_hold_action_doing'),
);
this.NetAppSnapshotService.holdSnapshot(
this.serviceName,
this.volumeId,
snapshotId,
)
.then(() =>
this.goToSnapshots(
this.$translate.instant(
'netapp_volumes_snapshots_hold_action_success',
),
),
)
.catch((error) =>
this.Alerter.error(
this.$translate.instant(
'netapp_volumes_snapshots_hold_action_error',
{
message: error.data?.message,
requestId: error.headers?.('X-Ovh-Queryid') || null,
},
),
),
)
.finally(() => {
this.loadingSnapshotHold = false;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import addModule from './add';
import restoreModule from './restore';
import editModule from './edit';
import deleteModule from './delete';
import service from './service';

const moduleName = 'ovhManagerNetAppVolumesDashboardSnapshots';

Expand All @@ -33,6 +34,7 @@ angular
])
.config(routing)
.component('ovhManagerNetAppVolumesDashboardSnapshots', component)
.service('NetAppSnapshotService', service)
.run(/* @ngTranslationsInject:json ./translations */);

export default moduleName;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { SNAPSHOT_STATUS } from './constants';

export default class NetAppVolumesDashboardSnapshotsRestoreController {
/* @ngInject */
constructor($translate, NetAppRestoreVolumeService, coreConfig) {
constructor($translate, NetAppSnapshotService, coreConfig) {
this.$translate = $translate;
this.language = coreConfig.getUserLocale().replace('_', '-');
this.NetAppRestoreVolumeService = NetAppRestoreVolumeService;
this.NetAppSnapshotService = NetAppSnapshotService;
}

$onInit() {
Expand Down Expand Up @@ -42,7 +42,7 @@ export default class NetAppVolumesDashboardSnapshotsRestoreController {
restoreVolume() {
this.isLoading = true;
this.trackClick('restore::confirm');
this.NetAppRestoreVolumeService.restoreVolume(
this.NetAppSnapshotService.restoreVolume(
this.serviceName,
this.volumeId,
this.snapshotToRevertTo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'angular-translate';

import component from './component';
import routing from './routing';
import service from './service';

const moduleName = 'ovhManagerNetAppVolumesDashboardSnapshotsRestore';

Expand All @@ -26,7 +25,6 @@ angular
'ovhManagerNetAppVolumesDashboardSnapshotsRestoreComponent',
component,
)
.service('NetAppRestoreVolumeService', service)
.run(/* @ngTranslationsInject:json ./translations */);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SNAPSHOT_TYPE } from '../constants';
import { FETCH_INTERVAL, SNAPSHOT_STATUS } from './constants';
import { SNAPSHOT_TYPE, FETCH_INTERVAL, SNAPSHOT_STATUS } from './constants';

export default class NetAppRestoreVolumeService {
export default class NetAppSnapshotService {
/* @ngInject */
constructor($http, $q, iceberg, Poller) {
this.$http = $http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ <h2 data-translate="netapp_volumes_snapshots"></h2>
data-translate="netapp_volumes_snapshots_actions_edit"
></span>
</oui-action-menu-item>
<oui-action-menu-item
data-on-click="$ctrl.holdSnapshot($row.id)"
data-ng-if="$row.type === $ctrl.SNAPSHOT_TYPE.AUTOMATIC"
data-disabled="$ctrl.loadingSnapshotHold"
>
<span
data-translate="netapp_volumes_snapshots_actions_hold"
></span>
</oui-action-menu-item>
<oui-action-menu-item on-click="$ctrl.deleteSnapshot($row.id)">
<span
data-translate="netapp_volumes_snapshots_actions_delete"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "Die Regel wurde angewandt.",
"netapp_volumes_snapshots_policies_apply_error": "Die Regel konnte nicht angewandt werden. Bitte versuchen Sie es später erneut.",
"netapp_volumes_snapshots_type_automatic": "Automatisch",
"netapp_volumes_snapshots_type_system": "System"
"netapp_volumes_snapshots_type_system": "System",
"netapp_volumes_snapshots_actions_hold": "Speichern",
"netapp_volumes_snapshots_hold_action_doing": "Das Backup Ihres Snapshots wurde registriert und wird in wenigen Augenblicken ausgeführt.",
"netapp_volumes_snapshots_hold_action_success": "Das Backup Ihres Snapshots wurde erfolgreich durchgeführt.",
"netapp_volumes_snapshots_hold_action_error": "Beim Backup Ihres Snapshots ist ein Problem aufgetreten."
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "Policy applied successfully.",
"netapp_volumes_snapshots_policies_apply_error": "The policy could not be applied. Please try again later.",
"netapp_volumes_snapshots_type_automatic": "Automatic",
"netapp_volumes_snapshots_type_system": "System"
"netapp_volumes_snapshots_type_system": "System",
"netapp_volumes_snapshots_actions_hold": "Save",
"netapp_volumes_snapshots_hold_action_doing": "Your snapshot backup has been processed, and will be active shortly.",
"netapp_volumes_snapshots_hold_action_success": "Your snapshot has been backed up.",
"netapp_volumes_snapshots_hold_action_error": "An error has occurred backing up your snapshot"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "La regla se ha aplicado correctamente.",
"netapp_volumes_snapshots_policies_apply_error": "No se ha podido aplicar la regla. Por favor, vuelva a intentarlo más adelante.",
"netapp_volumes_snapshots_type_automatic": "Automática",
"netapp_volumes_snapshots_type_system": "Sistema"
"netapp_volumes_snapshots_type_system": "Sistema",
"netapp_volumes_snapshots_actions_hold": "Realizar copia de seguridad",
"netapp_volumes_snapshots_hold_action_doing": "La copia de seguridad del snapshot se ha registrado y será efectiva en unos instantes.",
"netapp_volumes_snapshots_hold_action_success": "La copia de seguridad del snapshot se ha realizado correctamente.",
"netapp_volumes_snapshots_hold_action_error": "Se ha producido un problema al realizar la copia de seguridad del snapshot."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"netapp_volumes_snapshots_actions_create": "Créer un snapshot",
"netapp_volumes_snapshots_actions_create_label": "Snapshot: Créer un snapshot",
"netapp_volumes_snapshots_actions_edit": "Éditer",
"netapp_volumes_snapshots_actions_hold": "Sauvegarder",
"netapp_volumes_snapshots_actions_delete": "Supprimer",
"netapp_volumes_snapshots_id": "ID",
"netapp_volumes_snapshots_name": "Nom",
Expand All @@ -29,5 +30,8 @@
"netapp_volumes_snapshots_policies_description": "Vous pouvez appliquer une règle de snapshot à votre volume.",
"netapp_volumes_snapshots_policies_apply": "Appliquer la policy",
"netapp_volumes_snapshots_policies_apply_success": "La règle a été appliquée avec succès.",
"netapp_volumes_snapshots_policies_apply_error": "La règle n'a pas pu être appliquée. Merci d'essayer ultérieurement."
"netapp_volumes_snapshots_policies_apply_error": "La règle n'a pas pu être appliquée. Merci d'essayer ultérieurement.",
"netapp_volumes_snapshots_hold_action_doing": "La sauvegarde de votre snapshot a bien été prise en compte et sera effective dans quelques instants.",
"netapp_volumes_snapshots_hold_action_success": "La sauvegarde de votre snapshot a été réalisé avec succès.",
"netapp_volumes_snapshots_hold_action_error": "Un problème est survenu lors de la sauvegarde de votre Snapshot"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"netapp_volumes_snapshots_actions_create": "Créer un snapshot",
"netapp_volumes_snapshots_actions_create_label": "Snapshot: Créer un snapshot",
"netapp_volumes_snapshots_actions_edit": "Éditer",
"netapp_volumes_snapshots_actions_hold": "Sauvegarder",
"netapp_volumes_snapshots_actions_delete": "Supprimer",
"netapp_volumes_snapshots_id": "ID",
"netapp_volumes_snapshots_name": "Nom",
Expand All @@ -29,5 +30,8 @@
"netapp_volumes_snapshots_policies_description": "Vous pouvez appliquer une règle de snapshot à votre volume.",
"netapp_volumes_snapshots_policies_apply": "Appliquer la policy",
"netapp_volumes_snapshots_policies_apply_success": "La règle a été appliquée avec succès.",
"netapp_volumes_snapshots_policies_apply_error": "La règle n'a pas pu être appliquée. Merci d'essayer ultérieurement."
"netapp_volumes_snapshots_policies_apply_error": "La règle n'a pas pu être appliquée. Merci d'essayer ultérieurement.",
"netapp_volumes_snapshots_hold_action_doing": "La sauvegarde de votre snapshot a bien été prise en compte et sera effective dans quelques instants.",
"netapp_volumes_snapshots_hold_action_success": "La sauvegarde de votre snapshot a été réalisé avec succès.",
"netapp_volumes_snapshots_hold_action_error": "Un problème est survenu lors de la sauvegarde de votre Snapshot"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "La regola è stata applicata correttamente.",
"netapp_volumes_snapshots_policies_apply_error": "Non è stato possibile applicare la regola. Ti preghiamo di riprovare.",
"netapp_volumes_snapshots_type_automatic": "Automatico",
"netapp_volumes_snapshots_type_system": "Sistema"
"netapp_volumes_snapshots_type_system": "Sistema",
"netapp_volumes_snapshots_actions_hold": "Salva",
"netapp_volumes_snapshots_hold_action_doing": "Il backup del tuo Snapshot è stato preso in carico e sarà effettivo entro pochi istanti.",
"netapp_volumes_snapshots_hold_action_success": "Il backup del tuo Snapshot è stato effettuato correttamente.",
"netapp_volumes_snapshots_hold_action_error": "Si è verificato un problema durante il backup del tuo Snapshot"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "Reguła została zastosowana.",
"netapp_volumes_snapshots_policies_apply_error": "Reguła nie mogła zostać zastosowana. Spróbuj później.",
"netapp_volumes_snapshots_type_automatic": "Automatycznie",
"netapp_volumes_snapshots_type_system": "System"
"netapp_volumes_snapshots_type_system": "System",
"netapp_volumes_snapshots_actions_hold": "Zapisz",
"netapp_volumes_snapshots_hold_action_doing": "Dyspozycja wykonania snapshota została przyjęta. Będzie on dostępny w ciągu kilku minut.",
"netapp_volumes_snapshots_hold_action_success": "Snapshot został wykonany.",
"netapp_volumes_snapshots_hold_action_error": "Wystąpił błąd podczas wykonywania snapshota."
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"netapp_volumes_snapshots_policies_apply_success": "A regra foi aplicada com sucesso.",
"netapp_volumes_snapshots_policies_apply_error": "Não foi possível aplicar a regra. Tente novamente mais tarde.",
"netapp_volumes_snapshots_type_automatic": "Automático",
"netapp_volumes_snapshots_type_system": "Sistema"
"netapp_volumes_snapshots_type_system": "Sistema",
"netapp_volumes_snapshots_actions_hold": "Guardar",
"netapp_volumes_snapshots_hold_action_doing": "O backup da sua snapshot foi corretamente tomado em conta e ficará efetivo dentro de alguns instantes.",
"netapp_volumes_snapshots_hold_action_success": "O backup da sua snapshot foi realizado com sucesso.",
"netapp_volumes_snapshots_hold_action_error": "Ocorreu um problema ao guardar a sua Snapshot"
}
Loading