blob: 39844c54a523150c24199f278da39bf061f31065 [file] [log] [blame]
Sean Condon28884332019-03-21 14:07:00 +00001/*
2 * Copyright 2019-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { Injectable } from '@angular/core';
Sean Condon98b6ddb2019-12-24 08:07:40 +000017import {LogService, WebSocketService} from '../../gui2-fw-lib/public_api';
Sean Condon28884332019-03-21 14:07:00 +000018
19export enum LayoutType {
20 LAYOUT_DEFAULT = 'default',
21 LAYOUT_ACCESS = 'access'
22}
23
24/**
25 * ONOS GUI - Layout service - connects to the Layout UI Extension app
26 */
27@Injectable()
28export class LayoutService {
29
30 constructor(
31 protected log: LogService,
32 protected wss: WebSocketService
33 ) {
34 this.log.debug('LayoutService constructed');
35 }
36
37 /**
38 * tell the server we want a new layout
39 * @param type The type of layout we want
40 */
41 changeLayout(type: LayoutType): void {
42 this.wss.sendEvent('doLayout', {
43 type: type
44 });
45 this.log.debug('Layout changed to', type);
46 }
47}