Skip to content

Commit

Permalink
Plugin admin tab icon
Browse files Browse the repository at this point in the history
  • Loading branch information
newmanw committed Mar 25, 2024
1 parent 425edf6 commit 4bba64b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
@@ -1,6 +1,5 @@

import { Component, Input, NgModuleRef, OnChanges, OnInit, SimpleChanges, TemplateRef, Type, ViewChild, ViewContainerRef } from '@angular/core'
import { PluginHooks } from '@ngageoint/mage.web-core-lib/plugin/plugin.model'

@Component({
selector: 'mage-admin-plugin-tab-content',
Expand Down
2 changes: 2 additions & 0 deletions web-app/src/app/plugin/plugin.service.ts
@@ -1,3 +1,4 @@
import * as ngAnimations from '@angular/animations'
import * as ngCore from '@angular/core'
import * as ngCommon from '@angular/common'
import * as ngCommonHttp from '@angular/common/http'
Expand Down Expand Up @@ -120,6 +121,7 @@ export class PluginService {
private localStorageService: LocalStorageService) {
const shareLib = (libId: string, lib: any) => registerSharedLibInContext(system, libId, lib)
const providedLibs = {
'@angular/animations': ngAnimations,
'@angular/core': ngCore,
'@angular/common': ngCommon,
'@angular/common/http': ngCommonHttp,
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/ng1/admin/admin.component.js
Expand Up @@ -50,7 +50,7 @@ class AdminController {
}
const stateNameSuffix = cleanNameOfPlugin(pluginId)
const stateName = `admin.plugin-${stateNameSuffix}`
pluginTabs = pluginTabs.concat({ title: adminTab.title, state: stateName })
pluginTabs = pluginTabs.concat({ title: adminTab.title, state: stateName, icon: adminTab.icon })
if (this.$stateRegistry.states[stateName]) {
return pluginTabs
}
Expand Down
10 changes: 7 additions & 3 deletions web-app/src/ng1/admin/admin.tab.component.js
@@ -1,9 +1,14 @@
import _ from 'underscore';

class AdminTabController {
constructor($state, UserService) {
constructor($state, UserService, LocalStorageService) {
this.$state = $state;
this.UserService = UserService;
this.token = LocalStorageService.getToken()
}

$onChanges() {
console.log('changes plugin tabs', this.pluginTabs)
}

hasPermission(permission) {
Expand All @@ -12,11 +17,10 @@ class AdminTabController {

tabChanged(state) {
this.$state.go(state);
console.log('state changes', state)
}
}

AdminTabController.$inject = ['$state', 'UserService'];
AdminTabController.$inject = ['$state', 'UserService', 'LocalStorageService'];

export default {
template: require('./admin.tab.html'),
Expand Down
8 changes: 6 additions & 2 deletions web-app/src/ng1/admin/admin.tab.html
Expand Up @@ -66,8 +66,12 @@

<div class="admin-action" ng-repeat="pluginTab in $ctrl.pluginTabs" ng-class="{'admin-action-selected': $ctrl.stateName === pluginTab.state}" ng-click="$ctrl.tabChanged(pluginTab.state)">
<div ng-class="{'admin-action-arrow-left': $ctrl.stateName === pluginTab.state}"></div>
<i class="fa fa-plug"></i>
<div ng-if="pluginTab.icon.path">
<img class="admin-plugin-icon" ng-src="/ui_plugins/@ngageoint/mage.nerd.web/{{pluginTab.icon.path}}?access_token={{$ctrl.token}}">
</div>
<i ng-if="pluginTab.icon.className" class="{{pluginTab.icon.className}}"></i>
<i ng-if="!pluginTab.icon.path && !pluginTab.icon.className" class="fa fa-plug"></i>
<div>{{pluginTab.title}}</div>
</div>
</div>
</div>
</div>
22 changes: 0 additions & 22 deletions web-app/src/ng1/admin/plugins/plugins.html
Expand Up @@ -7,25 +7,3 @@
</div>

<ui-view plugins="$ctrl.plugins"></ui-view>

<!-- <div class="container-fluid">
<div class="row">
<div class="col-md-12">
Plugins go here
</div>
<div ng-repeat="plugin in $ctrl.plugins | orderBy:'title'">
</div>
</div>
<div ng-repeat="plugin in $ctrl.plugins | orderBy:'title'">
<div class="row">
<div class="col-md-12">
<div>Plugin {{$ctrl.title}}</div>
<a ng-click="$ctrl.showPlugin()">Show Plugin</a>
</div>
</div>
</div>
</div> -->
4 changes: 4 additions & 0 deletions web-app/src/ng1/css/style.scss
Expand Up @@ -999,6 +999,10 @@ admin {
background-color: #444;
}

.admin-plugin-icon {
margin-bottom: 8px;
}

/* User management page styles */
.admin-card {
height: 235px;
Expand Down

0 comments on commit 4bba64b

Please sign in to comment.