File size: 6,621 Bytes
4343907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<template>
  <div id="app" class="saap-app">
    <!-- SAAP Header -->
    <header class="saap-header">
      <div class="header-content">
        <div class="logo-section">
          <h1 class="saap-heading-2">
            <span class="logo-text">SAAP</span>
            <span class="logo-subtitle">Multi-Agent Platform</span>
          </h1>
        </div>
        
        <div class="status-section">
          <div class="connection-status" :class="connectionStatusClass">
            <div class="status-dot"></div>
            <span>{{ connectionStatusText }}</span>
          </div>
          
          <div class="agent-summary">
            <span class="agent-count">{{ activeAgents }}/{{ totalAgents }}</span>
            <span class="agent-label">Agents Active</span>
          </div>
        </div>
      </div>
    </header>

    <!-- Main Content Area - Direct Dashboard -->
    <main class="saap-main">
      <SaapDashboard />
    </main>

    <!-- Footer -->
    <footer class="saap-footer">
      <div class="footer-content">
        <span class="footer-text">
          SAAP v1.0.0 β€’ 
          Built with Vue.js β€’ 
          Powered by colossus Server
        </span>
        <span class="footer-build">
          Build: {{ buildDate }}
        </span>
      </div>
    </footer>
  </div>
</template>

<script>
import { ref, computed, onMounted } from 'vue'
import SaapDashboard from './components/SaapDashboard.vue'
import saapApi from './services/saapApi.js'

export default {
  name: 'SaapApp',
  components: {
    SaapDashboard
  },
  setup() {
    // Reactive state
    const isConnected = ref(false)
    const totalAgents = ref(0)
    const activeAgents = ref(0)
    
    // Computed properties
    const connectionStatusClass = computed(() => ({
      'status-connected': isConnected.value,
      'status-disconnected': !isConnected.value
    }))
    
    const connectionStatusText = computed(() => 
      isConnected.value ? 'Connected' : 'Disconnected'
    )
    
    const buildDate = computed(() => 
      new Date().toLocaleDateString('de-DE')
    )
    
    // Load agents data from API using saapApi service
    const loadAgentsStats = async () => {
      try {
        console.log('πŸ”„ Loading agents stats via API service...')
        const response = await saapApi.getAgents()
        console.log('πŸ“¦ API Response:', response)
        
        // Backend returns {agents: [...], total: N, active: N}
        if (response && response.agents) {
          totalAgents.value = response.total || response.agents.length
          activeAgents.value = response.active || response.agents.filter(a => a.status === 'active').length
          isConnected.value = true
          console.log(`βœ… Loaded ${totalAgents.value} agents (${activeAgents.value} active)`)
        } else {
          console.warn('⚠️ Unexpected API response format:', response)
          isConnected.value = false
        }
      } catch (error) {
        console.error('❌ Failed to load agents stats:', error)
        isConnected.value = false
      }
    }
    
    // Initialize app
    onMounted(() => {
      console.log('πŸš€ SAAP Dashboard initialized')
      loadAgentsStats()
      
      // Refresh stats every 3 seconds
      setInterval(loadAgentsStats, 3000)
    })
    
    return {
      isConnected,
      totalAgents,
      activeAgents,
      connectionStatusClass,
      connectionStatusText,
      buildDate
    }
  }
}
</script>

<style scoped>
/* SAAP App Layout */
.saap-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--saap-gray-50);
}

/* Header Styles */
.saap-header {
  background: white;
  border-bottom: 1px solid var(--saap-gray-200);
  box-shadow: var(--saap-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--saap-space-4) var(--saap-space-6);
  max-width: 1400px;
  margin: 0 auto;
}

/* Logo Section */
.logo-section {
  display: flex;
  align-items: center;
}

.logo-text {
  background: linear-gradient(135deg, var(--saap-primary-600), var(--saap-secondary-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: var(--saap-font-bold);
  margin-right: var(--saap-space-2);
}

.logo-subtitle {
  font-size: var(--saap-text-base);
  font-weight: var(--saap-font-normal);
  color: var(--saap-gray-600);
}

/* Status Section */
.status-section {
  display: flex;
  align-items: center;
  gap: var(--saap-space-6);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--saap-space-2);
  padding: var(--saap-space-2) var(--saap-space-4);
  border-radius: var(--saap-radius-lg);
  font-size: var(--saap-text-sm);
  font-weight: var(--saap-font-medium);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--saap-radius-full);
  transition: background-color var(--saap-transition-base);
}

.status-connected {
  background: rgba(34, 197, 94, 0.1);
  color: var(--saap-secondary-700);
}

.status-connected .status-dot {
  background: var(--saap-secondary-500);
}

.status-disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--saap-accent-700);
}

.status-disconnected .status-dot {
  background: var(--saap-accent-500);
}

/* Agent Summary */
.agent-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.agent-count {
  font-size: var(--saap-text-xl);
  font-weight: var(--saap-font-bold);
  color: var(--saap-primary-600);
}

.agent-label {
  font-size: var(--saap-text-xs);
  color: var(--saap-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Main Content */
.saap-main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Footer */
.saap-footer {
  background: white;
  border-top: 1px solid var(--saap-gray-200);
  padding: var(--saap-space-4) var(--saap-space-6);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  font-size: var(--saap-text-xs);
  color: var(--saap-gray-500);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: var(--saap-space-4);
    padding: var(--saap-space-4);
  }
  
  .logo-subtitle {
    display: none;
  }
  
  .status-section {
    gap: var(--saap-space-4);
  }
  
  .footer-content {
    flex-direction: column;
    gap: var(--saap-space-2);
    text-align: center;
  }
  
  .saap-main {
    padding: var(--saap-space-4);
  }
}
</style>