Skip to content

Commit

Permalink
Merge pull request #1 from zZHorizonZz/master
Browse files Browse the repository at this point in the history
feat(iam): added applications page
  • Loading branch information
zZHorizonZz authored Sep 12, 2024
2 parents 831a7e8 + de50784 commit 5343ac6
Show file tree
Hide file tree
Showing 39 changed files with 449 additions and 10 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 @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Löschen der Ressourcengruppe: ",
"iam_delete_entity_resourceGroup_success": "Die Ressourcengruppe wurde gelöscht",
"iam_delete_entity_resourceGroup_warn": "Sind Sie sicher, dass Sie den Löschvorgang bestätigen möchten?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "Beim Löschen des Produkttyps ist ein Fehler aufgetreten: {{ message }}",
"iam_delete_entity_resourceType_heading": "Löschen eines Produkttyps",
"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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Deleting resource group: ",
"iam_delete_entity_resourceGroup_success": "Resource group deleted",
"iam_delete_entity_resourceGroup_warn": "Are you sure you want to confirm the deletion?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "An error occurred while deleting the product type: {{ message }}",
"iam_delete_entity_resourceType_heading": "Delete a product type",
"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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Eliminación del grupo de recursos: ",
"iam_delete_entity_resourceGroup_success": "El grupo de recursos se ha eliminado correctamente",
"iam_delete_entity_resourceGroup_warn": "¿Seguro que quiere confirmar la eliminación?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "Se ha producido un error al eliminar el tipo de producto: {{ message }}",
"iam_delete_entity_resourceType_heading": "Eliminar un tipo de producto",
"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"
}
}
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": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this 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": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this 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 @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Eliminazione del gruppo di risorse: ",
"iam_delete_entity_resourceGroup_success": "Il gruppo di risorse è stato eliminato correttamente",
"iam_delete_entity_resourceGroup_warn": "Vuoi davvero confermare l'eliminazione?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "Si è verificato un errore durante l'eliminazione del tipo di prodotto: {{ message }}",
"iam_delete_entity_resourceType_heading": "Elimina un tipo di prodotto",
"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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Usuwanie grupy zasobów: ",
"iam_delete_entity_resourceGroup_success": "Grupa zasobów została usunięta.",
"iam_delete_entity_resourceGroup_warn": "Czy na pewno chcesz potwierdzić usunięcie?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "Wystąpił błąd podczas usuwania typu usługi: {{ message }}",
"iam_delete_entity_resourceType_heading": "Usuń typ usługi",
"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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"iam_delete_entity_resourceGroup_name": "Eliminação do grupo de recursos: ",
"iam_delete_entity_resourceGroup_success": "O grupo de recursos foi eliminado com sucesso",
"iam_delete_entity_resourceGroup_warn": "Tem a certeza de que deseja confirmar a eliminação?",
"iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}",
"iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application",
"iam_delete_entity_application_heading": "Delete an application",
"iam_delete_entity_application_name": "Deleting application: ",
"iam_delete_entity_application_success": "Application deleted",
"iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.",
"iam_delete_entity_resourceType_error": "Ocorreu um erro aquando da eliminação do tipo de produto: {{ message }}",
"iam_delete_entity_resourceType_heading": "Eliminar um tipo de produto",
"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"
}
}
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';

Check failure

Code scanning / SonarCloud

OVH keys should not be disclosed High

Make sure this OVH key gets revoked, changed, and removed from the code. See more on SonarCloud
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;
Loading

0 comments on commit 5343ac6

Please sign in to comment.