Home:ALL Converter>Angular: Show Service Status (stopped/processing) in dropdown menu

Angular: Show Service Status (stopped/processing) in dropdown menu

Ask Time:2022-09-02T04:35:45         Author:Rabia Iftikhar

Json Formatter

When a service is running or terminated, I need to modify the status in a dropdown menu. It uses Angular's "select" and uses GraphQL to access data. Here is a snippet of my code.


<li ng-hide="!vm.isAdmin">
            <div class="form-group" style="margin-bottom: 0;">
                <select class="form-control input-sm"
                        ng-options="item.database as item.code group by item.group for item in vm.services | orderBy:['-group','code']"></select>


static mapState = (state) => {
const services = getVirtualServices(state)

return {
  isAdmin: authSelectors.isAdmin(state),
  services: map(services, s => ({ ...s, group: (s.isActive ? 'en' : 'dis') + 'abled' })),
  currentServiceName: authSelectors.getCurrentService(state),  


export const getVirtualServices = (state: StoreShape) => getState(state).services.items


export type InstanceInfoStoreShape = {
services: {
isLoading: boolean
error: ApiExceptionData | null
items: VirtualService[]
interface VirtualService {
code: string
database: string
isActive: boolean
status: boolean

` VirtualServicesStatus code in GraphQL type.ts

export enum VirtualServiceStatus {
Ready = 'READY',
Initialisation = 'INITIALISATION',
Processing = 'PROCESSING',
Stopping = 'STOPPING',
Stopped = 'STOPPED',
Faulted = 'FAULTED'

Author:Rabia Iftikhar,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73575165/angular-show-service-status-stopped-processing-in-dropdown-menu