Skip to content

Commit

Permalink
Merge pull request #13403 from ovh/feat/MANAGER-15410
Browse files Browse the repository at this point in the history
feat(iam): add applications tab
  • Loading branch information
tibs245 authored Dec 13, 2024
2 parents 5ddd0d4 + 454f13a commit 301669d
Show file tree
Hide file tree
Showing 39 changed files with 461 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export const DELETE_ENTITY_TAG = {
error: TAG.RESOURCE_GROUPS__DELETE_GROUP_CONFIRM_BANNER__ERROR,
success: TAG.RESOURCE_GROUPS__DELETE_GROUP_CONFIRM_BANNER__SUCCESS,
},
[ENTITY.APPLICATION]: {
close: TAG.DELETE_APPLICATION__CANCEL,
delete: TAG.DELETE_APPLICATION__CONFIRM,
error: TAG.APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__ERROR,
success: TAG.APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__SUCCESS,
},
};

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export default class DeleteEntityController {
promise = this.deletePolicy();
} else if (this.entity.type === ENTITY.RESOURCE_GROUP) {
promise = this.deleteResourceGroup();
} else if (this.entity.type === ENTITY.APPLICATION) {
promise = this.deleteApplication();
} else if (this.entity.type === ENTITY.RESOURCE_TYPE) {
promise = this.$q.when(true);
} else {
Expand Down Expand Up @@ -135,6 +137,14 @@ export default class DeleteEntityController {
return this.IAMService.deleteResourceGroup(this.entity.data.id);
}

/**
* Delete the entity using the IAMService
* @returns {Promise}
*/
deleteApplication() {
return this.IAMService.deleteApplication(this.entity.data.applicationId);
}

/**
* Custom trackClick wrapper witch uses the tagPrefix bound property
* @param {'close'|'delete'} tagKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Löschen des Produkttyps: ",
"iam_delete_entity_resourceType_success": "Der Produkttyp wurde gelöscht",
"iam_delete_entity_resourceType_warn": "Achtung, mit dieser Aktion werden alle zugehörigen Ressourcen und ausgewählten Aktionen gelöscht",
"iam_delete_entity_secondary_label": "Abbrechen"
}
"iam_delete_entity_secondary_label": "Abbrechen",
"iam_delete_entity_application_error": "Die Anwendung konnte aufgrund eines Fehlers nicht gelöscht werden: {{ message }}",
"iam_delete_entity_application_field": "Bitte geben Sie das Wort „{{ statement }}“ ein, um das Löschen Ihrer Anwendung zu bestätigen.",
"iam_delete_entity_application_heading": "Anwendung löschen",
"iam_delete_entity_application_name": "Löschung der Anwendung: ",
"iam_delete_entity_application_success": "Anwendung gelöscht",
"iam_delete_entity_application_warn": "Warnung: Durch diese Aktion wird die Anwendung gelöscht und alle dieser Anwendung zugeordneten Zertifikate werden widerrufen."
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Deleting product type: ",
"iam_delete_entity_resourceType_success": "Product type deleted",
"iam_delete_entity_resourceType_warn": "Warning: this action will delete the associated resources and the selected actions",
"iam_delete_entity_secondary_label": "Exit"
}
"iam_delete_entity_secondary_label": "Exit",
"iam_delete_entity_application_error": "An error occurred deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word “{{ statement }}” to confirm the deletion of your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Delete application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: This action will delete the application and revoke all associated certificates."
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Eliminación del tipo de producto: ",
"iam_delete_entity_resourceType_success": "El tipo de producto se ha eliminado correctamente",
"iam_delete_entity_resourceType_warn": "Atención: Esta acción eliminará los recursos asociados y las acciones seleccionadas",
"iam_delete_entity_secondary_label": "Cancelar"
}
"iam_delete_entity_secondary_label": "Cancelar",
"iam_delete_entity_application_error": "No se ha podido eliminar la aplicación debido a un error: {{ message }}",
"iam_delete_entity_application_field": "Introduzca la palabra «{{ statement }}» para confirmar la eliminación de su aplicación.",
"iam_delete_entity_application_heading": "Eliminar una aplicación",
"iam_delete_entity_application_name": "Eliminación de la aplicación: ",
"iam_delete_entity_application_success": "Aplicación eliminada",
"iam_delete_entity_application_warn": "Importante: esta acción eliminará la aplicación y revocará todos los certificados asociados a dicha aplicación."
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Suppression du groupe de ressources : ",
"iam_delete_entity_resourceGroup_success": "Le groupe de ressources a bien été supprimé",
"iam_delete_entity_resourceGroup_warn": "Êtes-vous sûr.e de confirmer la suppression ?",
"iam_delete_entity_application_error": "L'application n'a pas pu être supprimée en raison d'une erreur : {{ message }}",
"iam_delete_entity_application_field": "Veuillez entrer le mot \"{{ statement }}\" pour confirmer la suppression de votre application",
"iam_delete_entity_application_heading": "Supprimer une application",
"iam_delete_entity_application_name": "Suppression de l'application : ",
"iam_delete_entity_application_success": "Application supprimée",
"iam_delete_entity_application_warn": "Avertissement : cette action supprimera l'application et révoquera tous les certificats associées à cette application.",
"iam_delete_entity_resourceType_error": "Une erreur est survenue lors de la suppression du type de produit : {{ message }}",
"iam_delete_entity_resourceType_heading": "Supprimer un type de produit",
"iam_delete_entity_resourceType_name": "Suppression du type de produit : ",
"iam_delete_entity_resourceType_success": "Le type de produit a bien été supprimé",
"iam_delete_entity_resourceType_warn": "Attention, cette action va entrainer la suppression des ressources associées et des actions sélectionnées",
"iam_delete_entity_secondary_label": "Annuler"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"iam_delete_entity_resourceGroup_name": "Suppression du groupe de ressources : ",
"iam_delete_entity_resourceGroup_success": "Le groupe de ressources a bien été supprimé",
"iam_delete_entity_resourceGroup_warn": "Êtes-vous sûr.e de confirmer la suppression ?",
"iam_delete_entity_application_error": "L'application n'a pas pu être supprimée en raison d'une erreur : {{ message }}",
"iam_delete_entity_application_field": "Veuillez entrer le mot \"{{ statement }}\" pour confirmer la suppression de votre application",
"iam_delete_entity_application_heading": "Supprimer une application",
"iam_delete_entity_application_name": "Suppression de l'application : ",
"iam_delete_entity_application_success": "Application supprimée",
"iam_delete_entity_application_warn": "Avertissement : cette action supprimera l'application et révoquera tous les certificats associées à cette application.",
"iam_delete_entity_resourceType_error": "Une erreur est survenue lors de la suppression du type de produit : {{ message }}",
"iam_delete_entity_resourceType_heading": "Supprimer un type de produit",
"iam_delete_entity_resourceType_name": "Suppression du type de produit : ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Eliminazione del tipo di prodotto: ",
"iam_delete_entity_resourceType_success": "Il tipo di prodotto è stato eliminato correttamente",
"iam_delete_entity_resourceType_warn": "Attenzione: questa azione comporta l'eliminazione delle risorse associate e delle azioni selezionate",
"iam_delete_entity_secondary_label": "Annullare"
}
"iam_delete_entity_secondary_label": "Annullare",
"iam_delete_entity_application_error": "Impossibile eliminare l’applicazione a causa di un errore: {{ message }}",
"iam_delete_entity_application_field": "Inserisci la parola \"{{ statement }}\" per confermare l'eliminazione della tua applicazione.",
"iam_delete_entity_application_heading": "Eliminare un'applicazione",
"iam_delete_entity_application_name": "Eliminazione dell'applicazione ",
"iam_delete_entity_application_success": "Applicazione eliminata",
"iam_delete_entity_application_warn": "Importante: questa azione comporta l'eliminazione dell'applicazione e la revoca di tutti i certificati ad essa associati."
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Usuwanie typu usługi: ",
"iam_delete_entity_resourceType_success": "Typ usługi został usunięty",
"iam_delete_entity_resourceType_warn": "Uwaga, ta operacja spowoduje usunięcie zasobów i powiązanych operacji.",
"iam_delete_entity_secondary_label": "Anuluj"
}
"iam_delete_entity_secondary_label": "Anuluj",
"iam_delete_entity_application_error": "Aplikacja nie mogła zostać usunięta z powodu błędu: {{message}}",
"iam_delete_entity_application_field": "Wpisz słowo „{{ statement }}”, aby potwierdzić usunięcie aplikacji.",
"iam_delete_entity_application_heading": "Usuń aplikację",
"iam_delete_entity_application_name": "Usuwanie aplikacji: ",
"iam_delete_entity_application_success": "Aplikacja usunięta",
"iam_delete_entity_application_warn": "Ostrzeżenie: ta operacja spowoduje usunięcie aplikacji i unieważni wszystkie certyfikaty powiązane z tą aplikacją."
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
"iam_delete_entity_resourceType_name": "Eliminação do tipo de produto: ",
"iam_delete_entity_resourceType_success": "O tipo de produto foi eliminado com sucesso",
"iam_delete_entity_resourceType_warn": "Atenção, esta ação levará à eliminação dos recursos associados e das ações selecionadas",
"iam_delete_entity_secondary_label": "Anular"
}
"iam_delete_entity_secondary_label": "Anular",
"iam_delete_entity_application_error": "Não foi possível eliminar a aplicação devido a um erro: {{ message }}",
"iam_delete_entity_application_field": "Introduza a palavra \"{{ statement }}\" para confirmar a eliminação da sua aplicação",
"iam_delete_entity_application_heading": "Eliminar uma aplicação",
"iam_delete_entity_application_name": "Eliminação da aplicação: ",
"iam_delete_entity_application_success": "Aplicação eliminada",
"iam_delete_entity_application_warn": "Atenção: esta ação eliminará a aplicação e revogará todos os certificados associados a esta aplicação."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import controller from './applications.controller';
import template from './applications.template.html';

export default {
bindings: {
applications: '<',
alert: '<',
goTo: '<',
trackClick: '<',
},
controller,
template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AbstractCursorDatagridController } from '@ovh-ux/manager-ng-apiv2-helper';
import { TAG } from '../../iam.constants';

export default class ApplicationsController extends AbstractCursorDatagridController {
/* @ngInject */
constructor(IAMService) {
super();
this.IAMService = IAMService;
}

/**
* Go to resourceGroup deletion
* @param {string} id The application id
* @returns {Promise}
*/
deleteApplication(id) {
this.trackClick(TAG.APPLICATIONS__DELETE);
this.goTo({
name: 'iam.dashboard.applications.delete',
params: { application: id },
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import angular from 'angular';

import component from './applications.component';
import routing from './applications.routing';
import deleteModule from './delete';

const moduleName = 'ovhManagerIAMDashboardApplications';

angular
.module(moduleName, [deleteModule])
.component('iamApplications', component)
.config(routing)
.run(/* @ngTranslationsInject:json ./translations */);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TAG } from '../../iam.constants';

export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('iam.dashboard.applications', {
url: '/applications?cursors',
component: 'iamApplications',
resolve: {
breadcrumb: () => null,
applications: /* @ngInject */ (IAMService) =>
IAMService.getApplications(),
},
atInternet: {
rename: TAG.APPLICATIONS,
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<div>
<p data-translate="iam_applications_description"></p>
<oui-datagrid
data-rows="$ctrl.applications"
data-page="{{ 1 }}"
data-page-size="{{ $ctrl.applications.length }}"
>
<!-- <Columns> -->
<oui-datagrid-column
data-title="'iam_applications_datagrid_column_application_id' | translate"
>
<span data-ng-bind="$row.applicationId"></span>
</oui-datagrid-column>
<oui-datagrid-column
data-title="'iam_applications_datagrid_column_application_name' | translate"
>
<span data-ng-bind="$row.name"></span>
</oui-datagrid-column>
<oui-datagrid-column
data-title="'iam_applications_datagrid_column_application_description' | translate"
>
<span data-ng-bind="$row.description"></span>
</oui-datagrid-column>
<oui-datagrid-column
data-title="'iam_applications_datagrid_column_application_status' | translate"
>
<span
class="oui-badge"
data-ng-class="{
'oui-badge_success': $row.status === 'active',
'oui-badge_error': $row.status !== 'active'
}"
data-translate="{{ 'iam_applications_datagrid_column_application_status_' + $row.status | translate }}"
>
</span>
</oui-datagrid-column>
<oui-datagrid-column
data-title="'iam_applications_datagrid_column_application_key' | translate"
>
<span data-ng-bind="$row.applicationKey"></span>
</oui-datagrid-column>
<!-- </Columns> -->

<!-- <Actions> -->
<oui-action-menu data-compact data-placement="end">
<oui-action-menu-item
data-on-click="$ctrl.deleteApplication($row.applicationId)"
>
<span
data-translate="iam_applications_datagrid_action_delete_application"
class="text-danger"
></span>
</oui-action-menu-item>
</oui-action-menu>
<!-- </Actions> -->
</oui-datagrid>
<div data-ui-view></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import angular from 'angular';

import deleteEntity from '../../../components/deleteEntity';
import routing from './delete.routing';

const moduleName = 'ovhManagerIAMDashboardApplicationsDelete';

angular.module(moduleName, [deleteEntity]).config(routing);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ENTITY, TAG } from '../../../iam.constants';

export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('iam.dashboard.applications.delete', {
url: '/delete/{application:string}',
component: 'iamDeleteEntity',
resolve: {
breadcrumb: () => null,

/**
* A polymorphic DTO required by the deleteEntity component
* @returns {{
* data: Object,
* type: string
* }|null}
*/
entity: /* @ngInject */ (application) => {
if (application) {
return { data: application, type: ENTITY.APPLICATION };
}
return null;
},

/**
* The application to delete if an id is provided
* @returns {Object|null}
*/
application: /* @ngInject */ ($transition$, IAMService) => {
const { application: id } = $transition$.params();
return id ? IAMService.getApplication(id) : null;
},

/**
* Whether the entity requires a statement
* @returns {boolean}
*/
statement: /* @ngInject */ (entity) => entity.type === ENTITY.APPLICATION,
},
atInternet: {
rename: TAG.DELETE_APPLICATION,
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import angular from 'angular';
import uiRouter from '@uirouter/angularjs';
import ocLazyLoad from 'oclazyload';

const moduleName = 'ovhManagerIAMDashboardApplicationsDeleteLazyLoading';

angular.module(moduleName, [uiRouter, ocLazyLoad]).config(
/* @ngInject */ ($stateProvider) => {
$stateProvider.state('iam.dashboard.applications.delete.**', {
url: '/delete/{application:string}',
lazyLoad: (transition) =>
import('./delete.module').then((module) =>
transition
.injector()
.get('$ocLazyLoad')
.inject(module.default),
),
});
},
);

export default moduleName;
22 changes: 22 additions & 0 deletions packages/manager/modules/iam/src/dashboard/applications/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import angular from 'angular';
import uiRouter from '@uirouter/angularjs';
import ocLazyLoad from 'oclazyload';

const moduleName = 'ovhManagerIAMDashboardApplicationsLazyLoading';

angular.module(moduleName, [uiRouter, ocLazyLoad]).config(
/* @ngInject */ ($stateProvider) => {
$stateProvider.state('iam.dashboard.applications.**', {
url: '/applications',
lazyLoad: (transition) =>
import('./applications.module').then((module) =>
transition
.injector()
.get('$ocLazyLoad')
.inject(module.default),
),
});
},
);

export default moduleName;
Loading

0 comments on commit 301669d

Please sign in to comment.